Skip to main content

Posts

Showing posts from August, 2006

Linux: On-the-fly BASH Aliases with Cntl-R

If you use BASH, I hope you make use of Cntl-R to search for commands you've already executed. Even though I know about and use Cntl-R, even I underuse it. For instance, you can use Cntl-R to create on-the-fly, short-lived aliases. Start with:cd /some/long/path # cdlongpathThen later:<Cntl-R>cdlongpathIt will autocomplete to your earlier command. If you happen to forget an alias, no big deal :)

Python: Limitations of Coroutines via Enhanced Generators

I've been thinking a lot about tricks such as the coroutine system in this article. PEP 342 improves the situation for Python 2.5. In fact, Example 3 in the PEP is exactly what was on my mind. I came to the same conclusion as the PEP:In effect, this example emulates simple tasklets as are used in Stackless Python, as long as you use a yield expression to invoke routines that would otherwise "block". However, what happens if you can't use a yield expression to invoke routines that would otherwise block?

For instance, say coro() is a coroutine that calls third_party_1() that calls third_party_2() that calls blocker() where blocker() blocks. If third_party_1() and third_party_2() are intermediary functions that exist in third-party code, they won't know how to "do the right" thing using yield. If third_party_1() and third_party_2() don't do the right thing with yield, there's no way for blocker() to yield back to the scheduler.

Ideally, I'd…

Python: Stunning News: Django isn't Perfect!

Concerning http://www.cmlenz.net/blog/2006/08/the_python_web_.html:

Although I have a ton of respect for what the Django guys have accomplished (I really do!), I couldn't agree more with this post based on my own experience and the experience of many of my co-workers.

By the way, when he mentions, "There was a comment by someone in the audience at the Google TechTalk on Django along the lines of...or scale down to teams where the programmers are also those who write the templates," that was me! :)

It's not that our team wasn't large enough for separate template authors. Quite the opposite; we had 169,000 lines of code. It's that I generally don't trust template authors because I fear they write redundant code. Compared to Cheetah or Myghty, Django makes it hard to write quick little template functions that take keyword arguments, thus I suspect that a lot of people put up with redundant templates because, after all, (tongue in cheek) it's HTML, not co…

Haskell: Translating C to English Using Haskell

I've written a two-part series for "Linux Journal" called "Translating C to English Using Haskell". Here are links to the two parts:http://www.linuxjournal.com/article/9096
http://www.linuxjournal.com/article/9242The catchline is:Write a program in Haskell that translates C type declarations into English. Manually translate the Haskell into English.I've tried very hard to make it an entertaining article for Haskell newbies, so if your head exploded when you tried to read "A Gentle Introduction to Haskell", give my article a shot!