Monday, June 1, 2009

99 Design patterns on the wall

Found this on a web site that contain programs for singing (couting, printlning, Console.Outing...) "99 bottles of beer on the wall" in many (manier than I knew existed) programming languages.
It demonstrates the true power of enterprise-ish programming: Take a simple concept and make it robust by harnessing the power of design patterns, modular degin, defensive programming, etc...
(Only found 1 design pattern I recognize - Observer - but perhaps a savvier programmer would spot a few extra.

Slax - linux on a key

A few days ago I had to take out my main hard disk to be replaced. I was terrified with the thought of being left out without an operable computer. I wanted to find something that will leave me with some web access and help me prepare to computer set up the operating systems of choice when i get back a replacement hard drive.
After some googling, and through the live cd list I got myself introduced to Slax - a linux you can install as a live cd, or on a USB stick, and to do almost anything with.
I'll begin this short review with the conclusion - It's good! I recommend anyone making himself a ready to use copy of Slax to be used in the time of need.

I'll go through with how I installed and ran Slax. Of course it might be different in your environment. I wanted to install Slax on a USB stick, as I always have bad expirience with fucked up CD medias, and I hate moving parts in my computer. I leave the to my bicycle.

Installation
My installation process began from Windows XP. I downloaded slax as a tar file from http://www.slax.org/get_slax.php. The tar file (which is something like a zip archive file) is completely identical in its contents to the ISO image, which is simply easier to to be write to a CD.
I connected a small 500Mb usb stick which Justin left here a year ago, muahaha slax basic installation is about 250mb., and formatted it. Then i simply untarred the tar file using 7zip (which is btw ugly as hell but works like the devil) to the root of the fresh usb.
The Usb drive was then formatted by running /slax/boot/bootinst.bat on the disk. Why not every distribution provides it? So much better than CDs.
Slax supports what it calls Modules, which are small packages of software, which can be added to the Slax version you make and be part of it when it loads, or be downloaded and added when slax runs. I chose to add "Firefox 3.0.10 + Flash 10 + JRE 6u13", and "Transmission" - a bit torrent client. To add packages to be loaded as part of Slax you simply copy them to /slax/modules on your disk. Beautifuly simple, and that's it.

Booting
I never tried to but from a Usb drive in my computer, but i knew the BIOS was suppose to support it (Award bios of such and such version). It has a nice feature to open a "Boot from..." menu when it loads by hitting F12. I did it, and then tried all the options - "USB-FDD", "USB-HD", "USB-CD". Nada, Zilch. I entered the Bios setup and started poking at things. Then I stumble upon something like "Generic Usb flash drive" as part of the hard disks list! WTF? I also disabled USB keyboard as some post said it might help.
Well, booted again and chose "Hard disk" on the boot menu, and viola! there it is! listed with my other non-too-solid-state disks!
Later on i discovered that i can boot to it with USB keyboard enabled, but only sometimes. First time i can't boot to usb as described, and then on the boot menu i ctrl-alt-del, and on the second time it's there. Strangeness, but one that doesn't bother me too much. It will if i ever wanted to permenently booth to a usb disk.
Anyway, then Slax starts to boot, printing out all kind of nice kernels and daemons message, and opens KDE, its window manager. And i think that calls for another header:

Running
Well, Slax started, automatically detected my hardware: Network, sound card, dvd drive. Sweet. It also recognized all my hard disks (i did it before disconnected on of them), and automatically mounted them so i can access them (you can see them under "Storage Media" in Konqueror - the File manager/ default web browser).
Later on i managed to browse the interweb, burn a cd*, rsize the hard disks partitions with the installed GParted.
It feels really fast and stable compared to windows and Ubuntu (which i later installed, and so far i have a less positive experience with), and the modules are simple to use and install. Makes me think of installing it for a more permenent use, or trying out Slackware which it is based on.

So, get some slax today.

*CD burning using k3b - It gives an error message when trying to burn a cd image on a DVD media. For it to work (for example, buring Ubuntu iso image on a dvd instead of on a cd), choose from the menu "Tools/Burn DVD Iso Image..." and then it will treat the image right. Thank god i had a web browser working to find that out.

Stupid Idea of the Day (SIOTD): Backup flying balloons

There's no need to stress the importance of off-site backup. Perhaps one of the blockers for the wide implementation of that is the speed. But I think, that backup simply isn't cool enough.
I propose: Backup by wireless equipped flying balloons!
The balloons will have routes going above houses. Computer software in those houses will determine the presence of the Wireless Flying back up device ("Look mommy, a balloon!"), connect to it, and send the data waiting to be backed up.
Similar to an old-school milkman bringing bottles door to door. Only it's taking, and not bringing. And data, not milk. And roof to roof.

My current Internet upload speed is 128kbps. On 802.11g wireless connection the maximum speed is 54mbps - about 420 times faster. That means that the balloon will have to stay over my roof only 1/420 of the entire day to achieve the backup quota per day i currently have over the internet,. This is about 3 and half minutes! But of course, we can program the balloon stay as long as needed, or the get along to other friends if you're wasting to much if it time.

Ok, i think i wasted enough of your time.

One last thing: Peer to Balloon to Peer file sharing!