The Five Faux Pas of Well-Designed Websites

August 18, 2008 on 10:59 pm | In Programming | No Comments
  1. It is not acceptable to ban users from using their ‘Back’ button.
    You can be sure that when a user reaches a page they don’t want they will hit the back button on their browser. There are so many shortcuts to this: ‘delete’ on windows, Apple and [ on mac and some people even have a button on their mouse that sends the browser back in the history. By the time they have pressed their favourite Back button by reflex their frustrated mind hasn’t even had *time to remember* that they aren’t supposed to use it because you issued a small warning in 9px font-size underneath your Ads By Goooooogle.
    Think about why a user has used the back button. If it is a multi-part form (pain in the damn arse) they probably want to change a value submitted on a previous page. And why not? If this potentially invalidates data that they have entered in a latter form make sure it is checked when the form is submitted. Failure to bother with this is just damn lazy and irritating for the user.
    You cant be sure if the back button will load the page from cache (correct behaviour) or the server - however far before the birth of Jesus you set the page expiry time - so handle both cases. See: the ‘if’ statement (all languages).
  2. Worst offender: Barclays iBank online banking. Using the back button logs you out. Bastards.

  3. It is not my job to work out what your site/product/opinion is about.
    You have got all day to design your homepage. Remember that I DON’T CARE who your team is, what awards you’ve won, who your sponsors are, what server farm you prefer or that you have a cat named Geoff who is probably better at pleasing your wife than you are. If your site is software, explain what the software does that I can’t do already; then make it easy to download. I don’t want to have to go through thirty steps choosing mirrors in Sourceforge or hunt through source trees for the most recent version. Have a Download link that takes up at least half the pixels of the homepage which links directly to a .tar.gz file which I can then right-click on and paste in to wget or 100% compatible. The MOST irritating thing is having to provide keystrokes of any kind to download your software. I am only ever going to enter the email address dev@null.com and the name Yu R. Dicks for this. If this fails I am not going to download it.
  4. Flash intros are the most irritating thing you could possibly put on your website.
    I do *not* want to watch your 1500Kb flash bullshit load while I wait to find out whether Google was correct and that your poxy site was the one I was after. Standard Google search user algorithm: Put a deliberately vague search in the google bar; Open the first thirty results in their own tabs, find what you were looking for in the first three; Force quit the entire program to get rid of the remaining twenty-seven erroneous tabs that have each started their own 32kbit Madonna WMA with Flash intro and have hence reduced your quad-core beefcake workstation to a capacitor with series resistance.
    I guarantee that while your lavish animation wastes valuable oscillations of my TFT pixel-control transistors 90% of your users are desperately searching for the skip intro link you shitting-well better ‘av provided. If you haven’t provided this and the skip button is in the Flash animation itself then I hope both power supplies deliver 185V direct to the pitiful silicon excrescence you call your server.
    Lesson: The web is fast-paced; people on a mission typically view a couple of entirely different sites in the space of ten seconds. However ‘cool’ your flash intro looks nobody can be bothered to watch it. (Let us not deal with the case where your entire website is Flash.)
  5. Don’t tell me that your website looks best in Firefox or at a resolution of 800×600
    Looks better in Firefox? Maybe true, but I couldn’t give a damn shit what your favourite browser is. I bet you are the kind of teenager who uses FrontPage to design his shit family homepage complete with scrolling marquee tag and pink background and yet in every thread on slash-dot about web standards extols the virtues of open-source and how Microsoft is an evil monopoly with their ‘non-standards compliant bloatware’. I am NOT going to change my resolution just so I can say “Oh yeah, they have used absolute positioning and tables with the constant cell widths contrary to all published advice and it does actually just fit in the 763 pixels not absorbed by the ghost of the scrollbar on the exact version of Internet Explorer built into their version of FrontPage” because to change the resolution on a computer is a task that is the internet-complexity equivalent of firing and re-hiring a department full of employees on maternity leave.
  6. Get off your damn soapbox
    I don’t care if your site is valid XHTML, syntactically correct HTML version 3.2 or beautiful error-free DHTML 1.3. I don’t want to know that your CSS is tab-aligned and reads like a novel by Roland Merullo or that over a 9600 baud modem your website downloads in 8.2 milliseconds leaving enough bandwidth for your fanny-liberal telnet session to refresh your ASCII-rendered Star Wars film at 65fps. I care that when parsed by the first web browser invented by the Aztecs running on a machine that can only address a screen 45 pixels square drawn on a wall in sprayed tricolour shit your website looks identical to the latest in-house build of Internet Explorer 8.432b rc12 with strict mode taking a random value between 10 and I Don’t Care.

I thank you.

For 2nd Year Electrical Engineers

April 17, 2007 on 3:52 pm | In Programming | 3 Comments

Dearest colleagues,

(Further to Pietro’s blog post)

I do hope you are getting on well with your C++ assignment, which from the sounds of it is going down like a lubed anvil. Couple of things id like to get off my chest, if I may be so bold.

1. Hash Maps

A hash map is none of the following:

  1. A linked list
  2. A “big” array
  3. A binary tree
  4. A balanced tree
  5. A “happy” atlas

If we store our records in a linked list, we can access them by scanning along and comparing the key until we find the right one. If the list is unsorted and of an unknown length this will take at worse N comparisons (and increments) where N is the length of the list. If the list is sorted and of a known length then it will take Log(N) comparisons (binary cut), but to get to each node one must still traverse the list in that direction, so it in fact takes (I believe… john?) xLog(x) (i.e the order of the integral of log(x)). So sorting a linked list and binary chopping is therefore futile unless you can access elements without scanning. Don’t iterate over list.at(i)!

Enter: the hash map. Let us say we are storing students with a cid and a name. The key will be the id. We know that these are evenly distributed between odd/even so we could construct two linked lists, one with the evens and one the odds. This would cut the average search time in half. Thus the hash function (which decides which list to enter) would be cid%2. Obviously this generalises quite nicely, so if we have 10,000,000 students we could have 100 lists from our table and use cid%100 as the hash function.

However, when running on a computer that has even a marginally faster clock rate than a wall clock, there is no fucking difference - just search the damn list and get on with something more useful.

Here is the only code you need to look for records:

class Record { int cid; string name; }; class Node { Record* record; Node* next; }; class JamesList { Node *head; string lookupNameByCid(int cid) { Node* runner = head; while (head != null) { if (runner->record->cid == cid) return runner->record->name; runner = runner->next; } return null; } };

I thank you.

2. Simulating Circuits

Here is a circuit:

(circuit)

The aim is simulate its behaviour using an event queue. There are two different types of entities here, nodes (blob) and gates. Both share common functionality, they have an output value (Vo) and a set (see above) of outward connections. This makes traversing the network in the same direction as the input changes propagate easy.

So:

class Device { int Vo; int delay; JamesList drivenDevices; }; class Node : public Device {}; class Gate : public Device {};

Good. Some good stuff there. So when the user presses the button for node a to change its voltage to 1, we create an event in the event queue (an ordered list of some kind). Then start the simulation by making the first event happen. The output of a device only changes when the event is actually executed, not when we realise that a change must happen. The time difference between these is the propagation delay of the device (for a node this = 0).

I think the event execution should go something like this:

void simulate(int until) { EventListNode *runner; runner = events->head; /* FOR EACH EVENT */ for (int i=0; i<events->size; i++) { //Check we arent about to overstep the mark if (runner->event->time > until && until > 0) { break; } //This event's node Device *changedDevice; changedDevice = runner->event->node; //Actually change the output voltage changedDevice->setVo(runner->event->Vnew); //The gate immediately to the right of this node Set *affectedGates; affectedGates = changedDevice->drivenDevices; if (affectedGates != NULL) { set<DeviceConnection*>::iterator itr; itr = affectedGates->begin(); Device *thisDevice; //Gate for which to update output //Foreach Device which this Device affects, recalculate its output int vnew; while( itr != affectedGates->end() ) { thisDevice = ((*itr)->device); vnew = thisDevice->Vnew; //If the voltage has changed make an event if (thisDevice->Vo != vnew) { events->addEvent(thisDevice, thisDevice->Vo, vnew, runner->event->time + thisDevice->delay); } itr++; } } runner = runner->next; } //We're done, so delete the events. events->clear(); }

I do hope that makes some sense, since I have personally given up caring.
Its also important that the ordered event list puts new events with the same time as existing events after the current ones, else they will be missed.

Love and cuddles,
James

:: james at jgubby.com

John Ayres on James

February 6, 2007 on 11:38 pm | In Programming | 1 Comment

Hi, my name’s James and this is my weblog, LOL. I’m a liberal ‘wannabe’ computer scientist. In my spare time I write the most appalling Java, much to John’s distaste. Often I can be found playing the pretent-o-phone or ‘piano’ as it is known to less liberal comrades.

My Amazon wish-list:
Marxism for dummies (softback)
Mastering Visual Basic 6 Linear Alegbra Edition (hardback)
Frontlight for beginners (only lightback)

I’m selling:
Flannel (unwanted and unused gift)
Me and my piano (just completed)
Inflatable Jeremy Beadle (used)

Syntax Highlighting for Java

February 6, 2007 on 5:41 pm | In Programming | No Comments

Seems there’s a wordpress plugin that uses enscript to highlight the syntax of code available, from this site.

Download the states-highlight.phps file from http://www.nextthing.org/code/wp-states-highlight/. Rename it states-highlight.php and put it in wordpress/plugins.

Also, get a copy of enscript.st from http://www.nextthing.org/code/enscript/ and put it in the same folder. Then enable the plugin in the admin thingy and it should work.

There is a readme in the folder of the first thing too, that tells you to put some CSS classes in various files. The admin one exists, but I couldnt find it in the layout one, so put it in the file of the theme.

Check there is enscript, too:
whereis enscript
on my fanny liberal mac it is in /usr/bin/enscript

Look at how fabulous it is:

Java:
import fixture.Fixture; import junit.framework.TestCase; public class Main { public static void main(String[] args) { Fixture f1 = new Fixture("Mac_500_Stage_Left_1"); Fixture f2 = new Fixture("Mac_500_Stage_Right_1"); } }

C++:
#include <iostream> using namespace std; int main(int argc, char*[] argv) { while(true) { cout << "John is a TERRBIBLE PINCHER" << endl; } cout << "Take that you most terrible pincher!" << endl; return 0; }

Entries and comments feeds. Valid XHTML and CSS. ^Top^

''