Facebook likes to recommend friends for you, and recently it started recommending actions as well. Quite often it's recommending I poke someone, but yesterday I got this:
A recommendation for Facebook: you probably don't need to remind people to catch up with their partner.
Thursday, November 19, 2009
Sunday, November 1, 2009
Log4J Null Pointers
Sometimes you may get a strange error message in your logs coming from Log4J. Depending on what version you're using, you may get odd messages like
LogMananger.repositorySelector was null likely due to error in class reloading, using NOPLoggerRepository
If you're using an older version, you may get a NullPointerException somewhere in the Log4J bowels.
So what's happening? Basically, it's Tomcat being helpful. When you redeploy a webapp to Tomcat (perhaps by using Eclipse in debug mode, or by using the Manager webapp), Tomcat goes and clears out any static fields by setting them to null before reloading. This helps to prevents memory leaks in your webapp.
However, the order in which it does this can't be specified, and if it happens to Log4J before it does another class which uses Log4J somewhere, you can run into the situation where Log4J is essentially broken but other classes are still trying to use it. This can happen on a shutdown hook, but more commonly it'll happen because Tomcat has to use reflection to find out about fields. The associated bug for this issue has more information.
So, what can you do about it? It's actually quite easy to solve: ensure your Log4J jars aren't in your webapp's lib folder -- you could either move them to tomcat/shared/lib, or if you want Tomcat to use Log4J too, move them into tomcat/common/lib. If you're using commons-logging, move that in there too.
The issue is supposedly resolved (ie you could put Log4J in along with your webapp) with Tomcat 5.5.25+ and Log4J 1.2.15+, but I could still reproduce it with 5.5.27 and 1.2.15. I'd recommend you move them into tomcat/common/lib, if only because then you can control Tomcat's logging with Log4j.
NOTE: when you move the jar files, you'll also have to move your log4j.properties or log4j.xml. This has the (possibly welcome) side effect of having one central configuration file, rather than one per webapp.
LogMananger.repositorySelector was null likely due to error in class reloading, using NOPLoggerRepository
If you're using an older version, you may get a NullPointerException somewhere in the Log4J bowels.
So what's happening? Basically, it's Tomcat being helpful. When you redeploy a webapp to Tomcat (perhaps by using Eclipse in debug mode, or by using the Manager webapp), Tomcat goes and clears out any static fields by setting them to null before reloading. This helps to prevents memory leaks in your webapp.
However, the order in which it does this can't be specified, and if it happens to Log4J before it does another class which uses Log4J somewhere, you can run into the situation where Log4J is essentially broken but other classes are still trying to use it. This can happen on a shutdown hook, but more commonly it'll happen because Tomcat has to use reflection to find out about fields. The associated bug for this issue has more information.
So, what can you do about it? It's actually quite easy to solve: ensure your Log4J jars aren't in your webapp's lib folder -- you could either move them to tomcat/shared/lib, or if you want Tomcat to use Log4J too, move them into tomcat/common/lib. If you're using commons-logging, move that in there too.
The issue is supposedly resolved (ie you could put Log4J in along with your webapp) with Tomcat 5.5.25+ and Log4J 1.2.15+, but I could still reproduce it with 5.5.27 and 1.2.15. I'd recommend you move them into tomcat/common/lib, if only because then you can control Tomcat's logging with Log4j.
NOTE: when you move the jar files, you'll also have to move your log4j.properties or log4j.xml. This has the (possibly welcome) side effect of having one central configuration file, rather than one per webapp.
Monday, October 5, 2009
On the Importance of Scope
Those of you who know me may think I'm going to harp on about JavaScript again. No, this time it's about Spring.
Spring is good for wiring up your beans with any services it may need. You do this in XML traditionally, by declaring beans:
<bean id="lieschke">
<property name="doc" value="true"></property>
</bean>
You can then use this bean inside other beans:
<bean id="webArchitecting">
<property name="architect" ref="lieschke"></property>
</bean>
The problem is that with this bean declaration is that Spring, by default, will only make one instance of the lieschke bean. This is a problem if you need your bean to not be a singleton; perhaps if you give it a database connection which you wouldn't want it to hang onto for a long time.
The solution is the scope property. Using this property, we can say that we want a new instance every time:
<bean id="lieschke" scope="prototype">
<property name="doc" value="true"></property>
</bean>
All very easy and all, but why isn't it this by default?
Saturday, September 26, 2009
Jonathan Coulton Playing London in November
Jonathan Coulton, everybody's favourite troubadour, is playing London on 13 Movember.
I've booked my tickets, but if you want some you'd better get them soon -- there are 24 available today, but there were 49 this time yesterday!
I've booked my tickets, but if you want some you'd better get them soon -- there are 24 available today, but there were 49 this time yesterday!
Wednesday, August 12, 2009
Saturday, July 4, 2009
Profiling in Eclipse
Recently I had to analyse some code I'd written to work out why it was running so slowly. And it was running pig-in-the-mud slowly too, not just little-old-lady-going-shopping slowly. This thing was almost going backwards.
So I decided to bust out the profiler. It's my fervent belief that you shouldn't optimise code just because you think something might be slow; you have to know that it's slow. This is what a profiler excels at, and it sure beats System.out.println.
I'd previously had some exposure to JProfiler, which is excellent. Unfortunately though, it has a non-zero pricetag, which is often a barrier. I instead decided to investigate Eclipse's profiling solution.
The official one seems to be the Eclipse Test and Performance Tools Platform Project (there are others, but this one is officially hosted). This is also not a solution, because it is awful. It ran out of memory when I naively ran it with the default settings, and still ran out as I filtered the settings back to only profiling a few particular classes. In the end, the only way I could get it to work was to pare it back to only a handful of classes, which wasn't very useful.
The best solution out there is actually in NetBeans. If you hate the IDE, don't worry, you don't have to use it. Under the profiling menu, there is a command to attach to a remote process. Just fire your process up with the correct arguments -- NetBeans gives you these -- and your app will obediently wait until the profiler is started. Then you get profiling goodness in NetBeans (which works with the default settings), and the luxury of Eclipse. It's pretty much the best of both worlds, and unlike JProfiler it's free. Give it a try.
So I decided to bust out the profiler. It's my fervent belief that you shouldn't optimise code just because you think something might be slow; you have to know that it's slow. This is what a profiler excels at, and it sure beats System.out.println.
I'd previously had some exposure to JProfiler, which is excellent. Unfortunately though, it has a non-zero pricetag, which is often a barrier. I instead decided to investigate Eclipse's profiling solution.
The official one seems to be the Eclipse Test and Performance Tools Platform Project (there are others, but this one is officially hosted). This is also not a solution, because it is awful. It ran out of memory when I naively ran it with the default settings, and still ran out as I filtered the settings back to only profiling a few particular classes. In the end, the only way I could get it to work was to pare it back to only a handful of classes, which wasn't very useful.
The best solution out there is actually in NetBeans. If you hate the IDE, don't worry, you don't have to use it. Under the profiling menu, there is a command to attach to a remote process. Just fire your process up with the correct arguments -- NetBeans gives you these -- and your app will obediently wait until the profiler is started. Then you get profiling goodness in NetBeans (which works with the default settings), and the luxury of Eclipse. It's pretty much the best of both worlds, and unlike JProfiler it's free. Give it a try.
Tuesday, June 30, 2009
Standards
I'm somewhat of a mobile network junkie. I'm on my third one now, and this is only my fourth month in the UK. This last move is due to a unfortunate situation where we had to take out another contract to get a stolen phone replaced, but that's another story.
I could never have done this back in NZ. Aside from the fact that there were only two networks when I left, they were both completely incompatible with each other. So, if I wanted to jump ship, I had to get a whole new phone.
In the UK, all the networks use GSM or one of its successors. This means that as long as I'm not tied into a lengthy contract, I can flit around them and choose whoever has the best deal. And there are plenty of deals out there; you can pay £10 and get a rolling contract that will give you 100 mins and 300 texts (you can get slightly more of one and slightly less of the other depending on which network you choose).
I can't help but wonder what the mobile situation would have been like in NZ if the networks were compatible with each other. A rumour I've heard was that when Telecom NZ were setting up their network, the government of the time forced them to use CDMA because they thought it would be better for consumers if there was more competition -- ie if they used a different technology to BellSouth's GSM.
Unfortunately, that reasoning has been shown to be wrong. The most competition occurs when there is a level playing field, as players must differentiate themselves on other grounds. This is actually a better situation for companies; they are flexible, innovative, and up for a challenge. If consumers don't like what they get from you, they can always jump to a competitor.
What I'd like you to remember is that standards, and a homogeneous culture, is a very good thing for consumers. It lowers the barrier of entry for you, the producer, and for you, the consumer. The World Wide Web is another pertinent example; it's difficult to see how it could have taken off if everyone wasn't speaking HTTP and HTML, and if consumers couldn't easily switch between browsers.
There are risks; some people like to complain about the Microsoft culture: in particular, how having a massive install base of Windows is harmful as it is easier to attack. Companies may also see locking consumers into their own proprietary technology is an advantage. While these are both true to some extent, I would argue that the benefits of standards outweigh these. Please use standards. They're good for you!
PS Some of you may be thinking "why, CDMA is a standard just like GSM". This is true; but perhaps GSM was just a little more standard than CDMA :)
I could never have done this back in NZ. Aside from the fact that there were only two networks when I left, they were both completely incompatible with each other. So, if I wanted to jump ship, I had to get a whole new phone.
In the UK, all the networks use GSM or one of its successors. This means that as long as I'm not tied into a lengthy contract, I can flit around them and choose whoever has the best deal. And there are plenty of deals out there; you can pay £10 and get a rolling contract that will give you 100 mins and 300 texts (you can get slightly more of one and slightly less of the other depending on which network you choose).
I can't help but wonder what the mobile situation would have been like in NZ if the networks were compatible with each other. A rumour I've heard was that when Telecom NZ were setting up their network, the government of the time forced them to use CDMA because they thought it would be better for consumers if there was more competition -- ie if they used a different technology to BellSouth's GSM.
Unfortunately, that reasoning has been shown to be wrong. The most competition occurs when there is a level playing field, as players must differentiate themselves on other grounds. This is actually a better situation for companies; they are flexible, innovative, and up for a challenge. If consumers don't like what they get from you, they can always jump to a competitor.
What I'd like you to remember is that standards, and a homogeneous culture, is a very good thing for consumers. It lowers the barrier of entry for you, the producer, and for you, the consumer. The World Wide Web is another pertinent example; it's difficult to see how it could have taken off if everyone wasn't speaking HTTP and HTML, and if consumers couldn't easily switch between browsers.
There are risks; some people like to complain about the Microsoft culture: in particular, how having a massive install base of Windows is harmful as it is easier to attack. Companies may also see locking consumers into their own proprietary technology is an advantage. While these are both true to some extent, I would argue that the benefits of standards outweigh these. Please use standards. They're good for you!
PS Some of you may be thinking "why, CDMA is a standard just like GSM". This is true; but perhaps GSM was just a little more standard than CDMA :)
Saturday, June 20, 2009
What is a Browser?
When you work in technology, it's sometimes hard to remember that most people don't speak the same language as you. This is a good reminder of what regular people think a browser is.
Via Mauricio Freitas
Via Mauricio Freitas
Sunday, May 3, 2009
On SSDs and battery life
Some time ago, the gadget websites posted a link to some empirical testing of netbook batteries. The observant reader will note that my netbook, the Dell Mini 9, fits in about halfway down the list. What's interesting about these results is that the Mini has the smallest battery capacity of all the netbooks on the list.
The Asus 1000H has double the battery capacity of the Mini, but it also has a regular hard disk. It only gets an extra 20 minutes or so of battery life (the other specifications are mostly the same as the Mini).
From this I think we can conclude that solid state drives are more power efficient than their regular counterparts in laptops. This was a common belief before an article in Tom's Hardware claimed they weren't; if we believe the results in this test, which might be a little bit more indicative of real use, rather than the tests used by Tom et al.
The Asus 1000H has double the battery capacity of the Mini, but it also has a regular hard disk. It only gets an extra 20 minutes or so of battery life (the other specifications are mostly the same as the Mini).
From this I think we can conclude that solid state drives are more power efficient than their regular counterparts in laptops. This was a common belief before an article in Tom's Hardware claimed they weren't; if we believe the results in this test, which might be a little bit more indicative of real use, rather than the tests used by Tom et al.
Thursday, April 30, 2009
Late to the Party: Google App Engine
One thing I always meant to try out was the Google App Engine. Now that I have a bit of time on my hands, I thought it would be an excellent time to give it a go.
If you're not familiar with GAE, it launched quite a while ago with solely Python support. Recently they added experimental Java support, with mixed feelings from Simon Phipps. I wasn't interested in the Java support -- I wanted the Python!
For a simple test case I wrote a twitter spammer -- it will ping my twitter account every time I write a new blog post. This will hopefully encourage traffic to my blog, and will hopefully be complex enough to let me try out all the main features of GAE.
One of the things I enjoyed most was the persistence model. Instead of having to define a database structure to accompany your objects, you just define your object with appropriate database strings. Your object is magically persisted when you go object.put().
Another thing I enjoyed was the templating. While the example starts you off by manually writing data out into the response, it's fairly easy to start using a template, and not that much more complex to start automatically creating things like forms.
The thing is though that these features are both provided by Django (well, the persistence model is more inspired by it). Given that the two main features I like aren't really features of GAE, what does it have going for it?
It's free
The most compelling reason to use GAE is that it's free and always available. Instead of having to pay for hosting for your Python (or Java) app, you get to run it on Google's hardware (until your app becomes too popular, when you'll have to start paying).
It has elegant cron
Cron jobs aren't really that difficult to set up in Unix, but Google's implementation is particularly elegant. You define a URL to hit, and then specify your cron pattern. I really like how they used a regular URL to implement this rather than making you define a script you want to run -- it's simple, and it works.
It's Google
Not much of a reason, I know, but while I had heard of Django I never got around to using it. GAE got me to use something I had wanted to play with not by virtue of the technology, but by its brandname. Who knows what else I'll come across in the course of developing my app that I wouldn't normally.
If you haven't had a chance to give it a whirl, I'd recommend you give it a try. Let me know what you think of the Java support.
If you're not familiar with GAE, it launched quite a while ago with solely Python support. Recently they added experimental Java support, with mixed feelings from Simon Phipps. I wasn't interested in the Java support -- I wanted the Python!
For a simple test case I wrote a twitter spammer -- it will ping my twitter account every time I write a new blog post. This will hopefully encourage traffic to my blog, and will hopefully be complex enough to let me try out all the main features of GAE.
One of the things I enjoyed most was the persistence model. Instead of having to define a database structure to accompany your objects, you just define your object with appropriate database strings. Your object is magically persisted when you go object.put().
Another thing I enjoyed was the templating. While the example starts you off by manually writing data out into the response, it's fairly easy to start using a template, and not that much more complex to start automatically creating things like forms.
The thing is though that these features are both provided by Django (well, the persistence model is more inspired by it). Given that the two main features I like aren't really features of GAE, what does it have going for it?
It's free
The most compelling reason to use GAE is that it's free and always available. Instead of having to pay for hosting for your Python (or Java) app, you get to run it on Google's hardware (until your app becomes too popular, when you'll have to start paying).
It has elegant cron
Cron jobs aren't really that difficult to set up in Unix, but Google's implementation is particularly elegant. You define a URL to hit, and then specify your cron pattern. I really like how they used a regular URL to implement this rather than making you define a script you want to run -- it's simple, and it works.
It's Google
Not much of a reason, I know, but while I had heard of Django I never got around to using it. GAE got me to use something I had wanted to play with not by virtue of the technology, but by its brandname. Who knows what else I'll come across in the course of developing my app that I wouldn't normally.
If you haven't had a chance to give it a whirl, I'd recommend you give it a try. Let me know what you think of the Java support.
Saturday, April 25, 2009
Face Recognition in Flickr
It is a truth universally acknowledged that Flickr has a load of APIs. Recently, a website named Polar Rose has emerged, which offers to run face recognition over your Flickr photos.
Note that I'm not calling it face detection, which is merely being able to find a face, but face recognition -- it should be able to know who the face is. This is quite a tough problem: I remember coding face detection at University wasn't that easy.
So, I added my photos and gave it a go. There's a processing time delay as it sucks everything out of Flickr (they estimated 30 mins for my 700 odd photos). After it's done, you get to start naming people: it pops up a face, asking who it is. When you tell it, it shows you similar faces and asks if these are also the same person.
My experience started smoothly. The first picture it chose was one of me, wearing sunglasses. Adding my name was easy enough, but then the subsequent pictures were all of my girlfriend, also wearing sunglasses. Not a good start overall.
As I kept tagging faces, I was generally impressed by the face detection. It seemed to be picking most faces, even partly obscured ones. I was less enamoured by the recognition, which seemed to find at most maybe two other photos of the same person.
Eventually though, it all got a bit silly. It kept asking me to identify people I had already said I didn't want to, and started showing faces that weren't even faces. I suggest the threshold for what is considered a face might need to be adjusted a bit higher, as by the end I was getting almost an even ratio between faces and non-faces.
Although I read it would tag my original Flickr photos with the names of the people I'd chosen, I checked the originals and couldn't see any. While I can understand this -- if you can browse pictures of people through tags on Flickr, why would you use Polar Rose -- it's a little bit sad in this era of openness.
Overall, I'd recommend Polar Rose as an entertaining way to spend a rainy afternoon. I don't think I'll be coming back frequently though; the face recognition gimmick quickly wears thin, and its accuracy deteriorates quite rapidly.
Update: if I was friends with William Shatner, I'd be in more luck.
Note that I'm not calling it face detection, which is merely being able to find a face, but face recognition -- it should be able to know who the face is. This is quite a tough problem: I remember coding face detection at University wasn't that easy.
So, I added my photos and gave it a go. There's a processing time delay as it sucks everything out of Flickr (they estimated 30 mins for my 700 odd photos). After it's done, you get to start naming people: it pops up a face, asking who it is. When you tell it, it shows you similar faces and asks if these are also the same person.
My experience started smoothly. The first picture it chose was one of me, wearing sunglasses. Adding my name was easy enough, but then the subsequent pictures were all of my girlfriend, also wearing sunglasses. Not a good start overall.
As I kept tagging faces, I was generally impressed by the face detection. It seemed to be picking most faces, even partly obscured ones. I was less enamoured by the recognition, which seemed to find at most maybe two other photos of the same person.
Eventually though, it all got a bit silly. It kept asking me to identify people I had already said I didn't want to, and started showing faces that weren't even faces. I suggest the threshold for what is considered a face might need to be adjusted a bit higher, as by the end I was getting almost an even ratio between faces and non-faces.
Although I read it would tag my original Flickr photos with the names of the people I'd chosen, I checked the originals and couldn't see any. While I can understand this -- if you can browse pictures of people through tags on Flickr, why would you use Polar Rose -- it's a little bit sad in this era of openness.
Overall, I'd recommend Polar Rose as an entertaining way to spend a rainy afternoon. I don't think I'll be coming back frequently though; the face recognition gimmick quickly wears thin, and its accuracy deteriorates quite rapidly.
Update: if I was friends with William Shatner, I'd be in more luck.
Thursday, April 2, 2009
A Keyboard Conundrum
One thing you very quickly notice about life in the UK is the difference in keyboards. Although I've been here for over a month now, I still don't remember that the @ symbol is down by the semicolon instead of up above 2 (that's where you'll find the double quotation mark).
The other change I notice is that the # symbol has its own dedicated key instead of being above 3, which is where the £ hangs out (which is fairly amusing if you think about how our American friends refer to # as "pound"). This is obviously sensible, though I do wonder why they simply didn't replace $ with £ and move the former to be a secondary key, like the Euro symbol.
But I really don't understand the logic behind @ and ". My usual answerer of tricky questions, Wikipedia, is exceedingly knowledgeable about the differences between the British keyboard and what I would call 'the normal one', but is surprisingly quiet about the reasons behind the key-switcheroo.
I suspect this will remain a mystery unless I decide to fork out £32 for a copy of BS 4822, but I would love it if somebody out there could tell me why the @ symbol is in a different place on the British keyboard?
The other change I notice is that the # symbol has its own dedicated key instead of being above 3, which is where the £ hangs out (which is fairly amusing if you think about how our American friends refer to # as "pound"). This is obviously sensible, though I do wonder why they simply didn't replace $ with £ and move the former to be a secondary key, like the Euro symbol.
But I really don't understand the logic behind @ and ". My usual answerer of tricky questions, Wikipedia, is exceedingly knowledgeable about the differences between the British keyboard and what I would call 'the normal one', but is surprisingly quiet about the reasons behind the key-switcheroo.
I suspect this will remain a mystery unless I decide to fork out £32 for a copy of BS 4822, but I would love it if somebody out there could tell me why the @ symbol is in a different place on the British keyboard?
Monday, March 23, 2009
Dell Mini 9 Quick Review
When Leah and I arrived in the UK, we didn't have a laptop. This made it quite hard to apply for jobs, so one of the first things we did was order one.
Our requirements were fairly simple. I didn't want to get a full-blown beast with Vista etc because Windows 7 is just around the corner, and Vista is sometimes painful to use (the observant reader will recall I have had a good experience with Windows 7). I also didn't want a desktop because we're not planning to be too settled over here, and we don't want to have to lug it around.
That pretty much left netbooks, and it just so happened that Dell had a special on. We bought the model with an 8GB SSD and 1GB RAM with Ubuntu for £189, which was £70 off. It took its sweet time arriving, but eventually a shiny new Dell Mini arrived in the mail. You can check out the unboxing pics.
The first thing you notice about the Mini is not the size -- you expect it to be small. The first thing you notice is that it's completely silent. It doesn't have any fans, and the silence is lovely.
After using it for a while, the next thing you notice is how cramped the keyboard is. The keys on it are really close together, and while the alphabet characters are ok, the punctuation keys really suffer. The apostrophe key is right next to enter, and when I go for it I often get enter instead. This makes me look really stupid on Skype. The 10" model probably won't suffer from such problems (the HP Mini has a keyboard that's 92% the size of a normal one), and eventually you do get used to it. It means though that when you use a regular sized keyboard it feels giant.
The Mini comes with a Dell custom launcher that gives you easy access to common apps. I turned it off fairly quickly; there was plenty of razzle dazzle in it, and it looks ok, but I'm quite happy with the default layout. I might turn it on again once I've finished exploring and I know which apps I normally use.
The battery life is meant to be pretty phenomenal; Ubuntu is estimating I have 4h of battery time remaining on a full charge. I'm using the wireless connection, but just surfing the web (no video or anything). So far it looks accurate.
The one really annoying thing was the trackpad. It has tap to click enabled by default, and if you don't know the magic to disable it after you press a key, you end up accidentally clicking when you go for the space bar. You can disable tap to click temporarily by using syndaemon.
Other than that, there's nothing really wrong with this netbook. It supposedly comes with a slot for a SIM card, so I'm going to pop the battery out and check if mine has one. If it does -- internet anywhere, baby!
Our requirements were fairly simple. I didn't want to get a full-blown beast with Vista etc because Windows 7 is just around the corner, and Vista is sometimes painful to use (the observant reader will recall I have had a good experience with Windows 7). I also didn't want a desktop because we're not planning to be too settled over here, and we don't want to have to lug it around.
That pretty much left netbooks, and it just so happened that Dell had a special on. We bought the model with an 8GB SSD and 1GB RAM with Ubuntu for £189, which was £70 off. It took its sweet time arriving, but eventually a shiny new Dell Mini arrived in the mail. You can check out the unboxing pics.
The first thing you notice about the Mini is not the size -- you expect it to be small. The first thing you notice is that it's completely silent. It doesn't have any fans, and the silence is lovely.
After using it for a while, the next thing you notice is how cramped the keyboard is. The keys on it are really close together, and while the alphabet characters are ok, the punctuation keys really suffer. The apostrophe key is right next to enter, and when I go for it I often get enter instead. This makes me look really stupid on Skype. The 10" model probably won't suffer from such problems (the HP Mini has a keyboard that's 92% the size of a normal one), and eventually you do get used to it. It means though that when you use a regular sized keyboard it feels giant.
The Mini comes with a Dell custom launcher that gives you easy access to common apps. I turned it off fairly quickly; there was plenty of razzle dazzle in it, and it looks ok, but I'm quite happy with the default layout. I might turn it on again once I've finished exploring and I know which apps I normally use.
The battery life is meant to be pretty phenomenal; Ubuntu is estimating I have 4h of battery time remaining on a full charge. I'm using the wireless connection, but just surfing the web (no video or anything). So far it looks accurate.
The one really annoying thing was the trackpad. It has tap to click enabled by default, and if you don't know the magic to disable it after you press a key, you end up accidentally clicking when you go for the space bar. You can disable tap to click temporarily by using syndaemon.
Other than that, there's nothing really wrong with this netbook. It supposedly comes with a slot for a SIM card, so I'm going to pop the battery out and check if mine has one. If it does -- internet anywhere, baby!
Friday, February 27, 2009
Not Dead
Just a quick note -- I know I haven't posted for a while, but it's not because I've been hit by a no. 74 bus. I've just moved from Auckland to London (via a one week holiday in San Francisco).
Leah and I have started a travelling blog to update everybody -- this is also suffering from some neglect as we're using the internet at the library -- but the address is http://leahandstuart.spmiller.net. We'll update it when we can.
Leah and I have started a travelling blog to update everybody -- this is also suffering from some neglect as we're using the internet at the library -- but the address is http://leahandstuart.spmiller.net. We'll update it when we can.
Wednesday, February 4, 2009
Fully Licensed
I sat my full driver's licence test yesterday, and I'm pleased to report I passed. The test was much less stressful than I had anticipated; I was purposely trying to keep myself calm beforehand because last time I made a few mistakes solely due to nerves.
I had a lovely testing officer from Invercargill. He was relieving a Dunedin officer, who had to go up to Oamaru to train a new one there. He seemed to enjoy the change of scenery, and tried to chat a bit with me (I wasn't falling for that one -- if you chat you get distracted). He also helped me through the hazard identification section: after I did the first one, he told me how I should have said it rather than failing me on that one and moving on.
In terms of geekery -- and I'm sure that's what you, gentle reader, are interested in -- there is a website called Practice, which eventually send you out a CD-ROM. This CD has interactive exercises which simulate you driving and get you to click on the hazards. I used this, and I found it very useful when I had to do the real thing. I think it also made me use my side mirrors more.
I haven't driven anywhere that I couldn't on my restricted yet. Maybe I should make somebody sit in the back seat next time I drive.
I had a lovely testing officer from Invercargill. He was relieving a Dunedin officer, who had to go up to Oamaru to train a new one there. He seemed to enjoy the change of scenery, and tried to chat a bit with me (I wasn't falling for that one -- if you chat you get distracted). He also helped me through the hazard identification section: after I did the first one, he told me how I should have said it rather than failing me on that one and moving on.
In terms of geekery -- and I'm sure that's what you, gentle reader, are interested in -- there is a website called Practice, which eventually send you out a CD-ROM. This CD has interactive exercises which simulate you driving and get you to click on the hazards. I used this, and I found it very useful when I had to do the real thing. I think it also made me use my side mirrors more.
I haven't driven anywhere that I couldn't on my restricted yet. Maybe I should make somebody sit in the back seat next time I drive.
Tuesday, January 27, 2009
When is a permanent redirection not permanent?
Let's say I have a flatmate called John. One day, his friend Simon rings:
This, ladies and gentleman, is the difference between a temporary redirection and a permanent redirection. Those of us in the know call them a 302 and a 301. They behave exactly like I've described above -- if the server sends a 302, the client should keep checking back with the server for the resource in case its URL changes.
If it sends back a 301 though, it's permanent. Never going to change. Never. So, the client may as well remember that, and indeed, this is what the spec says:
So, any decent browser worth its salt will be caching this response, right? Wrong. Although there have been posts asking about this, it turns out that the neither Firefox nor Internet Explorer cache any kind of 3xx redirection. The only one I've come across that does is Google Chrome (as also noted by Mauricio Scheffer).
This is really annoying, and I spent a morning tearing out my hair trying to understand why this wasn't working. Hopefully this post means somebody else loses a bit less time.
So, in summary:
Google Chrome: good
Firefox: bad
Internet Explorer: bad
If you want to test your browser, I recommend the excellent suite of tests written by Mark Nottingham. He has also written an excellent introductory guide to caches, which I suggest you read to understand this area.
Simon: "Hello, is John there please?"No problems here. But eventually, John decides to move in with his girlfriend, but forgets to tell Simon the exact date.
Me: "No, he's at his girlfriend's this afternoon. Her number is ..."
Simon: "Ok, thanks."
Simon: "Hello, is John there please?"So, now I no longer have a flatmate called John. Then, one day:
Me: "No, he's moved in with his girlfriend. His new number is ..."
Simon: "Ok, thanks."
Simon: "Hello, is John there please?"Then another day:
Me: "No, he moved out, remember? His new number is ..."
Simon: "Ok, thanks."
Simon: "Hello, is John there please?"This is obviously wrong. When John was out for the afternoon, it was okay for Simon to ring and ask for John. But when I told Simon that John no longer lives here, Simon should just remember John's new number and start ringing that instead.
Me: "No, I told you before, his new number is ..."
Simon: "Ok, thanks."
This, ladies and gentleman, is the difference between a temporary redirection and a permanent redirection. Those of us in the know call them a 302 and a 301. They behave exactly like I've described above -- if the server sends a 302, the client should keep checking back with the server for the resource in case its URL changes.
If it sends back a 301 though, it's permanent. Never going to change. Never. So, the client may as well remember that, and indeed, this is what the spec says:
This response is cacheable unless indicated otherwise.(Note that the spec never really says "Cache it, or else" -- it only gets worked up over things that aren't cacheable.)
So, any decent browser worth its salt will be caching this response, right? Wrong. Although there have been posts asking about this, it turns out that the neither Firefox nor Internet Explorer cache any kind of 3xx redirection. The only one I've come across that does is Google Chrome (as also noted by Mauricio Scheffer).
This is really annoying, and I spent a morning tearing out my hair trying to understand why this wasn't working. Hopefully this post means somebody else loses a bit less time.
So, in summary:
Google Chrome: good
Firefox: bad
Internet Explorer: bad
If you want to test your browser, I recommend the excellent suite of tests written by Mark Nottingham. He has also written an excellent introductory guide to caches, which I suggest you read to understand this area.
Sunday, January 25, 2009
Stuart Miller: Bug Disposer
One of the things I like doing most is getting rid of bugs. Today Leah called me into the bathroom sounding very worried: she could see a blurry oval shape (her eyes aren't so good without glasses). Anyway, this is what I found:
That's right, a big uglyhuhu beetle cockroach! After wondering what to do, I eventually managed to capture him in a chinese food container (note: this was harder than it sounds. He was very quick, and would go running at the mere sight of the container. Luckily I think the camera flash stunned him so I took a few (bad) photos before I got the container on).
We took him down to the bushes outside our apartment and released him, so it all ended well after all.
For the rest of the pictures, head over to Flickr.
UPDATE: turns out it's not a huhu beetle, it was a cockroach. So, instead of saving a native bug, I saved a pest. Awesome. Thanks Tom.
That's right, a big ugly
We took him down to the bushes outside our apartment and released him, so it all ended well after all.
For the rest of the pictures, head over to Flickr.
UPDATE: turns out it's not a huhu beetle, it was a cockroach. So, instead of saving a native bug, I saved a pest. Awesome. Thanks Tom.
Thursday, January 22, 2009
Windows 7 Mini Review
I've been using Windows 7 for about a week now, and I have to say -- it's pretty sweet. This is my completely subjective review.
Startup
Windows 7 makes my computer feel faster. I'm not running on the fastest hardware here -- I've got a 2.4Ghz P4 with 768MB RAM (the minimum specs call for 1Ghz and 1GB). With XP, it takes an age to get to the desktop, and even once you can see the desktop it takes a long time for it to actually be usable.
With 7, it starts up in roughly the same time, but the desktop is usable as soon as you can see it. While this feature was new in Vista, my computer doesn't spend ages on the "preparing your desktop" screen I have seen on Vista computers.
Using Windows 7
Applications load snappily in 7, and I have yet to see the freezes that sometimes occur in XP. I can't decide whether to put this down to 7 or the fact that it's just a new installation -- time will tell.
The best thing I can say about it is that there's nothing really bad about it. I like the little improvements, like how when I drag a file it explicitly says "move to..." and "copy to..." rather than rely on an icon. I like how when I minimise an application that's doing something, it displays the progress bar in the application's thumbnail in the start menu (I don't like how it takes focus when it's done). I like how I can set my desktop backgrounds to rotate through pictures, and I like that there's localisation features in the built-in themes (in the US at least, it'll show you a different background depending on where you live).
There's definitely a lot to like about 7. But, there's one thing I'm not sold on.
The Taskbar
In 7, Microsoft has decided to go a bit OS X-y and has turned the taskbar into more like a dock. Instead of having a separate window for every application you have open, you just have an icon for every application. Clicking that icon lets you visually choose between the different windows your application has open (and in Internet Explorer's case, the different tabs it has in all of its windows). This means I can't quickly see how many windows I have open (something I found myself trying to do when I was wondering which window a site I had opened was in).
I guess it's not really bad -- it's just different and new, and I haven't gotten used to it yet. It's interesting though that this is the only feature that I haven't loved at first use.
Overall
When you look at the entire product, there's not much wrong with it. It hasn't crashed once (remarkable, from a beta), it's fast, it found all my device drivers, and there are several new features that are great.
The Windows 7 beta is what Vista should have been. While it looks like Vista in many places, it doesn't get in your face like Vista sometimes does. I may or may not have User Account Control turned on -- the key thing here is that I don't know. That pretty much sums it up: this version of Windows gets out of the way and lets you do your work, and that's the best compliment you can pay an operating system.
Postscript
It would be remiss of me not to mention that the end-game effects in Solitaire and the other games have changed. In every previous version of Solitaire, the cards would bounce around and fill up the screen. Now they fall down from the top and shatter on the bottom. The other games, like Spider Solitaire, still feature the fireworks, but now they're 3D and pretty.
My games reviewer, Leah, would like it known that the Solitaire effect is not as good as the old one, but that the fireworks are much better.
Startup
Windows 7 makes my computer feel faster. I'm not running on the fastest hardware here -- I've got a 2.4Ghz P4 with 768MB RAM (the minimum specs call for 1Ghz and 1GB). With XP, it takes an age to get to the desktop, and even once you can see the desktop it takes a long time for it to actually be usable.
With 7, it starts up in roughly the same time, but the desktop is usable as soon as you can see it. While this feature was new in Vista, my computer doesn't spend ages on the "preparing your desktop" screen I have seen on Vista computers.
Using Windows 7
Applications load snappily in 7, and I have yet to see the freezes that sometimes occur in XP. I can't decide whether to put this down to 7 or the fact that it's just a new installation -- time will tell.
The best thing I can say about it is that there's nothing really bad about it. I like the little improvements, like how when I drag a file it explicitly says "move to..." and "copy to..." rather than rely on an icon. I like how when I minimise an application that's doing something, it displays the progress bar in the application's thumbnail in the start menu (I don't like how it takes focus when it's done). I like how I can set my desktop backgrounds to rotate through pictures, and I like that there's localisation features in the built-in themes (in the US at least, it'll show you a different background depending on where you live).
There's definitely a lot to like about 7. But, there's one thing I'm not sold on.
The Taskbar
In 7, Microsoft has decided to go a bit OS X-y and has turned the taskbar into more like a dock. Instead of having a separate window for every application you have open, you just have an icon for every application. Clicking that icon lets you visually choose between the different windows your application has open (and in Internet Explorer's case, the different tabs it has in all of its windows). This means I can't quickly see how many windows I have open (something I found myself trying to do when I was wondering which window a site I had opened was in).
I guess it's not really bad -- it's just different and new, and I haven't gotten used to it yet. It's interesting though that this is the only feature that I haven't loved at first use.
Overall
When you look at the entire product, there's not much wrong with it. It hasn't crashed once (remarkable, from a beta), it's fast, it found all my device drivers, and there are several new features that are great.
The Windows 7 beta is what Vista should have been. While it looks like Vista in many places, it doesn't get in your face like Vista sometimes does. I may or may not have User Account Control turned on -- the key thing here is that I don't know. That pretty much sums it up: this version of Windows gets out of the way and lets you do your work, and that's the best compliment you can pay an operating system.
Postscript
It would be remiss of me not to mention that the end-game effects in Solitaire and the other games have changed. In every previous version of Solitaire, the cards would bounce around and fill up the screen. Now they fall down from the top and shatter on the bottom. The other games, like Spider Solitaire, still feature the fireworks, but now they're 3D and pretty.
My games reviewer, Leah, would like it known that the Solitaire effect is not as good as the old one, but that the fireworks are much better.
Monday, January 19, 2009
Spammers in Gmail
I recently got an email from my brother. It reads as follows:
My brother may be in Germany at the moment, but his English is much better than that. It was pretty clear his account had been spoofed as the reply to address.
Or was it? I took a look at the headers, and I was surprised to see that Gmail reckoned it had been sent by gmail.com. This is the whole domain-keys thing which is meant to prevent spam; surely it couldn't have been spoofed?
As it turns out, it wasn't. My brother found out that somebody in China (or at least whose IP address, 115.49.89.238, resolved back to China) had logged into his account and had sent the email to his address book. Somehow they had gotten his password; we're not sure how yet.
I've gotten him to run an antivirus scan with AVG and Avast, and an anti-spyware scan. Nothing has turned up on his laptop, so I can only assume he was caught on somebody else's machine.
The moral of the story is be careful where you log into your email from. It's altogether too easy to be blasé about it and assume that nobody could possibly be interested in your email, but my brother's case shows that anybody can be targetted.
And, the most important thing: change your password regularly, and don't reuse it for different sites.
Dear sir/madam,
We are an international electronic company. sell high quality low price
products, like IPOD, laptop, LCD TV, camera, mobile and so on. Welcome to visit
them, please visit our Web site:{redacted}
Online MSN/Mail:redacted disturb your precious time understanding. Best
wishes
My brother may be in Germany at the moment, but his English is much better than that. It was pretty clear his account had been spoofed as the reply to address.
Or was it? I took a look at the headers, and I was surprised to see that Gmail reckoned it had been sent by gmail.com. This is the whole domain-keys thing which is meant to prevent spam; surely it couldn't have been spoofed?
As it turns out, it wasn't. My brother found out that somebody in China (or at least whose IP address, 115.49.89.238, resolved back to China) had logged into his account and had sent the email to his address book. Somehow they had gotten his password; we're not sure how yet.
I've gotten him to run an antivirus scan with AVG and Avast, and an anti-spyware scan. Nothing has turned up on his laptop, so I can only assume he was caught on somebody else's machine.
The moral of the story is be careful where you log into your email from. It's altogether too easy to be blasé about it and assume that nobody could possibly be interested in your email, but my brother's case shows that anybody can be targetted.
And, the most important thing: change your password regularly, and don't reuse it for different sites.
Wednesday, January 14, 2009
Windows 7 Installation
So I, like just about everybody else on the planet, recently installed Windows 7. Lured by the promise of "looks like Vista but is fast", I fired up Virtual PC and installed it.
I'd like to complement the installation procedure. I've installed various versions of Windows quite a few times, from the days of 3.11 where you had to insert about 10 different floppy disks, to Windows 98, to Windows XP. The Windows 7 installation was hands-down the easiest I've ever done.
It asks you for three bits of information at the start: your language, where it should install to, whether you agree to the license; and that's it. Then it goes and installs. After a few restarts it's done, and you get asked a few more questions (username, security settings and product key), but really, compared with the stop-start nature of Windows 98 and the "stop in the middle" nature of XP, this is just fantastic. Well done to the guys that designed and implemented this. It's really good.
Here's a screenshot of my installation. Note how the length of the "collecting information" is pleasingly smaller than the "installing" bar.
I'd like to complement the installation procedure. I've installed various versions of Windows quite a few times, from the days of 3.11 where you had to insert about 10 different floppy disks, to Windows 98, to Windows XP. The Windows 7 installation was hands-down the easiest I've ever done.
It asks you for three bits of information at the start: your language, where it should install to, whether you agree to the license; and that's it. Then it goes and installs. After a few restarts it's done, and you get asked a few more questions (username, security settings and product key), but really, compared with the stop-start nature of Windows 98 and the "stop in the middle" nature of XP, this is just fantastic. Well done to the guys that designed and implemented this. It's really good.
Here's a screenshot of my installation. Note how the length of the "collecting information" is pleasingly smaller than the "installing" bar.
Saturday, January 10, 2009
SCJP 1.5
After it being on my todo list for the last two years, I finally got my Sun Certified Java Programmer certification. I was a nervous before the exam, but I came out with 90%, which I'm very happy with.
There are a couple of things I'd like to point out about the exam:
All in all, it was a pretty successful experience. I hope it'll be a useful addition to my CV.
There are a couple of things I'd like to point out about the exam:
- The Sierra and Bates SCJP book is very good. The questions in it are similar in style to the ones you'll get in the exam, and they explain concepts very well.
- The Heller SCJP book is not so good. It has quite a few errors (most are listed in the book's errata), but also has a lot of stuff that isn't actually in the exam. Streams? Not in the exam, but covered in-depth in the book. Bitshifting? No, not in the exam and not even covered in the book, but there's at least one mock question on it which gave me a start.
All in all, it was a pretty successful experience. I hope it'll be a useful addition to my CV.
Sunday, January 4, 2009
Planning San Francisco
As you may know, Leah and I are moving overseas in February. First though, we're having a holiday in San Francisco for a week.
We chose San Francisco because we weren't particularly smitten with the places we could go via Asia (although Japan would have been really nice). That pretty much leaves going through the US or Australia, and there's no way we were going to go on a flight direct from Sydney for 23 hours. So, it was either San Francisco or Los Angeles, and San Francisco looked lovely. It's not the warmest place, but it's very compact and looks to be tourist friendly.
After booking our flights, we took a look at activities and accommodation. I can recommend the Fodor's San Francisco book for lists of things to do -- we were lucky enough to find the 2009 version at our library, and have consulted it pretty heavily.
I can also recommend Expedia -- so far, at least. We took a while to decide where to stay; the guide book was particularly helpful in recommending areas to stay, but the hotels it recommended were a bit out of our price range. Luckily Expedia lets you search individual suburbs. We eventually chose the Hotel Stratford (mostly because Expedia was having a sale on it the day we were looking :) )
There are a few websites that will help you deciding which place to stay at; Booking.com is a good resource, as is Trip Advisor. Trip Advisor especially seems to be quite good at filtering out the cruft. I've noticed that a lot of the reviews on other sites are brought down by somebody who likes to whinge, but Trip Advisor seems to have detailed reviews from seasoned travellers.
The bad side of things? Trying to work out where everything is so you can plan which days you're going to do your activities! I found out that Google Maps has a way of 'bookmarking' a location only after I put everything into Google Earth first. Still, at least I have a nifty KMZ file now, which I bet I can put into Google Maps anyway.
We chose San Francisco because we weren't particularly smitten with the places we could go via Asia (although Japan would have been really nice). That pretty much leaves going through the US or Australia, and there's no way we were going to go on a flight direct from Sydney for 23 hours. So, it was either San Francisco or Los Angeles, and San Francisco looked lovely. It's not the warmest place, but it's very compact and looks to be tourist friendly.
After booking our flights, we took a look at activities and accommodation. I can recommend the Fodor's San Francisco book for lists of things to do -- we were lucky enough to find the 2009 version at our library, and have consulted it pretty heavily.
I can also recommend Expedia -- so far, at least. We took a while to decide where to stay; the guide book was particularly helpful in recommending areas to stay, but the hotels it recommended were a bit out of our price range. Luckily Expedia lets you search individual suburbs. We eventually chose the Hotel Stratford (mostly because Expedia was having a sale on it the day we were looking :) )
There are a few websites that will help you deciding which place to stay at; Booking.com is a good resource, as is Trip Advisor. Trip Advisor especially seems to be quite good at filtering out the cruft. I've noticed that a lot of the reviews on other sites are brought down by somebody who likes to whinge, but Trip Advisor seems to have detailed reviews from seasoned travellers.
The bad side of things? Trying to work out where everything is so you can plan which days you're going to do your activities! I found out that Google Maps has a way of 'bookmarking' a location only after I put everything into Google Earth first. Still, at least I have a nifty KMZ file now, which I bet I can put into Google Maps anyway.
Saturday, January 3, 2009
First!
I've pulled the trigger and bought my own domain. Now I just have to work out what to put on here.
Some things I've learnt in the process:
Some things I've learnt in the process:
- Google do the cheapest secure domain registration. It'll cost you US$10 to buy your domain, and it comes with the proxy registration so you won't get spammed.
- You can then use Google Apps for Your Domain to get free email. The other features -- Docs and Sites -- aren't really worth worrying about. I made a basic homepage in Sites as a placeholder until I figure out what to put there.
- For hosting your blog, your choices are basically wordpress.com or Blogger. Wordpress has beautiful themes, but charge $10 a year for pointing your domain at it. Blogger doesn't charge anything for using your own domain, and you can write your own template for it.
Subscribe to:
Posts (Atom)