Web development and design


If you visit this site rather than just the RSS you will have noticed a change in the theme that I am using. I’ve switched to a modified version of Connections, which won the recent WP Themes Competition.

I’ll be working on gradual improvements, otherwise it would never be released as I want it. The header image is what I see standing on the platform at Wellington Railway Station. It’s about 5 photos taken with my phone and then stitched together with Autostitch. I’ve added my del.icio.us links to the theme. I’ll slowly fix the colours to match the header over the next few days. Also, I’ll have a go at converting it to Strict XHTML, just for fun.

Following on from Mike Brown’s presentation about Web Standards and the Web Standard Group, I gave my presentation on Semantic HTML at the GOVIS conference.

Public speaking is not my forté, but I managed to pull it of, even with a chuckle or two in what can be a very dry topic, especially after lunch. The anticipation and nervousness made me feel really drained afterwards.

My home email address gets a huge amount of spam, as does my Gmail. The great thing about Gmail is that all of its spam filtering is set up already. I don’t have to mess around and configure all sorts of folders and filters, tag all of my mail so that Thunderbird know that it’s spam etc.

Instead of filtering it with email headers, I just forward all mail sent to joe@kapiti.net.nz to my Gmail account, which has a filter that returns it to [secret-nonsense-phrase]@kapiti.net.nz and set thunderbird accordingly.

One disadvantage of this method is that mail sent directly to [secret-nonsense-phrase]@kapiti.net.nz would get through without being filtered. This is only a ’security through obscurity’ type of thing, which is in general a bad idea.

I think it was Dale Carnegie that said the most important words to a person is their name. Here’s the proof: think about the first thing you look up when you new phone book is delivered each year.

I was thinking about the labels we put on forms on the web. As an anglophone I often assume that people’s names are in the format FirstName Surname. However, this is not always the case. In some languages and cultures surname (or family name) is the first name and given names are secondary. This can be further confused by different titles or honorifics which may be prepended or appended.

It is generally a bad idea to use the term ‘christian name’ when refering to someone’s given name. I recall a discussion about names and their origin a collegue and I were having with a visitor from Indonesia. My collegue continually referred to his given names as christian names. The visitor was quite offended and protested that his name was Hindi, not Christian.

From now on I will use where possible the labels ‘Given Name’ where I would have previously used first name and ‘Family Name’ where I would have used surname.

it seems that every time I go back to my Gmail my mailbox size has increased. Last week I was using 16MB of 2048MB. Now its creeping up and tells me I have used 16MB of 2089MB

Is this a game of keeping up with the Jones? Is there someone out there claiming to offer a bigger mailbox? Or is Google trying to encourage us to use Gmail so much that we can’t live without it and lock us in?

UPDATE: If you go to the login page, you can see the size increase in real time

UPDATE: I have the answer in the comments below. Thanks Toby!

Well maybe not horribly organised, but it fits their acronym. After releasing their API there was a general wow around the web about how Yahoo! was (getting) better than Google.

I thought this would be great; I could use Yahoo to power the search for a site I was working on. However, their terms clearly say ‘non-commercial’. Great, as a Government agency, we are clearly not commercial. There is even case law to back this opinion up.

However, I thought I’d check with Yahoo for their interpretation, just so that all of the ‘i’s are dotted and ‘t’s crossed. They didn’t respond to the first email I sent two weeks ago so I tried again. There response was weird; they tried to sell me advertising. I’ve written back trying to get a definite answer, but no response.

I know I’m just a small fish in a huge sea, so I understand that they can’t answer everything immediately, but a simple yes/no answer should be relatively easy for them. In their FAQs they have an email address specifically for this.

This is what I sent them:

Hi,

I am investigating different search options for a Website I am
developing for a small New Zealand Government agency.  Can you please
tell me if using your APIs on a government site is considered
non-commercial?

Thanks

Joe Lindsay

And their response (within 24 hours):

Hello,

Thank you for your interest in commercial use of the Yahoo! Search Web
Services. Although the Yahoo! Search Developer Network is currently
licensing the Yahoo! Search Technology solely for non-commercial use, we
are evaluating future commercial offerings.  In the mean time, please
share with us your ideas on the types of commercial licensing models
that would work best for your applications and business.

If you are a high volume customer, Yahoo! Search Marketing Solutions
(formerly Overture) offers commercial licensing that may serve your
needs.  If you are interested in obtaining a commercial license, please
visit us at  http://www.content.overture.com/d/USm/ps/po.jhtml.

You are also welcome to use our SDK and APIs to develop a non-production
internal prototype of a commercial application using Yahoo! Search
Technology, and Yahoo! Search Marketing Solutions would be happy to
review it when discussing your interest in a commercial relationship.

Thank you again for your interest, and we look forward to working with
you.

Sincerely,

The Yahoo! Search Team

So I wrote back

Hi,

Thanks for the response.  However, it doesn't actually answer the question.

The question is over your interpretation of 'non-commercial' in your
API terms of use.  According to case law in New Zealand, because we
are a Government agency that is not established (in fact not allowed)
to make a profit, we are considered non-commercial.  I would like to
know if this interpretation is consistent with your terms of use, and
we can use the API for a public web site we are developing.

The number of serches that we generate are low, about xxxxxx per day.

Thanks

Joe

So far I have not had another response. I wait with bated breath

Now this is something I’ll probably be hated for pointing out, but isn’t it obvious? Why not build popups with absolutely positioned <div>s or another element.

At work we have to conduct a website user survey and the view (although it is agreed it is bad practice) is to have a popup on the homepage. It will take them to a survey form when clicked, or alternatively, remind them later, or never bug them again.

Now the code is far from perfect; it’s been thrown together as a proof of concept, but this is basically how it works:

  1. The user visits the page
  2. The popup’s block is hidden (display: none;) by the stylesheet
  3. Javascript checks for a cookie
  4. If the cookie is there, the block stays invisible
  5. If there is no cookie, Javascript sets the popup block to display: block;
  6. The “Remind me later’ link sets a 2 hour cookie if clicked
  7. The “Don’t bug me” link sets a 1 year cookie
  8. Doing the survey sets a 1 year cookie

I’ll clean it up as I bed it in, but here’s the code so far:

HTML

<ul id="popsurvey">
<li><a href="survey.html">Complete a survey - help us improve our website</a></li>
<li><a href="#" onclick="javascript:later('popsurvey');">remind me later</a></li>
<li><a href="#" onclick="javascript:nobug('popsurvey');">don't bug me</a></li>
</ul>

CSS

#popsurvey {
	position: absolute;
	left: 50%;
	width: 260px;
	margin-left: -150px;
	top: 35%;
	background: #00556B url(images/window300wide.jpg) no-repeat top; /*looks like windows */
	padding: 20px;
	padding-top: 35px;
	display: none;
}

Javascript

window.onload = function () {
	var survey = getCookie('nobug')
	if(!survey) {
		document.getElementById('popsurvey').style.display = 'block';
	} else {
		document.getElementById('popsurvey').style.display = 'none';
	}
}

function hide(elementID) {
	document.getElementById(elementID).style.display = 'none';
}

function nobug(elementID) {
	// date 1 year in future
	var ex = new Date();
	ex.setTime(ex.getTime() + (365*24*60*60*1000));
	ex = ex.toGMTString()
	//set nobug cookie
	setCookie('nobug', 'TRUE', ex)
	//close popup
	hide(elementID);
}

function later(elementID) {
	// date 2 hours in future
	var ex = new Date();
	ex.setTime(ex.getTime() + (2*60*60*1000));
	ex = ex.toGMTString()
	//set nobug cookie
	setCookie('nobug', 'TRUE', ex)
	//close popup
	hide(elementID);
}

function setCookie(name, value, expires, path, domain, secure) {
	var curCookie = name + "=" + escape(value) +
	((expires) ? "; expires=" + expires : "") +
	((path) ? "; path=" + path : "") +
	((domain) ? "; domain=" + domain : "") +
	((secure) ? "; secure" : "");
	document.cookie = curCookie;
}

function getCookie(name) {
	var dc = document.cookie;
	var prefix = name + "=";
	var begin = dc.indexOf("; " + prefix);
	if (begin == -1) {
		begin = dc.indexOf(prefix);
		if (begin != 0) return null;
	} else
	begin += 2;
	var end = document.cookie.indexOf(";", begin);
	if (end == -1)
	end = dc.length;
	return unescape(dc.substring(begin + prefix.length, end));
}

Limitations/Caveats

This only works if cookies, Javascript and CSS are on.

Javascript turned off
Popup is not visible
Cookies turned off
Popup on every time
Styles turned off
Styles and Javascript turned off
Popup is rendered in document flow

I’ve just found the first reason I would want to migrate to PHP5. I’m not a great programmer. I learnt BASIC as a 9 year old playing with ZX81 and Commodore 64s. I don’t care about better OO support and all that stuff that appears to have been built in to PHP5, I just want a nice simple interpreted language. PHP4 works and I am a great believer (probably out of laziness) that if it ain’t broke, don’t fix it.

The reason I would seriously consider migrating is SimpleXML. After reading about Yahoo! Search Web Services and hunting for a nice simple PHP XML Parser I found this tutorial. Like its name suggests, its simple.

The one thing I think that is holding back wider uptake of PHP5 is that most hosts are not getting demand for it from their users. In a commercial environment where you run your own servers it can be much easier to change that to potentially upset 100 hosting customers on a shared box. Most people don’t need it. PHP4 just works.

« Previous PageNext Page »