Category Archives: Code

The importance of filenames

When I’m putting PDFs (or any kind of downloadable file) on web sites, I’m always sure to publish them with a filename which is meaningful, including some indication of the web site it came from. ‘Cos if the average user is like me, they save PDFs etc all over the place, and some kind of identifier makes it heaps easier to find the file later.

Car rental web sites again

(Previous rant)

Trying to hire a car in Adelaide for a single day, a Sunday. I’d really rather not have it overnight, so I don’t have to park it somewhere. As it turns out, it looks like none of the car rental places are open beyond 4pm on Sundays, but the problem with their web sites is how they tell you this:

Budget: “Your return time is after the location’s closing time.” — So what’s the location’s closing time? Surely you’re not going to make me guess? Wait, check the Locations page. OK, found the list of nearby branches. Click on the chosen one. No opening hours shown. … (sometime later) … Wait, if I mouse over the location on the map, it tells me the opening hours! Not that there’s any prompt to the user to say that’s how it works.

Hertz: “Return Date or Time – This location is closed at the time indicated. Please adjust your return or select an alternate location. [DE357]” — But at least there on the screen it’s showing me what the times are.

Thrifty: “Your rental details could not be processed because the return time is outside the opening hours for the return location. The return time has been changed to be the location closing time.” — Better, but why didn’t you tell me the opening hours when I was checking what your locations are?

Europcar: “Your Return Time could not be accepted because the operating hours for our Adelaide City Branch on 10/28/2007 7:00:00 PM are between the hours of 09:00 and 16:00.” Bravo!

Avis: tells as I click through where the branch is and what its hours are, but ignores it for another screen or two. But when it does notice, it eventually tells me everything I need to know in one message: “The Return Location selected is closed at the time requested. The Return Location operates from Sun 08:00AM-02:00PM; Mon-Fri 07:30AM-06:00PM; Sat 08:00AM-02:00PM. The Return Location Service may be available after hours. Please call this number (61) 08-84105727 to contact this location for further details.” — Bravo Avis, you win.

Of course, the aggregator sites like VroomVroomVroom don’t do too well out of this either. Oh well. SimilarlyDriveNow.

I ended up booking with Avis (closest to the hotel) via DriveNow (the best mix of good prices and nice web interface). And when I discovered (after placing the booking) that I’d entered the wrong dates, I went to avis.com and changed them. Neato.

The logo doesn’t make it secure

http://www.greatreads.com.au/the7deadlysins/competition1.htm

See the protocol on the front? On the page, net to the big verisign logo:

We guarantee that every transaction you make on our website will be safe. Our secure server software (SSL) is the best software available today for secure commerce transactions. It encrypts all of your personal information, including credit card number, name, and address, so that it cannot be read as the information travels over the Internet. When an order is received, SSL is again used to unscramble the message, check that it came from the correct sender, and verify that it has

Has what? It’s a mystery.

What is it with these half-baked web pages?

They never learn

Webform, major financial group. I entered my phone number, only to be presented with an error message:

Contact Number is invalid. Contact Number can contain only numeric digits. There is no need to include a country code.

My crime? Putting in spaces. Heaven forbid that the computer strip them out again.

ANZ computerised banking is user-hostile

I have an ANZ Bank account. Using their website to pay bills is an exercise in frustration. I only have one account, but the website insists on me picking it out of a dropdown with two entries – the first one, the default, instructing me to pick an account. Failure to do so results in an error – “Please choose a From Account.” I only have ONE! Assume that’s where I want to pay from! Then one must pick who to pay, with an option to pick previous billers from a drop-down list. If you pick from the dropdown without JavaScript enabled, you get the error “Please select a biller from the drop-down list or enter a biller code.” – with JavaScript it fills in a few fields for you, but why does it even need you to fill those fields in if you’ve picked your biller already? Fill them in when I click the “I’m done” button!

Finally, we come to a bugbear I have with ANZ currency fields. You can’t enter a dollar amount, it has to include a decimal point with two following cents; they can’t infer from a lack of a decimal point you’re talking about a dollar amount. They enforce this rule on their website, and they insist that at an ATM you enter the number of cents you wish to withdraw from the ATM. Given the smallest unit of currency available from an ATM is $20, what is wrong with this picture?

How to do null dates in database queries in VB.Net

They do make you jump through some hoops, but I think I’ve got it worked out.

Dim dYourDateField As Nullable(Of Date)

…then you either set it to be a date (using DateSerial or CDate or whatever, or you set it to Nothing.

Then when you’re using it in a database query, the parameter can be set like this:

oCmd.Parameters.Add(“@YourDateField”, System.Data.OleDb.OleDbType.DBDate).Value = dYourDateField

That’s it. At least, it seems to work okay for me. Touch wood. Apparently it should be okay in the .Net Framework 2 onwards.

[Another in an occasional series of things Daniel posts about so he can easily re-discover it next time he needs to remember how it’s done.]

Mortgage ‘Calculator’

Have a go at this crappy morgage calculator. Insofaras mortage calculators go, it’s middle of the road. It doesn’t allow for being an investor, which renders it useless to me – I have a substaintial investment income (only matched by my substaintial interest expense), and I’m not trading up from my current house.

But my biggest gripe is how the calculator has been “designed” to only work if you enter a valid, live email address. So this thing turns out to be a marketting tool, not a calculator per se. The address of me@example.com doesn’t work. If you enter an email address that isn’t live, it doesn’t give an error message – it barfs with an ASP error when sending the email fails. WTF? How is J Random User meant to figure that one out? Thankfully, it hands over the results (for what they’re worth) because jobs@google.com is a valid email address. Sorry about that, Google.

Snopes Love/Hate

I love Snopes.com. It’s an invaluable resource for urban legends. Every time some idiot forwards me the latest fad email, I can debunk it (or, far more rarely, prove it isn’t true.)

I hate Snopes.com. Because they go out of their way to make their site fiddly to use. There’s popups that beat Firefox’s default blocker. If you click through to another site from their pages, it not only opens in a new window, but they try to hide its URL when you mouse over the link.

And they’ve got code that prevents you clicking or selecting on their page — so for instance if the browser gets focus in the address bar, you can’t click back onto the page to get the up/down keys working again. I guess it’s to stop you copy/pasting text off the site:

if (typeof document.onselectstart!=”undefined”)
   document.onselectstart=new Function (“return false”)
else{
  document.onmousedown=disableselect
  document.onmouseup=reEnable
}

… though right-click / Select All works (at least in Firefox). Right-click also works for getting focus back on the page, thankfully.

The Project

I started The Project primarily so I could learn PHP. I’ve been using ASP (classic and .Net) for a while now, but wanted to try another web development language, preferably one that would be compatible with my dirt cheap web hosting. The way I envisaged it, it would be straight HTML/CSS, no fancy AJAX, using PHP and database lookups.

For development, I set up a Virtual PC with Win2K on it (quickest, best, easiest basic Windows version I had an unused licence for) and put IIS and PHP and MySQL on it. All reasonably easy. For database admin I put on PhpMyAdmin; it’s what runs on my web ISP, and is reasonably easy to use. For the IDE I looked around at Zend and some of the other paid tools, but decided to try DevPHP, a freeware thing, until I figured out if this project was going to fly.

It was all going well until I wanted to do some mod_rewrite fiddling with .htaccess. There are a few things around the place that purport to make mod_rewrite (or an approximation of it) work in IIS, but nothing seemed to do it well. In a fit of rage I ended up removing IIS and going the whole hog and installing Apache instead. It actually runs very well on Windows, and (after re-installing PHP and doing some config fiddling) matches my web ISP much better than any version of IIS could.

After using it for a bit, I also got a bit fed-up with PhpMyAdmin, which is particularly laborious for entering data. It’ll only do two records at a time, and semi-regularly seemed to ignore the second. Then I found the MySql GUI tools, which by comparison are an absolute Godsend. Why did nobody tell me about this before? (Actually it looks like I found a bit of it some time ago, but hadn’t used it properly until now.)

The coding has been coming along nicely, and the basic functionality is ready. I’ve got a couple more enhancements I’d like to do before it goes public.

So what is The Project? Not telling. But it’s aimed at non-geeks, going to be free for users, with Google Adsense to try and pull in some income (and get it indexed quickly). Maybe it’ll pay for itself, maybe not. But even if not, it’s already been successful as a way for me to learn some PHP.

Update 2007-04-19: The Project is now live.

CSS for table displays

After much time swearing over how to get a table-like display out of CSS, I was stumped. All I wanted was an definition with the label on the left hand side and the text on the right, wrapped into a column.

And let me tell you: given my limited knowledge of it, wrestling with CSS is not my idea of fun.

Finally after scouring Google for various terms, I did a search for “hanging indents” which led me to a good way to do it using dd dt and dl tags, and appropriate CSS for each. Eureka! (Yes, if I’d thought about it, these tags are for “definitions”, precisely what I was trying to do.)

Thank you, the good people at Max Design.