Pages

Sunday, July 30, 2006

Broken Chair take 2

Some of you may remember my original complaint about a broken chair.
No problems, next door neighbor helped in fixing it.

Chair broke again. This time one of the legs decided it just wanted to give way. It happened when I was trying to turn my computer on, so of course I fell of it rather awkwardly.
So I went out and bought another one. It’s currently sitting a bit higher than the previous chair, but I’ll make it comfortable.
Also have to get my "groove" back into the chair

Wednesday, July 26, 2006

Word on Generics

Had another java programmer here at work point me at a page complaining about generics
Ken Arnold’s Blog

And because I was interested in the possible performance issues that might be associated with generics, I wanted a read.

But it turned out to be a discuss about the difficulties of using generics. I read the article and I didn’t understand what his problem was. It seemed like he was using generics wrongly.

I though generics where meant to be an aid to prevent typecasting from items. A way to gaurantee that when you put something in of a certain type, it will come out as that type without typecasting.

There was one line in there “Right now, there are some idioms that you cannot code without a type-safety warning, such as creating arrays of generic types”
Unless I’ve missed something, isn’t

List<Thing>[] myList = new ArrayList<Thing>[5] ;// *

All you need to do?

*Code may not compile. I don’t think I’ve set Eclipse for 1.5

-= Comments
1. Matthew Delves | July 25th, 2006 at 12:28 pm
Whilst I am not a big fan of idiot proof code, it does make for more stable programs if and when it is used properly. Surprisingly someone who would be assumed to know Java would not be able to grasp the concept of Generics and convey it to others.

Simplifying code

It has been a while since I have written a good simplify post. It has also been a while since I’ve posted several entries end to end
[java]
String fileName = file.getName();
if (fileName.endsWith(someValue)) {
return true;
} else {
return false;
}

[java]
String fileName = file.getName();
return fileName.endsWith(someValue));

Now I know it could be shortened to one line, but then things start looking a little long. If it was c# with properties, I might have gone with it.

-= Comments
1. Lucien | July 26th, 2006 at 11:07 am

The one liner for that isn’t so bad.

return file.getName().endsWith(value);

At least you didn’t start with:
[java]
String fileName = file.getName();
if (fileName.endsWith(someValue) == true) {
return true;
} else if (fileName.endsWith(someValue) == false) {
return false;
}



That’s the kind of newbie code I *love*

2. Mark | July 26th, 2006 at 12:24 pm
This one with css is a classic

border-top-color: #000000;
border-right-color: #000000;
border-bottom-color: #000000;
border-left-color: #000000;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;

The amount of times I see the above code is stunning..

border: 1px solid #000;

3. Matthew Delves | July 26th, 2006 at 12:27 pm
There is something always beautiful about simple code. It is easy to follow and as long as you know exactly what it does there can be less bugs.

4. Lucien | July 26th, 2006 at 12:43 pm
With the CSS example, I expect it’s auto generated by some tool (not the tool sitting in front of teh keyboard).

doesn’t make it any more acceptable. And since humans inevitably have to go in and tweak it when it’s not working, it just makes out job harder.

5. Clinton | July 26th, 2006 at 1:17 pm
I’ve seen a few tools "expand" css rules because they internally expand them to implement each feature (aka firefox+web developer -> css view etc).

A neat css tidy tool at http://csstidy.sourceforge.net/i but the informed human is still the elegant solution…

6. Lucien | July 26th, 2006 at 2:17 pm
What about an elegant human designing an informed solution?

7. Mark | July 27th, 2006 at 10:54 am
No, an informed designer building an elegant solution.

Friday, July 21, 2006

Windows XP Pro Software Raid 1

Somehow at work, I managed to let myself assist in the management of the hardware at Hyro. Hooray for me.
The last guy was a windows only man. When a computer died the other day, and chckdsk /f didn’t work he was out of options. I come in with a linux cd and hey presto, some data is readable (It seems that it is a nasty disk).

He is an artist, and I know his plight. He needs the speed of a local disk, but probably should back it up somehow. Things change that often that keeping tabs on backups is a pain.

So I thought, haha, give the man two disks and see if Windows will do a software raid. Both disks are probably crap, but at least they shouldn’t fail at the same time.

Spent most of this morning googling. Came across this interesting forum:
short-media forum

It was a kind of yes / no thing. The only way I was going to get an answer was to actually do it.
Fired up VMWare, worked out how to add a second disk, shrunk the first partition with some linux tools and loaded up disk management. I was able to create a striped volume, not much else.

Maybe it was because I was running without any service pack. Fired that on and tried again, still no luck.

I remember reading that it may not be possible with a disk that holds the operating system: a limitation of the software perhaps, so I bung in a third disk and give it another go, carefully reading all of the screens again.

[hmmm, seems I no longer have a copy of the image that was here]

Here is the magical screen where 5 = 3.
I don’t mind sticking up for Microsoft sometimes, but it’s this sort of thing that makes it hard.

Just about to try the hack over here, but I think sleep might get the better of me.

Funny how sometimes you can go months without posting, and then two big things come across your lap.

-= Comments
1. Clinton | July 21st, 2006 at 2:44 pm

When i realised i couldn’t (easily) do software RAID (2-disk mirror) on a non-server addition of XP, I purchase an Apatec SATA RAID (1210SA) card ~$80 AUD and it’s been really good. Yeah - i know it feels crazy to buy hardware when the software should be able to just *do* this (stupid policy for this feature I feel)… but using a hardware solutions has actually been a good result.

It was also pretty easy to plug-in the existing hdd (with XP pro installed) into the card etc. and not lose anything (i had backed up everything as that was a real concern Second disk got mirrored up and apart from some extra heat from two drives me checking on the disk health (SMART hidden from the direct interface now) I’m happy.

Thursday, July 20, 2006

Unfriggin believable - Source Game

http://storefront.steampowered.com/v2/index.php?area=game&AppId=922

Check out the new portal game that is to come with Half Life 2: Episode 2
Drool.

Now that is game play that might make me go out and get a credit card so I can have this game as soon as it is released.

I waited before DOD:S came out in a box, I’m waiting for Episode 1 to be boxed, but this just looks to good to pass up.