Another one in the category of always-forget-how-to-do-this-so-noting-here:
class Entry(models.Model):
blog = models.ForeignKey(Blog)
b = Blog.objects.get(id=1)
b.entry_set.all() # Returns all Entry objects related to Blog.
# b.entry_set is a Manager that returns QuerySets.
b.entry_set.filter(headline__contains='Lennon')
b.entry_set.count()
Full docs here …
MoreThis morning while trying to close a firefox tab I accidentally hit a button on Gmail that made it magically faster and better. I'll share it with you: look at the top right hand side of your gmail screen. Look for the link that says "Older version":
Click on this …
MoreStill thinking about iPhone versus BlackBerry. The iPhone is great, but I prefer the BlackBerry for business use. The iPhone's weakest points:
I'm a bit of an iPhone fanboy, it's true. However, Fred Wilson's post on mobile apps has me thinking - the main reason I carry an iPhone as well as a BlackBerry is the iPhone's browser. The rest of the stuff is great, but the killer app is the browser.
And …
MoreMy brother-in-law bought Arabian Nights (aka 1001 nights) to read to his 2 year old daughter, thinking they'd be nice, quaint stories. He thought better of it and gave it to me, so I gave it a quick read.
You probably know the general story: there's a cruel king that …
MoreUpdate: Gotta love it. Genius, I am. Turns out the laptop was on "Power Saver" mode.
About 2 weeks ago my Vista laptop started slowing down. I don't know what caused it, but it started sometime after I updated to service pack 1, although I have no idea if that …
MoreInteresting essay from David Adewumi on Why Black Nerds Are Unpopular. My observation on nerdism and popularity, based on going to school in three different continents, is that "nerds" are an American invention. Popularity, or lack thereof, is of course universal, but being a social outcast due to intelligence is …
MoreInteresting new open source release from Google called Protocol Buffers. Language neutral data serialization and exchange via protocol definition and generated code for C++, Java, and Python.
Apparently Protocol Buffers are heavily used inside Google, so they look to be a robust implementation. Should be a good format for wire …
MoreI'm trying to examine and modify form variables from jQuery by catching the submit event. jQuery has a serializeArray method that hands you the form variables in a nice array. For example:
$('#someform').submit( function() {
$.post("/some/url/", $(this).serializeArray(),
function(data){
console.log(data);
}, "json");
return false;
} );
This is …
MoreI just cancelled my Verizon broadband account, mainly because the card was no longer working in my PC and the mac doesn't take PC cards. I was surprised at how little effort Verizon put in to keeping me; I've been paying the $80 per month for almost 2 years now …
MoreWatched In Bruges. Really not too bad. The British do good gangster movies - not shy about violence, but also layers of introspection and classical tragedy elements. I recommend it, worth seeing.
Update: I've watched the movie a couple of times since writing this, it's quite good. See it.
MoreIn most programming languages (Java, C, Python, Perl) I'm generally thinking "I'll put this thing on this shelf here, then I'll do x, then I'll pick up that thing, do some work on it, put the result over here," and so forth.
With Javascript, particularly when used correctly, which for …
MoreA friend forwarded me an email about yet another group using a database to implement what's really a queue. Not surprisingly, performance is an issue.
Queues are still not part of the average developer's standard set of tools. At least the Java world has a standard API and several good …
MoreWatching the Euro 2008 games. Yes, many days late.
The Germany-Turkey game was an interesting one. The entire time watching I was reminded of our European trip, oh, about 10 years ago.
We spent a lot of time sharing trains with lots of people from lots of countries. Twice with …
MoreI'm about buy a new laptop for my wife, and it has me thinking about how to keep computers for non-technical folks virus free.
The best method I can think of is to have a virtual machine running on her machine. She can keep her important things on the core …
MoreThis is kind of pretty:
void log(lazy char[] dg)
{
if (logging)
fwritefln(logfile, dg());
}
void foo(int i)
{
log("Entering foo() with i set to " ~ toString(i));
}
Note the lazy keyword in the definition of the log function, which tells D to only evaluate the value if needed (ie …
MoreIf you've spent any time with virtualized environments you know how effective and productive they are. The process of expanding capacity for FaceDouble, for example, became significantly simpler once they moved to depolying virtual servers, and SmugMug has been singing the praises of Amazon's EC2 with a clever system to …
MoreI have a need to verify user email addresses, which I've been doing the traditional way - sending an email with a secret to the user's address and having them reply or click on a URL.
Unfortunately this is not optimal - emails tend to not make it to the user, go …
MoreLooks like Time Warner has dicontinued usenet service:
A good reason to leave Time Warner. I currently have the majority of my services through them (cable, phone, web), I'll be looking for alternatives.
MoreJust finished watching Russia vs. Netherlands. Most of it anyway - I'd only DVR'd the main match, missed most of the extra time.
What a fantastic game. Arshavin is the real deal, looking forward to seeing more of him. Sorry to all my Dutch buddies, but Russia really looked like they …
More