Beloved English setter; sometimes it seems dogs are smarter than people.
R.I.P Pupa — Dec 2011
Spring Garden 2011
This has been a wacky year as far as the weather goes, with a late freeze and then some sweltering hot days this Spring will bring interesting results for what actually grows and yields. Our fruit trees have been sprayed twice now initially with dormant fruit tree oils early season and then again more recently with standard Orchard Spray. The trees look healthy but fruit show this is likely to be a low yield year as far as that i concerned, and already there are already signs of some bug dinged fruit. This years garlic yield looks to be as good as last (approx 60 head yield); I figure with garlic: for every 5 heads you keep you should reseed with another, and it keeps the rabbits moving away from the other garden plants.
Spring Garden Surprising Crop goes to the various planting of Indian Mustard. At first the baby leaves and yellow flowers/pistols made nice additions to spice up the garden reds and greens used in our house salads. I figured most of the plant would simply go to waste until I did some more Google-ling to uncover that this plant is also chalk full of healthy compounds, vitamins and minerals, plus being related to the Broccoli plant, this is a surprising relative. The Indian Mustard plants did not win on those merits alone, it still had to be cooked into something and for that we discovered the Pakistani dish Sarson-Ka-Saag. This year I had loads of delicious appetizer growing in the back yard serving no purpose other than garden beautification. Steam the finely chop greens before running them through a food processor and returning them to the strove to simmer and add the corn meal.
The Garlic Scapes are beginning to look impressive with their spiraling outward rotations and it will be any day now before the perfect opportunity is upon us for harvesting them scapes for making delicious Almond Garlic Scape Pesto!
Summer Garden 2010
Optimizing SQL Queries in Django with very little code
Back at the tail end of 2007, I began developing an open source Course CMS for Courses on the web. For technologies, I choose the Python language with the Django MVC framework as an initial code base deployed to an Apache server–the reason being that Django released under the BSD do as you please license had reached .96 Beta maturity and was showing strong potential as a MVC web framework that could one day outperform both Rails and Symphony and other popular frameworks. Also it looked like it would be fairly fun to work with.
Well 2008 came and passed, and I was left with a patched up version of Django .98 and a small streamlined product that could be connected into the University network and serve the same functionality as an existing product–well maybe. There were still core issues with the Django framework and I was convinced my time would better be spent elsewhere while I waited for things to catch up. I put the source on Google Code and left it for a rainy day. Well 2009 came, went and now today we are staring at the face of the Django 1.3 release where 1.2 brought an exciting new CSFR protection that was easy to convert existing projects and also felt worth doing.
Finally the product had come from concept to prototype to something worth testing upon. I began a search of the latest popular Django apps out there and discovered django-registration which would allow opening up registration to the public whereas before it was always imagined we’d stick to an LDAP creator function. While good, the django-registration app is still incomplete, but definitely deserving attention for anyone starting a Django project looking for a registration with activation example. Then I discovered the hottest Django thing yet: the Django Debug Tool Bar which, as an installable app, is easy to plug into a deployment of your project and will demo the full power of a modern Java Script marvel.
The Django Debug ToolBar lets you view the processing time for each request, as well as how much of that time is taken up in SQL queries, what those queries are, and how much time was spent in each query. Using this tool I was able to find bugs in my code that showed linear dependencies of queries existing in the template layer (because yes, Django templates can create queries when the Context dictionary doesn’t have all the data.) After seeing this tool’s Panel views, I was able to identify this issue type and then fix it using Django’s built in select_related on some of the QuerySet statements where the SQL gets generated. This tool combined with firebug, View Cookie, and Opera’s quick page markup validation has allowed me to highly optimize my GoogleCode project django-classcomm. In some cases page views reduced load time from ~250ms to ~125ms!
April is the cruelest month
Python’s cProfile–Profiling your code straight-a-way!
This past day or so I have been working on some Facebook puzzles, and in doing so I’ve used Python’s built in code profiler cProfile. It is incredibly easy to set up for cases such as these: simply import cprofile, and then call your entry point with: cProfile.run(‘Main()’) replacing Main with the name of your entry point. You get CPU timing results, for instance showing that calling a C function to compete the Levenshtein Distance will reduce the time for computation to completion by more than half! Good profiling data and a powerful user friendly debugger are two of the most important software QA tools available.
So I’ve been updating the project I started for my honors project in college, which is a GPLv3 Django Project for delivering Courses on the web. It is now hosted on Google Code. I have also begun wiki documents outlining specific aspects of installing, maintaining and using the project. I hope it might be useful to someone.
My Northern Illinois Garden 2009
In 2009, my gardening approach was to open up grassy land for cultivation (since gardening had gone out of style here at this ranch home by the turn of the millennium), and to run several traditional row plots separated by plant species. This approach has worked well to demonstrate several vegetable varieties that can easily be grown here in Northern IL. I’ve spent some time researching companion plantings and working the land over to be more like long mound like rows.
Gray Hat Python
I ran into issues running the demos from my new Gray Hat Python book–likely because I was working directly in 64 bit Vista, and the authors code examples makes use of the kernel32 windows API. I found this blog post outlining this issue in more detail. There exists a follow up post with a number of fixes to various issues in the printed book here: Gray Hat Python: The Followup. Also the publisher’s updates to the book are here. The bottom line though is that this book has low press quality, and the examples do not always hold up to what the real world demands. Still, there are insightful moments and interesting points on security and program debugging. Possibly more useful to someone improving the language than a web developer, still the book has merits if this is your project space. Find a used copy today! (Or look for the E-Book on O’Reilly Media Website) I know I’ll be reading the chapter on Fuzzing Windows Drivers again …