Saturday, November 27, 2004

Odds and Ends

Very exciting day today. Went down the street and got some passport photos to send to the other half to attach to my fiancee-visa papers for submission. Sent email to my cousin congratulating her on her wedding (this day in australia).

Cut some excess strappage from my backpack.. melted ends down…

Ate some jellybeans…

Played some Soul Caliber II on playstation (I picked it up for a fiver!!). I must say, I have better rose tinted memories of Soul Caliber I on the dreamcast than I do of this version on the PS2.... So far I am battling away in weapon master mode and am at about act 6? or act5… anyway…

Current thoughts of food are on my mind. dinner. Chips and gravy?? I dunno.

Gotta have an early night tonight since I am up at 6am for work tomorow, aah yes. Working 12 hours on a Sunday really gets me pumped.

Couldnt get Xorg loaded onto Dragonfly.. Couldnt get XFree86 loaded onto Dragonfly… gave up trying to get KDE installed… blargle.

Apparently the measuring/sizing went well for the bridal frou-frou dress and brides servants frou-frou dresses + pom poms.

Posted by Stu on 11/27 at 05:44 PM Permalink to this post.
Filed Under : Life
Comments are closed There are no comments on this entry.
Linked To by (0) blogs. Get a Trackbacks link here

Letters

Just got an acceptence from the Royal Mail post office job I applied for a few weeks back. It would be for the whole of December, from 7pm to 2am Monday to Friday.

I am passing on it, so. nnnnnnn to to Royal Mail. I have a job. (even if its crap, I dont have to work while my fiancee is here!!).

This working Sunday to Thursday gig has thrown my week out. Its saturday right now, and it feels like Sunday. My week has been shifted by a day… ah well…

I also got this coming week Sun to Thurs again, so another week of pay in my pocket coming up…

Posted by Stu on 11/27 at 09:54 AM Permalink to this post.
Filed Under : Work
Comments are closed There are no comments on this entry.
Linked To by (0) blogs. Get a Trackbacks link here

Saturday, November 20, 2004

Jobs

So.. I now have a job.

I’ll be standing on my feet for 8 hours a day, starting at 7:30am on Sunday.
Currently its for 3 days but more will be there after this ‘trial’…

I will be doing the fun thing of packing prepackaged-sandwhiches into cartons to be delivered to supermarkets and snack shops around the country.

Yehaw!

Posted by Stu on 11/20 at 02:40 PM Permalink to this post.
Filed Under : Work
Comments are closed Commented on by (4) people. Read those Comments Here

Linked To by (0) blogs. Get a Trackbacks link here

Bulbs are growing

My bulbs are doing really well… I hope they flower right on christmas day… heres hoping!

image

image

Posted by Stu on 11/20 at 02:38 PM Permalink to this post.
Filed Under : Life
Comments are closed There are no comments on this entry.
Linked To by (0) blogs. Get a Trackbacks link here

Thursday, November 18, 2004

Xmas Movies

The shmaltz has started. Tonight Family Man was on tv. ooh the hollywood famly values movies. yay....

Posted by Stu on 11/18 at 11:29 PM Permalink to this post.
Filed Under : Life
Comments are closed There are no comments on this entry.
Linked To by (0) blogs. Get a Trackbacks link here

Half Life 2, Steam and I

hmm I dunno if I will be getting HL2..

out of curiosity I did download ‘steam’ just to check it out.
I created an account no probs as YakumoFuji and looked around..  looks like a QT application. crap ‘colour schemes’. eesh.

for something to do I stuck my HL1 key into the rego wizard and voila! it added about 7 games to my list.. sweet. Half Life 1 premium platinum pack.. (ok i didnt buy that i bought ages ago some hl1/return to wolfenstein/tom clancy game pack for like £5...)…

at least it locked this key to my account…

i havnt heard/played any of the ones it added besides HL1/CS
(team fortress classic, day of defeat, deathmatch classic, opposing force, ricochet, hl1, counter strike).

is half life: source the same as half-life 1??

very strange......

Posted by Stu on 11/18 at 04:21 PM Permalink to this post.
Filed Under : Life
Comments are closed There are no comments on this entry.
Linked To by (0) blogs. Get a Trackbacks link here

Wednesday, November 17, 2004

RUBY : Tokeniser

I looked around the internet a bit for a general tokeniser and couldnt find one.. So I tried writing my own version.. Which was quickly going nowhere using regular expressions, so anyway..
I ended up iterating across the string.

This code will return an array of words.

Here is an example of use;

# tokenise example.
require "tokenise"

Tokenise.new

# thigs that split words
t.breakers.addDelim(" ""t""r""n");

# seperators -> eg:  x() -> x, (, )
t.grabbers.addDelim(";""+""-""*""/""&""^""|")
t.grabbers.addDelim("!""<"">""=""("")"".""%""#","$")

# string delimiters.
t.quotes.addDelim(""", "'")

# glued operators (since they get split by grabbers)
t.glue.addDelim("//", "/*", "*/")
t.glue.addDelim("+=", "-=", "*=", "/=", "&=", "|=", "^=")
t.glue.addDelim("==", ">=", "<=", "!=")
t.glue.addDelim("<<", ">>", "->", "::")

while line = gets
    # remove cr/lf
    line.chomp!
    x = t.tokenise(line)
    x.each do |word|
        puts "[" + word.to_s + "]"
    end
end

And here is the tokenise.rb code

###########################################################
# tokeniser routines

class TokeniseDelimiters
    def initialize
        
@aDelims = Array.new
    
end
    
    def clear
        
@aDelims.clear
    end
    
    def addDelim
(*arg)
        
arg.each do |a|
            @
aDelims << a
        end
    end
    
    def 
include?(arg)
        return @
aDelims.include?(arg)
    
end
end

class Tokenise
    attr_reader 
:glue, :breakers, :grabbers, :quotes

    def initialize
        
@glue TokeniseDelimiters.new
        @
breakers TokeniseDelimiters.new
        @
grabbers TokeniseDelimiters.new
        @
quotes TokeniseDelimiters.new
    
end
    
    
    def tokenise
(line)
        
ll line
        
        lx 
= Array.new
        
index 0
        start 
0
        
        ll
.strip
        
        
while index ll.length
            
if @breakers.include?(ll[index].chr) == TRUE
                
if index start 0
                    lx 
<<  ll.slice(startindex start)
                
end
                
                index 
+= 1
                start 
index
                
                
# grabbers.
            
elsif @grabbers.include?(ll[index].chr) == TRUE     
                
# take what exists.
                
if index start 0
                    lx 
<<  ll.slice(startindex start)
                    
start index
                end
                
                
# now take this
                
lx << ll.slice(startindex start 1)
                
index += 1
                start 
index
                    
            elsif 
@quotes.include?(ll[index].chr) == TRUE
                mye 
ll[index].chr
                
                
# skip over opening quote.
                
index += 1
                
                catch 
"breakout!!" do
                    while 
index ll.length
                    
                        
if ll[index].chr == "\"
                            
index += 2
                        end
                        
                        
if ll[index].chr == mye
                            index 
+= 1
                            throw 
"breakout!!"
                        
else
                            
index += 1
                        end
                    end
                end                    
                
                lx 
<<  ll.slice(startindex start)
                    
                
index += 1
                start 
index
            
else
                
index += 1
            end
        end
        
        
if start != index
            lx 
<< ll.slice(startindex start)
        
end
        
        
# glue
        
0
            
        gcount 
1
        
while gcount 0
            gcount 
0
            1.
.lx.length.times do |l|
                if @
glue.include?(lx[l-1].to_s lx[l].to_s) == TRUE
                    lx[l
-1] lx[l-1].to_s lx[l].to_s
                    lx[l] 
nil
                    gcount 
+= 1
                end
            end
            
            lx
.compact!
        
end
    
        
return lx
    end
end

Posted by Stu on 11/17 at 03:49 PM Permalink to this post.
Filed Under : Development
Comments are closed There are no comments on this entry.
Linked To by (0) blogs. Get a Trackbacks link here

Sunday, November 14, 2004

Whats up with America?

What is up with America?? Cant screen Saving Private Ryan on veterans day because it has swearing in it.. HELLO, Its a WAR movie.. If Disney made a war movie, it would have swearing in it.

Were talking about the country thats the porn capitol of the world, Producing all the worlds violent movies, where Britney Spears can get married when she is utterly hammered in Las Vegas.. But no, we cant have SWEARING on tv!

oh my!

BBC : War film axed by 66 US stations
http://news.bbc.co.uk/1/hi/entertainment/tv_and_radio/4009821.stm

BBC : US Bans swearing on TV
http://news.bbc.co.uk/1/hi/entertainment/tv_and_radio/3549105.stm

Posted by Stu on 11/14 at 10:55 PM Permalink to this post.
Filed Under : Life
Comments are closed Commented on by (4) people. Read those Comments Here

Linked To by (0) blogs. Get a Trackbacks link here

uname for windows

Having been frustrated at the lack of a proper uname tool for windows, I hacked
out my own version. This properly displays various uname bits.

The source is very crusty and a hack. Lots of win32 calls for things like
ComputerName, OSVersionInfo etc.

Source + Binary is here

Supporting standard “asnrvmpo” switches.

eg:

WindowsNT LAPTOP 5.1 build 2600 i586 i386 Microsoft Windows XP Professional Service Pack 2 (Build 2600)

Better page is at http://mega-tokyo.com/programs.html

Posted by Stu on 11/14 at 05:08 PM Permalink to this post.
Filed Under : Development
Comments are closed There are no comments on this entry.
Linked To by (0) blogs. Get a Trackbacks link here

Saturday, November 13, 2004

SPAM

Well it was bound to happy, some time in the last two days all my blogs were filled with spam…

Someone has written a nice spam robot to add comments to every entry…

Ive locked things down somewhat but it might still happen… so…

Im waiting for the makers of pMachine to write some SPAM blocking code… Ive just deleted near 200+ entries out of my log. esh…

To this Ive added some hacks to the code, now you cant post anything with HTML in the post and cant post but once every 5 minutes.

Posted by Stu on 11/13 at 12:42 PM Permalink to this post.
Filed Under : Life
Comments are closed There are no comments on this entry.
Linked To by (0) blogs. Get a Trackbacks link here

Thursday, November 11, 2004

RUBY: RubyInfo.rb

I am writing a small app which needs to know what platform its running on and such, so I knocked out this small class. It lets me determine what platform it (should) be running on, returning either WIN32, UNIXLIKE, OS2 or AMIGA.

There is only 1 perhipheral routine inside which is versionCompare returning (-1, 0 or 1).

Here is some sample testing.

1.8.2 is higher than 1.8.2-rc2
1.8.2-rc2 is lower than 1.8.2
1.8.2-rc1 is lower than 1.8.2-rc2
1.8.2-rc3 is the same as 1.8.2-rc3
1.6.0 is lower than 1.8.2
1.8.2 is the same as 1.8.2

As you can see, RC versioning is lower in the chain than non RC. Since it is assumed 1.8.2-rc1 is LOWER than 1.8.2…

Class code follows…

#
# Ruby Info, v0.1 - 20041111
# Stu George, [url=http://mega-tokyo.com]http://mega-tokyo.com[/url]
#
# License : Public Domain
#
# Changelog
# v0.1 - 20041111
# - Initial mockup


# RubyInfo holds basic info on Version and Platform
# TODO
# - Detect running on Risc OS?
#
class RubyInfo
    attr_reader 
:strPlatform, :strVersion
    
    def initialize
        
# get ruby interpreter version
        
@strVersion RUBY_VERSION
        
        
# Work out the platform
        
breakPlatformDown
        
        
# split it down
        
@intVersion = Array.new
        
breakVersionDown
    end
    
    
# override
    
def to_s
        puts 
"Version = #{@strVersion}, Platform = #{@strPlatform}"
    
end
    
    
# Compares two version strings
    # 1.8.2rc1 is LOWER than 1.8.2
    #
    # returns -1 if ThisVer is LESS than ThatVer
    # returns 0 if ThisVer is EQUAL to ThatVer
    # returns 1 if ThisVer is GREATER than ThatVer
    #
    
def versionCompare(thisVerthatVer = @strVersion)
        
aVer thisVer.to_s.split(".")
        
bVer thatVer.to_s.split(".")
        
        
aaVer = Array.new
        
bbVer = Array.new
        
        
0
        aVer
.each do |x|
            
x.scan(/w+/) do |z
                
z.gsub!(/[^d]/, '').to_s
                aaVer[i] 
z.to_s.to_i
                i 
+= 1
            end
        end
        
        i 
0
        bVer
.each do |x|
            
x.to_s.scan(/w+/) do |z
                
# remove non digits from string : eg rc2 -> 2
                
z.gsub!(/[^d]/, '').to_s
                bbVer[i] 
z.to_s.to_i
                i 
+= 1
            end
        end
        
        
# compare aaVer to bbVer
        
0
        j 
aaVer.length
        
if aaVer.length bbVer.length
            j 
bbVer.length
        end
        
        
while j
            
            
# no more in aaVer... but must still be some in bbVer.
            # thus 1.8.2-rc2 is -1 to 1.8.2
            
if >= aaVer.length
                
return 1
            end
            
if >= bbVer.length
                
return -1
            end
            
            
if aaVer[i].to_i bbVer[i].to_i
                
return -1
            elsif aaVer[i]
.to_i bbVer[i].to_i
                
return 1
            
else
                
+= 1
            end
        end
        
        
return 0
    end
    
    private
    
# breakPlatformDown creates our platform string.
    # WIN32
    # *-mswin32
    # *-mingw32
    # *-bccwin32
    # *-msdosdjgpp
    #
    # OS2
    # *-os2
    # *-os2-emx
    # *-emx-os2
    #
    # AMIGA
    # amigaos
    #
    # UNIXLIKE (we dont test this, its the default)
    # *-cygwin
    # *-darwin
    # *-aix
    # *-linux
    # *-freebsd
    # *-netbsd
    # *-openbsd
    # *-solaris
    # *-hpux
    #
    
def breakPlatformDown
        x 
RUBY_PLATFORM
        
        
# the GROSS assumption here is RUBY_VERSION returns
        # the platform the binaries were built with, not
        # what it is running under...
        
        # easiest thing to do is to determine unixlike exceptions.
        # aka everything that isnt a unixlike.
        
        
x.scan(/(mswin32|mingw32|bccwin32|msdosdjgpp|os2|amigaos)/)
        
        
# TODO : how do we test for riscos?
        # NOTES : os2 also covers os2-emx (eg: i386-pc-os2-emx)
        
case y.to_s
            when 
"mswin32""mingw32""bccwin32""msdosdjgpp" 
                
@strPlatform "WIN32"
            
when "os2"
                
@strPlatform "OS2"
            
when "amigaos"
                
@strPlatform "AMIGA"
            
else
                @
strPlatform "UNIXLIKE"
        
end
    end
    
    def breakVersionDown
        aVer 
= @strVersion.split('.')
        
        
0
        aVer
.each do |x|
            
x.scan(/w+/) do |z
                
# remove non digits from string : eg rc2 -> 2
                
z.gsub!(/[^d]/, '').to_s
                
@intVersion[i] z.to_i
                i 
+= 1
            end
        end
    end
end

Posted by Stu on 11/11 at 02:01 PM Permalink to this post.
Filed Under : Development
Comments are closed Commented on by (3) people. Read those Comments Here

Linked To by (0) blogs. Get a Trackbacks link here

RubyFileManager (RFM)

In not-very-many-lines, RFM has sprung from nothing. I find it quite refreshing to be able to build things so quick, yet utilise so few lines of code, and still retain full flexability and power over it.

RFM is a file manager in the same vein as StupenDOS (unrelated to me), Norton Commander etc, or Midnight Commander for Linux.

Personally I hate Midnight Commander, and the fact its so unstable now and requires X and a bunch of Gnome libs to build what is primarily a console app.

So, I am writing a basic file manager in Ruby, and since its in Ruby, I guess you will be able to extend it with Ruby scripts etc. (Not sure exactly what for… but eh...)…

The only dependancy right now is opon NCurses for Ruby…
Im also quite impressed by its speed. I did a File::STAT on everything in my e:/windows/system32 directory and it took less than 1 second… So I am not worried about stat’ing large directories…

Dual panel, quick key commands eg;

ESC C -> copy tagged files to other pane.
ESC D -> delete tagged files.
ESC M -> move tagged files

ESC T C 
-> clear tags
ESC T I 
-> invert tags
ESC T A 
-> tag all

ESC X 
-> quit

ESC H 
-> help

Posted by Stu on 11/11 at 01:06 AM Permalink to this post.
Filed Under : Development
Comments are closed There are no comments on this entry.
Linked To by (0) blogs. Get a Trackbacks link here

Tuesday, November 09, 2004

Ruby on Rails

I think I’m going to experiment with Ruby on Rails… First thing I guess, is to try and convert one of my existing php sites over (a very simple one), just to get the hang of it, and see how things go from there.

Posted by Stu on 11/09 at 11:51 PM Permalink to this post.
Filed Under : Development
Comments are closed There are no comments on this entry.
Linked To by (0) blogs. Get a Trackbacks link here

GMail

So I succumbed to the gmail phenomena… I couldnt let my fiancee have a gmail account and I not have one! So i took up an invite offer.

Boy its LOADS better than hotmail and yahoo mail. I think GMail really hit the sweet spot for web email.

Posted by Stu on 11/09 at 05:01 PM Permalink to this post.
Filed Under : Life
Comments are closed Commented on by (1) people. Read those Comments Here

Linked To by (0) blogs. Get a Trackbacks link here

RUBY: First pass at converting some more code…

This is another first pass at converting my INI code from C to Ruby. Im semi happy with it. I dont think I am doing things the ‘Ruby Way’ but that doesnt really matter to me quite so much.

This version lets you retrieve/write back .INI files but you cant add new items to the list or anything like that…

#
# INIFiles 0.1 - Ruby Version by Stu George 
# [url=http://mega-tokyo.com]http://mega-tokyo.com[/url]

# Author:: Stu George
# License:: Public Domain
# Copyright:: blah blah
#
# I am not very happy with this class much at all. I dont like the way in
# which I break the INI up into key/value pairs. It looks woefully inefficient
# and prone to breakage... (my inexperience with ruby is showing here probably)
#
# v0.1 - 20041107
# - Started conversion of my C routines
#
#
#
# TODO
# - Ability to add new items to list.
# - Check for duplicates

# This does all the heavy lifting of the INI file
#
class INIFile
    
    
# constructor
    
def initialize(filename)
        @
filename filename
        
        
if File.exists?(@filename) == TRUE
            strLines 
IO.readlines(@filename)
            
            @
hMasterHash Hash.new
            
hCHash = @hMasterHash        # put a value in it so we can use it later.
            
sCurrentHash ""
            
intLineNo 0
            
            strLines
.each do |strINILine|
                
intLineNo += 1
                
                
# stringify each line.. just incase it comes back as an integer or something
                
strINILine "" strINILine.to_s
                
                strINILine 
CleanLine(strINILine)
                
                if 
strINILine.length 0
                    
if strINILine.index('[') == 0
                        
# now, make a new header group, remove the []
                        
sCurrentHash strINILine.slice(1strINILine.length-2)
                        
                        
# TODO
                        # check if group already exists in hash!
                        
                        # new hash table group entry
                        
@hMasterHash.store(sCurrentHash.to_sHash.new)
                        
hCHash = @hMasterHash.fetch(sCurrentHash.to_s)
                    else
                        
# make sure we are in a group!
                        
if sCurrentHash.length == 0
                            STDERR
.puts "INI: No group header. Line(#{intLineNo})!n"
                            
exit 1
                        end
                        
                        intIndex 
strINILine.index('=')
                        if 
intIndex != nil
                            key 
strINILine.slice(0intIndex)
                            
value strINILine.slice(intIndex 1strINILine.length intIndex)
                            
                            
# trim the fat
                            
key.strip!
                            
value.strip!
                            
                            
# TODO
                            # check for duplicate values in collection already....
                                                        
                            # save key/value pair into hash
                            
hCHash.store(keyvalue)
                        else
                            
STDERR.puts "INI: No key/pair. Line (#{intLineNo})n"
                            
exit 1
                        end
                    end
                end
            end
        end
    end


    def WriteBack
(newFileName)
    
        if 
File.exists?(newFileName) == TRUE
            File
.delete(newFileName)
        
end
        
        fp 
File.new(newFileName"w")
        if 
fp != NIL
            fp
.puts "#n# INIFile.rb WriteBack()n#nn"
            
            
@hMasterHash.each do |hKeyhVal|
                
fp.puts "[#{hKey}]n"
                
hVal.each do |kv|
                    
fp.puts "#{k}=#{v}n"
                
end
                fp
.puts "n"
            
end
            
            fp
.close
        end
    end

    def ReturnGroupHash
(groupName)
        @
hMasterHash.fetch(groupNameNIL)
    
end
    
    def ReturnGroupItemValue
(groupNameitemName)
        
ReturnGroupHash(groupName)
        
        if 
== NIL
            
return NIL
        end
        
        
return x.fetch(itemName)
    
end
    
    
    
# stringify
    
def to_s
        
"INIFile: #{@filename}"
    
end
    
    
#
    # private routines
    #
    
private
    
    
# this will clean the input line
    
def CleanLine(strLine)
        
intIndex 0
        
        strLine
.strip!
        
        
# - attempt 1, this kills mid string hash marks....
        # - we need to tokenise the string
        
        
intIndex strLine.index('#')
        if 
intIndex != NIL            
            
# strips comments off end of line. takes quoted strings into account.
            
""
            
strLine.scan(/w+|"[^"rn]*"|[ a-zA-Z0-9.=#]+/) do |w| 
                w.strip!
                if w.index('#') != 0
                    x = x + " " + w
                else
                    strLine = x
                    break
                end
            end
            
            strLine.strip!
        end
        
        return strLine
    end
    
end


# This is the main starter class that just instantiates a BuildVersion
# and runs it.
#
class Application
    def initialize
        # 
    end
    
    def start
        # this is just testing stuff.......
        ini = INIFile.new("
udark.ini")
        
        ini.WriteBack("
NewIni.ini")
        
        #puts ini.ReturnGroupHash("
options")
        puts ini.ReturnGroupItemValue("
display", "screen")
    end
end

# Create new app and run!
AppMain = Application.new
AppMain.start

Posted by Stu on 11/09 at 04:12 PM Permalink to this post.
Filed Under : Development
Comments are closed There are no comments on this entry.
Linked To by (0) blogs. Get a Trackbacks link here

Page 1 of 2 pages  1 2 >