I love this one. I don’t know the name of the pattern, but i love using it.

Imagine your system uses strings to represent the value of a status field. potential values of this field are:

  • New
  • Requested
  • Open
  • Closed
  • Deferred
  • In Progress
  • More Information Required

…and you want to write a method (or webservice) called UpdateStatus, which takes in one of these values.

Standard signature would look something like this:

public void UpdateStatus(string newStatus)

The use of “string” for the static type has the problem that someone could pass through a rubbish value as a string, and the UpdateStatus method is now responsible for domain validation of the input.

However, following the pattern below, you’re able to statically define your domain (if known at design-time) and enforce the stronger type in subsequent method calls.

public class IssueStatus
{
	void IssueStatus(string description)
	{
		this.description = description;
	}
		readonly string description;

	public static IssueStatus New = new IssueStatus("New");
	public static IssueStatus Requested = new IssueStatus("Requested");
	public static IssueStatus Open = new IssueStatus("Open");
}

and you can then use the strong IssueStatus type in your signatures:

public SaveButton_Clicked(object sender, EventArgs e)
{
	bo.UpdateStatus(IssueStatus.New);
}

public void UpdateStatus(IssueStatus newStatus)
{
	if (newStatus == IssueStatus.New)
	{
	// do something here
	}
}

I learnt this one on the job a few years back, and think it’s fantastic.

…and while i’m on the topic of Facebook – LOSE THE SHITTY APPLICATIONS, FACEBOOK!. Your website is becoming overrun by hundreds of thousands of lousy applications, most of which are focused on trying to make a quick buck out of the system.

if you leave something popular open, it will be exploited by those who see monetary value in it’s existence.

Google (on the other hand) use very closed-circuit tactics for managing their software and environment, despite the perception of an open system.

  • 1. Their search technology is closed-source and proprietry
  • 2. Ad-Words is tightly controlled by Google
  • 3. Google CSE
  • 4. Google Maps has no SOAP API – just AJAX.

Where Google makes its success is in providing hundreds of little tools and applications to interface with their technologies within their controlled environment. Facebook gives you open slather to do whatever/whenever and rewards and promotes people for referral of applications – hence it is now a cesspool.

…soon enough the next big thing will be upon us and facebook will slowly phase out if they cant get it under control.

Does it concern most people that Facebook (as one particular example) basically allows you to show and share virtually everything about you?

I don’t particularly care if any of the 390 odd people on my friends list check out my photo gallery, or tagged photos of me, but surely there comes a point when people you haven’t seen or spoken to since forever are able to go through all your info.

one half of me asks “well why are they even on your facebook in the first place, if you haven’t spoken to them for so long?”…..and the truth is….i dont know. i can’t explain my compulsion to want to try and re-contact people from my past. but at the same, i highly doubt i’m the only one does this.

so now you have a growing culture of people just adding each anyone and everyone else…..and access to information is easily available. only those who are truly anal go about changing the privacy settings from the defaults.

At my last job, this quote was printed on an old, half dog-eared, half-torn piece of paper, and stuck to a random pillar in the office.

As fate would have it, I sat next to this pillar for my first few months there, and this message seemed to resonate with me since then. It’s (quietly) one of my life mantras.

I don’t know who came up with the proverb, but i believe it’s quite accurate of how people should be treated (and ironically the complete opposite of how i was treated at the company).

Breakdown:
Reward Success – This one is pretty easy. If you do a good job, you should be rewarded for your efforts

Reward Failure – Important point. if you try, but fail. you’re still successful. You’re successful in that you’ve managed to try something new. You’ve managed to attempt something difficult, and although you didn’t get there, you’ve learnt more from failing than you possibly would have from succeeding. Sometimes it’s important to know that by touching a hot iron, you’ll get burnt. lesson learnt for future (yes i’m reliving a childhood memory there 😉

Punish Inaction – Fundamental point. If you do nothing; if you sit back, and let things go on around you without actively addressing the issue, you’ve failed miserably. knowing of a problem and doing nothing about it is the worst course of action that one could take. The problem spirals out of control and the you’re in the thick of it.

Why am i posting? Because i learnt that while i was on holidays a member of my team discovered that one of our computers was compromised, and failed to act on it. I discovered the problem myself, and have taken the (only) course of action which is to bring the servers down and re-build with a post-mortem to come. But to learn of a serious breach of security, and NOT do anything about it is undeniably the complete opposite of how the problem should have been addressed.

Reward Success – if the problem was acted on, then i would be blogging about the reverse right now

Reward Failure – if the problem was discovered, and they were unable to fix it, but managed to contain the damage, that’s still commendable. You can’t hold someone liable if they don’t know how to fix the problem.

Punish Inaction – the problem was not acted on. The problem was left around for nearly 2 months until my return, and subsequent discovery. Who knows how deep the problem has gone, and we’re now all entangled right in the middle.

it’s been a shitty week.

This morning i managed to install run Photoshop under Ubuntu Gutsy. Wine
never stops to amaze me.

At the bare minimum, i was impressed at how the installation was flawless.
well….almost ;)….it looked like it had crashed towards the end, so i
killed the process, but by that stage, everything had already been installed
and registered, it seems.

Once installed, I had to add the Photoshop.exe to run under Windows 2000
emulation, otherwise things like keyboard accelerators aren’t recognised.

and how did it run? Brilliantly. it was clean and fast…..lightning fast.
Working on hi-res images, rotating layers, applying layer masks – all of it
worked at full speed…you’d never guess there was an emulation layer
sitting in the middle.

the only gotcha i seem to be coming across is the error message: “Unable to
continue because of a hardware or system error. Sorry but this error is
unrecoverable.”. It seems that this happens when the user profile becomes
“corrupt” and the only way to fix it is to blow away the photoshop settings
profile on boot. To do this, hold down immediately after
running photoshop, and answer yes when it asks you to delete the preferences
file.

appears tat you have to do this everytime you run the program though. O_o
…..i’m not convinced and i’m sure more digging around will disprove that.

Remember that when you’re converting from an ASP.NET 1.1 web site
project to an ASP.NET 2.0 web application, you need to configure IIS to
run as an application, and run in a .NET 2.0 app pool.

Without doing this, you’ll end up with a broken error like this:

Server Error in ‘/’ Application.

Parser Error=20
Description: An error occurred during the parsing of a resource required
to service this request. Please review the following specific parse
error details and modify your source file appropriately.=20

Parser Error Message: Could not load type ‘Project1._Default’.

Source Error:=20

Line 1: < %@ Page Language=3D"C#" AutoEventWireup=3D"true" CodeBehind=3D"Default.aspx.cs" Inherits=3D"Project1._Default"%>
Line 2: =20
Line 3:

Today is the day I go back to work 😐

Mixed reactions about it – I’ve enjoyed the last 6 weeks without having
to take the 501 down Victoria road.

Ps. If anyone has had success getting the Intel 965 wireless card working in bridged mode for VirtualBox, I’d like to hear from you. I’ve got a Gutsy host, virtualising W2003 and cant get VBoxto bridge using the built-in wifi card in my laptop.

*sigh*

Hopefully the workitis blues pass.

(edit: MS Office is a rubbish mail client)

http://www.toshiba.co.jp/about/press/2008_02/pr1903.htm

Okay so i got this one wrong.

hopefully now we see the market flood with cheap BluRay players as
manufacturers don’t need to gamble on which technology will win out. I bet
Sony are feeling relieved at the moment 😉