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

Dixie decked out

Since KateOS was a tad bit disappointing, I booted back into my PC-BSD v1.4 partition and set out to use Window Maker, by far my favorite window manager. I love the look and feel wmaker has but rarely have used it. The main reason I use PC-BSD, is I don’t want to go through the bother of installing/upgrading KDE, given the time involved…. If I used FreeBSD, I’d probably use Window Maker instead of KDE lol.

Here is some initial work,

PC-BSD v1.4, running Window Maker 0.92.0
screen shot hosted on imageshack

I’ve installed docker to gain a system tray, which I have done with Blackbox in the past. And I’ve used wmclock which I find less obstrusive then the wmclockmon program I’ve used in the past. I might experiment with running Window Maker as KDE’s window manager but I don’t mind hacking up my menu hehe.

Play time

About 25:17 woth of downloading later I burnt the disk, install went great but Linux hangs during the boot 🙁

I installed KateOS on my laptop using a spare storage partition. It works great aside from not auto-detecting my Atheros based PCMCIA card with the rest of my hardware. The default Desktop Environment is Xfce4, never used any of the Xfce’s but it’s a dandy GTK+ based one. I found it some one suprising that I had to create my own ~/.xinitrc to be able to log in through the GUI but it was as simple as coping roots to my home directory.

Surprisingly with the exception of Live CD’s, I have never had a Linux Distro that just ‘worked’ with my hardware :. I’ve always had to screw with them to get them work, even in Ubuntu when I tested 6.06 to try Gnome. Although I must admit having to rewrite Ubuntu’s /etc/fstab was not as annoying as Debian and NetBSD telling me I have no hard drive xD

FreeBSD has always worked well for me, except on one laptop. Which I could swear should have been marketed as a ‘Wintop’ lol.

Maybe it’s just a strange twist of fate, I generally get along with FreeBSD/OpenBSD more readidly and vice versa in terms of getting things done.

I must admit, I am tempted to either to use OpenBSD (for the first time with X11) or FreeBSD on the new system. Although I could probably roll my own Linux From Scratch but that’s a tad more time consuming !

Update

Well, 10% of download complete in about 2 1/2 hours (two and a half)… Interesting although the download speed is only about 20~28kbyte/sec, it is generating enough network traffic that page loads are very slow, normally I can ping www.google.com and get a response average in the 48-62ms range, and maybe 150ms or so to my primary DNS server set by the ISP.

By contrary, the *US* mirror alone for KateOS pinged at > 400ms and still has a just as bad D/L rate, so since it would mean downloading 3 disks from them as they don’t have a copy of the DVD ISO, there’s no loss by a server from a far off place… But I’ve got to admit, if I had the $6… I would by the bloody disk instead of download it LOL.

As I do with many of my pre-planned operations, I’ve assigned this one a code name: Phoenix. Both because it will be raising an old cannabolized PC out of the ashes; and will probably end up either enflaming my rageometer or proving to be worth the trouble…

Here is part of my ~/phoenix.outline file, I’ve worked out a number of things so far. Software needed on the system once it’s ready op, General goals of the overall plan, changes to Vectra, which PC gets what drive, Suggested file system schemes, estimated the probable cost ($95), since time can only be guessed at I factor that as a level of involvedness it will take to get changes done. I’ve also worked out a strnger concept of what each system will be doing. What follows is the tail end of my outline, pointing out the major placement alternitives. I think points 0 and 2 are best, 0 is annoying but probably the best solution given the terrain, although idea 2 is also a nice idea if I didn’t have a fscking parakeet screaming my head off from morning to just before bed time — No wonder they invented WORK !

Ideas:

| 0/ Remote Workstation {
| | Move either Vectra or Phoenix into my room and set the other up
| | in Vectra's current position (Living Room, my PC desk, lower
| | store point).

| | Set up Phoenix? to make use of xrdp server and access it from
| | Dixie, SAL1600, and also if necessary Josephine.

| | Pro's:
| | | Grants a *decent* working environment from my Desktop
| | | without forcing me to use the Cywgin provided x-server
| | | (also an option here, since it's installed on SAL1600).
| | | And without making me use my laptop for every thing.

| | | Takes best advantage of space, e.g. my Desktop (SAL1600) is
| | | the only place I can actually set up a PC to sit at and
| | | use comfortably, hence why my Laptop (Dixie) has been
| | | such a life saver, because I can sit in bed or at a
| | | regular table -- hole problem could be solved with an
| | | LCD Monitor, which I can't afford... Only have 2 CRT's
| | | in the 19 and 17 or 19 inch range.

| | | Further integrates remote access across the LAN, which
| | | is currently limited to all BSD boxes running OpenSSHs
| | | ssh daemon and all systems having SSH Clients installed.
| | | My Desktop having WinXP MCE's built in RDP capabilities
| | | and all other systems RDP Clients.
| | Con's:
| | | Lack of (me) testing RDP based operations for indented
| | | purposes, also no configuration experience with xrdp.

| | | The 'annoyance' of having to use my Desktop as a client
| | | to access another box for getting work done.

| | | Wireless adaptor must be supported by either Linux or
| | | OpenBSD, which could be a bit *hard* to confirm based on
| | | the local shops generic stockpiles.

| | | Due to the amount of local network traffic, it might be
| | | bet to setup the File Server with the Wireless instead
| | | of the Linux system.
| }

| 1/ Bedroom Work Platform {

| | Set up Phoenix? in my room with Wireless adapter,
| | possibly attempt to cannibalize Vectras CD-ROM drive so
| | that Vectra becomes reliant on Floppy disks only. Wish I
| | had a way to either give all systems a card reader or a
| | floppy drive... Would make life easier!

| | Pro's:
| | | Less disturbing of existing systems then other
| | | ideas.

| | | Gets me further away for
| | | disturbances/distractions

| | | Can use Monitor, Keyboard, and Mouse, as well as
| | | rest of PC physically rather then remotely

| | Con's:
| | | No decent working environment in my room to use
| | | a full size PC without purchasing either an LCD
| | | Monitor or setting up a /or another PC Desk in
| | | my room; I only have the one that SAL1600 and
| | | Vectra are hooked up to.

| | | I can hear my family from at least 10 metres
| | | out side of the building! Let along every where
| | | inside of it.

| | | My laptop might get a lot less use, since most
| | | times I use my laptop it is in my bedroom.

| | | Any possible working environment I could arrange
| | | in my room is likely to be much less then
| | | comfortable for physically sitting at a PC
| | | without buying another PC Desk.

| | | Requires Wifi to be compatible with Linux.
| }

| 2/ Bedroom Game box {

| | Move SAL1600 into my room and swap the Ethernet NIC with
| | the Wireless Adapter.

| | Place Phoenix? in SAL1600's place in the living room

| | Pro's:

| | | Eases shopping for wireless adapter

| | | Moves my Gaming system away from most common
| | | 'interruptions'

| | | Better chance of hearing people on TeamSpeak !

| | | Limits potential for using my laptop less

| | Con's:

| | | No decent working environment in my room to use
| | | a full size PC without purchasing either an LCD
| | | Monitor or setting up a /or another PC Desk in
| | | my room; I only have the one that SAL1600 and
| | | Vectra are hooked up to.

| | | Any possible working environment I could arrange
| | | in my room is likely to be much less then
| | | comfortable for physically sitting at a PC
| | | without buying another PC Desk.

| | | With a work platform placed in the living room
| | | (in SAL1600's place), it would be even *HARDER*
| | | to get freaking work done.

| | | Being in my room on the game box would likely
| | | make it harder for Ma to call me when she needs
| | | things done.
| }

The braces denote folds and the pipes I inserted into the copy/paste so it displays as I see it in my text editor. I’ve configured vim to run a function when ever reading or writing a file with a .outline extension, the function sets settings that I find help write an outline and try to categorize my thoughts more clearly. This is actually how my vimrc file sets different style and other minor options to suit the language I am currently editing, for example a standard tab (visually equal to 8 spaces) when working with C files, and 2 actual spaces for Ruby, e.t.c.

The Pipes or ‘|’ are not really in the file, they just show the tab-deliminated indentation. While I don’t use this when editing source code, I find it works nice for things like this. Normally foldmethod is set to indent, and changed to ‘syntax’ where supported suitably. For outlining, since I didn’t have time to work on a more suitable method of folding, I mearly set it use single braces and fdm=marker; usually it uses 3 braces but I rarely use the marker foldmethod.

Heres my function in vimrc:

function! My_OutlineMode()
setl tabstop=8 shiftwidth=8 noexpandtab
setl listchars =tab:| " Mark t's with |'s
setl list
setl spell
setl autoindent smartindent
setl showmatch matchtime=3
setl matchpairs+=(:),{:},[:],<:>
" Fold by tabs
"setl foldmethod=expr
"setl foldexpr=getline(v:lnum)[0]=="\t"
" Fold by braces
setl foldmethod=marker
setl foldmarker={,}
endfunction
autocmd BufNewFile,BufRead *.outline call My_OutlineMode()

Although it is probably unnecessary on most vim builds but the autocmd should probably be wrapped in an

if has(“autocmd”)
autocmd goes here
endif

hmm, supper time