Back after a long time…saw something strange today and think it deserves a post. I was cranking through Problem 47 on Project Euler. As I was optimizing the solution, the optimization actually increased run time – and I’m at a loss to explain it. So here goes: def problem_47(maxlen = 4): found = False i = 2*3*5*7 + 1 while not found: # facs = [len([j for j in uniq(prime_fac(i+k))]) for k in xrange(0,maxlen)] d = 4 for t in range(i+3, i-1 , -1): k = len(list(uniq(prime_fac(t)))) if k < 4: i = t + 1 break else: d -= 1 if d ==0: found = True print list(xrange(i, i + maxlen)) # if i % 1000 == 0: # print i The run time is about 1m2s.
Was in need of a utility function that can retry an arbitrary function a few times before giving up. Essentially something like Gmail or Google Readers behavior when there’s no network connection. Thought it would be a few minutes job to cook up a decorator utility in Python. Boy! was I wrong! I mean, the basic use case is definitely trivially easy with Python – however, once you want something that’s more useful than that and resembles something that you’d actually use in production, the complexity goes over the top!
Obviously, I’m not writing enough out here… part of the reason being even though wordpress’s web editor is great, I really like not having to type gobs of text in a text area. So eventually, looked around and found Windows Live Writer. Its going out on its customary spin :). So what’s been cooking? Actually a bunch of things over the last several months: Stuff – on which I mean to put up individual posts
Firstly - my VM setup: I’m running Virtualbox with Xubuntu 9.10 on Win7 host - and its pretty. Its on a office standard issue Dell D531 - meaning they’re AMD Turion X2 TL-60 and 2GB of RAM. Now the Turion’s supposed to have hw virtualization (AMD-V) however, the moment hw virtualization was enabled in virtualbox and I tried starting the vm, the machine would hard reboot!!! After searching high and low, turns out that its an issue with Dell bioses and they dont have any updates.
Just started using Hudson recently and I’m wowed! It’s head and shoulders above CruiseControl and things that I like a lot are Snappy web based config - felt great that I could set up a CI build with essentially the repo path alone Plugin system! Deep maven2 integration (though read on below that this isnt always what works) Trending data OOB - essentially giving you nice charts about how your build is doing over time
Recently, decided to use Apache CXF to expose a service with a RESTful API. Part of the reason for choosing REST had more to do with the fact that the client is going to be a mobile client. These days, though mobile devices stacks have come a long way and provide SOAP clients, it still seems prudent to not depend on a whole slew of technologies where plain 'ole HTTP and JSON might do the trick.
Decided that I want to timestamp my photo collection with the date from the exif data. Many digicams have an option to do this - unfortunately, my Panasonic DMC-LZ8 doesn’t seem to do this. I knew imagemagick would do the trick, but thought it would be a good time to play around with PIL and python. Here’s my PIL effort - functional, but one that came with quite some amount of googling and trying to make sense of the PIL documentation which is inadequate at best.
andLinux is built on top of co-linux (co operative linux) and basically runs side by side with Windows. andLinux packages the whole thing better (coLinux bundled with Xming and a nice systray app allowing you to launch Linux apps right in windows). Here’s details on getting off the ground - and the reason that I have this post is that though andLinux comes with an installer application, it still needs some amount of fiddling under the hood to make it work.
I’ve always hated the fact that on Ubuntu with the default themes, there’s far too much space wasted. The buttons are too tall, the treeview wastes too much space so that if you’re on eclipse or some other ide, you see a precious few items on the screen. I’ve been trying to tweak it to no end - even looking to see if there are any ~/.gtkrc-2.0 tweaks. Found a few links such as this Making Eclipse look good on Linux - Max’s blog- however, didn’t really satisfy my need.
Can’t believe I didnt come across this before - if you’ve gotten used taming your hdd by creating links to folders and have been annoyed with the lack of symlinks and hardlinks on NTFS, then despair no more. I’ve been using Mark Russinovich’s (of sysinternals fame) tool - junction.exe all this while and though it works great, have always wanted something that would integrate with Explorer too. For an in-depth discussion - read http://shell-shocked.