Friday, October 10, 2008

How to boot from USB in xVM VirtualBox


I've looked around the internet a lot and mostly didn't find any working solution apart from trying to make an image/virtualDisk from a raw physical disk (USB). I was basically experimenting with writing simple bootloaders in assembly language, and wanted to rapidly test and make changes to the code without rebooting my system again and again to try booting. The obvious solution is to use a Virtualization tool like VMWare or xVM VirtualBox by Sun (the latter is free), but the trouble is that neither of them support booting from pen-drives and I have long forgotten the existence of floppy drives, and have thus no way of directly writing to a disk and virtual booting straight-away, without creating an new image of the disk each time I make changes to it. So I decided to write to my USB pen-drive directly and try booting from it. It works when I boot the entire computer with it, but VMWare and VirtualBox do not have the option of booting from a USB device.

So messing around xVM VirtualBox 2.0.2 36488 for Windows yesterday, I was pretty surprised to find my USB Pen-Drive listed under the field of Floppies! That is,

a) Create a new Virtual "Machine"
b) Click on the "Floppy" link in the main screen (right panel)
c) Enable "Mount Floppy Drive", and from the drop-down list in "Host Floppy Device", select your USB drive's Drive Letter (haven't tried it in Linux, I guess you'll have to select the correct device like /dev/sdxx)

That's it. Try starting the Virtual Machine now.

Its quite wierd, and I'm still wondering why my USB drive gets listed under floppy, but it works for me! Neither VMWare Workstation, nor xVM VirtualBox permit booting directly from the USB otherwise.

Cheers
Shashank

Sunday, October 05, 2008

Of the Elusive Breakfast Syndrome


I really have a problem, or rather had one. It is an uninteresting topic for anyone but me, but I haven't managed to have breakfast on any weekend this ENTIRE semester i.e. in the past 4 months. I have never managed to wake up before the closing hours (9 am) of the hostel mess (often I directly wake up for evening snacks on weekends, let alone breakfast and lunch). I have even attempted, several times, to stay awake the entire night, till the golden moment when the clock struck 6:45 am, and each time some odd conspiracy of Nature conspired against me. Once I watched a movie till 6:35 am, and then pondered over how to pass the intermediate 10 minutes, and then continued pondering as I next regained conciousness at 10:30 am. Then once I managed to sleep off on the floor of my room, beside my door, while trying to open it to leave for the mess, again at 6:35 am.

Today, however, I grabbed Fate by the wrist and bent it to my will! I left my room at 6:30 am, as I was sure I wouldn't manage to survive any longer after watching Lord of the Rings III (for the 5th time), and also figured that I probably wouldn't sleep off in the corridor beside the mess, though I'm not sure I'd put that past my capabilities. Anyhow, here I was - unshaven, unkempt, with a haggardly-desperate look, sitting outside the stairs of the mess waiting for it to open. Then I tried walking around the area a bit, and I discovered I didn't like the cold air too much, and again returned to my patient look-out post. And then, the Gates of Destiny opened! And I had wonderful breakfast, and Tea! One of the greatest battles of will and destiny in my life had been fought, and I had emerged the victor - a fed victor at that. :-)

Shashank
PS: I haven't gone loopy. Food breaks the best of men, I'm just a mere, humble mortal.

Saturday, October 04, 2008

DMOZ Local Directories and BatchDMake


Today morning I finally settled in to perform a long-pending weekend house-cleaning job, except that the cleaning work was electronic, i.e. my computer. It is a common scenario to find your files so badly scattered around the hard-disk, inspite of some organization scheme that we all implement. Years ago, I saw a nice scheme Roshan, a friend of mine, implemented. He created directories and sub-directories based on topics and categories, like "Science", "Computers", etc, and Science would contain "Physics", "Chemistry" ... while Computers would contain "Programming", "Internet" and so on. It was a complete hierarchial structure, and I've been using it on my systems too ever since I saw it there.

But, its hard to maintain my directory, as creating such a structure is a rather tough task. You could either create an entire directory structure before-hand, with empty folders waiting to be filled, or you could create new folders as and when you require, in the correct category of course. The latter option obviously seems more efficient, as you don't have an empty mammoth directory structure, but a dynamic and to-your-taste structure. But after several years of trying out both, I have found that the first approach is much better. When you are, say, saving a file from the Internet, you often don't have the patience to ponder over the hierarchial relationship between "Geese Hunting" and "Duck Hunting", and whether you should create a new directory for each, or just club them into one single directory called "Bird Hunting". This inherent impatience of people when using files, as understandable and natural it is, is THE reason why files are scattered and chaotic. Thus I have concluded that people need an existing order to follow, that is as extensive and accomodating as it can be, but also flexible in order to allow people to delete and modify and create new topics and directories.

With this long discourse on the philosophy of file management in mind, I sat about thinking! :-D

This is what I came up with: Why not use an existing MASSIVE topic-wise directory structure, which has been developed and nurtured for about a decade by tens of thousands of people across the world? That directory structure is the DMOZ Open Directory Project (http://www.dmoz.org) by the Mozilla Foundation (of Firefox fame). It forms the backbone of Google Directory and several other places on the internet, and is a collaborative and open effort at building efficient web directories. My interest, however, is not in the links to websites that is provides, but the topic-based organizational structure. And as luck has it, they offer a downloadable plain-text file containing the ENTIRE folder structure. Perfect. Its available at:
http://rdf.dmoz.org/rdf/categories.txt (57.4 MB)

Then I wrote a simple tool in Java called "BatchDMake", which will read a given text-file line-by-line and create the folders listed in it. Each folder path is listed in a separate line. For example, this is from the DMOZ dump:

Arts
Arts/Movies
Arts/Music
Computers
Computers/Artificial Intelligence
Computers/Games


The syntax for operating it is:

java BatchDMake [filename] [root folder]

The filename parameter is obvious, the root folder is the folder name relative to the current working directory in which it should create the folders listed in the text file. For e.g. using the downloaded DMOZ categories file:

java BatchDMake categories.txt dmozRoot

The source code for BatchDMake is available here, and the executable .class file is here.

I just created the ENTIRE folder structure of DMOZ on my hard-disk, it has about 770,000 directories & sub directories. A lot of them are useless ones, so I'll go about pruning the tree to come up with the most useful structure for normal users. Will post that one soon. In the meanwhile, you could try the DMOZ structure and use BatchDMake to create it on your system!

Cheers!
Shashank
PS: I even found the place I'm currently in!
root\Regional\Asia\India\Tamil_Nadu\Districts\Vellore
This is like exploring an uncharted world in your hard-disk! :-P

Thursday, October 02, 2008

Software Freedom Week 08 - Phew!


Note: This is a blog post I'd written in a state of half-sleep at 3:38 AM, 27th September, 2008. I slept off before managing to send it and forgot all about it, so here it is. :-)

Sitting at 3:38 AM, while browsing the Internet for some interesting articles, I found I had received a new mail. Looking into my Inbox, I discovered that the mail had been entered into my "Friend Networks" label, and it turned out to be an insistent invite (he had sent it thrice) from a friend in a social networking site, and the invite reads: "You have been invited by ____ to join the community: I LOVE FRUITS". Need I ask, "Huh?"

This was meant to be a blog on the "Software Freedom Week", which more or less got concluded today. Technically, it finishes tomorrow, but the only event we're having tomorrow is the passive collection of Abstracts for the Product Engineering contest and a party! So no crazy real-world events that require fighting with the "bureaucrazy" and stuff. The last one week has been a very hectic period, which reminded me of the days of our "IEEE Resonance", the two-day National Level Technical Fest, held in March earlier this year. That event was gigantic and I, as one of the 3 main organizers, probably lost several years of my lifespan due to the stress and workload that went into organizing that event.

This Software Freedom Week was organized together in a VERY short span of time. Really. It sets a sort of personal record, as the only Large Scale event I've organized within a span of 9 days. The other large events have me and the core team starting work atleast 3 months in advance. The entire idea that we Sun Campus Ambassadors have to organize a Software Freedom Day in our colleges by 27th September became clear only once we had done our Induction & Training programme at Noida from 5th - 8th September.

Our SFW went off pretty well! We managed to conduct several successful installfests, and installed and distributed openSolaris DVDs to atleast 30 folks! The other guys installed some distributions of Linux, like Ubuntu, Fedora and openSUSE. Then our Linux & Unix demos were quite successful with a lot of interested people turning up who managed to get an intro to the basics of the file structure and philosophy of the Unix operating system, as well as some common tools and commands. Our Programming challenge paper was very well appreciated by all the students as being "damn interesting to solve". The biggest success was the "Mobile Application development using NetBeans" workshop which I conducted yesterday evening (26th). The turnout was HUGE and the guys were amazed at the ease of developing MIDlet apps using the Visual Editor. There was a pretty strong request for conducting an advanced session for them soon as they wanted to learn more about this. :-) And just to recall that I myself had been trained at this for the first time 3 weeks ago in Noida!

Organizing large events at a very short notice leads to nightmarish organizational problems, and can easily spin out of control to lead to horrible mis-management and utter chaos. We came close to it during the hiccup that happened on the first day with the venue conflict with another department's research class, and it took us a great effort to continue with full speed throughout the week inspite of the regular, minor-but-painful hiccups that occured. We always managed to solve them somehow, but the fact that they appeared shows that a lot more work could have gone into the planning process. Yet, I do not regret anything, and even though I am so totally physically and mentally exhausted, I can still say that the SFW was one of the most challenging and awesome things I and my friends have attempted. And I enjoyed it and the great response it generated. But now we're planning a FAR larger thing in December. A sort of a Open Source Mega Fest at the top levels.

More soon, I'm too sleepy!

Cheers
Shashank
PS: No technical work has been possible over the past one week
PPS: Metallica released their new album called "Death Magnetic". Most of the songs are just average in my scale. I like "Cyanide" and the intro of "That was just your life". And Kirk Hammet is finally playing guitar solos again. His solos were cut out of the last album: "St. Anger", which was a welcome return to Thrash Metal. In my opinion, all the songs on the St. Anger album sounded like an army of tin-soldiers sprinting over a tin bridge, and a song playing in the distant background. Heh!

Tuesday, September 23, 2008

SFW & WTF ...

Note: The following post is organized into five sections: Boring, Bad, Interesting, Personal, TechNotes. Pick the kind of news that you dig into most!

Boring Stuff:

Although the official date of my appointment as the Campus Ambassador in VIT for Sun Microsystems is August 1st, I officially was handed the reins from September 1st, and real work started off on September 8th, the day I returned from the Sun Induction & Training programme, Noida. The task at hand, the first order of business, was the "Software Freedom Day" that each CA had to organize in their respective colleges and universities and spread awareness about Open Source and impart knowledge etc.

Organizing large scale events at short notice is a rather dangerous thing to do, especially when you have an elephantine "bureaucrazy" ready to thwart every move of yours.

Bad Stuff:

We had a pretty bad false start in our Software Freedom Week where the administration decided to, without fore-warning, re-allocate the venue of our "Inauguration & Intro to Open Source" event to some Embedded Systems class, and we had thus move event to another timing. This was indeed frustrating and embarassing, but we explained the deal to the assembled audience and informed them of the revised schedule.

Interesting Stuff:

We had a great installfest today, and the revised Open Source introductory session. The folks turned up and were real innocent about Linux & Open Source, and we had a nice time explaining to them the difference between Open Source and Freeware, and so on. I probably did get a little emotional about Open Source at one point when a guy asked me, "Why do we need Linux when we have Windows which fulfils all our requirements". Imagine that. Any person reading this who doesn't see this question as absurd, is pretty seriously naive!

We also showed people "Big Buck Bunny", a short animated movie made using Blender, and was a great hit among people. The movie is absolutely hillarious!

Personal Blabberings:

Anyhow, this was Day 2 of the "Software Freedom Week" here at VIT University, and battling new catastrophic problems everyday and nearly ruining events and then miraculously managing to pull off a great show is something that is now something really really very familiar and all-in-a-day's-job occurance for me and my friends. Can't say I really enjoy this kind nerve-wrecking event management anymore -- am quite a veteran now, after 2 years at it; but I have better and newer plans for getting Open Source a greater reach among students out here, instead of just organizing Plain-Jane events like today's. This is the Participation Age, not the age for delivering sessions and telling people how and what to do. More about this unconventional idea in my next blog post!

Tech Notes:

On the other hand, my messing-arounds with my iPod hacks (here) has been getting more productive. I recently got some nice programs of mine running on Rockbox, and have decided I like iPodLinux once again! :-) Nothing wrong with Rockbox as such, but I feel that with iPodLinux having the comfortable "Linux structure", it makes more sense porting the nicer features of Rockbox to Podzilla and maybe in the process bring some things back to Rockbox as well. The other major interesting iPod-related thing is the in-depth reading-up I've been doing about the "Apple Accessory Protocol" (AAP), the set of commands iPods use to communicate and allow the world to control the iPod remotely through the Data Connection Port. This makes the critical part of my iPodMouse project pretty easy! :-)

Cheers!
Shashank

Friday, August 29, 2008

Upgrade to a dial-up!


Well, here it is finally. Internet in my hostel room. And man, is it fast? I rejoiced when my download speed finally managed to reach 10 KBps at 2 in the morning, and average far worse during regular "earthly" hours. Yet, adaptation is the key to survival. After having paid a substantial amount for this wireless datacard (Reliance NetConnect), I am finally on the internet which is a highly liberating experience, regardless of the speed of connection. Hard to describe in words! :-)

I've been messing around a lot with Rockbox, another OS-type thing for an iPod, and was thrilled to see real video files being played on my ancient iPod Mini 2G (4 GB)'s tiny, monochrome screen. Who said that video was the domain of expensive iPod videos only?! Take an iPod nano or something with a color screen, install Rockbox and BANG! you have excellent videos being played, and with capabilities of extending the codec base. I've been trying to get hold of the various components required for compiling for ARM6-processors, which is rather hard to do without a proper source of unrestricted fast internet. Rockbox allows you to write your own "viewers", which are programs that can process specific types of files, like associating .mpeg files with the mpeg-Viewer, .txt files with the text_editor viewer etc. You can also write plugins to provide new applications. Once my development environment for ARM6 (and Rockbox specifically) gets set I can work on some of the interesting stuff I think can be put in. I would rather like some simple HTML viewers, and a Java virtual machine on it. KVM (released by Sun microsystems) does something of that sort, but hasn't been running all that well for me. Infact it has run at all.

Then I also got this idea of controlling my iPod through my PC, maybe write a simple mouse controller program in Rockbox, which can take inputs from the data-cable connecting it to the PC, and therefore permit me to move my real physical mouse of the PC to control the cursor on the iPod screen. This could later be expanded upon to eliminate the PC by writing mouse-drivers in Rockbox and then using a USB mouse and connecting it directly to the iPod via the iPod data-cable. That would make life tonnes easier for using advanced applications in iPodLinux/Rockbox.

Anyhow, more later. I am too busy sitting idle, waiting for "Google.com" to open. (*rolls* eyes).

Shashank

Saturday, August 16, 2008

I had hair...


Don't mistake me. I still have hair, albeit, 8 inches shorter. Farewell my dear long locks. At my prime, I had hair till my shoulder-blades. Now they barely are an inch long. Two and a half years without paying a visit to a barber; feels like I've lost an arm or something. But anyway, why am I boring you with my story of locks lost behind?

I've been studying. No really, I finally have been studying new stuff. Not academic stuff related to what's taught at University (who cares?!) but new interesting stuff. More specifically, I've been enjoying myself by playing around with Mandelbrot sets, Julia sets etc. With the result that I've started manufacturing a sequence of rather spectacular wallpapers by applying various color filters and mapping different parts of the above mentioned sets.

The other things include a compulsary mini-project as a part of our 5th semester curriculum, and we're working on simulation of artificial personality in software bots. You can poke, hit, pat, feed bones etc to an artificial dog and view its responses according to the selected personality, and it will vary over time depending on the past interactions. I'll post on some demos once we have a decent build ready. This time, as it is compulsary and there is a strict deadline, I will finally actually complete something rather than touching it and leaving it to bide time once the interesting parts are done.

Oh, and I finally got iPodLinux installed on my ancient iPod Mini 2G, and it is really great and Awful. Great because it is Linux running on an iPod, and all the cool demos and stuff that can be done with it. Awful because the input method is limited to a dumb touch-wheel, so to input text, I have to circle through a list of alphabets each time. Use it, and you'll know how painful that extra-sensitive touch-wheel is. Another reason it is awful is because it is difficult to program for it as I have to use ARM6-gcc for it. And there is no Java on it. And arm6-gcc is hard to install correctly on my openSUSE machine back at the hostel because I have no internet which effectively makes installing any package with millions and zillions of cross-linking dependencies a nightmare.

Finally, I'm planning to take an internet connection at my hostel room, which will make life "normal" for me again. I have been selected as the Campus Ambassador for Sun Microsystems, which means that I represent Sun in our University, and had to go through a rigorous process of interviews etc. Anyhow, I am supposed to promote Open Source and Sun stuff in our campus, which should be fun I guess. And I get a stipend for it too! :-)

Shashank
PS: The image at the start of the post is from a specific region of a Julia set.