Dogs

Just a random picture of the doggies at the river.

Trust Nobody

One important lesson when developing applications (I’m focusing on websites here, but this applies to all types of applications) is to ditch user trust.

In a nut shell, do not trust any input you receive from a user. Seriously, do not assume it is clean and good, treat all user input (whether it be cookies, text from a text box or something else) as potentially dangerous. Check it, filter it, escape it.

Never let input from a user go straight into your database or on to a page without it being filtered. If you let it straight into the database you leave yourself open to SQL Injections and other attacks.

This is why you should clean up all input. (Click for bigger version)

Keep that in mind when you are developing an application, any and all user input needs to be checked out, torn to pieces, ripped apart, put back together before being considered safe.

Haiti Quake

This is the first time I’ve ever actually donated to any sort of disaster relief. Not because I was selfish, but because I was lazy. I did not have a credit card, so could not easily donate. I did not own our phone line, so could not donate this way.

This quake and relief call has coincided with me switching banks from National Bank to Kiwi Bank. Now that I’ve shifted I’ve a brand shiny new debit card, and I used it to donate to the Red Cross.

The forum I moderate (Gaia Online) is offering to match contributions made to the Red Cross up to the value of $10,000 US. Even though some call into question the motives for such action (we call them cynics), the point is if you donate to the Red Cross through Gaia, your donation will be matched by them. Ultimately it means more money going to help Haiti.

If you are going to donate to the Red Cross or another charity (try to stick to ones that are well known, there are a lot of scams going around right now), try doing it so a company of sorts will match your donation. Even if you aren’t a member of Gaia you can still get them to match your donation, information is provided in this thread.

Striped Backgrounds

Just a FYI for all of you web designers out there about pretty striped backgrounds.

I’m actually unsure if this is a LCD screen thing, or all of them in general. I actually don’t remember it from my old CRT screen, but let’s face it, who has a CRT these days? (OK, I’ll admit it I have one…)

Some websites like having a striped background, with an image like the following.

It does look pretty neat, and when it’s full-paged background it can give a webpage an interesting look.

The trouble is, scrolling. On screens like mine images like that do not work well when scrolling. The background does this weird flickering thing when scrolling along, and it does mean the website looks less cool, and more cheap.

I’d seriously advise you skip the tiny little stripes in background images. Try larger ones, they can look pretty good as well. Or, you know, a solid colour doesn’t hurt either.

Webmin for Ubuntu

If you’re playing around with Ubuntu Server I would seriously suggest you check out Webmin, it rocks.

I’ve got an old PC I got from my school (for some cans of food). It’s too hold to run Windows successfully, but it is perfect to use as a Ubuntu server to muck about on.

Definitely try the Webmin interface, it makes managing the system a breeze.

http://www.ubuntugeek.com/ubuntu-serverinstall-gui-and-webmin-in-ubuntu-810-intrepid-ibex-guide.html

Add a CSS class to any disabled button

This adds the class of “myclass” to any input with a type of “button” that is marked as disabled. This way you can easily style disabled buttons across a multitude of browsers.

$('input[type=button][disabled=disabled]').each(function(){
	$(this).addClass('myclass');
});

Phishing

Originally Posted: January 4th, 2009

In the field of computer security, phishing is the criminally fraudulent process of attempting to acquire sensitive information such as usernames, passwords and credit card details by masquerading as a trustworthy entity in an electronic communication.

That’s how wikipedia defines phishing. Don’t confusing it with fishing which is a sport where you either catch undersized fish and brag about the ones that go away, or it’s a way people get out their sadistic torture urges by torturing fish for fun.

Phishers on the Internet do so to rob people of their username/password combos for many different websites. This is generally used with banking websites through the use of fake-login pages or emails that look official. Banks get hit by this a lot, as people use it to literally rob you of your money, so you need to be bloody careful.

What annoys me though it’s not limited to things that have actual worth, such as money. People phish other people on gaming websites to access their game accounts. It amazes me honestly.

If you’ve been on Gaia for more than five minutes then you’ll know they have password phishers floating about. Claiming to be from admin who need your password to check your account out, or claiming to be a moderator giving you gold. It’s funny and sad at times really.

I get a few a week sent to me, I don’t know why honestly I guess they’re hoping I’m extra stupid.

Outlining a Scam

Obviously it wasn’t coloured, instead I added the colours so I can talk about the specific points. So shall we embark?

attempted hacking, scamming, trolling, and life threatening

Wow, I’ve certainly been a bad boy haven’t I? I mean attempting hacking is one thing, but also trolling and scamming as well. Apparently also life threatening which is a concern.

Obviously it’s complete rubbish. They like to put a lot of threatening words inside their messages as then it scares some users into not reading the rest properly and ignoring the warnings (like common sense) and falling for the scam.

The light-blue section cracks me up, yes you shouldn’t give out your password normally but this is a special time and you should anyway.

Then we add with the yellow section, threats. If you don’t do this then “it will resolve in a 6 month ban and banning of the IP power”. Right, so firstly how can it resolve into a ban? Wouldn’t it result in a ban? And do any of you reading this understand what “banning of the IP power” means? I don’t think I’ve ever heard of the IP power.

Once again, it’s meant to scare you though this wouldn’t scare a toaster.

We also ned space between your password

Ok, so you ned a space between my password. Would this have anything to do with the fact that passwords cannot be PMed on Gaia and an error occurs when you try it?

Now, correct me if I’m wrong, why would a website require you to be examined for bad things by sending them your password, and then design a system that actively prevents the password from being sent? That just doesn’t make sense.

Unfortunately a lot of people don’t actually think about that. They don’t wonder why any developer would design a system that relied on user assistance to examine anything bad they may have done.

It would be as if the police had to get your personal PIN number for your bank account to examine your bank records so they can make a case against you. Can anyone spot the flaw in the system?

Any developer who designs a system like that deserves being sacked and then banned from ever going near a computer again.

Sadly phishers are still out there, because they’re evil, greedy people who need to be banned from the Internet for life.

They’re thieves, digital thieves.

Terry Prachett

This man is a genius. Seriously, his literary work is stuff of legend. I can only hope that somehow they transfer his brain to some sort of robot thing, so in 100 years time he’s still churning out Discworld books. For some reason, they don’t tire out.

Normally anything gets tired after several copies, like the books and movies. You can’t really drag it on, people lose interest and the work seems to be losing its edge. That doesn’t happen with Discworld.

Each book is pretty much a self-contained story, you don’t need to read any other story to enjoy the current one. Sure, it does get better if you read them in order, but it isn’t essential.

Discworld is named after their planet, as it is not spherical like the worlds made up in universe’s of logic and mathematics, but a flat disc on the back of 4 giant elephants standing on the back of a gigantic tortoise, who is the size of the disc. This makes sense, since everyone knows that elephants can carry large loads, and tortoises are known to plod along. So nobody questions it really (Except the few who venture off to sail around the world and prove it is in fact round. Funnily enough, none of them ever return to report their findings).

The stories started out introducing the Disc, and the main city of Ankh-Morpork. That’s pretty much old London, with the Ankh river winding through it. Whether this river actually deserves the classification is a lively debate. People don’t sink more as they walk as the silty sludge has a almost solid form.

Earlier books focused around characters such as Death, Rincewind, Granny Weatherwax while later books focus around Sam Vimes, Moist Von Lipwig and Lord Vetinari, although earlier characters still occur in the later books.

Here are some examples of quotes, they give an indication to the humour level.

“When he (Death) discovered that he had tied the two ropes on branches either side of the trunk, he simply removed the offending trunk as opposed to repositioning the ropes. This has not in the least affected the growth of the tree.” – Soul Music

“In Thief of Time, Kaos, the Fifth Horseman, was introduced, having previously left before they became famous and now works as a milkman under the name Ronnie Soak

“Since Death is professionally involved in almost everything that is going on everywhere, the Rite is usually performed so that he can be asked questions. Death hates this because he is always summoned at the worst possible time, like when he is at a party. The senior wizards performing the Rite are not too happy about it either, though, since they don’t enjoy drawing Death’s attention to them; they are often very senior.”

“I said I hope it is a good party”, said Galder, loudly. At the moment it is, said Death levelly. I think it might go downhill very quickly at midnight. “Why?” That’s when they think I’ll be taking my mask off.

“I am Death, not taxes. I come only once.”

Billious is – the “Oh God of Hangovers,” who gets all of the bad effects of drinking even though he has never touched a drop. He has a supreme dislike of people who drink often.

Libertina is – the Goddess of the Sea, Apple Pie, Certain Types of Ice Cream and Short Lengths of String.

Urika – The Goddess of Snow, Saunas and Theatrical Performances for Fewer than 120 People.

I could just go on and on, I’m having fun finding these out. I laughed when I say “and Theatrical Performances for Fewer than 120 People”.

One of my absolute favourite references is in regards to the sandman. People wondered about how he could have enough sand to knock all those children out each night, when in reality he had a rather small sack and didn’t need to take the sand out at all (Hinting he actually whacked them with the sand bag).

Ok, I’ve gone on enough about Discworld. Just promise me you’ll visit your local library or bookshop and give one a try.

Azula – A Downfall

Originally Posted: September 21st, 2009

Azula is a princess of the Fire Nation and she’s terrifying. She uses fear to intimidate those around her, her family, her friends, her subjects. Fear is how she lives, and she loves it.

Throughout the avatar series Azula has been terrifying. As a firebending prodigy she quickly controls any battle.

Now the reason I’m talking about this fictional character is because she was my favourite from the Avatar series. Avatar: The Legend of Aang (or Avatar: The Last Airbender depending on your location) is a story about a world split into four nations, the Water Tribes, Air Nomads, Earth Kingdom and Fire Nation. Each is focused around one of the mythical elements with certain people in each nation having the ability to manipulate their element, known as ‘bending’.

Only the Avatar can master the four elements, the most powerful bender in the world. His or her job is to keep the balance between everything, the spirits, nature, humans. The Avatar is considered to be the spirit of the world. When one Avatar dies, a new Avatar is born in the next nation in the cycle. Water, Earth, Fire and Air. The cycle continues on, and there is always an Avatar.

One day the Avatar vanishes, and the Fire Nation uses a comet to strike a terrifying blow against the Air Nomads, all but wiping them out completely. Only one Air Nomad survived, the next Avatar.

The story follows how four friends, Katara (a waterbender), Toph (an earthbender), Sokka (a non-bender) and Aang (an airbender & the avatar) journey around the world so that Aang can master the four elements and defeat the world’s greatest threat, the Fire Lord. Leader of the Fire Nation it’s his mission to use the returning comet to end the war.

So anyway, back to Azula. She’s one of the villains in this series, second only really to her father. Always cool, calm and collected Azula strikes fear everywhere.

But as the chapters flip by, and we get closer and closer to the final battle, Azula starts to slip. You can really see this for the first time in The Burning Rock Part 2 where she’s hit by the biggest blow so far, being betrayed by her friends. I guess controlling them with fear wouldn’t last forever.

After that she was alone, and her appearances were disturbing at best. Gone was the cool calm Azula, her skillful firebending turned wild. You can really see the first example of this in The Southern Raiders where she attacks Zuko.

Throughout the last episodes, Sozin’s Comet you can see she’s becoming more and more paranoid and mad. She nearly threw a tantrum when told she wasn’t going to Ba Sing Se, until she learnt she was going to be named Fire Lord. Then she started banishing anyone who displeased her or anyone she deemed a threat or traiter. This eventually left her with pretty much nobody in the palace, all the servants banished. She even confused her old teachers, the scary twins, banishing one and not the other.

You can see that her mother was on her mind, from her conversation with her mother in her mirror. She never felt she had her mothers love, feeling that Zuko would have everything.

In the end her last battle was wild. The music as it was going on was pretty sad as you could see her losing it and her wild bending burning a lot of the capital city. She tries to kill Katara with a lightning blast, but Zuko takes it. Eventually Katara manages to trap her with her waterbending and ties her up, where Azula’s sanity is hanging on by a few threads. Screaming and trying to firebend she ends up collapsing in loud tears as she realizes she’s lost. She’s alone.

Which is why I say poor Azula, because even though it’s a fictional character, you get involved with the story. Watching her decline and her sanity leaving her was hard, as all that is left for her is pity.

LTrim, RTrim and Trim JavaScript Functions

These are some functions I found online, and it drives me mad having to find them each time. I didn’t write these, but they’ve been passed around a lot. They’re useful if you need some basic JavaScript functions.

Left Trim
Pass it a string to trim and any characters that should be trimmed from the left. chars can be left empty to trim spaces.

function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}

Right Trim
Works exactly the same as the left trim, just on the right.

function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}

Trim
Combines the left & right trim to have a full trim functions.

function trim(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}