Author Archives: Josh

Printer prices still haven’t changed?

Christmas Eve, and following through on an idea I had six months earlier for fantastic presents, Fridge magnets and customized T-Shirts featuring smiling images of the whole family. Gifts like these would be well received by anyone blessed by them.

I’m not a big fan of inkjets, but several years ago we needed a scanner and the cheapest way of acquiring one was by buying one of those scanners with a free, built in inkjet printer. For some reason they’re sold in the printer section of the store. Knowing that inkjet cartridges don’t like sitting unused for extended periods, I didn’t install the cartridges. Until Christmas Eve 2009.

Things were going swimmingly well, with print-head alignment and test pages coming out, looking a little odd but they were very speedy drafts. A final print of a sheet of photos (well over 15 minutes to produce) didn’t come out so good. It was obvious yellow was missing. A few attempts to clean and clear the cartridge were attempted. One Christmas Eve, I decided to go shopping for a replacement colour cartridge. We’ve seen the movies. I knew what to expect.

From personal experience I can tell you that the afternoon of Christmas Eve isn’t all that crowded. Parking was bad, but not Boxing-Day-terrible. I picked the easy, undercover park that’s a substantial walk to the shopping centre, and all was good.

The plan was to check out cartridge prices, compare to new printers, and decide what to do. Turns out the inkjet pricing tactics haven’t changed since I bought the scanner. A replacement cartridge, just one of two required cartridges, was $45. A new printer, $48 (different brand). Given I didn’t know when the black was going to fail on me, I went with a new printer and fresh cartridges.

The new printer is much faster than the old one. And it came with same photo paper too. The T-Shirts could have gone down better, but the fridge magnets went down a treat.

Google Chrome on Linux: slow, memory hog

I’ve run the Google Chrome on Linux beta since it first become available, and my impression is: slow. I might be unusual, in that I typically have dozens and dozens of tabs open, and that may break Chrome’s model of shoving each page into its own process, and this PC has “only” a gig of RAM, but it’s slower than FireFox for the same task. Things were a lot worse before I loaded AdBlock and FlashBlock for Chrome. Now my CPU isn’t pegged at 100%.

Embedded JavaScript is affected by this performance hit, so that particular tools that I have help do my stuff, well, don’t anymore.

Most annoyingly, it seems, although I haven’t confirmed it, that the back button causes a page reload: it doesn’t come out of the cache. Or the slowness could make it look that way. But how long can it possibly take to render a page anyway?

On the upside, it hasn’t crashed, and I would have expected FireFox to mysteriously die without any explanation by now (a sign that Firefox is going to die soon is that tab-swaps/page loads become very slow, indicating a similar root cause which I’m guessing is memory exhaustion). Firefox has always done the mysterious death thing, and I was hoping that upgrading to 3.5 would fix things, but no dice.

I’m trying to decide whether it’s preferable to have my browser snappy, but occasionally fall in a big pile and get back up again, or a laggard that rolls with the punches. Perhaps I’ll split my browsing between them simultaneously; vital stuff on Chrome and throw-away stuff on FF, but that’s going to be a bit tough on my brain.

[UPDATE]
Well, it turns out that Chrome is a memory hog. I bought another gig of RAM, and wouldn’t you know it, the PC is flying. My suspicions were tripped when all of the RAM was in use, most of the paging file and the little orange disk activity light was slowly burning a hole in the wall on the other side of the room.

Car buying websites think they’re classified ads

I’m in the process of buying another car, and it seems that the major car buying websites are stuck in the classified ads mentality; you drill down by make, model, year, limit for a range of odometer readings (you get to set a minimum! Great! Who would ever set a minimum?) and a price range (you get to set a minimum! Great! Who would ever set a minimum?), then look at what you get. Now that we’re in the 20th century, you can even sort the results by ascending price! Wow, what did we ever do without computers?

But I while don’t know what model I want to buy, I do know I want curtain airbags. Can I search for that? No. Do they have the data on that, for each and every vehicle listed? Yes. They have pre-populated the check-boxes for each feature for every model of car ever sold. That would be a handy database to search, especially in nifty combinations like curtain airbags in five door vehicles getting better than 8l/100km, order by turning circle then price.

Clearly, the presumption here is that you have the slightest idea what you want, and that you care terribly about brands, but not at all about features. For me, in my situation, this is arse backwards. However, in my researching, I discovered that the Peugeot 307 was rated 158th of 159 cars for reliability. Could I exclude that please? No? Oh.

You can do a “keyword search”, which is just a text search of the description attached to the ad – whatever the advertiser types in. Typing in curtain gets a bunch of ads with curtain airbags, which thoughtful advertisers have included in their descriptive text – repeating all the text of the various feature check-boxes – but you also get to see a bunch of Kombi vans (they have actual curtains).

And the useful values, like ANCAP ratings, RACV (or whatever) crash worthiness ratings, RACV reliably ratings, choice vehicle reliability scores, are they in the databases? Can you search them?

Must try harder.

On another note, Toyota Australia’s website is a laugh riot. When you pull up their vehicle comparison tool, they include a bunch of very amusing “features”, such as “Steering wheel” and “door handles”. I wonder if they carry any cars without door handles?

Interogating an IRC bot

(15:39:10) josh_geek: G’day bot. Can I poke you with ! commands here?
(15:39:17) josh_geek: !greet
(15:39:18) Helpmebot: Hello, , welcome to #wikipedia-en-help, the help channel for the English Wikipedia! Just ask your question and we’ll be right with you. đŸ™‚
(15:39:46) josh_geek: Yes I can. I insist you list all commands. Immediately.
(15:39:50) josh_geek: !help
(15:39:54) josh_geek: !helpme
(15:39:55) Helpmebot: There are no users requesting help at this time.
(15:40:21) josh_geek: Hmmmm, no instruction manual, eh? Don’t worry, I can beat it out of you if necessary.
(15:40:47) josh_geek: Who is your commanding officer! When does the invasion begin!?!
(15:41:04) josh_geek: !
(15:41:05) Helpmebot: ***ERROR*** in ReceivedMessage: startIndex + length > this.length Parameter name: length
(15:41:16) josh_geek: !?
(15:41:22) josh_geek: !
(15:41:22) Helpmebot: ***ERROR*** in ReceivedMessage: startIndex + length > this.length Parameter name: length
(15:41:32) josh_geek: !commands
(15:41:33) Helpmebot: http://helpmebot.org.uk/v6/?action=commands
(15:42:23) josh_geek: !age josh_geek
(15:42:24) Helpmebot: There is no such user ‘josh_geek’.
(15:42:39) josh_geek: !age Josh_Geek
(15:42:40) Helpmebot: The age of Josh_Geek is 4 years, 282 days, 22 hours, 58 minutes, and 3 seconds.
(15:43:02) ***josh_geek thinks that isn’t all that old
(15:43:42) josh_geek: !mesagecount
(15:43:48) josh_geek: !
(15:43:48) Helpmebot: ***ERROR*** in ReceivedMessage: startIndex + length > this.length Parameter name: length
(15:44:02) josh_geek: !uptime
(15:44:03) Helpmebot: Bot has been up since Thursday Thursday, 26 November 2009 06:20:39
(15:44:19) josh_geek: You’re running on Windows then.
(15:45:02) josh_geek: !faq
(15:46:04) josh_geek: rd
(15:46:08) josh_geek: !rd
(15:46:08) Helpmebot: Hi! Your question appears to be more suited to our reference desk ( http://en.wikipedia.org/wiki/Wikipedia:Reference_desk ). You may wish to ask your question there instead.
(15:46:31) josh_geek: !AynRand
(15:46:32) Helpmebot: The eminent 20th-century Russian-American philosopher?
(15:57:54) josh_geek: !version
(15:57:54) Helpmebot: ***ERROR*** in ReceivedMessage: An exception was thrown by the type initializer for SharpSvn.Implementation.SvnHandleBase
(15:58:06) josh_geek: Ew. Don’t get it on you.

Which goes to show a few things. Blowing up bots isn’t too hard; discovering their operational parameters can be fairly easy if the bot is well designed; and AynRand is an eminent 20th-century Russian-American philosopher.

Wikipedia makes extensive use of bots, and they need it with the volumes of traffic they deal with and the drudgery of the tasks that need undertaking. This particular bot is a helper in IRC, providing various services that you’d need a web-browser open simultaneously to get. I’m currently scratching together the specs for a few bots to add to the automation, but mine will run against the encyclopedia from ToolServer; not an IRC bot like this (I think it lives on ToolServer itself).

Summer 2009/2010 starts

I have a algorithm for detecting summer. Seven consecutive days in a row with a temperature of or above 20 degrees Celsius. I give you Summer, from the Bureau’s seven day forecast for Melbourne:
Forecast for Monday Max 20
Forecast for Tuesday Min 8 Max 24
Forecast for Wednesday Min 10 Max 25
Forecast for Thursday Min 12 Max 28
Forecast for Friday Min 16 Max 29
Forecast for Saturday Min 18 Max 28
Forecast for Sunday Min 16 Max 26
I should also point out that I consider there to be two seasons in Melbourne: Nice-but-hot (summer-ish) and a-bit-iffy (winter-ish).

Summer 2008/2009 starts

I have a algorithm for detecting summer. Seven consecutive days in a row with a temperature of or above 20 degrees Celsius. I give you Summer, from the Bureau's seven day forecast for Melbourne:

Thursday      Fine.                                  Min  6    Max 21
Friday        Mainly fine.                           Min 12    Max 25
Saturday      Fine.                                  Min 12    Max 30
Sunday        Shower or two.                         Min 15    Max 22
Monday        Fine.                                  Min 10    Max 23
Tuesday       Fine.                                  Min 12    Max 28

I swear, this gets earlier and earlier each year.

One third party: a tiny bit more complexity; Many: :-(

I didn’t find the most interesting part of the StackOverflow podcast #16 to be my question. I direct you to 17:06 in, where Jeff discusses the pros and cons of using OpenID as the authentication mechanism for StackOverflow:

Atwood: Granted, there’s a third entity here so there’s going to be a tiny bit more complexity.

What Jeff’s overlooked here is the Combinatorial Complexity; he’s not hooking up with an OpenID provider, he’s hooking up with all OpenID providers, which he acknowledged earlier can be a bit of a problem [34:48 in podcast #7]:

Atwood: Well you can, I found that Yahoo doesn’t really do attribute exchange very well.

If you look at the uservoice… forum… bug-reporting… suggestion-y thing for the StackOverflow beta, you see a lot of people complaining “my OpenID provider doesn’t work [at all]/[properly] with your site”.
OpenID has a spec, but given the difficulties being experienced, it mustn’t be terribly tight or there’s no reference implementation to validate against.

Having said all that, guess what I’m going to be using as my authentication process on my next website?

Linker problems galore

LINK : fatal error LNK1104: cannot open file ‘mfcs42d.lib’

Go to Tools | Options… | Projects and Solutions | VC++ Directories, select Show Directories for: Library files and insert the path to your existing mfcs42d.lib.

Now you get
LNK2019: unresolved external symbol “public: __thiscall AFX_MODULE_STATE::AFX_MODULE_STATE(int,long (__stdcall*)(struct HWND__ *,unsigned int,unsigned int,long),unsigned long)” (??0AFX_MODULE_STATE@@QAE@HP6GJPAUHWND__@@IIJ@ZK@Z) referenced in function “public: __thiscall _AFX_DLL_MODULE_STATE::_AFX_DLL_MODULE_STATE(void)” (??0_AFX_DLL_MODULE_STATE@@QAE@XZ)

Remove mfcs42d.lib and you get
mfcs90d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in MSVCRTD.lib(dllmain.obj)

Know what you did wrong?

I’ve got the answer.

Don’t link to mfcs42d (and, for that matter, the non-debug version mfcs42.lib) in your 2008 project. If that name’s hard-coded into your project – and it is, isn’t it? – then change the name to mfcs90d and you’ll be fine.

Visual C++ Compiler Error C2316: Make with the class definition

Visual C++ Compiler Error C2316

You know, I was getting this error when porting some exception catching code from Visual C++ 6 to version 9. The error message helpfully states that 'exception' cannot be caught as the destructor and/or copy constructor are inaccessible

Weird thing was, it was wrong. Both the copy constructor and destructor for the class and all it’s ancestors were in public scope.

Eventually there was the figuring out: the exception was being anonymously caught, like so:
try {
whatever();
}
catch (MyExceptionClass&) {}

And to keep MSVC6 happy, earlier in the codebase a preceding programmer had coded:
class MyExceptionClass;
Which did indeed keep MSVC6 happy. MSVC9 asked what I’d done with the copy constructor. Well, dear friend: it’s in the header file that wasn’t included. Delete the forward declaration, add one #include and we are cooking with gas.

If we actually give the compiler the definition of the class being caught it can generate code rather than misleading error messages. Why the error message wasn’t: “No definition for this class” is beyond me.

Weird bug

Let’s say, for example, that a system supplies you the time of some event in UTC, you convert it to local and shove the date/time up on the display. Say, for argument’s sake, you also include the Day Of Week, ending up with a format of DD/MM, DOW HH:MM. Everything looks fine, until someone notices that the Day Of Week is wrong. The 28th of May is a Wednesday, not a Thursday.

What happened?

The date conversion routine that generates the DOW string does a bunch of odd stuff, but seems to work correctly; it certainly works in other parts of the code, and generates the right string there.

WTF?

The UTC time seemed to be converted to local time twice, but that wasn’t the culprit; surprisingly, no-one is killed in an explosion of silicon splinters when that code is double-executed. Whatever.

Could it be that the system supplying you the time of that event in UTC is off by a year? One year into the future. That would give you that behaviour.

Check it.