January 2, 2012 at 2:48 p.m.
Ian Bicking's virtualenv has become one of those apps I just can't code without (or at least, I hate to code without). I have so many quick-hit, one-off, throwaway apps with so many strange and sometimes conflicting dependencies that I can't imagine how I'd get anything done if they all swam in the same soup.
This is all made better by Doug Hellman's virtualenvwrapper, which makes creating and managing virtual environments dead simple.
Given that, here are two tricks I figured out yesterday that could make things a little more interesting:
Using (Some) Global Site ...
July 15, 2011 at 12:49 p.m.
Instead of revolving around a monolithic central piece of software, we have adopted the paradigm of feature-as-app. Our frontpage: an app. Our slideshow: a different app. Article publishing: yet another app. You get the picture. At the heart is a simple and flexible API that digests manifold requests from the different applications. For example, Moveable Type is great at publishing entries and updating its database accordingly. Our new system will simply wrap the MT database in a cached ...
February 19, 2011 at 10:29 p.m.
This month's Carnival of Journalism asks: What can I do to increase the number of news sources?
I take the following as given: DC doesn't have a shortage of news, or an inadequate supply of sources. There are three daily newspapers (with metro sections), a weekly, several TV stations and radio on both AM and FM. TBD's community network points to 225 blogs focused on the metro area. Between Wordpress, Facebook, cell phones and cheap broadband access, anyone with an urge to participate in conversation and report news (however defined) can do so.
(A disclosure I'll ...
January 21, 2011 at 2:33 p.m.
Note: in lieu of other excuses: I have a carnival of journalism post coming soon. Consider this an unrelated holdover to remind you that I do, in fact, still occasionally use this blog.
For a while now, I've been toying with a side project called TableFu. If you follow me on Twitter or Github, you've probably seen it. It might already be in your toolkit (if, for example, you needed to organize a bunch of Youtube videos of Christmas carols).
The project started as a Python port of ProPublica's project of the same name, which is written ...
July 7, 2010 at 2:56 p.m.
Cross posted at MediaShift
The oil spill in the Gulf of Mexico has lasted more than two months now. It is the worst spill in US history, and it is likely to continue until at least August. And in covering it, the NewsHour has broken every traffic record it ever had.
So, what have we learned here?
(Quick note: A lot of the thinking behind this post comes from a debriefing at work with my colleagues Vanessa Dennis, Travis Daub and Katie Kleinman, and from conversations about the spill and our coverage with other people in and out of the ...
May 24, 2010 at 11:12 a.m.
By now, I'm pretty sure anyone who reads this blog has seen the widget the PBS NewsHour launched a few weeks ago. Those ticking numbers have been embedded on dozens of websites, bringing thousands of new visitors our site.
So it's probably worth mentioning up front that at first, I thought building this thing was a bad idea. I thought it was gimmicky, and that it assigned specificity where there was none. I argued that any number we pick as the rate of spillage was almost guaranteed to be wrong, since the government, BP and outside experts were ...
April 8, 2010 at 4:13 p.m.
Columbia University will soon offer a new dual masters degree in journalism and engineering, with the goal of cranking out more programmer-journalists, Wired reported yesterday.
This is good. It builds on the success of Medill's Knight-funded experiment offering scholarships to software developers to learn journalism. That's to be lauded.
But... (you knew there was a "but" coming)
Those getting dual degrees shouldn't be the only journalists hanging out with computer scientists. The problem isn't just a lack of reporters who can code, but a shortage of people in the newsroom who know what's possible.
April 7, 2010 at 2:56 p.m.
I picked up my old MacBook from the Apple Store with a new, bigger, and spotless, hard drive, with a fresh install of Leopard.
Time consuming as it is to set up a computer from scratch, it's actually something I'd been meaning to do. The death of my old hard drive just forced me to do so sooner, and a little less gently than I might have liked. But it is nice starting from scratch.
With that in mind, I decided I should set up my development environment the Right Way: with code sandboxed as much as possible ...
February 13, 2010 at 8:08 p.m.
One more quick code recipe before I jump back into the Journalism to Django series. In my last post, I mentioned that I set up permalinked paragraphs on a couple recent entries, using a different technique on each one. You might be wondering how I did that.
This is documented, but it took me a while before I realized how simple it is. The key is Django's
select_template functions, which are part of the template system. Get template takes a string and gets a template. Select template chooses the first one that matches from a list or ...
February 12, 2010 at 5:24 p.m.
var entry = document.getElementById('entry-text'); var paras = entry.getElementsByTagName('p')
Assuming you have a
id="entry-text", we've just grabbed every paragraph below it and created an array called
paras. Simple enough.
Now, like we did with Python and Beautiful Soup, we're just going to loop through that list of paragraph elements, add ...
February 11, 2010 at 9:06 p.m.
I mentioned in my last post how useful Ben Welsh's code recipe's are. Count this post as my effort to encourage the practice among coding journalists.
Since launching the NewsHour's Annotated State of the Union, I've gotten a few questions about how it worked, particularly about linking comments to paragraphs. What's needed is paragraph-level permalinks. As it turns out, that's pretty easy to do.
The first thing you'll need is a block of clean HTML. Then, you'll need something that can parse and modify that HTML. Fortunately, tools abound.
Doing it server ...
February 7, 2010 at 12:34 a.m.
So, you've gotten the hang of HTML and CSS. You can install Wordpress in five minutes, and you're comfortable mucking with templates. Or you get databases and it's time to get them on a web. Or you read my last post and feel ready for the next step.
At this point, take a look at the Django Book.
You can learn Django and Python at the same time (I did, as have others). But it is worth getting the hang of Python a bit first. Take some time and go through Think Python. It's ...
January 28, 2010 at 10:51 p.m.
The Analyzer (I can never think of clever names for my apps; this is what everyone here calls it) is built in Django, with a lot of help from jQuery. From pitch to launch took exactly a week, including a working weekend.
The app is built around two main models: Speeches and footnotes. Every footnote is tied to a speech and indexed to a ...
January 26, 2010 at 10:26 p.m.
Programming is hard.
There's no way around it: Learning to make a computer do things means learning a new form of expression. It is not, in some ways, all that different from learning a spoken language.
But it's also fun in an addictive sort of way. It's like telling your Legos to build themselves. When things start to click, massive problems begin to break apart into a long series of eminently squashable bugs.
Before you start learning Django, a few things I recommend brushing up on:
(X)HTML: This is, after all, a framework for building web ...