Programming


Posts on various aspects of programming or hurdles I've jumped (or stumbled) over and anything else related to programming I might write.

  • Thursday, April 15, 2010 - 22:11

    This little program lets you create a bargraph of the number of results returned by a google search when replacing a small part each time. For example if you use
    Google Query: how to get better at <x>
    Search Terms: starcarft 2; kissing; cooking; robbing a bank; becoming cowboy neal

    It will plot the number of results returned by a google search when <x> is replaced by each search term. This means it would plot the number of results for each of "how to get better at starcraft 2", "how to get better at kissing", "how to get better at cooking" ....

    This was inspired by several XKCD comic strips like Numbers and Dangers. Of course, the numbers don't quite match up with the comics.

    Google query "<x>" will be replaced:

    Search terms to substituted into the above query (separated by semicolons):


  • Thursday, April 8, 2010 - 11:38

    Occasionally one has to jump through a lot of hoops and do some pretty bizzare and unorthadox things when coding. Especially when working with multiple versions of libraries. At work all of our iMacs were recently upgraded to Snow Leopard and Python 2.6 and libraries isntalled (all in 64-bit). Its nice to upgrade . . . when it doesn't break things. Unfortunately during the upgrade numpy 1.4 was installed. Now this was only unfortunate because the super computer we also need to run on has numpy 1.3 which won't unpickle objects pickled with numpy 1.4.

  • Saturday, March 13, 2010 - 15:36

     I use matplotlib fairly frequently in my research, it rocks. However, the fact that the MacOSX backed doesn't let me use 'Cmd-Q' to close things down is annoying. So my solution is a combination of pycario and preview with a little AppleScript through in for fun. I program in Eclipse with PyDev, however I run my python programs exclusively from iTerm. Hence, I'm used to cmd-tabbing back and forth between iterm and eclipse. However, when I run a program that opens up a gui, such doing "pylab.show()" things get annoying.

  • Monday, April 20, 2009 - 11:17

    For my Embedded Systems class I'm working on a project where we are doing some webcam capture and video processing/effects work. To make life simple we are using OpenCV, which rocks. Our language of quote-in-quote choice is C# and to work with OpenCV we are using EmguCV wrapper/binding/what-have-you. So, while working on code that has to capture a video frame, process the frame to do face detection and a video effect, then draw a frame to display to the user I decided to throw everything into its own frame.

  • Monday, April 6, 2009 - 13:16

    I have for some time now been using matplotlib to do all my graphing in python. Its a great package! Recently I've been wanting to do basic animation of graphs, while you'd think it would be simple has turned into a bit of a trek. There is a simple animation example found here: http://matplotlib.sourceforge.net/examples/animation/simple_anim_gtk.html it works okay, but if you try to move the window it freezes, and you can't use anything on the toolbar.

  • Sunday, February 15, 2009 - 15:18

    The more I work with python the cooler it becomes, especially the more I let my mind think of way out there things to do with the tools python provides. In my work I frequently find my self writing code in this order:

  • Friday, February 13, 2009 - 15:22

    So one of the coolest things I just found out about python is that it will let you chain comparisons, so 1 < a < 10 works. Even 1 < a < 10 < b < 25, and so on, you can even get really crazy and try a < 5 > b, wich is a funky way of saying a < 5 and b < 5, pretty cool huh!

  • Monday, February 9, 2009 - 18:25

    So today I used my first function closure in Python. I had always wondered why/how someone would use them, but today after reading an article earlier this morning I ran across a place to use them while coding this evening. Here we go:

  • Thursday, January 29, 2009 - 23:38

    Every so often I try to write some code in MatLab instead of my beloved Python, it generally turns into a marathon even of trying to get MatLab to do what I know how to make Python do in a couple of lines. One thing that I am missing right now is Python's sort and the ability to pass it in a key function that will be used in sorting an array.

  • Thursday, December 11, 2008 - 10:37

    So I've run across the issu of tabs vs spaces again and have decided to put in my two cents. A nice overview of the topics is given here, but I disagree with is final conclusion. The topic actually consists of three points: