2009-11-27

iTunes tracks residual value; BIG FAT ZERO

I find this really funny, and in fact I'm quite smug about it. I read earlier today on Twitter that a guy I'm following was wondering "...what to do with all my purchased iTunes tracks now I'm using Spotify premium...".
HAHAHAHAAH! Let me laugh for a bit here. HAHAHAHAHA. HOHOHOH!!
Right, composure...
Here's the deal; You can burn them to DVDs and/or data CDs. Even Audio CDs. Then you can stick them in a box in the loft. That's it. You can't sell them because that's illegal, even if someone would be prepared to pay for your second hand digital music.
Feel a bit f'd over...?! Well you should be, all of you iTunes customers that haven't thought about "what's next". Sure, iTunes (and other digital music download shops) are fine if all you want to do is to listen to the music. And the word listen really is crucial here.
Let's compare to that "old' format", the CD Audio disk. With a CD you can give to your friend to listen to. Yeah, you can go to the pub or café to meet your friend, hand them a CD and it's pretty sure they can listen to it at home. You can get the CD sleeve whilst listening to the CD in the player, and you can look at photos and read the stuff in there, such as lyrics. You can do this anywhere in the house, even outside. You don't need a daylight readable screen for it. And you know what. You can give this CD sleeve to your 150 year old grandmother, and she'll be pretty compatible with it.
Another cool thing is that, should you meet the artists on the CD you can get them to sign the CD (and increase the CD's value). Novel concept; Sign my MP3 files (or AAC in iTunes speak).
But here's a part you didn't think of; You can actually sell your CD onwards. The residual value of a CD might not be much (unless it's a collectible), but there definitely is a residual value. Your digital music files don't have any residual value. Nada. Zip. Zilch. Big Fat Zero.
So, now that you're aware of this, you can either keep buying your inferior digital music files, or you can start buying physical formats that, not only sound better, but are actually tangible in more than one way.
Oh, and Spotify, another "music leasing" idea that's not to my taste. I'll leave that to another caffeine fuelled morning.
PS, sorry for the quetness, been busy and boring.

2009-09-11

iTunes 9 App organising is abysmal

I have been waiting for a way to organise my applications on the iPhone for a long time. Once you have more than 4 screens of applications things start to get either messy or very tedious. Draggig an application with your finger across 4 screens is painstaking.
I even thought of taking a set of screenshots of the application icons, then cutting them out and organising them on an A3 paper. Then return to the iPhone and painstakingly drag them around.
I've also always thought that iTunes is an abysmal application. It might have been good when it was concieved as a conduit between your local MP3 files and the proprietary communication to the iPod. After that, Apple has just piled on functionality as it has emerged. Today iTunes is a hub for too many things. Where's the logic of activating and updating your phone with a music software? Don't get me started on the interface. I'd easily say that iTunes is Apples worst UI and a catastrophy when it comes to useability.
Now iTunes 9 seeks to fix some of these UI horrors. It's got a new iTunes Music Store (which sells vidoes and ring tones and now applications) UI, and so forth. One of the improvements is the UI to organise your applications on the iPhone or iPod Touch.
Let's have a look at it.
To the left you have a list of all your applications in a sortable list. With a checkbox to install/uninstall the application from the device.
In the middle you have the screen from the iPhone/iPod Touch.
To the right you have very small thumbnails of the screens, and the application icons.
Here's a question for you (and Apple). Why the hell do I need to see three icons of the same application? On top of this, why do you waste my screen real estate with icons so small that I can't be bothered to squint at them? This user interface is absolutely pointless. It's also very cumbersome. You can drag applications between the different columns and screens, but the logic is a bit cloudy. Sure it makes a bit of sense, but it doesn't have to be this confusing.
Here's what to do to fix it;
First sack the guy you hired to do this. Tell him to go back to the Windows Vista team and never ever touch a computer again.
Second of all, what's wrong with the interface on the actual iPhone and iPod Touch. This user interface is a bliss, both to view and use.
It would have been really easy for Apple to have a long horizontally scrollable "Screen" in iTunes. The fixed icons on the bottom of the screen would be fixed to the left. Then you could scroll screen by screen to the left and right. Just like on the iPhone. Having one of those icon-size-slider would allow the user to zoom in-out to view the icons as they please. Overview or details when the user wants. When zooming out far enough there could be more than one row of "screens" so you could get a really good overview.
Grabbing the bottom of the screen and dragging would change the location of that particular screen. Grabbing and dragging an icon would naturally change the location of that icon. Well, what about the applications you've bought, but don't want on your device. Well, they'd be located to the left of the home screen, say with a white background so the user would see that they're not on the device's black background. Dragging them from there would put them on the device. You could even have tabs on top of this/these screens to sort the applications.
Why they have not implemented this obvious user interface is beyond my comprehension. But then again I would never have come up with the idea of using an MP3 playing software to buy movies, download operator updates.

Right, back to squinting at those icons. Bhlergh.

2009-08-28

MultiTouch in Snow Leopard FAIL on older trackpads

I just installed Snow Leopard on my June 2007 MacBook (a plastic one). I had my hopes up that Snow Leopard would bring MultiTouch, that's 3 and 4 finger gestures, to my old computer's Track Pad according to this Gizmodo Article - amongs many others.
Sadly the truth is that the new features are only given to MultiTouch track pads, the older Track Pads can apparently not handle more than two fingers on the surface at one time. This means that, pretty much, from the start of the MacBook Air and forward the laptops all have MultiTouch TrackPads. Mine doesn't. Read the "Multi-touch coming to older MacBooks? Not so fast."-article on Tuaw for a better and more precise explanation of the innards of this.
Bhlergh - still only letdown in Snow Leopard so far. It's still very cool! :)

2009-07-14

PostgreSQL one click installer fails - SOLVED

I finally got around to upgrading my PostgreSQL 8.0 to latest, which is PostgreSQL 8.4 as of writing. I had used a fink (Debian APT version) of PostgreSQL before, but now I wanted it upgraded.

I found that EnterpriseDB - the commercial branch of PostgreSQL has got a "One Click Installer". Oh JOLLY, I merrily thought. I figured that I'll push it in and then I'll figure out how I'll deprecate my old install and transfer the DBs over (haven't done that as of writing).

Not totally surprising I ran into problems. The error message I got in the installer was:
Failed to initialise the database cluster with initdb

Hmmmm.... That's quite serious. I headed over to the support forum. Not long before I found the thread named "Error Installing Postgresql on OSx (Macbook Pro latest) using one click installation". It seems that the problem is that the previously installed postgres user is an "anonymous" one. I.e it doesn't have a shell nor a home directory. Until this oversight is fixed in the PostgreSQL/8.4/installer/server/createuser.sh script, you can do the following kung-fu-grips.
First, check that your postgres user really is screwed (command ran as root, if you're not using root, prefix the command with sudo as usual). Run this and see if you get something like this.
bash-3.2# dscl . read /users/postgres
AppleMetaNodeLocation: /Local/Default
Change: 0
Expire: 0
GeneratedUID: 00818549-E7C6-60A498CE64B5
NFSHomeDirectory: /dev/null
Password: *
PrimaryGroupID: 252
RealName:
PostgreSQL Database Server
RecordName: postgres
RecordType: dsRecTypeNative:users
UniqueID: 252
UserShell: /dev/null

You notice that NFSHomeDirectory has the value of /dev/null and that UserShell has got the value of /dev/null too. Run these commands to fix it:
dscl . -create /Users/postgres NFSHomeDirectory /Library/PostgreSQL/8.4
dscl . -create /Users/postgres UserShell /bin/bash

Note that if you're using another version than 8.4 you'll have to change the path. If you re-run the first command it should now look like this:
bash-3.2# dscl . read /users/postgres
AppleMetaNodeLocation: /Local/Default
Change: 0
Expire: 0
GeneratedUID: 00818549-B53E-60A498CE64B5
NFSHomeDirectory: /Library/PostgreSQL/8.4
Password: *
PrimaryGroupID: 252
RealName:
PostgreSQL Database Server
RecordName: postgres
RecordType: dsRecTypeNative:users
UniqueID: 252
UserShell: /bin/bash

Note that both NFSHomeDirectory and UserShell has got "proper values". You can now log in (from root shell) to postgres user (su postgres). If your previous attempt didn't work, delete the /Library/PostgreSQL/8.4 directory (folder) and you can now install PostgreSQL 8.4 with the one click installer from EnterpriseDB.

Hope that's of any use to anybody out there.

Oh, and one more thing:
PostgreSQL > MySQL > *

2009-07-03

My iPhone iSSH set up

Since my Psion Revo I've had terminal (later SSH) applications on my phones, just so I can access any server I might need to from anywhere. It's a very comforting thing to have, knowing that if there's a problem you can fix it.
I'm happy to say that the iPhone experience is better than any other mobile SSH solution I've ever used. This is thanks to the iPhone's UI and Dean Beeler of Zingersoft and the iSSH application. I've not tried other SSH apps for the iPhone as I'm very happy with Dean's efforts. He's also very active on the Google Group for iSSH. He's also (slightly reluctantly) dishing out AdHoc releases when the approval process of the AppStore is slow. Excellent!
This post pertains to iSSH 3.1, and I know it will probably be short-lived as Dean has already submitted 3.5 to Apple AppStore as I type this. It also is only about how to set up your connections, I'm not very versed in the advanced use (yet?).
Let's get started.
I wanted easy connection to my servers, and my passwords are tedious things, so typing them, even on a normal keyboard, is no fun, let alone the iPhone's keyboard. iSSH has got the option to store the password, and I think that's a good idea, but I find it safer to use the RSA key functionality. The reason for this is quite simple; Should I lose my iPhone I can log onto the servers and delete the keys from anywhere. I can't blank the passwords remotely. To add a bit of protection onto this "blanket log in", I use the "Passcode Lock" feature. This is simply a 4 digit PIN (personal identification number). If you don't know the PIN, you're locked out of the app.
Short config is thus;
  • Passcode (PIN) lock
  • RSA key pair for login
  • Never log in as root (Super User)
Simple enough!
Here's how to do it.
  1. Turn on "Passcode Lock" - Go into "General Settings". Flick on the "Passcode Lock" switch.
  2. Generate your key, RSA key in my case, by clicking the "Generate" under "RSA Key Functions".
  3. Create a new connection by clicking "Add Configuration".
  4. Enter your details as you would with these notes.
  5. This is optional; Use "screen -DRRS iphone" in the Command setting. This starts a screen session automatically or reconnects to an existing one. This enables you to shut down your iSSH application without losing anything from the terminal. Thanks to a lot of guys on the Google Group, and Jared Earle in particular for his "SSH on the iPhone at last" post.
  6. Then enter your password in as usual.
  7. Click "Save" at the top of the screen. This step shouldn't be necessary, but I found the app giving some error messages once. I'm sure Dean will fix it.
  8. Go back into your newly created connection and then click "Transfer Public RSA Key". This will copy the public key into your ~/.ssh/authorized_keys file. If you don't have the file, you need to create it; mkdir ~/.ssh && touch ~/.ssh/authorized_keys && chmod -R 700 ~/.ssh before you transfer the key.
  9. Once the key is successfully transferred, flick the "Use RSA Key" switch on. This switches from using your password to using the key.
  10. Click "Save" at the top of the screen.
  11. Test your new setting. You will be asked to confirm the host's certificate. (Note that you'll need to confirm the certificate every time you change the setting - I was almost getting annoyed with this until I figured it out).
What should happen when you connect is that you shouldn't have to enter a password, but you should be logged straight into the server and swished straight into a screen session.
Separately these steps aren't difficult, but figuring out the sequence took a bit of time for me, so hope this saves you a bit of time.
I've now got all my important connections on the phone. The useability of the iPhone iSSH application is just astonishing for such a small device. Screen swiping, pinch zoom, gestures, horizontal mode, etc, etc all make it surprisingly easy to control your server.

2009-06-11

Where's the iCal/vCal links in TV Shows, Events, Concerts, etc?!

This is bugging me more and more and more and more and more (hope you get my point). What I'm talking about here is the ability to download event information in iCalendar or vCalendar format from Internet sites.
A long time ago I wrote some sort of a web based calendar application, and one of the things we included in it was the ability to download the events to your computer's electronic calendar. It's so long ago that I almost forgot about it.
Either way, lately I've been trying to free up my head from remembering things like dates and times and really started getting back into organising my computer's and phone's calendar. They're synchronised so I don't have to worry about that. My mail application helps me a bit with these smart tags (or whatever they're called) so that I get this little highlight and a drop down on words that resemble dates and times. It's really easy for me to create a calendar event from it.
But 99% (not scientific 99%) of all websites I visit that have some sort of events do not supply any way for me to easily enter that into my calendar. What's wrong with these people?! Don't they want me to attend their events?!
Let me give you a few examples;
I like watching The Gadget Show, if not simply for the content but also to see how much Jason Bradbury's eyewear frames have grown since the last episode. I went to Five.tv's website to look for a program schedule - there was none, and natually there wasn't an iCal/vCal download.
I want to go to Silverstone Classic, so naturally I'd like to mark it in my calendar. You guessed it, no event iCal/vCal.
I use RadioTimes.com website to check when stuff is on TV... That's correct, there's no easy way to enter that data into my calendar.
I wanted to track Apple's WWDC 2009 keynote. I checked several websites for info, none of them had a downloadable iCal/vCal calendar entry.
I've been to several high-profile concerts this year and last, and none of the vendors of the tickets, including Ticketmaster and Seetickets, offered iCal/vCal downloads.
And so forth, and so forth. Not a single one! None!
I seldom get very animated by stuff like this, but here goes;
WHAT'S WRONG WITH YOU PEOPLE!?!?!?
Don't you want people to attend your events? Don't you want people to watch your shows?

Here's a tip for all of you web developers and web development sales guys/project managers out there; Have a look on your clients website and see if there's any information pertaining to dates and times on the site, and if there is, go sell them "your new downloadable calendar entry". Go do it!
Here's a tip for all of you content providers and event organisers; DEMAND THIS NOW. NOW!

Thank you. I feel better now (until next time I sit there copy-pasting dates incrorrectly from a web page to my calendar).

2009-06-04

Solar Charging my Car

My car stands, sometimes, for weeks on end, simply because I have nowhere to go in it. Its task is to chauffer big things around, not just me. So, there it stands. Batteries don't like that. They kind of like doing things. Kind of like me. Batteries get empty and soulless if left for a while. What I've done so far is to stick a small (Halfors [Halfrauds] call it "up to 1200cc" - as if you should measure battery capacity by the capacity of the engine) charger to the battery. This is sometimes annoying as I tend to forget it. I come out to the car and no charge. On top of this my 1200cc charger *cough* doesn't seem to charge the battery fully either.
The solution, I hope, is a solar panel. Maplin is flogging these panels that are designed to keep 12V batteries trickle charged. They've got different sizes, but when I walked into the shop I just opted for the cheap one. At £13 (well, £12.99) I wouldn't mind it if it didn't work. It's the Solar-Powered 12V / 2.4W Battery Trickle Charger that I bought.
I've already run into two little things that I would want to fix. First of all, the instructions say that I should disconnect the panel from the car before starting the engine. OK, fair enough. But the point of having a panel is to not having to disconnect it and reconnect it. See the "forget" point above. I need to locate a relay that is connected by default, and when power is added it disconnects. I can then take power from the cig lighter sockets to disconnect the panel. Another problem is that I have no 12V permanent point within the coupe. I'm not very keen on running a cable from the coupe straight to the battery as I think I should be able to connect it up in the coupe. I just need to find such a 12V point.
And then I obviously need to mount the panel (semi) permanently somewhere. On top of the dash would be the best spot as it's the only flat surface that can be hit by sunlight from above. All other windows are vertical. The panel comes with suction cups, but they won't work on the dash, so I might just hot-glue-gun the cups onto the dash. Heheheh... joking! Well, perhaps!
If I get all that done, then my car should be able to stay charged without me having to worry about giving it regular attention. In theory anyway.

2009-05-27

Removable Bathroom Speakers

This is probably weird to you, but here goes anyway. Being Finnish I miss my saunas. I really do, so I substitute the sauna with hot baths. I've previously made a magzine rack so I can read a book or magazine whilst soaking in the bath. In the past I've also turned up the music on my computer so I could hear it reasonably loud into the bathroom. Naturally this meant that the sound level was quite high nearer the speakers much to the annoyance of my girlfriend and probably the neighbours. The solution to this could have been a portable radio/stereo etc, or fixed waterproof speakers in the roof. However, my girlfriend wasn't really keen on me installing speakers into the ceiling. Therefore the solution couldn't be permanent, but had to be removable.
The solution is a set of computer speakers connected to our home server situated in the loft not too far from the bathroom. The server already houses all of our MP3s and runs several music streaming apps, including SqueezeCenter (artist formerly known as SlimServer). Not too far between the dots to connect them then?!
I already had a set of Creative I-Trigue 2200 speakers that has served me well over several years as desktop speakers for my computer. They're no super-duper HiFi speakers, but they're good enough to pump out some tunes in close range and not too high volume. They're also quite compact. Perfect for the job.
I had been hoping that I could do some aluminium welding on this project, but it turned out that it was not needed. I simply took a 13x13x13mm alu U-profile of 1mm thickness some 800mm long and affixed the two speakers onto this "arm". I left a part of the arm sticking out to prevent cables from getting too close to the bath. I then bough a simple suction cup, officially known as a "Suction Lifter", from Axminster Tools, cost me £2.40. Only problem with this one is that it's a hideous colour. Nevermind. I screwed the suction cup onto the arm. Then I collected the wires and taped and zip-tied them onto the bar. I'll need to extend the power supply a bit and put it in a permanent spot, but for now it still works.
That's the hardware done.
Now how do we get the tunes to the speakers?!
I spent quite a bit of time trying to stream from the SqueezeCenter onto localhost I tried mgp123, mpg321 (doesn't do streaming), madplay, and splay, but none of them worked. To make it a bit clearer, in theory you should be able to do something like this: mpg123 http://username:password@127.0.0.1:9000/stream.mp3 or even madplay http://username:password@127.0.0.1:9000/stream.mp3, but it just didn't seem to work. I tried using wget etc, but I got the streaming to work only for one song, then it cut. Something like this: wget -q -O - http://username:password@127.0.0.1:9000/stream.mp3 | madplay - but nope. And then by some pot luck I managed to find out that there's a headless (i.e command line) version of the very nice SoftSqueeze. SoftSqueeze is a Java application that runs on your desktop mimicing the commands from the hardware such as Squeezebox and Duet. It works well on the desktop but for me it was pointless as the server doesn't bother with the GUI stuff. I was very pleased when I found SqueezeSlave. I just downloaded the appropriate binary and started it and voila I had full control over the audio. Perfect!
I then installed a iPhone/iPod Touch specific skin for the SqueezeCenter called iPeng. Whilst it worked fine, it was still a web-app and not 100% good. However, there's native iPhone apps out there, three in fact. One by the same guys who do iPeng, but the one that caught my eye was Squeezemote. The reason I chose it was because it seemed to use the native iPhone look and so far it's worked flawlessly. At £4.99 it was a bit more than I wanted to spend, but hey. The total cost so far isn't too bad. ;)
I can now pick up my phone and create a playlist for my bathroom audio experience. All I then have to do is to make sure that the SqueezeSlave is running (which I plan to leave running and install on the garage laptop too) and that I clip the speakers onto the tiles in the bathroom and turn up the volume! If it's too loud, you're too old! ;)
Quite pleased.

2009-05-13

It's cloudy out there, but do read on..!

I realised that I've not posted in a long time, very long time in fact. It's really strange as a lot of things have happened between this post and the previous one.
Here's a some of the things that have happened.
  • I've bought a TIG welder. I've knackered my bank account. Why the hell a TIG welder?! Well, I freely admit to being a garage and welding deprived child. Since I stopped playing with my Lego Technic I've always yearned for the ability to weld. Last may I bought a small Milling Machine - allows me to shape metal - but not fuse it. I've now bought the TIG welder and I feel that the universe is the limit. It's difficult to describe how it feels to be able to weld. I've since buying it spend hours in the garage practising. It's not difficult to TIG weld, but it's not easy either. Needs practise
  • Caz has had her birthday. The whole family chipped in and got her something nice. I'm not saying what it is, because that's up to her.
  • We've been to the Nürburgring for the customary Easter season start. We stayed at Jochen's and Fia's. Huge thanks to them, we had a really good time! The SuperDuke R was great on the Ring, but it all was spoilt by a sliding feeling at the rear wheel. I'll look into that when the sun is shining.
  • Roomba got ill, but the doctor's bill was picked up by the warranty. All is well now.
  • We've sold tons of old gadgets on eBay and mobiles to Mazuma Mobile. Good to get rid of the old stuff.
  • I've been to LRUG and found it very interesting, especially Jon's talk which helped me see Ruby blocks in a different light. I'm going again next Monday.
  • I've been to see AC/DC in Birmingham. I loved it, Caz loved it, Wolfy loved it, Daz loved it. We all loved it! They're f***ing great! It's a no-BS show, that rocks from the start to the finish. Only bad thing was there was this tiny oriental girl who decided she had the right to squeeze past us, standing in between me and Caz, and she didn't even seem that much into AC/DC. There's always one, isn't there! I'm very much looking forward to the Wembley gig!
  • The day after AC/DC we saw NoFX in Birmingham too. It was utter cr*p. There was four, "support" acts. "Alienating acts" more like it. And when NoFX finally got on stage they spent most of their time talking. Sheeeesh! Everybody is a rock star, everybody is a clever programmer, everybody has got a guitar solo. The whole NoFX experience annoys me because I've got several of their albums and I really like their comedy take on the world.
  • Finland didn't win the World Ice Hockey Championship. In fact, didn't make it very far. *sobs*
  • We've got tickets for Green Day in Birmingham. YAY!
  • We went to Clacton-on-Sea for a Tae Kwon-Do training thing for Caz and her TKD buddies. Despite some awesome people, I would rather have stayed home in a dark closet with a bottle of booze, or better yet, shortening my ToDo list. I don't regret going, it was an experience, and another place to see. (And I did have a good chuckle at the chav-spotting).
  • I had another birthday. Pressie-wise I got a few bottle of red wine (thanks guys!), Big Bang Theory Season 1 DVD, but I should also mention my advanced BD cum Christmas Present; 22" LCD TV that also works as external monitor for my computer when needed. It's next to me in the office.
  • I have shortened the ToDo list by quite a few items.
As you can see, there's been tons of things going on, and I don't really know why I've not posted anything "clever" for a while. I guess I'm trying to do as much as I can of those things that have been lying around. For example, we gutted the downstairs cloakroom, but that's as far as we've got. The Espace is playing up and is currently of no use to me. As it's now been for about 6 months. I try to fix it when I can (read find energy). I need to fit a set of shocks to a K1200R, as soon as I get my hands on it. The garage roof will need doing this summer, and summer is approaching quickly. I have an Archos camcorder that I'd like to fit to my bike. I want to make non-foldable foot pegs for it. I want to make a GPS holder. I want to make SAS plates for it. And tons and tons and tons more things that I want to do.

2009-03-26

AC/DC Fan Club Pack Arrived.

I wasn't looking forward very much to receiving this Fan Club Pack from the AC/DC Fan Club, but this one is even worse than I expected. HAHAAHAH. I'm sure than not even a 12 year old super-stalking-fanatic would be impressed with this pack. It consists of 2 pin-buttons, one cheap key-ring, two plectrums and a lanyard of some sort along with a card.
I've not opened it as I don't see any point in it. Maybe it'll be valuable 10,000 years from now and I'll be able to cash in. Not very rock n' roll this!
Either way the Fan Club membership has paid off in the sense that I've got tickets to both Birmingham and Wembley this year, and at a discount. YAY!

2009-03-06

Recovering from a crashed (soft) RAID

My previous post is about that one of the disks in my mirrored (RAID1) set up has died. This post is about how it was fixed. And fixed it was, without any real pain, just a bit of confusion.

Right, it all started at dusk in the castle, the wolves were howling in the distance, and you see, but not hear the owls fly over the fields, hunting their prey.... No, scratch that.
It started with a message like this:
This is an automatically generated mail message from mdadm
running on xyz

A DegradedArray event had been detected on md device /dev/md0.

Faithfully yours, etc.

P.S. The /proc/mdstat file currently contains the following:

Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md0 : active raid1 sdd1[1]
312568576 blocks [2/1] [_U]
That means that one of the disks has gone to HDD heaven (you know where the beer volcano is). Notice the [2/1] and the [_U]. It means one disk of two is gone.
Take this message seriously!
Now the next job for you is to locate (read, freak out and stress whilst buying a new disk) a replacement disk. This disk should be of equal or larger size. I chose equal. I'm cool like that.
Then you need to figure out which of the disks it is that's gone. This caused me some headscratching. By issuing mdadm --detail /dev/md0 (where md0 is your multi disk, a.k.a RAID, that's failed). You get an output that finishes in something like this:
Number Major Minor RaidDevice State
0 0 0 0 removed
1 8 49 1 active sync /dev/sdd1

That tells you which disk is active. And as I knew that both of my disks were of identical sizes I could check the partitions, like this; cat /proc/partitions and I got an output with this in it (not full output included);
8 32 312571224 sdc
8 33 312568641 sdc1
8 48 312571224 sdd
8 49 312568641 sdd1
9 0 312568576 md0

As you can see /dev/sdc and /dev/sdd are exactly the same. Some high-end-maths applied means that it was /dev/sdc that had taken leave of absence. Now all I had to do was to figure out which disk that was on the motherboard. I concluded that it would be the one with the lower number, I had SATA something 1 and SATA something 0... I unplugged number 0 and rebooted the machine and checked if the data was still present. It was, which meant I had unplugged the correct disk. Shutdown again and replace the broken disk with a brand spanking new one. Boot the machine back up and everything is tickety-boo. Just like before. Data still present, but now we have a "partitionless" disk in the mix. If you issue fdisk -l (for list) you'll get a list of what you've got. One should say something like:
Disk /dev/sdc doesn't contain a valid partition table

And that's the one you now need to partition. I had never used fdisk before, and I absolutely hate toiling with disks and partitions. It's so easy to make a mistake. Start fdisk with; fdisk /dev/sdc (obviously where the device is the one you're working on). Then you want to create a new primary partition. Press n for new, then select primary and then 1. My disk used the full space so I only selected the defaults when it came to size. Then you need to change the file system to "Linux Raid autodetect". I did it this way; press t for type, then enter fd (which is the hex code for "Linux Raid autodetect") or you can press L for a list of options. Select the code from the list. If you now press p for print (out the partition table) you should see something like this:
/dev/sdc1 1 38913 312568641 fd Linux raid autodetect

This means you're ready for the sweetest of the sweet spots when it comes to all your previous efforts with this RAID unit. All you have to do is to add the newly partitioned disk to the RAID array.
Issue this simple command: mdadm /dev/md0 --add /dev/sdc1 (naturally the devices should match what you're working with) and, as Gordon Ramsay says; "Done!".
Now you can issue mdadm --detail /dev/md0 to check the status of your disk. You should see something like this:

State : clean, degraded, recovering
Active Devices : 1
Working Devices : 2
Failed Devices : 0
Spare Devices : 1

Rebuild Status : 0% complete

UUID : e6583ff6:48d02cb1:4e3ee66a:d08da4cd
Events : 0.17658

Number Major Minor RaidDevice State
2 8 33 0 spare rebuilding /dev/sdc1
1 8 49 1 active sync /dev/sdd1
Keywords here being "recovering" "Rebuild Status" and "rebuilding". If you issue cat /proc/mdstat you get an output something like this and there you can see the nice progress going on.
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md0 : active raid1 sdc1[2] sdd1[1]
312568576 blocks [2/1] [_U]
[>....................] recovery = 1.6% (5299456/312568576) finish=108.9min speed=46994K/sec
I can tell you that it's a very very sweet feeling seeing the recovery percentage creep upwards. Disaster averted! YAY!

A few notes.
This page http://linux-raid.osdl.org/index.php/Reconstruction says that you should "Use raidhotadd /dev/mdX /dev/sdX to re-insert the disk in the array " - that's deprecated and you should now just use the --add flag to mdadm, nothing more.
Then I thoroughly recommend you to write on the physical disk which device it is corresponding to. I.e write /dev/sdXX on the disk you stick into the machine. That way you don't have to waste time figuring out exactly which /dev/sdXX is which disk.
My disk setup in the machine is a single IDE disk that runs the system, and then the soft RAID1 mounted at /home/ but I also have all my music and photos on this device. Mainly linked with soft links and so forth. The system disk is only backed up, not mirored. I also have a "scratch disk" there that's normally not mounted, but that's another story.
A few resources:
Big thanks to the guys whom I've bothered with this. Dempa (being calm, tips, links, and generally being a "Good Guy"(tm)), Aaaandrew (again, being calm, having insight, and good support, and also being a "Good Guy"(tm)), and Tooony (for the loan of the panic-backup-disk and also being a "Good Guy"(tm)). Thanks!!

I can't express how convenient this has been. From now on RAIDed disks will always be part of my machines. I'm currently scheming on how I can make the server even more "indestructable". Muahahaha!

2009-02-24

Typical isn'tit. Disk crash the day before going away.

No matter how much you try to prepare yourself it always happens. Woke up this morning and I had a nice message in my inbox saying that one of my mirrored disks on my home server has given up the ghost. Having bothered a few friends and spent some time searching on the net I can now be pretty sure that one of the disks has died. It's not a problem. Yet. The disk is mirrored. There's two of them. One is dead. If the second one dies, then there's a problem.
But I'm going away for a while. So for now, all I can really do is back things up onto a 3rd disk temporarily. Then order a new disk for the mirror and then try to restore it.
Oh joy! But I guess this is just how things go. No need going into "I really don't need this" as you will never need this.
Let's just hope I can manage without data loss.

2009-02-03

How to drive in the icy and snowy conditions.

I've just watched a piece on BBC Breakfast show where they "advice" the general public on how to drive in the winter conditions. Whilst it wasn't totally rubbish, it wasn't particularily good and I think it totally missed a few points. So, here is... without further typing, my tips on how to drive in the winter. In two sections; preparing to move, and moving.
Preparing to move.
First of all start your engine. This is vital. Your engine needs time to warm up, and this engine heat is required to demist your windows (not just the windscreen) and thaw the snow. The sooner you do this the better. Don't turn on all your electrical gizmos, including the rear window demister. Don't. You'll probably stall the engine and the battery needs all juice it can get. Let it charge for a moment.
Then clear your windscreen, mirrors, and lights. This part the BBC news got right. However, they also wanted you to scrape your car to buggery by removing all the snow. They do have a point that the snow will fly around, but this isn't lethal. Clear away as much as you can, but please don't scratch your car. Make sure your windscreen wipers aren't frozen to the screen, and that they not frozen solid. If they're frozen solid they won't conform to the windscreen and they will be useless. Naturally you've spiced up you windscreen washer fluid to extra strong so that it can cope with the extra cold.
If your doors are sticking a bit, you can use a bit of WD-40 or similar on the door frames to prevent moisture to sticking there.
Now, next lesson is how to demist the car. The correct way is to use hot air and plenty of it. Turn your fan up, turn you heat up, and point the air at your windows. After a while your screens (all of them) will be clear. Trust me on this one!
OK, so now you car is running, it's demisted, desnowed, deiced. You're about ready to go. But first, wait a few more moments to see if you can get the interior up to temperature. You don't want to drive your car if you are a popsicle. If you do, you're stiff and you're not very focused on the road and traffic. If the car is warm you can even take off your big puffa jacket and be able to touch the steeringwheel. Point is; be comfortable with your driving. It might extend your life expectancy. (The BBC got this wrong, IMFO). (Oh, and you're moving outdoors in garmets that will keep you warm for more than 10 minutes, aren't you?!)
To get moving you need to try not to spin the wheels. If you're stuck in a pile of snow you should, not, I repeat, NOT floor it and spin the wheels. Spinnging the wheels creates friction, which creates heat and suddenly your British summer tyres have their own ice skating rink underneath them. Not good. What you want to do is try to get the car rocking back and forth and in this way gather momentum to roll out of the pile of snow. Do this by using the clutch ease the car forward, then push the clutch back in to let the car rock backwards, when it's at back you ease the cluth out for more forward momentum - without spinning the wheels. Repeat, with increasing momentum, until you're free.
When driving you must remember that you've already got "4x4 brakes". Especially if you feel you have extra traction thanks to driving a four wheel drive car. Your brakes won't have extra traction. The key is to maintain as much space around you as possible. This gives you time to react, time to avoid and time to stop.
If, and only if, you have enough space around you can do a traction test. Make sure you have nobody around you and/or that you're in a situation that doesn't cause confusion. When in this situation you can brake hard to see how much traction you have when braking. This will help you calibrate how you drive. You can also step on the throttle to see how much traction you have in "that direction". However, if you are at any point unsure on how to recover from a skid, just don't do this. It's easier for you to drive slowly and not crash.

Bonus; what to bring with you on your journey.
Fully charged mobile phone
Petrol/Diesel - don't let your tank run close to empty. You don't know what detour you might have to take, and you might be stuck and the car's engine might be the only source of heat.
Stick a blanket in the car. Could be handy.
Stick some sort of digging implement in the car, even if it's just the smallest of garden tools. It's still better than your credit card.
If you're a house owner you might have a bit of sand lurking in a shed. It's very good to have a bit of sand in your car for added traction. Just lay it out in front of your driving wheels to gain a bit extra traction. But make sure it's dry or you won't get into it. Store it indoors.
A torch. I gets dark avfully quick!
More windscreen washer fluid - concentrated.
Some drinking water. Don't let it freeze.
Jumper cables. They might not be needed for your car, but being kind in the snow is the right thing to do.
Tow rope. It might be easier for you to stop and pull a car out of the ditch than wait (and potentially waste) for the emergency services and/or the AA/RAC.

And that's about it.
But above all.... Take your time! Stressing will mean you'll screw up much easier. Be safe!

2009-01-08

Searching an array for a value in another array.

Been spending a few minutes (x 30+) trying to figure this one out in a nice manner.
I want to search an array, to see whether a value of another array exists in the first array. This being in Ruby of course.
Here's my solution:
["x", "z"].any? { |value| ["a", "b", "c"].include? value }
Returns false.
["a", "b"].any? { |value| ["a", "b", "c"].include? value }
Returns true.
So, there you have it. This piece of code will return true if one of the values in the first array exists in the second array. Here's a little for google indexing: Find a value in an array, or locate a value in an array.
A true programmer would probably shorten "value" to "v" to make it less legible for the "meagre earthlings", but I'm a "Nice Guy"(tm).
Hope that's of any help to anyone out there.

Updated:
Righto, annoyingly, CT has just got back from "AFK", and trimmed my efforts down to:
(["a", "b"] & ["a", "b", "c"]).empty?
Returns false.
(["z", "x"] & ["a", "b", "c"]).empty?
Returns true.
He could have not AFK'd and helped me when I asked. Eitherhoo... His solution is much neater than mine, and I'm grateful for his help! :) Sweeet!

Updated II:
That's what I get for listening to friends. Eagle eyed readers will spot that CT's solution above returns the wrong boolean value. They should be reversed. Use "!" to do that, like this:
!(["a", "b"] & ["a", "b", "c"]).empty?
Returns true.
!(["z", "x"] & ["a", "b", "c"]).empty?
Returns false.
That should'a done it. :)