Archive for January, 2007

sched 20 “pizza is ready”

While coding I often want to set a timer to be reminded when

  • the pizza in the oven ready
  • I tried too long to get my bell-and-whistle-but-not-really-necessary-feature implemented (while programming I often don't stop following one certain track until something stops me)
  • it's time to leave to catch the bus

On linux, the easiest way is to have this in your ~/.bashrc-File:

CODE:
  1. sched () {
  2.   (sleep $(($1*60)); xmessage "$2") &
  3. }

For having the popup message "pizza is ready" in 20 minutes, type sched 20 "pizza is ready".

For the bash-beginners (as me): $((math expr)) evaluates the math expression, i.e. 60*5 becomes 300. The parentheses around sleep and xmessage start a new sub process. So this still works if you quit the shell you started sched in.

Using djangos newforms

If you start a django-app just now (January 2007) you are in a dilemma since using the old form engine is discouraged:

If you're starting from scratch, we strongly encourage you not to waste your time learning this

But then, the documentation of new form engine, called "newforms", isn't complete at all.

You may argue «take a framework above 1.0», and you'd probably be right. As I wanted to stick with django, I implemented form handling the hard way by figuring out how to use newforms.

Anyway, as I finally got formhandling working with newforms, I thought I'd share this with you, my fellow readers..

The following code..

screenshot of the form
this examples' form after validating user input
  • ..displays a form
  • ..validates user input
  • ..shows validation errors
  • ..writes the user data into the database

(more...)

print “hello world”

This blog solely exists because with my other blog, I completely ran into a certain topic and there's no return.
This blog doesn't focus on only one topic. So: it's contents are not for you, subscribers, they are for you, Google-searchers, and you, link-followers.

Ah, and the background-color is taken from my favourite terminal. Thanks to sapientone for posting this design to wordpress' design pool. It's nice to start a blog without spending hours creating a nice looking design.