December 30, 2007

Starting to Understand Django

Given a fairly quiet holiday season I wanted to try and make some sense of Django, having formerly given TurboGears a look (though not yet having written that up). Both are capable systems whose designers I have a lot of respect for, so it would be nice to master their elementss. Each in its own way has the potential to improve web productivity, though it remains to be seen whether I have the headspace for all of both systems given their complexity.

After a couple of days messing around with Django I am at the stage where I have imported the Holden Web database model using Django's introspection features. A deal of cleanup was required, as well as a certain amount of reordering—most of which would not have been necessary if I'd had the sense to delete the Django admin tables from mo model, since I doubt I will need to manipulate them directly. Anyway, it's rather nice to see that the following views.py can generate the almost home page shown above:

from django.http import HttpResponse
from django.template.loader import get_template
from mainapp.models import Section

def homepage(request):
seclist = Section.objects.all()
hpdict = dict(("secPathZone%d" % s.sechomeslot, s.secpath) for s in seclist)
return HttpResponse(get_template("homepage.html").render(hpdict))


This is neat, though I have an idea that rendering the unnumbered lists to add the missing link sets is going to involve me in a little more work than I have had to do so far. Still, it's an encouraging start. I am serving this web from a local Apache server using mod_python to control Django and serving static content (images, CSS files) directly.

December 22, 2007

Ubuntu 7.10 Sound on Asus M2NPV-VM Motherboard

Dear Lazyweb:

I am really enjoying my new Linux system, but I can't seem to get the sound working. Perhaps it's a driver issue: all I know is that the aplay -l command gives me the following output:

aplay: device_list: 204: no soundcards found

This is very disappointing, as I was hoping to use this machine to work on a podcasts and screencasts in the new year. I'd be very pleased to find a recipe for fully working audio and digital sound, but at the moment any kind of sound would be a great improvement.

Google searches reveal that this has been an issue with various distributions and releases but so far nobody seems to have published a reliable solution, and I am beginning to doubt that one exists ...

December 21, 2007

December 19, 2007

Cheese Shop Doing Good Business

PyPi, the Python Package Index, is affectionately known as the Cheese Shop due to the the Python world's affinity with Monty Python and its tendency to relish obscure puns based on the sketches. I can't say I have ever liked the nickname, but PyPi is a valuable repository of often highly usable code and currently contains over 3,000 contributions. So it's worth a look.

The RSS feed contains the last thirty updates, which currently covers a 48-hour span--the feed appears to be updated once daily at 7 pm. So there's clearly a lot going on, and when I get time (note the ironic sound of hollow laughter ringing metaphorically in your ears) I shall be using the browse interface to take a closer look.

December 18, 2007

Cygwin ssh-agent Control

[Edited: 10/6/08 Remove temporary files before starting a new agent]

Another little annoyance gone: all Cygwin processes now share a single ssh-agent instance, which is started up automatically as required. I picked this tip up from a now-forgotten blog. the only change required to that recipe being to re-order the redirections for the ssh-agent command. Since it took me a while to find (low Google-fu today?) I take the liberty of repeating it here so I don't forget it.

In your ~/.bashrc file add the following:

export SSH_AUTH_SOCK=/tmp/.ssh-socket

ssh-add -l >/dev/null 2>&1
if [ $? = 2 ]; then
# Exit status 2 means couldn't connect to ssh-agent; start one now
rm -rf /tmp/.ssh-*
ssh-agent -a $SSH_AUTH_SOCK >/tmp/.ssh-script
. /tmp/.ssh-script
echo $SSH_AGENT_PID >/tmp/.ssh-agent-pid
fi


function kill-agent {
pid=`cat /tmp/.ssh-agent-pid`
kill $pid
}



You can use Start | My Computer | Properties | Advanced | Environment Variables to add an environment variable called SSH_AUTH_SOCK whose value is /tmp/.ssh-socket to make the agent available to other Cygwin-aware processes you run under Windows.

That's better!

For some reason a number of posts were stuck in the blog as drafts. This one is from October last year.

December 16, 2007

Getting There

Damn, it's been a long time without a decent computing infrastructure.

Regular readers (you poor, benighted individuals) will know that a lot of the last year has been taken up by a relocation from the United Kingdom (back) to the USA. In the UK somebody asked me how many computers I had, after a brief mental count, I replied "seven" (which didn't seem excessive to me). I gave one away to an honorary niece before I moved--she is probably still the only kid in her school with a Linux laptop.

Unfortunately four of them had to be packed up and moved with the rest of my house contents, the only ones carried across by hand being my wife's laptop and mine. This wouldn't have been so bad had it not been for the unfortunate necessity to live in rented accommodation (thanks, Gwen and Warren) from February until our new house was ready in September. The move into the new house, of course, coincided with a rather large number of non-computing tasks regarded as necessary for making the new environment livable.

So, now we have blinds on most of the windows, rugs in all rooms, a properly sealed garage floor (yes, "...Magic" is not my only blog) and Christmas shopping completed and the necessary gifts mailed to the UK I have been able to start thinking again about working with more than just the single trusty laptop that has kept me going for the last year. Woot!

The first piece of slightly depressing news was that my Linux system headrat was dead on arrival. I could boot up from an original disk on the second IDE interface, but the primary disk was as dead as the proverbial dodo--we are talking clicking noises from the head actuator, which is rarely a good sign. Fortunately this disk wasn't the one with my home directory on it, so there was no need to restore from backups. Headrat was getting pretty long in the tooth, however: to give you some idea it was a system I put together myself and the first one with a 1GHz Athlon processor in it. While quite blazing seven years ago, the performance today is no longer so impressive, so I decided to see what was available today.

With the help of a local (and very competent) computer dealer I managed to get the following system (now christened hourbot) for just over $600 including sales tax.
  • Athlon 64 dual core 4600+ processor
  • 4 GB DDF-2-667 memory
  • 160 GB SATA 7200 RPM disk drive
  • 18x DVD+/- RW DL optical drive
  • Asus M2NPV-VM motherboard
It was a pleasant surprise to discover that I had saved myself $140 by not requiring the Windows Vista Professional operating system. I would like to think that I have also saved myself a whole passel of trouble down the line thereby--Vista smells to me whereas I know Linux, if not like the back of my hand, then at least a lot better than Vista. I am so pleased with the system I have even thought of installing a decent Linux distribution (I'm using Ubuntu 7.10, better known as Gutsy Gibbon) and putting it on the market.It's a long way from my core skill set, however, so this will probably remain a fantasy. If it ever becomes real I can think of several interesting pieces of software to deliver with it.

There have been a few glitches, like having to load the proprietary Nvidia video drivers before I could get reasonable display performance, but overall the road has been smooth. Ironically I chose the specific motherboard for the superior audio quality it potentially offers, but so far I have been unable to get the sound subsystem working properly. If the lazyweb can help ne solve this outstanding issue I will be a happy man indeed--I had hoped to be able to use this system for putting podcasts together, but this won' at least t be possible until Audacity can see some usable sound hardware. I am prepared to wait a little longer for full 5.1 sound.

I brought the new system home just less than a week ago, and so far haven't had time to do too much with it (though it's nice to have cron job keeping the holdenweb.com front page news up to date on an hourly basis). Yesterday I managed to put a new wireless router up for general use, allowing me to repurpose my venerable Linksys WRT54G (which had been running OpenWRT) by loading Sveasoft's GNU/Linux-based Talisman 1.3.1 release on it. This has allowed me to go to WPA encryption, meaning I can now do client work over a wireless connection with fewer worries and can also get back into the home network securely via SSH.

So far I have only used Cywin's X server over the LAN, but in theory it will soon be possible to use the Internet to get a full Linux desktop from machines inside my firewall .That will be something pleasant, even if asymmetries in cable bandwidth make it run at less than stellar speed.

I managed to get all this done before going out to celebrate a friend's 40th birthday (many happy returns, Dave!), which has left me too tired (though not "emotional") to write much more tonight. But boy, it's good to lose the limitations of Windows and get back to realizing how much simpler it is to solve problems when you are no longer limited by proprietary constraints.
We don't need no stinkin' Vista!

December 6, 2007

Voting Machine Manufacturers Don't Get It

It's reasonably well known that the governor of California instituted a thorough review of voting machines which culminated in a fairly damning report earlier this year. San Francisco is now getting ready to spend $12 million on new machines, and the manufacturers have (apparently successfully) resisted requests to open up their source code. The reason they give is that "it would amount to giving away to competitors their proprietary software code".

So never mind scrutinized correctness, let's keep the buggy stuff to ourselves. These people make me smile as I hit my head against the wall. If democracy is as important as everyone keeps claiming then the most important thing is to count the damned votes correctly. But this is America, so profits have to come first.

December 5, 2007

Sun to Reward Open Source Contributors

Sun Microsystems made the news on Tuesday by announcing in India (which they feel will produce the majority of open source contributors in future) that they intended to start handing out cash rewards to open source programmers. Interestingly, although it's all over Google, it seems impossible to find a reference that does not include the word "dangle", indicating to me that a single source - Chris Kanaracus of IDG - is involved. Nice to get so much attention!

It was also reported, though, that Sun would "be releasing further details on Wednesday". The details have received very little web coverage, however. It turns out that Sun are investing $1 million, and have selected a few specific communities to work with in their Open Source Community Awards program's first year.

It's good to see the commercial world starting to recognize that the efforts of a relatively small number of forward-thinking pioneers have quietly and effectively provided the beginnings of an open infrastructure that we can all work with. I hope that others who have profited by their efforts will follow suit in short order. Industrial Light and Magic, to mention but one worthy candidate.

HOPping All Over the Place

Several regular Python bloggers have already noted the Google Highly Open Project (GHOP), which aims to introduce secondary school students to the open source world. The team managing the Python effort for the project have been pleasantly surprised by the competence of the student contributors, and they are just getting ready to add another batch of projects. If there's a project that you think would improve the Python ecology, take a look at the Python project page and get in touch with the organizers from there.

The project has just received an offer of hardware to help it along. This will broaden the scope of the activities, and the team has already started brainstorming about uses for the new kit.

So, the reason for this post is mostly to point out what an awesome job the guys who are organizing the project have been doing. Titus Brown took the lead and came up with a stupendous list of projects in extremely short order. He has been ably assisted by Andre Roberge, Doug Hellman and Georg Brandl pretty much right from the start, and an increasing number of others have joined in to suggest projects and review student submissions, offering guidance and generally helping things along.

Well done, all of you. The whole Python community owes you thanks for the amazing efforts you continue to make on their behalf on GHOP.