August 2005 Archives

August 30

Qalculate

I have myself many times needing a command line calculator. On most Unix/linux OS's one can find 'bc' for sure and there is also one kicking around called 'dc', the third one I tried is called 'calc', now in Debian there is also a (horribly unintuitive IMHO) built in calculator for emacs with the name 'calc', so you need to install the 'apcalc' package to get the other version.

Now why all these calculators? I am much better at understanding binary operations in C when I can actually see the numbers expressed in binary format. Most of these calculators will let me do that, but have a majorly annoying feature in that I have to actually type "quit" or "exit" to leave the program. No quick exit, and not even ctrl-c will let you out. The latter being very frustrating and sends me into a little hissy fit every time. (if your a command line app and I press ctrl-c, you must die, those are the rules)
UPDATE: I was just told in irc about ctrl-d, heh, I really should learn about my shell before I start whining :-)

I then found Qalculate which does what I want perfectly and respects ctrl-c. It has a gui version but I haven't tried that, I only installed 'qalc', the command line component.
$ qalc 
> 3 + 21 / 3
  3 + (21 / 3) = 10
>  1 << 3
shift(1, 3) = 8
(now lets set it to base 2)
> base 2
8 = 1000
> 1 << 3
shift(0001, 0011) = 1000
> 1 & 3
0011 & 0001 = 0001

Oh it even has command history with the up/down arrows for the lazy folks like me. I wish the emacs calculator were this easy.

Apparently my excitement about having readers in the island of Niue might have been premature, David from Sweden emailed me to say:
Sorry to rain on your parade, but presumably those hits from .nu comes from people in Sweden (or possibly Norway/Denmark), since that word means "now", and is very popular here, partly because it's much easier and cheaper to register a .nu domain than a .se domain).
Ok so that sounds more plausible but it doesn't rule out a reader in Niue either :-)

Posted by æc♥ | Permanent Link

August 28

Web Statistics With Analog



   The island Niue has about only 2,100 inhabitants, yet according to my Analog web stats someone there visited my blog 16 times last year!. I find this really cool for some reason. You might remember last year I had also ran Analog against my Apache logs (well I had someone do it for me) and had complained about the lack of readers from Sweden. As it turns out, the logs from last year did not do dns look-ups so 90% of the visits could not be verified. Sweden represented 1.3% (373) of all my hits so I consider that substantial :-)

This year the overall hits per day dropped from 175 to 153 but before you panic... remember that last year my blog was listed on the Linuxchix website so I imagine I got some extra traffic from that. Here are last years logs. Here are this years... It seems last year people read my blog on Tuesdays more than other days, but only by a slim margin. However in 2005 Saturday by far was the most common day. I have no idea what this means.

It also appears that more and more non-bzflag people are poking around, the operating system numbers indicate many more unix/linux users so perhaps google is leading them to some of my "how I did this..." posts.

I helped my friends move in across the hall this weekend, and most of the big stuff is done, now all they have to do is cope with the hell of unpacking and putting it all away. We have a deal with them whereby I supply them internet and they supply us with cable tv, and when our other neighbours heard about this, they wanted some internet too for their daughter so it looks like next week I will become an ISP.

I was going to use wireless, and maybe add a signal booster for my router but I my superintendent was here today and said he'd drill some holes in the concrete wall in all 3 apartments so we can fish some cat-5 cables across to each other. This saves me spending any money and will give my customers a slightly better service :-)

Posted by æc♥ | Permanent Link

August 25

Google Alerts

So Google has another nifty trick in this time in the form of 'alerts' whereby you subscribe to a search term and whenever google indexes a page with that term, google sends an alert to your Gmail.

Quite useful except one of my online friends decided to put my real name in as an alert and now google emails him when it digs some mailing list post where I'm asking some ridiculously dumb question. I have named this technique GoogleStalking and I am the first victim of the soon to be popular phenomenon. :-)

I rarely follow online cartoons except, as I have mentioned before, the PBF. I can't help myself and every couple of weeks I dig through the archives for new giggles.. Here is great collection of pictures from Mexico City.

Last night and this evening I am messing around with getopt() and command line argument parsing. Its all very cryptic as Ive tried to go the route of binary flags with 'anding' and 'oring'. Success is imminent...

Oh..someone messaged me in irc today saying he found my site via the nanoblogger users page and told me he was addicted to my blog! This of course made my day..so yay me.

Posted by æc♥ | Permanent Link

August 20

Nvidia Drivers The Debian Way

A few years ago accelerated drivers on linux was a huge pain and I was happy when Nvidia released their binary driver as it made things easy, the installer is pretty simple to the point of it being routine now.

The problem is that because Sarge took so long to release, Debian Unstable could not switch to xorg so there was very little in the way of huge changes going on with the Xserver. Now Sarge has been released the Debian unstable branch is once again truly unstable.

Xorg work is constantly being done and it always breaks my drivers so today on both my desktops I decided to dump the Nvidia installer and install the Debian packages instead, this will let xorg update all it wants and not break my driver each time.

Last time I tried this it all went horribly wrong and I ran back as fast as I could to the Nvidia installer. This time it was a breeze.
/etc/init.d/gdm stop    
sh NVIDIA-Linux-x86-1.0-7167-pkg1.run --uninstall
rmmod nvidia
apt-get install module-assistant
m-a prepare
m-a a-i nvidia (this will provide nvidia-kernel-common) 
apt-get install nvidia-settings
apt-get install nvidia-glx
echo nvidia >> /etc/modules
modprobe nvidia
dpkg-reconfigure xserver-xorg

And that was that, I did this on both desktops and even skipped the last command as I had a working xorg.conf. Here is the recommended howto for Debian which offers some alternative methods for the Debian way.

Posted by æc♥ | Permanent Link

August 18

Xresources Color

I have been messing around again with my ~/.Xresources file as I find the default colors to be a bit fruit salad looking. These are the colors I now use: They are softer on they eyes and although you can spend weeks tweaking them, I have decided to leave it at that.
This is an example of the old:

And the new:

And here is the relevant part of my ~/.Xresources file:
!-- default colors --
! color0         (black)              = Black
! color1         (red)                = Red3
! color2         (green)              = Green3
! color3         (yellow)             = Yellow3
! color4         (blue)               = Blue3
! color5         (magenta)            = Magenta3
! color6         (cyan)               = Cyan3
! color7         (white)              = AntiqueWhite
! color8         (bright black)       = Grey25
! color9         (bright red)         = Red
! color10        (bright green)       = Green
! color11        (bright yellow)      = Yellow
! color12        (bright blue)        = Blue
! color13        (bright magenta)     = Magenta
! color14        (bright cyan)        = Cyan
! color15        (bright white)       = White


*Rxvt*loginShell: true urxvt.cursorColor: #dc74d1 urxvt.scrollBar_right: False urxvt.foreground: #B2B2B2 urxvt.background: #000000 urxvt.color0: #000000 urxvt.color1: #9e1828 urxvt.color2: #4a7624 urxvt.color3: #b7a632 urxvt.color4: #414171 urxvt.color5: #963a76 urxvt.color6: #418179 urxvt.color7: #bebebe urxvt.colorBD: #FFFFFF urxvt.color8: #666666 urxvt.color9: #cf6171 urxvt.color10: #c5f779 urxvt.color11: #fff796 urxvt.color12: #4186be urxvt.color13: #cf9ebe urxvt.color14: #71bebe urxvt.color15: #f6f8f4 urxvt.saveLines: 2048 urxvt.font: xft:Bitstream Vera Sans Mono:pixelsize=13,xft:Andale Mono:pixelsize=11.5,9x15bold
In case your wondering how to make 'top' all colored, start top and press Z, play with colors and then press W to write it out to your ~/.toprc, or you can use this one..
RCfile for "top with windows"         # shameless braggin'
Id:a, Mode_altscr=1, Mode_irixps=1, Delay_time=3.000, Curwin=2
Def     fieldscur=AEHIOQTWKNMbcdfgjplrsuvyzX
        winflags=64824, sortindx=10, maxtasks=0
        summclr=4, msgsclr=5, headclr=6, taskclr=1
Job     fieldscur=ABcefgjlrstuvyzMKNHIWOPQDX
        winflags=64824, sortindx=0, maxtasks=0
        summclr=6, msgsclr=6, headclr=7, taskclr=6
Mem     fieldscur=ANOPQRSTUVbcdefgjlmyzWHIKX
        winflags=64824, sortindx=13, maxtasks=0
        summclr=5, msgsclr=5, headclr=4, taskclr=4
Usr     fieldscur=ABDECGfhijlopqrstuvyzMKNWX
        winflags=62776, sortindx=4, maxtasks=0
        summclr=3, msgsclr=3, headclr=2, taskclr=3


Posted by æc♥ | Permanent Link

August 17

drawing blog

I really like Drawn!, the illustration blog. It has links to REALLY cool sites from all over the world.
Drawn! site is a multi-author blog devoted to illustration, art, cartooning and drawing. Its purpose is to inspire creativity by sharing links and resources.
I have been reorganizing (or re-factoring as I'm told is the proper term) my program for the last evening or so. Pointers are slowly slowly sinking in and Ive learnt a bunch about working with memory so these are good things. I had to drop my ncurses research to do this so I guess this weekend I will try to pick that back up again.

All this studying and general interest in code has left me way out of practise in bzflag. This used bother me, as I am very competitive and like to do well but I fear my best days are behind me :-) Even the newer players lay a beating on me now. So I have resigned myself to taking little 5 min playing breaks to bust up the monotony of staring at emacs and to say hi to friends in the game. I might change my nick to easy-kill :-)

Someone posted a question about changing the ssh port (default 22) on his linux server over at Ars Technica. The number of replies and the number of views was interesting.

Posted by æc♥ | Permanent Link

August 11

macros

I should just make this an emacs blog and not bother writing about my comings and goings, but I can't help it, it seems every day I find some new little trick it can do.

I discovered tonight how to make a macro, you turn on the record macro mode C-x ( and then do a bunch of stuff, in my case, I split some windows, re-sized them, split a few more, and opened a few files. Then i hit C-x ) to close the macro, gave it a name and saved it in my ~/.emacs file.

Now I can call it up with M-x macro-name and just like that it repeats everything I had done. Who would have thought? Emacs can even do macros :-)

BeOS had a be/kernel/OS.h file with some rather humorous function calls:
int32 is_computer_on(void) Returns 1 if the computer is on. If the computer isn't on, the value returned by this function is undefined.

double is_computer_on_fire(void) Returns the temperature of the motherboard if the computer is currently on fire. If the computer isn't on fire, the function returns some other value.

Posted by æc♥ | Permanent Link

August 07

cursing curses

I have been working on a small program for a while now and have got most of the C stuff done, and even managed to use zlib which was surprisingly straightforward to figure out. Basically you just have to read /usr/include/zlib.h.

The next step involves ncurses which is a lot harder (for me at least) The problem as I see it is that one should really become familiar with a library before starting a program. Writing a bunch of stuff in C and then trying to retrofit it with ncurses seems backwards to me.

Anyway for now I have to shelve my program and do a bunch of ncurses trial and error type programs and read a few tutorials.

Posted by æc♥ | Permanent Link

August 04

push the button

   I bought the new Chemical Brothers album Push The Button this week and absolutely love it. The music is a varied as ever but some of it much more melodic than I have ever heard from CB, particularly Hold Tight London and Close Your Eyes jump out at you right away.

Of course I was unable to rip it to mp3's on Sarah's Windows XP computer because of the new Sony copy protection technology but worse was that even playing on XP opens a proprietary music play installed on the CD that quickly racks up the CPU usage to 80%!

I took it upstairs and ripped it to mp3's using Grip which had no troubles at all with copy protection crap, which by the way, is legal in Canada. I bought it, I am allowed to copy to my computer.

In other news, There were more injuries yesterday from cars on the 401 highway crashing into each other slowing down to watch the Air France jet on fire than people actually injured in the plane crash.

Posted by æc♥ | Permanent Link

August 02

Air France

My Mom called me with great news about that plane crash
All 309 people aboard a jet that overshot a runway and burst into flames at Pearson International Airport Tuesday survived the ordeal, according to fire officials on the scene.
link.

I am not sure that describing a plane skidding off the runway and bursting into flames as great news would be entirely accurate however Mom was right, thankfully it is in a way a good news story and although this city has collectively breathed a sigh of relief, no one is happier I am sure than the passengers and crew.

Posted by æc♥ | Permanent Link