Idiot spider

I am so stupid !!!

I’m sitting here working on a the configuration file stuff in my options class and BAM the laptop shuts down on me.

Battery firmly attached and not in use, laptops been on at least an hour and a half or more but it’s still cool, no signs of blockages of ports and the fan was fine last I looked.

Rolled my chair around and made sure the power cable was in the socket check,

turned around to the other flank and saw that the light on the mobile surge protector was on, check, back to the poor laptop…

“Wait”, I rolled back around and picked up the A/C Adopter and the surge protector/cable segment had come unplugged — BINGO WE HAVE A WINNER !!!

I can’t believe I’ve been sitting here using the battery the whole time, like a moron… But I am very glad that I save files often when editing and that vim keeps a swap file so I didn’t lose any thing but the open tabs in knoqueror and the interipters history.

It would kind of suck to lose the entire projects files on day one =/

Saved by the editor… hehe

backlog

This one made my day 🙂

[15:11] [SAS]_LCpl_DUKE: Did you know: The Navy takes now only not-swimmers.
[15:11] [SAS]_RSM_Spidey01: ?
[15:11] [SAS]_LCpl_DUKE: Yeah, they defend the war-ships longer…
[15:11] [SAS]_RSM_Spidey01: LOL
[15:12] [SAS]_LCpl_DUKE: the newest joke i got 5 minutes ago… 😉

I’ve been brushing up on Python for a little projectI’ve got in mind, so I’ve been cramming like a student at finals week. Python is a nice language but one I never put to use when I originally started learning it.

The thing I love the most about Python, is the doc strings, it’s such a great idea if you ask me.

--- def test(params):
... """ Simple test
...
... More detailed info about it"""
...
... print params
...
--- test.__doc__
' Simple testntnt More detailed info about it'

A poor example yes, but in actual usage the doc strings can be very useful. I also like it because it can be used to move inline-documentation (some times aka comments) into the body of the function, rather then being above it. And they are accessible at runtime with the __doc__ special method.

One thing I do wish Ruby had, is Doc Strings for methods, b/c then in IRB I could do a simple obj.methods.sort and follow up with checking a methods docstring rather then an intermixing of playful testing in IRB with looking it up in TFM.

With Python, it’s quite easy to go to interactive mode and use dir(obj) to get the methods an object responds to and any available __doc__ special methods to learn more about it, before we go RTFM hehe.

Some how, I think if I was the type for it, I would be stone cold drunk tonight… but as it is, I am sober as a codfish =/ Getting lit never helped any thing and my Families history is enough that it is not a fond concept. Although I must admit, a nice mixture of wodka, rum, and a little lemon juice does sound like an interesting idea.. Oh well, a spider can think lol.

trying to see if I can get QT (and possibly KDE) bindings for Ruby installed, I’ve had no luck with qtruby yet but so far korundum-3.5.5 is doing good, hope I don’t jinx it =/.

That’s not why I feel like getting drunk though, but even if I was that kind of person I’ve got to much crap to get done then to worry about it.

It is strange, how being busy is a two edged sword, in that it does have it’s advantages but it can be so damn exhausting some days !

damn, the build just blew, would be bloody nice if it would tell me *which* library is missing. Oh well, it’s not important. Hmm, what else to work on…

Funky dreams

From taking part in a commando raid on an out post, gone bad….

To being stuck on an Air Craft Carrier in the middle of a typhoon with a very Hot Blonde, and oh yeah how could I forget the dozens of goons with MP5’s trying to steal the ship! Oh well, what is a little adventure on the high sea without a woman that can fight?

All the way to being first mate on a rather super natural pirate ship = Like a cross between the Pirates of the Caribbean and a dark rendition of a old Peter Pan fairy tail.

I must admit, some times I have some very strange dreams.. Normally though it usually involves me coding, playing, or ‘taking a role in’ a Video Game or crack-pot adventure of some sort lol.

A more normal string of dreams for me would include joining the Colonial Marines for a bug hunt with a trusty M41A Pulse Rifle in hand. Once I even dreamed of fighting a Queen Alien one on one afther they took over a school building and chased me down… good thing Predators can make acid proof knifes 😉

I still remember one from many years ago though, rofl After fighting my way through 5y3 hive. I had signed a peace treaty ending the hostilities … and the Queen Alien endpushed me out an airlock xD

I don’t have nightmares but I do have the craziest dreams when I do get any +S

I’ve compiled all of my stored bookmarks (aside from the handfull on my laptop) into a single flat file…

One URL per line with a grand total of 662 lines.

Plenty are just enqueued to be read while others are perm storage.

Not bad for about 10 years of surfing =/

Now neatly redoing my bookmarks on ma.gnolia is the next big project of the day :'(.

And in the near future, properly using this for all my bookmarking needs.. lol.

Wasting time with the Euclidean Algorithm

The other night, I was very bored so… When I remembered reading about the Euclidean Algorithm on Wikipedia, which is a method of finding the greatest common denominator (gcd). I fed several implementations through ye ol’time(1) to get a rough idea of what differences they made.

At first I did it in Ruby and C for comparison, then I recompiled the *.c files with maximum optimization. Tonight I added a set of Java and Python files to the setup, I’ll probably include Bourne Shell and Perl later for fun.

For any one interested,

C // no optimization
./iteration 0.00s user 0.00s system 50% cpu 0.003 total
./recursion 0.00s user 0.00s system 66% cpu 0.002 total
./original 0.00s user 0.00s system 57% cpu 0.003 total
Ruby
./iteration.rb 0.01s user 0.00s system 59% cpu 0.014 total
./recursion.rb 0.00s user 0.00s system 79% cpu 0.010 total
./original.rb 0.00s user 0.01s system 75% cpu 0.010 total
C // optimized, -O3
./iteration-o 0.00s user 0.00s system 48% cpu 0.003 total
./recursion-o 0.00s user 0.00s system 32% cpu 0.005 total
./original-o 0.00s user 0.00s system 37% cpu 0.004 total
Java
java EuclideanIteration 0.39s user 0.38s system 66% cpu 1.165 total
java EuclideanRecursion 0.48s user 0.30s system 72% cpu 1.066 total
java EuclideanOriginal 0.36s user 0.42s system 67% cpu 1.155 total
Python
./iteration.py 0.01s user 0.01s system 59% cpu 0.034 total
./recursion.py 0.01s user 0.01s system 65% cpu 0.032 total
./original.py 0.01s user 0.01s system 65% cpu 0.031 total

done with:

ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-freebsd6]
gcc version 3.4.6 [FreeBSD] 20060305
javac 1.5.0
Python 2.5.1

The C versions were the same sources but compiled with -O3 for the optimized
version.

I’ve assigned each outcome a score, 3 for what I feel is fastest, 2 for the intermediate (often close) and 1 for the worst and totalled it:

method  C RB C(-O3) Java Python Total
iteration 2 1 3 2 2 10
recursion 3 2 2 1 1 9
original 1 3 1 3 3 11

And the code, which I tried to keep similar. Also the gcd()/mygcd() routines were always implemented as a function because of the recursive version in the tests.

#include <stdio.h>

#define A 1071
#define B 1029

int
mygcd( int a, int b ) {
int t = 0;
while ( b != 0 ) {
t = b;
b = a % b;
a = t;
}
return a;
}

int
main(void) {
mygcd(A, B);
return 0;
}


#include <stdio.h>

#define A 1071
#define B 1029

int
mygcd( int a, int b ) {
if ( b == 0 ) {
return a;
} else {
return mygcd( b, a%b );
}
}

int
main(void) {
mygcd(A, B);
return 0;
}


#include <stdio.h>
#define A 1071
#define B 1029


int
mygcd( int a, int b ) {
while ( b != 0 ) {
if ( a > b ) {
a = a-b;
} else {
b = b-a;
}
}
return a;
}

int
main(void) {
mygcd(A, B);
return 0;
}

#!/usr/local/bin/ruby -w

def gcd(a, b)
while b != 0
t = b
b = a % b
a = t
end
return a

gcd( 1071, 1029 )
#!/usr/local/bin/ruby -w

def gcd(a,b)
if b == 0
return a
else
return gcd(b, a % b )
end
end

gcd( 1071, 1029 )
#!/usr/local/bin/ruby -w

def gcd( a, b )
while b != 0
if a > b
a = a - b
else
b = b - a
end
end
return a
end

gcd( 1071, 1029 )

class EuclideanIteration {
static final int A = 1071;
static final int B = 1029;

public static int
mygcd( int a, int b ) {
int t = 0;
while ( b != 0 ) {
t = b;
b = a % b;
a = t;
}
return a;
}

public static void
main( String[] args ) {
mygcd(A, B);
}
}



class EuclideanRecursion {
static final int A = 1071;
static final int B = 1029;

public static int
mygcd( int a, int b ) {
if ( b == 0 ) {
return a;
} else {
return mygcd( b, a%b );
}
}


public static void
main( String[] args ) {
mygcd(A, B);
}
}


class EuclideanOriginal {
static final int A = 1071;
static final int B = 1029;

public static int
mygcd( int a, int b ) {
while ( b != 0 ) {
if ( a > b ) {
a = a-b;
} else {
b = b-a;
}
}
return a;
}


public static void
main( String[] args ) {
mygcd(A, B);
}
}

#!/usr/local/bin/python

def mygcd(a, b):
while b != 0:
t = b
b = a % b
a = t
return a


mygcd( 1071, 1029 )
#!/usr/local/bin/python

def mygcd( a, b ):
if b == 0:
return a
else:
return mygcd( b, a %b )


mygcd( 1071, 1029 )
#!/usr/local/bin/python

def mygcd( a, b ):
while b != 0:
if a > b:
a = a-b
else:
b = b-a
return a


mygcd( 1071, 1029 )

A good movie tonight, Night at the Museum. Ma likes to watch new movies but interestingly she never likes them rofl.

I enjoyed it though, much like Eight Legged Freaks it is a good movie to just sit back and let go.

S’no greatest movie ever made but still fun. Even more so for me because I love history! And the Museum of Natural History is probably the only reason I could think to visit New York other then to see the Statue of Liberty. The T-Rex on display, ohh baby would I love to get to see that. Paleontology is a field I would love to be closer to, it has always been very interesting to me, ever since I was a kid. But I don’t think my memory is good enough to even consider such a thing lol.

What I like is it is a family movie, think about it. Whats the best way to watch a film? With Family or with Friends or better yet both !!!

An interesting Apple

Could this bring the power of the command line, to the GUI?

An interesting idea, I wonder how it works from a security and flexibility point of view.

One reason I enjoy the Unix Shell is it is very easy to solve problems with the vast and expandable workbench provided. And to automate various tasks quickly, not to mention many good programs are extensible/scriptable 🙂

The only sad thing for new users of traditional unix-likes is that the interfaces are often different, such as Emacs Lisp Vs Vim Script, Various Shell scripting languages vs DOS/Windows batch files e.t.c. Although most of the best programs I’ve used do run on many different platforms hehe.

daily fortune cookie

Nothing is faster than the speed of light.

To prove this to yourself, try opening the
refrigerator door before the light comes on.

To days date is: Mon Nov 26 04:24:21 UTC 2007
Terry@Dixie$ 4:41

That so reminds me of some thing Lake posted xD