Getting organized

Cheap and simple. Your own mini, inexpensive personal organizer.

PocketMod

Comments off

Timocracy

Word of the Day: Timocracy  (noun)

Pronunciation: [ti-‘mah-krê-si]

Definition: Plato considered timocracy government by principles of honor. To Aristotle it was a government in which the ownership of property is a prerequisite for holding office.

Usage: The adjective for today’s word is “timocratic” [ti-mê-‘kræt-ik] and the adverb is “timocratically.” The plural is “timocracies.”

Suggested Usage: We are likely to see a government run by officials all with the name “Tim” before we see one run by officials driven by the love of honor and public service. The costs of political campaigns have reached such heights that we are approaching a timocracy in the Aristotelian sense in US, where only the wealthy can achieve national political office.

Etymology: The ambiguity in today’s word begins with its root, Greek word “time” [‘tee-me] which means “honor” when applied to people and “value” or “price” when applied to things. Now since kratia means “governance,” the compound could mean “governance by price” or “government by honor,” a familiar confusion in politics to this day. A diluted version of the same ambiguity can be found today in the Slavic descendent of the same root, e.g. Russian cena [tsi’na], which means both “price” and “value.”
–Dr. Language, yourDictionary.com

Comments off

Adding additional links to Django’s Admin

If you’re like me, you’d like to add some new links to one of the Django admin lists (perhaps to delete right from the list or to direct a user to a custom made view).

Here’s the relevant code:

To your model, add:

def some_name(self):
return '<a href="/some/admin/url/here/%s/">Link Name</a>' % self.id
some_name.allow_tags = True #this is to allow HTML tags.
some_name.short_description = 'Table Header Name here'

And then just add “some_name” to your “class Admin” in the “list_display” list. Nice and neat.

Comments off

Download DVDs onto my 30GB iPod

Trying to download DVDs onto my 30g iPod? Here’s how I did it.

The official way to do this is to purchase Quicktime Pro from Apple but it doesn’t support all video types (especially not ones that are downloaded off the net–but no one does that…)

However there is some free software out there for you: http://www.videora.com/en-us/Converter/iPod/download.php

A couple notes: you may want to shrink your DVD down to size before putting it on the iPod. A double layer DVD is about 8 GB. The converter naturally removes a large portion of that as it shrinks it down to 320 pixels wide but it can still be big. A decent program for grabbing your movie off your DVD onto your computer (do this before you convert it to an iPod format) is at http://www.labdv.com/dvdx/

Sooo. Step one–Use DVDx to copy your movie off your DVD. Step two–convert the movie into MP4 format using Videora. By the way each of these steps will take some time–the conversion takes almost as much time as watching the video cuz that’s what the computer is doing–watching the movie and recording it in another format.

Enjoy,
Tim

Comments off

Safari and Django Redirects

I was working on a Django Project (http://naturalareas.saleient.com/) and I was having trouble with people visiting the site with Mac’s Safari. As it turns out, a shortcut I was using was causing the problem. I was using HttpResponseRedirect(“/page-name/”) and apparently Safari doesn’t like this. It’s actually looking for the entire URL. So I had to change my code to HttpResponseRedirect(“http://naturalareas.saleient.com/page-name/”) and it worked.

Comments off

TeamRemind.com Beta Launch

Yup, we’re finally ready to show this guy off a little bit. The look and feel of it is not set yet and we’re still finalizing a few features but it’s good enough to show a few people and have some people test it out.

We’re already getting some good feedback.

FYI – If anyone out there is building a website, I have a few suggestions. First, design your code to be as simple and clean as you can get. TeamRemind.com flies off the server because of it’s slim HTML code and external CSS and Javascript (which are cached on most browsers). Also, it will be easier to maintain down the road.

Check it out at www.teamremind.com

Comments off

Code Search Engine – Krugle

Bad name but a great service for programmers.

http://www.krugle.com/

Comments off

Malcolm Gladwell

http://www.ted.com/tedtalks/tedtalksplayer.cfm?key=m_gladwell

Malcolm talks about how there is no perfect Pepsi but rather only perfect Pepsis. He describes how it is important to understand humans have variability. Some great anecdotes. Check out the rest of the site while you’re there.

Comments off

Work life update

Here’s a few cool projects that I’ve worked on over the past couple years. Enjoy.

http://www.nothingbutnets.net
(I did a bunch of the set up on this site. The design was created by a company in Vancouver)

http://naturalareas.saleient.com/
This site is a survey for the city of Edmonton to see what the citizens think of the local natural areas. This was very successful and could lead to some more work with the city in the future. I worked with Mike Evans (http://www.teleologic.ca/) and James Mireau (http://www.taskone.com/) on this. Mike did all the communications work and James put together the design. I created the survey and did the statistical analysis. The survey is just one part of the project.

http://www.allaboutelectrical.com/
This site is just starting out but it’s going to be cool. Ask questions about electrical matters.

http://www.mbveneer.com/
I built all the back end systems. The design was done by a company in Calgary. In particular, check out http://www.mbveneer.com/designzone-covermyworld.cfm and try building a project.

http://www.albertasoccer.com/
I’m currently working on trying to get them to update the site. It could look so much better.

The land developer’s project management software is at http://www.aceraprojects.com/ and it’s for Acera (www.acera.ca). There’s a demo available at http://pm.pivotib.com/ but it really needs a bit of an introduction before you can wade into it.

Of course there’s also my other sites like www.saleient.com and www.conflux.ca

Now, if you’re interested in seeing the cools stuff that’s emerging on the internet you could visit these sites:
http://www.techcrunch.com/
http://digg.com/

A couple blogs that I check frequently:
http://blog.guykawasaki.com/
http://headrush.typepad.com/creating_passionate_users/
http://www.goodexperience.com/index.php
http://www.37signals.com/svn/

Some of my friends are doing cool things too:
http://www.markwells.ca/ – Mark writes on Alberta Politics and other miscellaneous topics.
http://www.1024media.com/ – My friend Branden is an expert at getting web traffic to his clients’ sites.
http://www.liftinteractive.com/ – These guys are upstairs in my building. They’re releasing a new product, http://getparade.com/, very soon.
http://inviteright.com/ – These guys are also in the building. Online event planning.
http://www.fissionmediagroup.com/ – These guys are in the building as well. I’m working on a upcoming project with them.

Comments off

Django Newforms

Binding a form to a model instanceDjango’s newforms module provides the helper method ‘form_for_instance’. The method will return a Form similar to the one returned by form_for_model but the initial data will be populated by the instance’s data. The form will have a ‘save’ method which will save changes to the instance to the database (unless it is passed the commit=False argument) and will return the instance itself.

Sometimes, however, it is desirable to use fields different from the default. In order to bind a form to an instance one will have to provide __init__ and save methods.

The __init__ method should be defined as follows:


def __init__(self, data=None, auto_id='id_%s', prefix=None,
initial=None, instance=None):
  if instance is not None:
    self.instance = instance
    new_data = {}
    # Populate new_data using 'instance'
    # ...
    data = new_data
  else:
    self.instance = None
super(MyForm, self).__init__(data, auto_id, prefix, initial)

The __init__ method will save the original instance in self.instance and pass the data it contains to the superclass (most likely forms.Form). The bound form will be created with MyForm(instance=MyInstance). To use the form for creating new instances it can be created with MyForm(request.POST).

The save method will look similar to the following:
def save(self, commit=True):
  if self.instance is not None:
    instance = self.instance
  else:
    instance = InstanceModel()

# Construct the instance below using self.clean_data
# Using self.clean_data ensures everything is validated.
# ...

if commit:
  instance.save()
return instance

It should be noted that one will not be able to save ManyToMany data without saving the instance first. If the model contains M2M fields then commit=False will not make any sense.

Views

Your add+edit view should look something like the following:

def add_edit_model(request, id=None):
if id is not None:
instance = MyModel.objects.get(id=id)
InstanceForm = MyForm(instance=instance)
else:
InstanceForm = MyForm()

if request.POST:
form = InstanceForm(request.POST)
if form.is_valid():
form.save()
return HttpResponseRedirect(‘/whatever/url/’)

return render_to_response(‘template.html’, {‘form’: InstanceForm})

Comments off