Ah well… I don’t really like articles of this kind too much; but I couldn’t help plumping for this one, for obvious reasons. Stuff and Nonsense, as the Red Queen (was it her?) would say. What the heck, I’m entitled to spout a little nonsense too ;)
Archive for August, 2006
Yes! Yes! It’s a BSD :)
Posted by kovaiputhalvan on August 16, 2006
Posted in Nonsense, stuff | 2 Comments »
Creating variables on the fly in Python
Posted by kovaiputhalvan on August 16, 2006
This is a dirty hack; it is not recommended to be used in “production” code. Also, I lay no claim to the originality of this hack; after I discovered it, a little googling yielded the fact that many other people have had the same brainwave.
This hack works courtesy Python’s exec statement, which allows dynamic execution of Python code; thanks are also due to the string formatting / interpolation operator, %.
#Creating a variable called "new_variable" on the fly varname = "new_variable" value = range(1,10) exec "%s = %s" % (varname, value) print new_variable
Voila!
How the hack works is more or less self-explanatory. A brief look at section 6.14 of the Python reference manual should clear doubts, if any.
I’m using this hack for a “user-friendly” – or should I say user over-friendly – interface to something. I put in the “not recommended for production code” warning because I feel this is an ugly hack. Why is this an ugly hack? I don’t know! Variables appearing out of thin air all by themselves doesn’t seem right to me! Using a sleight of hand trick to achieve the effect doesn’t seem right either.
Posted in Python, stuff | 2 Comments »
Nightmare
Posted by kovaiputhalvan on August 15, 2006
Yesterday, I paid a visit to Phdcomics. It used to be one of my favourite sites when I was in the Institute with Tree Lined Avenues. I finally got to know the real story behind Mike Slackenerny’s thesis defense.
I woke up with a nightmare today. The nightmare was that my M.Sc thesis defense had gone haywire, the external examiner had trashed my thesis completely, and I needed to do more research to write and defend a thesis. It took me a little time to orient myself, and remember that yes, I had indeed defended my thesis more or less successfully, that no, I wasn’t going back to the Institute as a student. Also that I’d left my student days behind by at least four years.
Maybe it was because of my recent visit to Phdcomics, maybe it was because I heard a scare story about someone who joined the Institute along with me who still hadn’t completed his M.Sc – whatever caused it, the nightmare seemed very real.
Whew!
Posted in Not Worth Reading, Personal | Leave a Comment »
Some Random Crap
Posted by kovaiputhalvan on August 14, 2006
It’s been a reasonably good day. Managed to get quite a bit of work done, actually. No thanks to the fact that there were not too many people around, thanks to the long weekend, and hence there were fewer distractions at work. Can’t celebrate yet, I still have around halfway to go. I’m going to the RTO for my learner’s license on Thursday – hopefully. This time, I bloody well am going to get the license, by hook or crook.
Damn. I need to figure out how to get only the summary of each blog post on the front page. Apparently there is something called a more tag in WP that lets you do this. Need to sit and figure this out sometime soon. Till then, the blog stays the way it is – with large posts obscuring the smaller ones. Oh well, that’s that.
Update:
Sigh… OK, this can be done with a simple change to the template file. But how on earth do I edit the template file? Lemme find out…
Update #2:
Success! more! more! The magic word is more.
Posted in Not Worth Reading | Leave a Comment »
Me and the Monsoon
Posted by kovaiputhalvan on August 14, 2006
This post is more than a little disjointed and pretty badly written. I plan to work on it sometime later; I figured that if I did not post it now, I’d never post it ever. I chose to post it now.
Here’s a little background – Every time I have an argument with my wife, nature fixes it so that I lose. Every Time :) Before I start, I’ll need to do the usual thing – provide a disclaimer. Or two, maybe
This post is an unashamed unabashed plug for Nokia mobile phones. Period.
This post isn’t comprehensive. It details what I remember. Those events are mostly accurate. If you (one of the six involved) come across stuff that I have forgotten or have mangled due to a lapse in my memory, please feel free to correct me. Thanks :)
End disclaimers.
My usual brush with the Monsoon is to fight with the fungi which want to colonise the walls of my rented apartment, thanks to the guy who built it having made his profits by using more sand and less cement. It’s no different this year, but my brush with the monsoon was just a little bit more interesting than it normally would have been. Read the rest of this entry »
Posted in Not Worth Reading, Personal | 3 Comments »
Timeo Danaos et dona ferentis
Posted by kovaiputhalvan on August 10, 2006
Was watching Troy on the TV as I attempted to hack. Interesting movie, that. I have mixed feelings towards the movie – I like it, and I hate it. Someone else seems to have the same opinion, for pretty much the same reasons – so I’ll be lazy and save myself some typing by pointing you, gentle reader, to Timeo Danaos et dona ferentes. Read the rest of this entry »
Posted in Books, Quotes | 3 Comments »
What am I, part deux
Posted by kovaiputhalvan on August 6, 2006
I recently had an interesting conversation with someone who had read my blog. I’d written elsewhere in this blog that I was an atheist.
The conversation went somewhat this way:
Someone: You’re stupid
Me: Why?
Someone: You’d written that you were an atheist
Me: So?
Someone: How do you define an atheist?
Me: Someone who doesn’t believe in the existence of God.
Someone: How do you prove the nonexistence of something?
Me (light dawning): Ahhhhh yes. OK, so I’m an agnostic.
Hmmm. OK, so I don’t believe in God, I don’t care whether God exists or not, I believe that the truth value of any statement regarding the existence/nonexistence of God (other than this one) is unknown and cannot be established; I also believe that the (non)existence of God doesn’t make a difference to anybody’s life. So I guess that makes me an agnostic.
Posted in Personal, Philosophy | 14 Comments »
Assembly in DragonFly
Posted by kovaiputhalvan on August 4, 2006
I posted this on the DragonFly users mailing list ages ago, posting it here for my reference.
I was trying out a simple assembly “Hello World” under DragonFly, and found that one needed to do a little more than “as -o hello.o hello.s; ld -o hello hello.o” to get it to work. So here’s what I did: Read the rest of this entry »
Posted in DragonFly, stuff | 4 Comments »
Firewalled :(
Posted by kovaiputhalvan on August 2, 2006
ARGH!
The administrator minion bots of the Empire that controls my workplace have struck. Ports that allowed one to connect to the outside world have now been blocked by these mindless bots. Which means that I’m now unable to run cvsup to update my DragonFly source tree.
I have to think of other means of updating my DF source tree now. Nothing irritates me more than someone forcing me to think!
Also discovered that most of the posts that I imported from my previous blog have had their formatting mangled horrendously here. I just don’t have the time to go and fix every one of my sixty-four last posts. Moreover, the “visual rich editor” that WP offers doesn’t have a quick-fix “justify right AND left” button.
Grrrr.
Update:
Thanks to the ever helpful and friendly DF mailing list, I am now armed with other ways of updating my DF source tree :) Snapshots of the source are available for download as tarballs, and there’s mercurial. I also discovered that plain vanilla CVS works. I’m going the mercurial way.
Posted in DragonFly, Rant | Leave a Comment »