Tuesday, June 03, 2008

Saturday, May 24, 2008

Programming is pain (sometimes)

Last night I went to bed completely frustrated. I had spent probably 6 hours staring and poking at a piece of code and thinking what on earth could be wrong with it. It seemed functionally identical to the code I had been using as a guide, yet it didn't work. It didn't do anything - generate error messages, any messages at all - it just got silently ignored by the framework. Why, why, why, is all I could think about before going to bed.

But what I've learned and seen reinforced over and over again is - if you get completely stuck, step away from the problem for a while. Take a nap or a shower or watch a movie or do something to take your conscious mind away from it. Sure enough, when I woke up and went back at it, less than 1 hour in I spotted the discrepancy. I had a function included in a class definition, while my example code had the function outside the class. So I took it outside and hey presto it worked perfectly.

It still sucked though to have to go through all that frustration.

projectM - Finally audio visualizations for Amarok

The one area where my trusty WinAmp had Amarok licked was visualizations (although Amarok outshines it and nearly everything else I've tried in most every audio library category.)

Enter projectM :

projectM is an LGPL'ed reimplementation of Milkdrop under OpenGL. All projectM requires is a video card with 3D acceleration and your favorite music.

FINALLY I could get trippy fullscreen milkdrop visualizations. I talked about how I pulled libvisual-projectm from Debian lenny here. The two gotchas I had with getting the libvisual-projectm plugin to work with Amarok are:

  1. The config.inp file projectM drops in your home points to fonts from ttf-bitstream-vera - Vera.ttf and VeraMono.ttf. If you don't have these fonts installed then all you will see when enabling the plugin under Amarok is a brief projectM window flash and then disappear. You can get these fonts in debian by installing the ttf-bitstream-vera package. In theory you should be able to modify config.inp to point to whatever fonts you want but this runs into the second issue:
  2. Currently libvisual-projectm appears to ignore some parts of config.inp I got it to set directives for Preset Duration but it ignores other directives like Window Width and Fullscreen and FPS.
No biggie, but it is kind of irritating to have to resize the vis window to 640x480 and then right click in, whenever I want fullscreen visualizations. But milkdrop is so worth it. Maybe these issues will be resolved with the 1.1 release of projectM which I'm soon to build and install.

Friday, May 23, 2008

Great moments in Views 2 coding history

After scrabbling through source files and scrutinizing tantalizing yet incomplete docs, I finally got Views 2 to disdainfully acknowledge that yes, I was in fact a views style plugin.


Wednesday, May 21, 2008

MAN U 6 - CHELSEA 5 PK

To quote Vincent Vega, now if you'll excuse me I'm going to go home and have a heart attack.

Saturday, May 10, 2008

Getting fresh meat for Debian Etch (and solving the Dynamic MMap ran out of room problem)

Oddly enough the I don't recall ever installing anything from the Debian testing repository so far, but an opportunity presented itself when I discovered projectM. Getting projectM to work in Amarok is another story but for now, just the details of the pull from the testing repository:

1. SOP - Just add deb http://ftp.debian.org/debian/ testing main non-free contrib to sources.list in /etc/apt. I also added deb-src http://ftp.debian.org/debian/ testing main non-free contrib which probably contributed to the problems I had later.

2. Run apt-get update. Processed and downloaded the repository packages' metadata fine, until it ran into:

E: Dynamic MMap ran out of room
E: Error occured while processing sqlrelay-sqlite (NewPackage)
E: Problem with MergeList /var/lib/apt/lists/ftp.us.d.........contrib_binary-i386_Packages
E: The package lists or status file could not be parsed or opened.

So I googled the error and found a partial solution at the cached version of http://jaqque.sbih.org/kplug/apt-pinning.html:

You may find that you receive an error like the following:


E: Dynamic MMap ran out of room
E: Error occured while processing sqlrelay-sqlite (NewPackage)
E: Problem with MergeList /var/lib/apt/lists/ftp.us.debian.org_debian_dists_woody_contrib_binary-i386_Packages
E: The package lists or status file could not be parsed or opened.

This is caused because apt's cache is too small to handle all of the packages that are included with stable, testing, and unstable. This is also very easy to fix. Add the following line to /etc/apt/apt.conf

APT::Cache-Limit "8388608";

Thanks to R (Chandra) Chandras for pointing out this problem

Now it turns out in my Etch there is no apt.conf...there is an apt.conf.d directory with two conf files containing directives. So I followed the pattern, named mine 80aptcache.conf and added the CacheLimit directive above. However I had to set it to some insane high value - 200000000 (I suspect because of including the src packages) to finally get apt-get update working. But it did work and I got a the 1.01 version of libvisual-projectm. How I got that to work with Amarok is another post for another day.

Thursday, May 08, 2008

Setting up sudo

su and sudo don't come setup out of the box with Debian Etch (for good reasons I guess) so I had to set it up myself. The way I want su and sudo to work is:

Let me run any command as root, but only when I supply the root password
Always prompt me to supply the root password. This is different from the default sudo behaviour.

The example sudoers files I dug up on the net were complex, but didn't really answer my query about how to run it as described above so after some digging and head-scratching this is the sudoers file I came up with (you only edit sudoers with the visudo command):

Defaults env_reset,runaspw,timestamp_timeout=0

# User privilege specification
root ALL=(ALL) ALL
myuser ALL=(root) ALL

The syntax for each line in sudoers is:
initialuser network = (targetuser) commands
The initialuser is the logged-in user who will be sudo'ing to the targetuser. In this case it's a user called myuser so replace that with the user you login as. By specifying ALL you're allowing the user to sudo on any network interface currently active. (root) means you want to run as the root user and ALL means you can run any command as root.

Thre are two important additions to the Defaults entry. runaspw indicates that you want to be prompted for the targetuser's password, not your own. timestamp_timeout=0 means that everytime you sudo you will have to provide the password; otherwise you will be allowed for a certain time to perform su without requiring the password prompt.

For a single machine with mostly a single user this is a useful sudoers setup. If I feel the need to add anything more useful I'll post it.

Links:
http://www.gratisoft.us/sudo/man/sudoers.html man page for sudoers
http://www.sudo.ws/sudo/sample.sudoers Example sudoers file

Saturday, May 03, 2008

Happiness is DIY computing



Finally exams are over...what an ordeal. I'll have to do over Combinatorics in the summer or next year. It's a really interesting course but I didn't put nearly enough work into in this semester to pass.

So, de-stressing now, I got to tinkering with X-MAME. I finally got it up to it's proper performance by using the OpenGL mode of the xmame-x11 build, instead of the xmame-SDL I was using. I was getting horrible framerates even though the box I'm running on is powerful enough (1 GHz + nvidia GeForce 440MX) to run most everything full throttle.

This experience is one of many that reinforces for me the difference between open-source computing vs. Windows or Apple. It's pure DIY fun. Setting up the Linux box will eventually become my multimedia/retro-gaming machine took a lot of head-scratching and researching on the web and experimenting, but I have got it tweaked perfectly to the point where it's a lot better that it would be under Windows. Every time I look for an open-source alternative to a piece of Windows software, like a video player - I've rediscovered the same principle - it takes more time to tweak and setup properly FOSS software, but in the end it will have way more technical capability than the Windows variants.

So if you just love fiddling and digging into computers, FOSS is the only way to go.

Wednesday, April 23, 2008

SoC 2008 is on

This year I'll again be participating in Google's Summer of Code program and again with the Drupal org. My mentor will be Gordon Heydon. My project is adding output for microformats and RDF and JSON to Views, so content on a site can be easily exposed to semantic web agents and mashups. I'm really stoked about this project because it's going to be really interesting programming for the Semantic Web and I can envision countless uses for it when it's brought to fruition. I've been wanting to explore the fascinating world of semantic web data for a long time and now I'm going to get paid for it - how cool is that :D

This is my second SoC and just like last year I'm looking forward to meeting all types of brilliant interesting folk. I've always felt that one of the most important bits of SoC, besides the $4500 paycheck and the cert and the prestige (and of course the swag,) is the really cool people you meet on the way. I've already made friends with really brilliant people hanging out on IRC and hope to make more. So props to Google for giving students this fantastic opportunity.

Saturday, April 12, 2008

2 more very different movies



The Last King of Scotland didn't grab me at all. I was hoping to find some insight into Idi "The Butcher of Uganda" Amin's life and some psychological justification for what led this man to slaughter hunderds of thousands of human beings. Instead I got an adventure story starring Nicholas Garrigan as the protagonist and Amin his evil insane foil, with gratuitous sex and gore thrown in. The film doesn't even try explore the ordinary lives of Ugandans during the regime. Every panoramic scene is full of the same tired cliches of Africa - colourful clothing, women singing and men drumming in rural villages, tense unstable soldiers with weapons drawn...I just got tired of it really quickly. I really can't see what got Forest Whittaker Best Actor Oscar - he just put on an African accent and acted just as you would expect some insane African dictator buffon to act.

The Mist didn't win any awards but it was an outstanding film. The story, characters, acting, and special effects were top notch. Easily one of the best films I've seen for a while, probably one of my all-time favourites. The story is just perfectly paced - for most of the film you have no idea what the hell is really happening to the characters, and you share their confusion and fear. The scene where the fire-trucks and police car race by and then some Cold War siren starts blaring a futile warning is just brilliant - this is what would happen in real life you think.

I know I'm partial to sci-fi flicks but this is the second time a critically-acclaimed film
flopped and a lesser-known film ran away with me.

Wednesday, April 09, 2008

Google responds to Yahoo Pipes

I've always thought that Yahoo Pipes was one of the coolest (if not the coolest) web applications I've ever seen. It's no surprise that the big G, owner of quite a few web applications in this category, has responded with it's own data mashup builder - Google Mashup Editor. It's still in limited testing but it will be interesting to see where its similar and where it differs from pipes.

The most likely reason Windows does dumb stuff sometimes

http://blogs.technet.com/robert_hensing/archive/2007/04/04/dep-on-vista-explained.aspx

Let's start with Explorer - on 64bit versions of Vista - by default your shell, Explorer, is a 64bit version of the binary (explorer.exe) and thus it has DEP enabled by default. But as it turns out - we have provided a 32bit version of this binary and many other system binaries in a special folder for you to shoot yourself in the foot with use. Why? For the same reason we do anything seemingly stupid - for backwards compatibility and application compatibility reasons beyond our control. :)
It's a good thing 64bit versions of Vista default to running the 64bit version of Internet Explorer by default right? Oh wait - they don't. What what WHAT!? Why on Earth not?! Well, for the same reason we do anything seemingly stupid - for backwards compatibility and application compatibility reasons beyond our control. :)

This is the 2nd time I'm reading a Microsoft blogger lameting on sacrificing common sense for app compatibility. The first was Raymond Chen http://blogs.msdn.com/oldnewthing/archive/2003/12/23/45481.aspx explaining how MS would rather bend-over-backwards to support older programs that are buggy or using undocument stuff, than have those programs stop working. I understand their point of view - as both Robert Hensing and Raymond Chen note, if you upgraded to the newest version of Windows or IE and then programs you absolutely depend on like Flash crash who would you blame, MS or the app manufacturer? So in an atempt to keep a pristine out-of-box experience, new versions of MS products sometimes leave your head scratching and you thinking "Why on earth did they do that?"

This is also the driving force in the ongoing IE8 saga, which is excellent treated by Joel on Software
http://www.joelonsoftware.com/items/2008/03/17.html This essay is what clued me into to Microsoft's eternal stuggle with backwards compatibility.

Tuesday, April 08, 2008

Elephant Paints Self Portrait

This is freaking unbelievable. I had no idea elephants were so intelligent. This can't be real; can it?

Sunday, April 06, 2008

2 very different movies



I watched two very different movies this week. I honestly can't see what got NCFOM all that critical acclaim including 4 Oscars. The acting was really good but there are logical gaps in the plot and in the overall concept that just aren't filled. I guess you have to be a Cormac Mccarthy fan to enjoy it. It did make me go and borrow Child of God from my library though, just to start getting into McCarthy's work.

Sunshine on the other hand was a movie you could just sit back and enjoy. It constantly left you in awe of how amazing the Sun is; the all-enveloping white light just hypnotizes you, just like it did one of the characters. Sunshine didn't win any major awards and flopped at the box-office but for my plain tastes it was a lot better than NCFOM.

Tuesday, March 18, 2008

Monday, March 17, 2008

Del tha funky homosapien-made in america

Can't believe I slept on this guy for so long.

Man I feel terrible

...missed school today. Not that I can afford too - midterm on Thursday, SoC applications start next week, tons of reading to do for sociolinguistics and Structure of the English Language...*sigh* pop some Vitamin C suck it up and go go go

Wednesday, February 27, 2008

Tsar bomba is serious business

The device offically designated RDS-220, known to its designers as Big Ivan, and nicknamed in the west Tsar Bomba (and referred to as the Big Bomb by Sakharov in his Memoirs [Sakharov 1990]) was the largest nuclear weapon ever constructed or detonated. This three stage weapon was actually a 100 megaton bomb design, but the uranium fusion stage tamper of the tertiary (and possibly the secondary) stage(s) was replaced by one(s) made of lead. This reduced the yield by 50% by eliminating the fast fissioning of the uranium tamper by the fusion neutrons, and eliminated 97% of the fallout (1.5 megatons of fission, instead of about 51.5 Mt), yet still proved the full yield design. The result was the "cleanest" weapon ever tested with 97% of the energy coming from fusion reactions. The effect of this bomb at full yield on global fallout would have been tremendous. It would have increased the world's total fission fallout since the invention of the atomic bomb by 25%.


A shock wave in air was observed at Dickson settlement at 700 km; windowpanes were partially broken to distances of 900 km. All buildings in Severny (both wooden and brick), at a distance of 55 km, were completely destroyed. In districts hundreds of kilometers from ground zero, wooden houses were destroyed, and stone ones lost their roofs, windows and doors; and radio communications were interrupted for almost one hour. The atmospheric disturbance generated by the explosion orbited the earth three times. A gigantic mushroom cloud rose as high as 64 kilometers (210,000 ft).

The Tu-95 was painted with a special white reflective paint to protect it from the thermal radiation of the fireball. The airborne laboratory plane was also covered with the same paint. In clear air, the 50 Mt test was capable in principle of inflicting third degree burns at a distance of up to 100 km.



The area of effectively complete destruction extended to 25 km, and ordinary houses would be subjected to severe damage out to 35 km. The destruction and damage of buildings occurred sporadically at much greater ranges than this due to the effects of atmospheric focusing, an unpredictable but unavoidable phenomenon with very large atmospheric explosions that is capable of generating localized regions of destructive blast pressure at great distances (even exceeding 1000 km).





It is safe to assume that the 100 Mt bomb was a very conservative design - one that pushed no technical envelopes save for size. The two principal reasons for thinking this are the extremely compressed development schedule, and the very high profile of the test


Wonderful...


There was no previously existing military requirement for a 100 megaton weapon - such weapons are virtually useless for military purposes. The Soviet Union had only one delivery system capable of carrying a weapon of this size - a handful of the relatively slow prop-driven Tu-95 bomber - and it was incapable of intercontinental range with a payload this large. A 100 Mt weapon can level urban areas in a zone 60 km wide, cause heavy damage in a zone 100 km across, cause 3rd degree burns in a region 170 km across (only a bit smaller than the width of West Germany) and eye damage to 220 km. Such a weapon can only be used as a means of destroying an entire urban region - a major urban complex including suburbs and even neighboring cities. This scale of destruction is much larger than any discrete urban area in Western Europe. With its dense settlement, use of such a weapon in Europe is equivalent to an attack on a major portion of an entire nation and its population. Fallout from a low altitude or surface burst in central England could produce lethal exposures extending into the Warsaw Pact nations; a similar explosion in West Germany could create lethal fallout as far as the Soviet border. Even in the United States there were only three urban regions at that time large enough to conceivably merit attack with such a weapon - New York, Chicago, and Los Angeles. On any smaller target it would be simple overkill. Even if the Tu-95 were able to reach Chicago, the closest plausible U.S. target, (which is doubtful given the enormous payload, far in excess of normal for long-range missions, and the added drag from the belly bulge required to house the bomb) it would have been detected crossing the North American early warning line and then been over U.S. and Canadian territory for 8 hours - ample time for jet fighters to intercept and shoot it down


This made me feel a little better until I realized they were talking about this with reference to military technology 50 years ago. I wonder how hard it would be to come up with a delivery system for this class of weapon today.

So there you have it, the most powerful weapon of destruction ever built. I can't hide my recent fascination with nuclear weapons of the most murderous kind - it just feeds off the fear I get watching and reading this stuff.

Monday, February 04, 2008

The rotten foundation

All over this island, little knots of intelligent men get together and talk as we are talking now, deploring the systems and methods of education, labour, politics, social services. Then they finish their cigarettes and go off to a film or a football match. There is a lot of fury and indignation on the surface, but no one does anything. It's a pity about Trinidad. She builds on a rotten foundation, introducing new ideas to fool herself and the world that she is progressing.
-Samuel Selvon An Island Is a World

This was written in 1955 and it's true today as it was then, probably more so. Take our nation's roads - the roads and highways are so choked with cars that almost every day there is a fatal accident. So what is a government to do? Well they could invest some of those oil dollars and bring traffic control officers and vehicles up to the required strength so that they can discourage excessive speeders or drunk drivers or any kind of breach of road rules. In the States and other countries we aspire too, you can't drive half-a-mile without seeing a police patrol car. Here you can drive the length of the Solomon Hochoy and Churchill Roosevelt highways and back without seeing a police car. But what do they do...well they bought a blimp. A fucking blimp for US $10 million dollars plus maintenance. So that the police can cruise around and watch the carnage below.

Saturday, January 19, 2008

Surfacing

Wow I haven't written anything since July last year. That's half of a year. What happened - well GSoC was great, fall semester exams weren't too great, going home and packing away ham,turkey, black cake and every culinary xmas tradition by the plateful was great. It was good to be back home - I should go more often.

But time - 7 months? - It's like sand running through your fingers. Which incidentally is the point of this post. Here is my fix for people who have todo and idea lists miles long:

An hour is a lot of time

2 or 3 hours is a huge amount of time. I've always thought I couldn't do 1/10th the stuff I wanted to do because I didn't have time. But if I spend 1 hr a week on learning Gimp or practising piano or writing short stories or coding your dream project, it gets done. The hours add up. Over weeks, months, years an hour a week can get you to a place you never imagined.

So that's my New Year's resolution. Start doing all the stuff I want to do starting 1 hr a week or less.

Now with Blogger rolling out new features I gotta fix up this place. Finish my Google Maps mini-widget for one. Think I'll do that now.