Skip navigation.

Maudlin ruminations of a mind bit by wanderlust.

And a shaft of light shall sunder the heavens...

Werewolf is coming...

, ,

EDIT AGAIN :

And we're off!




EDIT :




Babbage, the language of the future...

Check this out : http://www.tlc-systems.com/babbage.htm

You have to have reasonable programming knowledge to understand the humor, but most people have that nowadays.

I still haven't stopped laughing.

It just works.

, , , ...

How many times have you seen a program or game or something that you like on the net, downloaded it for your OS (assuming it's free, otherwise bought), installed it, and it just worked? You just followed the instructions, and you were able to use it just like that?

If you're on linux, your answer would be "most of the time", while if you're on windows, the response would probably be "What? There are programs that just work?".

I recently got myself a couple of newish games, which sadly require windows to run. Not too surprised, because that's normal for most games. Because it's been a long time since I actually played something with 3D graphics (except scorched), I decided to install windows on the other hard drive and see things happen.

INSTALL 1 :
I knew that Vista had some tdr issues with nvidia 8 series cards, and it probably wouldn't let me game for more than 3 minutes or so. I was wrong. It didn't let me game past 1 minute, with blank screens every 10 seconds, capped off by a magnificent Blue screen to finish. Scrapped.

INSTALL 2 :
I resigned myself to the fact that I'd have to use XP, which is something I really didn't want to do, because I wanted Vista's security. Using XP meant I wouldn't be able to use the Internet, which wasn't so bad, because I wasn't really planning network gaming anyway. I popped in the XP CD, only to find that I couldn't install without removing Vista, as it was considered a downgrade. Switched back to linux, and used gparted to wipe my second hard drive. Then went back. The rest of the installation went smoothly, but it took ages. Finally, I had an XP system which hopefully hadn't screwed with GRUB enough to let me use Linux as well. It hadn't, so far so good. I install my graphics drivers, sound drivers, bluetooth drivers for my keyboard/mouse, you know the deal. Install the game. Play the game. Crash the game in 15 min, with blackouts every 5. Better, but not quite.

INSTALL 3 :
At this point I realized that there was a page on nvidia's website that had a list of hotfixes and other goodies which ought to be installed if you want to do something on Vista. I also realized that I hadn't realized that before. Go back to linux. Use gparted to get rid of XP. Put Vista DVD in and install. GRUB is still alive. Good. Connect to the internet (I can, in Vista). Go to nvidia, and download all the drivers. Go to microsoft.com and get all the hotfixes. Pass WGA, which for some reason takes ages on my connection. Install everything, one by one. Go back to Windows Update, and get what I've missed. Restart. Blue Screen. Poweroff.

INSTALL 4 :
I see now that my XP was not serviced by any of the packs, so I download SP2 in Linux, and have it ready. Wipe the hard drive with gparted again, and reinstall XP. Install SP2. Install Drivers. All of them. Install the game and play. I now get a worst case playtime of < 1min, best case time of 17mins and an average case play time of about 3-4mins. And this is not to mention that the first minute or so is spent on getting into the main menu, and loading a save game (which, half the time I am unable to save because the game crashed previously).

Epilogue :
Rebooted into linux, and decided to stay there some time longer. Keyboard didn't work because My bluetooth was screwed up in one of those installs. Fixed it by reinstalling the drivers 3 or 4 times, and doing some crazy acrobatics with the dongle and the power switches.

Told fedora to yum install wesnoth. It just works.

Why everyone with a computer should consider running linux

It's been a busy life, the last month or so. I've been having test upon test, project upon project, and am still expected with what time I'm supposed to have left. I've started using soft copies of my documents, so things have gotten a bit easier, except if my computer crashes, in which case the situation becomes impossible.

Anyway, I've attached a copy of the article I've sent to my college magazine. It's titled "Linux and You", and it's my first attempt at spreading the word. Try reading it (It's only about 2 pages long), and recommend it to someone. Anyone. Whatever.

linux_and_you.pdf

Doing the article up was very fun LaTeX practice. I don't get time even for that any more.

return 0

,

College has started again. Damn. All the good ideas come now (the best time is during the exams), but there's no time. When I do have the time, I don't have any ideas, and I refuse to post nonsense in order to keep the post count ticking.

So here are some of the things I've been doing :

>>> I found out how to download English Subtitles for most movies, and integrate them with the movie. I can finally watch movies which my friends always told me were good, but I couldn't understand too much.

>>> I installed Qt4 and PyQt4 on my new fedora system, and I'm loving writing programs for them. They look cool.

>>> They look even better on my 22" screen. So do the movies.

>>> My speaker system is also doing justice to the money I paid for it.

>>> I'm starting to write a few (fairly) technical articles on linux, some of which I hope to be able to put up here.

>>> I've lost physics and chemistry, and have had them replaced with More Computer-Sciencey subjects. I'll get to that later.

>>> I'm trying to decide upon a phone to get. Something better comes out every week.

>>> I'm getting pretty darned good at using linux, especially the command line. I expect that now, I fall under the category of 'power user', and border on expert (maybe in the next few years). I think I could live by the command line, with no gui, except for a pdf reader, which I hope to correct.

>>> Did I mention that I love my 22"?

>>> I finally watched the Illusionist, a movie I've been dying to see since I saw the trailers a little less than a year ago. It was amazing. Awesome movie. I am yet to see 'The Prestige', which they say is better.

>>> Like so many, I'm waiting for Heroes Season 2 in September.

>>> Numb3rs Season 3 screens at 10-11 at night, a timeslot that is distinctly not primetime, and unfortunately I can bring myself to stay awake that long. *sigh*, I'll have to watch reruns.

>>> Don't get me started on Harry Potter. Just don't.

That's all I can think of at this time of night. More to come when I actually have time.

Vista verdict : I'd almost forgotten why I hated Windows.

,

I've beem playing around with my new rig this week (which you can find in spirit here). It's one hell of a machine if I say so myself, as you would know if you were able to decode those specifications.

Like all good computer users, the first thing I did after putting it together was to install Windows, in this case, Vista. Don't get me wrong, as far as I can see, Vista is great. Although it's not a step up for me from linux on the productivity scale (Something I plan to rectify presently), it's definitely a step up graphically from ratpoison.

But my main problem with windows, is drivers. It's probably not windows' fault, but I'll be unforgiving. The computer goes blank every 3 minutes or so, which becomes for frequent if you play a video. The reason for this is the nVidia Driver, or so I'm told. The fact that nobody with an 8 series graphics card from nVidia can run Vista properly, despite the fact that they were Vista Ready (TM), has even prompted a law suit. Until then, we've just got to keep downloading the drivers. Blech.

Another little something I found, was that IE7 is actually quite fast. I made this observation as I can't user Opera (ntlmaps isn't working on windows), and I was pleasantly surprised that IE7 beats Firefox hands down, almost all the time. I know it's because its libs are already loaded, but still...

And then there's Vista Media Center. This is awesome, even though it doesn't work for me for more than a few minutes at a time (see bug above). It's the perfect way to run kiosk mode at a party. It looks awesome, and presents a fairly easy way to get to all your media, be it video, music or pictures. However it only plays non-windows media (read : divx) if you've installed ffdshow, which, as you would suppose, is a pain.

The visual effects are quite good. They execute seamlessly, although that's probably just my roaring hardware talking.

My Vista Experience Index Rating is 5.3, putting me in the Highest range for all hardware :



This is only a minor comfort, as if the drivers don't work, it's as good as a coaster.

In the meanwhile, I'm off to do the second thing that all good computer users do -- Use IE to download linux ISOs, and install them. I'll be back for the games though, which currently don't work, becuase of the driver problem.

During this post, my graphics driver crashed 27 times.

The Towers of Hanoi, recursion, and the end of the world.

These are the towers of Hanoi :



The story goes that a bunch of monks in Vietnam were given 3 pegs and 64 golden discs, and had to move all of them from one peg to another, using the third as storage. However, they could never place a larger disc on top of a smaller one. The day they finished their task would be the end of the world, says the legend. That's quite ok with the most of us though, because if we assume that the monks can move one disc in one second, we can show that it will take them 584542046.09062564 millenia or thereabouts to finish the task. So unless they started a reeeally long time ago, the end of the world isn't going to happen any time soon. But that's assuming they know how to go about doing it. We can do better.

Recursion is a great tool for the lazy programmer. If it is easy to state the problem at hand in terms of the problem itself, then recursion is the way forward. Consider, that to solve the problem of hanoi,

-- We want to move all the discs from one peg to another (source to destination, with the other being called storage).
-- We can do this as follows :
-- If there are no discs on a peg, do nothing.
-- Move all but the last disc from the source peg to the storage peg using the destination as storage.
-- Move the last peg from source to destination.
-- Move all the discs you moved earlier to the destination, now that the largest disc is there.

Using this description, we can write :
def transfer(discs, source, destination, storage) :
    # If there is nothing to transfer, do nothing.
    if discs == 0 :
        return

    # Transfer all but the last disc to the temporary storage location
    transfer(discs - 1, source, storage, destination)

    # Transfer the last disc to the destination
    print "Moving disc %d from %s to %s" % (discs, source, destination)

    # Transfer all but the last disc from the temporary storage to the
    # destination
    transfer(discs - 1, storage, destination, source)

def main() :
    n = int(raw_input("Enter the number of discs : "))
    source = 'A'
    destination = 'B'
    storage = 'C'
    transfer(n, source, destination, storage)


Note that we start the process for n discs by calling,

transfer(n, source, destination, storage)


For 3, 4 & 5 discs, the moves are as follows :

(sykora@nexus)(pts/3 | 0 job(s))(Thursday June 14, 2007 : 22:08:54)
(%:python)- python2.5 hanoi.py
Enter the number of discs : 3
Moving disc 1 from A to B
Moving disc 2 from A to C
Moving disc 1 from B to C
Moving disc 3 from A to B
Moving disc 1 from C to A
Moving disc 2 from C to B
Moving disc 1 from A to B

Enter the number of discs : 4
Moving disc 1 from A to C
Moving disc 2 from A to B
Moving disc 1 from C to B
Moving disc 3 from A to C
Moving disc 1 from B to A
Moving disc 2 from B to C
Moving disc 1 from A to C
Moving disc 4 from A to B
Moving disc 1 from C to B
Moving disc 2 from C to A
Moving disc 1 from B to A
Moving disc 3 from C to B
Moving disc 1 from A to C
Moving disc 2 from A to B
Moving disc 1 from C to B

Enter the number of discs : 5
Moving disc 1 from A to B
Moving disc 2 from A to C
Moving disc 1 from B to C
Moving disc 3 from A to B
Moving disc 1 from C to A
Moving disc 2 from C to B
Moving disc 1 from A to B
Moving disc 4 from A to C
Moving disc 1 from B to C
Moving disc 2 from B to A
Moving disc 1 from C to A
Moving disc 3 from B to C
Moving disc 1 from A to B
Moving disc 2 from A to C
Moving disc 1 from B to C
Moving disc 5 from A to B
Moving disc 1 from C to A
Moving disc 2 from C to B
Moving disc 1 from A to B
Moving disc 3 from C to A
Moving disc 1 from B to C
Moving disc 2 from B to A
Moving disc 1 from C to A
Moving disc 4 from C to B
Moving disc 1 from A to B
Moving disc 2 from A to C
Moving disc 1 from B to C
Moving disc 3 from A to B
Moving disc 1 from C to A
Moving disc 2 from C to B
Moving disc 1 from A to B


Forgetting for the moment about the actual moves, and concentrating on the number of moves, we find :
3 : 7
4 : 15
5 : 31
...


Notice a pattern? For 64 discs, the number of steps would be 2**64 - 1, which is 18446744073709551615. Taking this as a number of seconds we get the above mentioned number of millenia if the monks moved a disc a second.

What's the use? I'm told that a major use of this problem is to evalutate the pyschological stability of patients. Yes, that's apart from predicting the end of the world, and teaching recursion.

Playing the 'Guess my number' game recursively

,

This has probably occurred to a lot of you, but I only just realized it, after reading a book on Haskell. I'd never thought of it before.

Most programmers have written their own version of the 'Guess my number' game -- You know, it picks a number, you guess, it says if you're too high or too low, that kind of thing.

What we usually do is this :

def guess(n) :
    while True :
        x = int(raw_input('Enter a number : '))
        if x < n :
            print 'You're too low.'
        if x > n :
            print 'You're too high.'
        if x == n :
            print 'You're absolutely right.'
            return


I'd never realized that it could be done recursively, although it looks pretty obvious. No, it doesn't offer any performance boosts, and no, it doesn't make it easier to read. It's just something different.

def guess(n) :
    x = int(raw_input('Enter a number : '))
    if x < n :
        print 'You're too low.'
        guess(n)
        return
    if x > n :
        print 'You're too high.'
        guess(n)
        return
    if x == n :
        print 'You're absolutely right.'
        return


The usefulness of recursion is not perhaps as apparrent in this case as it usually is, but still...

Java, anyone?

, , , ...

I found this awesome site, which has a number of cool number theoretic projects such as the ECM Factorization Algorithm. The only problem is, the source code for the applet is in java, something I'm not prepared to grapple with yet. If anyone has any expertise with Java Applets, can they please go through it (no mean task), and tell me what the general algorithm is, without the applet part.

There's only one problem - It's 9522 lines long :|

In the meantime, I've been working on a python module for mathematical functions that are a bit higher than the standard library. They're not very fast, as they're written in python, but I'm trying to optimize them as much as possible. One upset I found was that the traditional python idiom for adding large strings : ''.join(huge_list) vs string += string : Is actually losing relevance. Of course I didn't test every possible contingency, but for smaller strings, string addition is faster, while for larger strings, the join idiom is faster.

I also found that most linux distributions come with a console command factor, which outputs the prime factors of a given number. Although it's pretty fast, its algorithm is still fairly primitive.

I'll put my math module (which I've tentatively called imath :smile: ) up when I've completed a decent amount of it. It's coming out quite well, actually.

Now, back to 9522 lines of java... :|

The Aftermath

, , ,

My exams are over. I did well in almost all of them, except for Electrical Engineering. Blech.

Anyway, now I'm int he market for a new PC, so if any of you have some blockbuster ideas about that, please drop me a line. One specific worry I have is that a particular motherboard that I have been after for some time...simply isn't available. I can't find it anywhere. (In case you're wondering, it's GA-965P-DQ6. There, are you happy now?)

My college reopens on the fourth of july, prosaic for the freedom it gives me. </sarcasm>

On the happier side, I'm back to doing the things I like, like Python and sleeping. I may even get my own webspace. That'll be cool.
Download Opera, the fastest and most secure browser
December 2009
S M T W T F S
November 2009January 2010
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31