Archive for May, 2009

  1. Django test fixtures and contenttypes

    Just came across an interesting problem with the contenttypes contributed application and the test framework.

    If you are using fixtures in the test frame work you might find that the database gets out of date as you are working on it, particularly if you are creating new models all the time.

    To get around this you need to regenerate the contenttypes database. If you depend on this, the following steps could give you problems so make sure that you back up your data (dumpdata) beforehand.

    So first off drop the database:

    python manage.py reset contenttypes

    If the database has foreign key dependancies on contenttypes you will not be able to reset it like that. Use a database administration tool and drop cascade on the django_content_type table instead.

    Then sync the database to create a new contenttypes table:

    python manage.py syncdb

    Now you are ready to dumpdata into a fixture:

    python manage.py dumpdata contenttypes > fixtures/testdata.json
    By timc3 on the
    May 29th, 2009
  2. PostgreSQL for Mac and language support – PLPGSQL

    Seems sometimes the PostgresqlforMac package doesn’t have support out of the box for PLPGSQL or other stored procedure languages and you can’t simply change to the correct user to upgrade it instead call the createlang command like this:

    /Library/PostgreSQL8/bin/createlang -l DATABASE -U USER;

    Obviously changing DATABASE to your database and USER to your user. This will list all the languages enabled for that database.

    To add PL/PGSQL, try this:

    /Library/PostgreSQL8/bin/createlang plpgsql DATABASE -U USER;

    Now you are free to create your functions.

    If you want to save the change for each database that is created, apply the change to template1 database.

    By timc3 on the
    May 26th, 2009
  3. This week in review

    Another week gone by, another update.

    So this week gone by was a bit of a strange one, though probably normal for a Swede, Thursday was off, Friday back to work and then the weekend off. A lot of people take the Friday off from work so Stockholm was beautifully quiet, just like the holiday period.

    So it was more bike rides, around Djurgärden up in to Östermalm and back in to Södermalm.

    We also went for a trip to Saluhallen and bought some really nice Monkfish and other products.

    Also been watching breaking bad, one of the best series that I have seen on TV.

    Sunday we went to Hermans which has a great view of the city.

    By timc3 on the
    May 25th, 2009
  4. Not last years model

    So I was thinking what have I/We bought in the last year that was new..

    Well I think top of the list are:

    • Pioneer plasma TV. We already had TVs but this looks and performs about as well as you can get right now.
    • Harman Kardon 7.1 surround sound amp. We needed a solution for the bedroom and living room for surround sound so I upgraded to this and kept the old amp for the bedroom. It supports Dolby TrueHD and DTS HD MA and all the lesser formats.
    • MacBook – Kristin needed a computer.
    • Cables. New installations require many cables.

    But come to think of it a lot of stuff we have bought secondhand such as tools, bikes and so forth.

    By timc3 on the
    May 23rd, 2009
  5. LastYearsModel

    Really like the idea behind lastyearsmodel.org. Even though I would love new shiny things all the time there doesn’t seem much that point most of the time.

    Examples for me are:

    • iPod. I still have a 30Gb old style model. New touch would be great, but mine still works and plays music well. New iPod touch might be nice when it holds 128Gb+ of music and video
    • Phone. Still using my 2+ year old HTC windows based mobile. I would actually probably use some of the software that I could get on an iPhone, but it still isn’t yet worth the price.
    • Xbox 360. My old Xbox mainly just runs XBMC media centre, the Xbox360 just isn’t as good media player.
    • New dishwasher. My old one isn’t perfect, is a bit noisy, but the hassle of changing something that isn’t quite perfect of this size just isn’t worth it. Besides is better for the environment to get the most out of this one.
    • New kitchen knifes. Who doesn’t like new Kitchen knifes, but the old ones can be sharpened up nicely.
    • Wireless-N router. Wired is better if messier.
    • New speakers. The old ones work ok, but my new amplifier probably deserves something a bit better than 10 year old missions.

    Life just seems to be one upgrade. Or does it.

    By timc3 on the
    May 18th, 2009
  6. The weekend in review

    Seems along time since I have given an update and I guess this is due mainly to lack of time in my part. Since the last update I have been skiing and hanging out some with friends. So this weekend was fairly typical.

    Friday:

    • Finished some design work for work, got the documentation out and built a new version of some Windows software.
    • Went and got Kristin a Kronan miltary bike – really nice.
    • Took it home and then went out to meet friends at Landet.

    woman_red.jpg

    Saturday:

    • Got up far to early and went out for breakfast at a really nice little cafe that we some times go to on Tjärhovsplan. Going to have to find out the name of that place because it has some of the best coffee in east Södermalm.
    • I finally started work on the bedroom. The filler/plaster that I had used to fill in the area surrounding the old door frame was extremely hard and is taking an age to sand down. Think I will be at this for some days.
    • Needed to rest so went to the small park outside the back of our apartment. I think its called Stig Claessons Park, it’s on Beckbrännarbacken, Söder. Stig Claessonwas a writer and illustrator apparently.
    • Then we went out to a chinese in Söder. Also have forgotten the name of it, but its a nice place with good atmosphere, perhaps not the best food in the world though.
    • Later we went to see Coraline in 3D at the cinema. Its an excellent film, visually a real treat.
    • Then I went to see friends in Mariatorget.
    • And on to a warehouse for Office#10 till about 5:30am.

    Sunday:

    • Well got woken up really early..
    • Went and looked at some wallpaper, have perhaps found the shop that we might buy it from if not the wallpaper itself.
    • Brunch at Moseback. This was really nice, they have a buffet, a great view over stockholm and a live jazzband playing. Landet.
    • Went to look at some bikes for me. Probably going to get an old English bike now.
    • Back home again, chill out on the sofa and watched Valkyrie and Traitor. Surprisingly both are actually somewhat ok.
    • Bed!

    In between this I have continued to mess around on my little Javascript project. More details on that soon.

    By timc3 on the
    May 18th, 2009
  7. Star Trek – lovely lens flare

    Seems that the new Star Trek film is getting talked about quite a lot at the moment and quite a lot of it to do with the lens flare used through out the production.

    Startrekposter.jpg

    I must admit that I really liked it, and I am sure a large percentage of that was to do with the look and feel of the film, lens flare included. Yes its geeky, yes its a summer blockbuster, yes its quite puerile – but its good fun and very attractive ( Colorist was Stefan Sonnenfeld ) at the same time.

    startrek-lensflare-spock-tsrimg.jpg

    According to a JJ Abrams interview on io9.com he thought it was too much as well. But that’s not the most interesting thing about the interview, its more his description on how they got the lens effects – literally using powerful torches (Flashlights) aimed at the camera lens, so its not so much digital trickery but good old fashioned optics in the first pass. It was shot on 35mm Kodak film using anamorphic Panavision zooms at a 2.35:1 aspect ratio, so no digital cameras here, just good lenses to help get the best detail currently possible.

    In post additional lens flare was added by ILM. “ILM Sequence Supervisor Todd Vaziri was responsible for developing the artificial lens-flare software system, which the company dubbed SunSpot. The system essentially combines off-the-shelf software, certain proprietary ILM tools, photographed elements, and several custom paint elements to painstakingly match the flares captured on the negative.”

    There is a lot more interesting information over at digitalcontentproducer about the production techniques used.

    Go see it!

    By timc3 on the
    May 13th, 2009