the corner office

a blog, by Colin Pretorius

# getLastModified

Having posted photies the last few days, I realised that the way I handled file serving, meant the app was re-serving the files each time, which clearly wasn't optimal, nooosirree. This prompted a tweak to the app and a visit to HttpServlet's getLastModified() method. I don't think this method gets used too often in web apps because there's so little static content in 'em, but it's exactly what's needed when you want to send an HTTP 304 / Not Modified response to a client who's sent you a If-modified-since header. I'd never come across the method before, hadn't even realised that servlets could handle this so easily.

You just override getLastModified() (which gets called before service()) and return the resource's age if you have it, and the web container takes care of the comparison with the client's header, and sending the proper response back. If the resource hasn't changed, service() doesn't get called. Nifty.

Now to be virtuous I ought to getLastModified-rinse some of the other static resources. I could go ahead and even handle this for plinks and summary pages, since I know when last anything got updated, and for a quiet site like mine, it might be a good idea. I think I might be fscking the cat if I did that, though.

File under: thee_blog, java : {2007.02.26 - 00:07} : Comments (0)

# I wasn't joking...

... when I said our staff, er 'stuff' had arrived:

staff inside

When we spoke to the removals company, we were advised against packing our belongings ourselves. If your goods are marked 'PBO' (packed by owner) it's apparently a guarantee that HM Customs will rip your boxes open and go through all your staff/stuff thoroughly. So even if you have things already stored in boxes, the movers will open the boxes, make a note of the contents, and re-pack them. I don't see what comfort HM Customs draws from boxes labelled 'stuff', but it seems to work for everyone, so I'm not complaining.

That bubble-wrap they use is evil though. It's part-paper and part-plastic, so I don't think it's recyclable. Not only that, but they go apeshit with the wrapping, so that after unwrapping half the furniture we brought over, and only a few boxes, we've already got one full car-load of the stuff to get rid of. The worst part is it's impossible to pop the bubbles!

{2007.02.24 - 23:45} : Comments (0)

# Our stuff is here!

lotsa boxes

Our goodies from South Africa got delivered today. Ouch. Our flat seems fair-sized by UK standards, moreso by modern Joburg matchbox townhouse standards, but our duplex in Northcliff was huge, and over the years, we filled it up.

We flogged the bulk of our furniture when we left, so the majority of items on our 7 page inventory list were boxes. Around 40 boxes make up our book collection (precioussss, precioussss!), and another 50 or 60 are CDs and DVDs and clothes and kitchen and personal crap. We're too sentimental for our own good. We're on a short lease here, so there's no point in unpacking the whole lot now (even if it could fit, which it won't). The plan is to unpack and check everything to make sure it survived the globe-trotting, extract things we really need and want, and then re-pack, re-seal and store the rest until we're in digs which are a little more... spacious.

We got by rather well without our stuff, and in many ways bootstrapping from nothing in a new place was good mental and spiritual housekeeping, but I must say, it's pretty damned comforting to know that everything's with us again.

File under: personal : {2007.02.22 - 23:28} : Comments (0)

# Manto is ill

On a more serious note, I read that Manto Tshabalala-Msimang, Minister of Health and after Dear Leader Mbeki, staunchest proponent of South Africa's embarassing HIV/AIDS non-policy has returned to hospital. She's been sick for a while, recently gave a press conference where she spouted crazy talk, and has now been readmitted into intensive care.

Funny how many of our high-ranking politicans suffer and eventually die from unspecified 'long illnesses'. Now I ain't saying nothing, and really, I have no idea what's wrong with her, but at the very least it raises the possibility; and it would be supremely ironic if she had AIDS herself.

Normally one ought to be sympathetic or respectful, but frankly, Tshabalala-Msimang deserves nothing but scorn. The scale of death and suffering and hardship that this obstinate woman and her stupid, ignorant, and backwards policies have wrought make the atrocities of half the world's war criminals look insignificant in comparison. Will she or her equally guilty boss ever be tried for crimes against humanity?

No matter what her affliction is, I don't care. Let her suffer on for years... only then might she begin to taste the suffering South Africa's millions of AIDS victims have experienced, and will continue to experience for years to come.

File under: politiek : {2007.02.22 - 00:03} : Comments (0)

# Visual Basic in Mono

Miguel de Icaza has blogged about Visual Basic.NET support in Mono:

Today we announced the support of Visual Basic.NET in Mono...

...The new compiler is fascinating because it is a VB 8 compiler (this means that it supports generics), but also because it is written in VB itself. This compiler was sponsored last summer by the Google Summer of Code (2006 edition).

The compiler on my laptop takes 12 seconds to compile itself (78,000 lines of code).

My first thought was 'that must be one helluva laptop'.

Nowadays it feels like it can take up to 12 seconds to compile a 10 line JSP in Websphere Portal. I know I'm comparing apples and gherkins, but still.

File under: techie : {2007.02.21 - 23:17} : Comments (0)

# The odd fauna and flora of Anglia

My entire life, birds chirping outside has meant that the sun is coming up, ie. it's time to go to bed. Tonight, it's 11h30, I'm sitting here at the dining table, tinkering on the laptop, Ronwen's dulcet preggy-snores gentle breathing occasionally emanating from the bedroom, and there's a bird chirping in the tree outside. Is it just confused or are British birds crazy? I feel completely unsettled, for the first time in years I have that guilty 'it's going to be a looong day on 2 hours of sleep' feeling.

On a related note, I always thought daffodils were really pretty flowers. I still think they're pretty, but considering how they're squeezing up absolutely everywhere, I'm mentally reclassifying them as weeds.

File under: personal : {2007.02.20 - 23:37} : Comments (2)

# Blog upgrade didn't break everything!

Cool. I was looking at the blog app's version history, and the last version I'd uploaded to this server was from April last year. So I'm rather pleased that the upgrade went OK: the blog should look no different to what it did half an hour ago, but it's served by the new version, which means it's a huuuge new chunk of code and hanging off of a brand new config system and seems to have made its way through table changes, the lot, without breaking (much).

I picked up a few niggles that need attending to, but they won't take long. Thereafter, I'll get to see how easy this thing is to set up from scratch, because Ronwen wants her own blog, dammit, and I'd best get cracking. She's been waiting patiently for quite some time, poor lass. Once Ronwen's blog is up and running, it'll be time to sling together a download page, sling up some zip files, and wash my hands of this whole blog app thing for a very long time.

File under: thee_blog : {2007.02.20 - 23:20} : Comments (0)

# Firefox restoring sessions

Firefox 2 was released last year, but since I was in the digital wilderness at the time, I sort of missed it, and only got around to upgrading recently.

One thing I don't like about the new Firefox is that the close 'x' icon is now on each browser tab. IIRC early Mozilla browsers did this and I think it's a pity they've regressed. I like having the single close button to the far right, because it's easier to close a number of tabs at once, without having to move the mouse. I find it a bit frustrating when I want to close a lot of tabs and have to move the mouse across the screen to catch 'em all. (Update: there's an about:config setting to restore the behaviour, and more, see comments for a link. Thanks Bryn!)

What is quite nifty is that if the browser crashes (or if it's open when you log off), it prompts you to recover your session, and will re-open all the pages you were visiting when the browser closed/crashed. That feature can also be quite useful for normal browsing, for example, when you're really busy with something and then need to reboot because that's what you sometimes still have to do with Microsoft Windows.

Of course, you can save everything with the Bookmarks > Bookmark All Tabs... option, but if you think restoring your session is really cool and worth using every time you restart Firefox, you can specify that too. Perhaps this option's been around for a while, but I never noticed because Firefox never prompted you on a restart? Either way... it's nice to know the feature is there. Just go to Tools > Options and in the main tab, from the 'When Firefox starts' drop-down, choose 'Show my windows and tabs from last time'.

What was that about never posting tips anymore?

File under: techie : {2007.02.20 - 22:14} : Comments (2)

# A tip: multiline JSP comments

I don't normally do tips, and this is probably fairly obvious to most, but I'll go ahead anyway because I don't really have anything else intelligent to blog about tonight.

The proper way to comment JSPs is to enclose comments in <%-- --%> tags. The only minor annoyance is that the Jasper compiler (and perhaps others, perhaps it's the standard), will still send a newline for each line of JSP comment, so a multiline JSP comment leaves the HTML page with a big chunk of whitespace.

This isn't the end of the world, and you have enough wonky HTML formatting with other JSP tags inserting newlines and mucking up indentation, but I'm always a bit iffy about really mangled HTML. Clean JSP markup is leagues more important than clean HTML, but if it won't hurt your JSP, then better-looking HTML is worth aiming for. Now, I think most modern literature will tell you that Java code in JSP's is evil, and that plain old <% %> tags have no place in modern JSPs. However, the quickest way to get around the miles of whitespace problem, if you consider it to be a problem, is to use normal tags, and use normal Java comments, like so:

<% /* 
    This
    is
    a
    multiline
    comment
*/ %>

That generates only two lines in the HTML page. I don't recall having seen anyone do this before, but I stumbled across a project which did this while looking at a few open-source web apps when I was trying to see how people handled copyright info in their JSPs. I far prefer it to the three main alternatives I found, which seem to be (a) ignore the problem, (b) limit copyright notice to a line or two, and (c) put copyright notices at the end of the page where the whitespace is less noticeable.

I don't think I'd do this in a work environment, where following expected conventions is probably more important than HTML aesthetics, but for a small pet project like, say, the blog, I think it's nifty enough to be worth doing.

File under: java : {2007.02.18 - 23:15} : Comments (0)

# I'm just a peasant in the big shitty

London again, bright lights, big city. I really do like the place. The throng of people is incredible, but my mind always wanders back to how hectic the sewerage systems must be to support that many people in one place.

I feel like a country bumpkin walking around, I'm sure people can tell I'm not a local. It's probably because I'm constantly staring up at buildings and gawking at interesting things. What really piqued my interest this time were the basement flats in Bayswater and Kensington. They must have a really awesome urban jungle vibe, and a little more affordable than the 5-storey terrace houses above them, but living below street level in a city with a real risk of flooding is perhaps a little too adventurous for me. Even out here in the country, the Thames Valley becomes more of a Thames Marsh every time there's a heavy stretch of rain. I'm all for living on high ground, myself.

At least exams are over, for this year. Given the chaos of moving last year I decided to cancel two subjects, so I have another year of studying ahead, but with only two subjects it shouldn't be too much of a stretch. The only frustrating thing is that a postgrad 'Honours' degree by SA standards doesn't exactly map to the UK concept of 'Honours' so I'm working towards a qualification that doesn't seem to mean much to anyone here. I'm so close to finishing though, that I'd be crazy not to see it through.

What I do know is that I'm guilt-free and unburdened for the next month or two. Yippee!

File under: personal, studies : {2007.02.17 - 00:24} : Comments (0)

Next »

meta

-home-
about
contact
disclaimer
articles
code
tech blog

style: [?]
[plain.dark.blue]

Categories

java
linux
music
notes/domino
personal
politiek
studies
techie
thee_blog
world

RSS Feeds

rssfeed all posts
rssfeed all cmts
rssfeed tech posts
rssfeed tech cmts

Archives

2010.09
2010.08
2010.07
2010.06
2010.05
2010.04
2010.03
2010.02
2010.01
2009.12
2009.11
2009.10
2009.09
2009.08
2009.07
2009.06
2009.05
2009.04
2009.03
2009.02
2009.01
2008.12
2008.11
2008.10
2008.09
2008.08
2008.07
2008.06
2008.05
2008.04
2008.03
2008.02
2008.01
2007.12
2007.11
2007.10
2007.09
2007.08
2007.07
2007.06
2007.05
2007.04
2007.03
2007.02
2007.01
2006.12
2006.11
2006.10
2006.09
2006.08
2006.07
2006.06
2006.05
2006.04
2006.03
2006.02
2006.01
2005.12
2005.11
2005.10
2005.09
2005.08
2005.07
2005.06
2005.05
2005.04
2005.03
2005.02
2005.01
2004.12
2004.11
2004.10
2004.09
2004.08
2004.07
2004.06
2004.05
2004.04
2004.03
2004.02
2004.01
2003.12
2003.11
2003.10
2003.09
2003.08
2003.07
2003.06

© Colin Pretorius