Tuesday, May 13, 2008

Ruby

So while taking Aron Pilhofer to the airport on Sunday, he gave me a nice rundown on Ruby on Rails (and, as a sidebar, Ruby itself). It was interesting enough to convince me to give it a look.

If you're even remotely interested, do yourself a favor and check this out. It kind of gives you a nice little overview of Ruby.

In other news, I got a new Django book in the mail last week. Was intending to mess with it today, but had to take the wife to the hospital when she sliced her paw open while using scissors on flowers at work.

What I'm reading today...

"Left-leaning" or "non-partisan"?
"Why would a Times article call the American Enterprise Institute "conservative-leaning," but not refer in the same article to the politics of the Mike Mansfield Foundation? Why do stories refer to the Brookings Institution variously as "centrist," "conservative" and "nonpartisan"?"

Who Will Tell Us?

"The steady drip of buyouts and layoffs has consumed an estimated four thousand newsroom jobs in print alone since the turn of the century, according to the much-chewed-over annual State of the News Media report released in March by the Project for Excellence in Journalism. As to whether the Web is replenishing this reportorial firepower, the authors are blunt: “In print, broadcast and elsewhere, more effort is moving to packaging and repurposing material….But less is being devoted to original newsgathering, especially the bearing witness and monitoring of basic news.”'
Cablevision Chief: Deal will 'bolster' Newsday
"In the News12 interview, James Dolan promised a "renewed invigoration of the newspaper here on Long Island." He said cable executives feel "that we can make this paper at least what it was before," referring to circulation declines experienced under Tribune."

Tuesday, May 6, 2008

Great shirts....

Full disclosure: I stole this post from Danny Sanchez over at the Orlando Sentinel.

But who doesn't need a shirt like this?


Some of these shirts are almost as nerd-a-rific as my personal favorite (which you can find here):

Monday, May 5, 2008

OK. I lied. Sort of.

Ok, so the other night I posted this, proclaiming mission accomplished on my little Django problem. However, in my late-night bliss, I forgot it was only half the problem.

I'm also having trouble getting a search form to work properly. Hopefully this will be easier, mainly because I was able to get the search stuff figured out here. My problems actually started because I wanted to know how to display the other fields in the example.

Anyhow, I plan to work on this later today if I can get some more pressing stuff out of the way. Otherwise, it'll probably be tonight.

Then I plan to move on to learning how to create a URL-driven search page similar to this. We'll see what happens.

Friday, May 2, 2008

Django and success

Too bad I can't bring in Borat to give a nice "Success!"

After several days of beating my head against the wall, bugging Derek Willis and Matt Waite to the point they probably would like to shoot me, I finally figured out my Django woes.

For days, I was having any trouble getting beyond Chapter 7 in The Django Book. There's the spot where the author shows you the template. More specifically, the place where you show the search results in the loop.

For the life of me, I couldn't figure out how to show additional data. Waite beat it into my head that it didn't have anything to do with the data request in the view or model --- i.e., it is the equal of
select * from table
whether I like it or not.

I kept trying to modify
      {% for book in results %}
  • {{ book|escape }}
    {% endfor %}
  • into something like:

    {% for book in results %}
  • {{ book|escape }} {{ anothervariable }}
    {% endfor %}

  • Or

    {% for book in results %}
  • {{ book|escape }} {{ modelname.anothervariable }}
    {% endfor %}


  • And I tried all kinds of different things. I tried Waite's suggestion to do some sequential error checking to identify whether it's the url, the view or the template. But assuming it isn't dumb luck, I discovered something that finally broke through to my slow brain.

    I apparently needed this:


    {% for book in results %}
  • {{ book|escape }} {{ book.anothervariable }}
    {% endfor %}

  • Again, assuming that's what I needed (and this isn't luck), I think I've gotten past the big brain block and hopefully Django will be a little easier to digest. I can already see the awesome and amazing speed with which you can put together an app.

    For some reason, I assumed I needed to reference the model name, apparently forgetting the basics so clearly illustrated here in crayon-like colors for dense-minded people like myself.

    That being said, it's cool I've needed to learn so little Python to make something useful (OK, I haven't made anything useful to anyone ELSE yet). As someone who attempts to use Perl, I wasn't looking forward to the idea of learning another scripting language.

    So thanks to all who helped. And thanks to my random late Friday night (I have no life, apparently) find from Jacob Kaplan-Moss.