Clean install of OSX Lion on your Mac but keeping documents and applications

lion_logo.png My Macbook Pro ground to a halt after 6 months of heavy usage.
It started to freeze up frequently preventing it to load anything from the hard drive. Things that already were in memory continued working but accessing anything from the hard drive or unlocking the screen saver took up to 2 minutes. Not even “ls -l” worked.

A quick visit to the Genius Bar and after running many hardware diagnostics test it was diagnosed as a software error. They weren’t sure whether it was a problem just with the user account or whether it was in the system so the recommendation was to reinstall OSX.

Since OS X Lion (10.7) was out I thought I might as well install that rather then re-installing Snow Leopard (10.6).

Call me old fashioned but I don’t trust OS installations over older OS installations. I prefer fresh installs from removable media so I starting looking for a method to install OS X Lion from fresh but it wasn’t as easy as it should be!
By installing the OS X Lion on a new partition on the hard drive I was able to keep all my documents and application and move them across when needed.

What you need:

  • OS X Lion installer (purchased from Apple store)
  • An empty recordable DVD (it may be possible to install Lion from USB but I haven’t tried that)

First you need to create a start-up DVD from the OS X Lion installer. The trick is to find “InstallESD.dmg” inside the Lion installer. You can navigate items inside the installer by choosing “Show package contents”.
InstallESD
WARNING: The OS X Lion installer is deleted after you have installed Lion so make a back-up copy of it for future use!

Insert the blank DVD and choose to start Disc utility.
lion disc utility
Drag InstallESD.dmg to left-hand side of the Disc Utility, select the newly added InstallESD.dmg and hit Burn (and Burn again). It will take around 10 minutes to burn and verify the DVD.

Time to restart your Mac. Hold down Alt (Option) when booting to be presented with what media to boot from. The DVD should be visible after a short spin-up of the drive.

You can choose to install OS X Lion over your older version but this will delete all your files and applications. Instead you may want to consider keeping your old installation and install Lion onto a new partition.

Once booted into the Lion installer, don’t click continue but rather select Disc Utility from the top bar. Shrink your old partition to minimum possible, create a new partition in the newly created space and continue with the OS X Lion installation into that partition.

The installtion takes a good 30 minutes but once you have re-started and logged into Lion, your old partition is visible and you can copy items from it.

If you were using File Vault to encrypt your documents you have to navigate to /Users/<user name>, show content, double click on “sparsebundle”.

You will be asked for your original password and it will be mounted as a new image. You now have access to your old documents and application settings.

Most application you can simply drag from /Applications on the old partition but first copy the application settings (bookmarks, settings, accounts, passwords and etc). There are two places where the old application settings live:
<user home>/Library/Application Support/<application name>
<user home>/.<application name>

You need to show hidden files for this. You can enable hidden files by entering the following in a terminal window:
defaults write com.apple.Finder AppleShowAllFiles YES
Good luck and enjoy a clean install of OS X Lion (10.7)

JSR 303: Combining custom and standard validators

We are using the JSR 303 Bean validation API (Hibernate validator as the implementation) on a project and recently faced a problem.
Whenever we were using our own custom validators in combination with standard validators like NotNull and NotEmpty, the standard validators seemed to be ignored.
The result was that we were getting NullPointerExceptions in our custom validators and sometimes we were getting duplicate error messages for the same invalid field.
I haven’t poured over all of the JSR 303 documentation in detail so maybe I’ve missed a recommended best practice but the following code in the default NotBlankValidator gave me a hint.

public boolean isValid(String s,
ConstraintValidatorContext constraintValidatorContext) {
if ( s == null ) {
return true;
}
...

Why would you ever return true (i.e. valid) for an input that is null? That doesn’t make sense until you realise that validation is a *combination* of all constraints.
This means that your validator should only return false for your specific test. If it fails for a chained validation, for example if input is null, it should return true and rely on the NotNull validation to report that error.
You still have to guard for null and empty inputs but return true if they occur rather then returning false.
Hide any required basic validations inside your custom constraint annotation. For example NotBlank does that:

...
@NotNull
public @interface NotBlank {
...

Bali with children

children in baliWe just completed what I believe to be our first adventure with our kids; a trip to Bali, Indonesia.
Our children are 4 and 3 years old and we were contemplating whether they would be able to handle the 17+ hours long *day* flight and the culture shock.
I’m glad to report that it all went spectacularly well and our children have memories for a life time.
We started out in Ubud which is a wonderful place busting with culture, music and art craft.
While the Mrs enjoyed browsing the markets and shops the kids were much more keen on excursions. Luckily there are a lot of activities in and around Ubud that are just a short drive away.
monkey forestMonkey Forest is a little pathway in the local forest which is filled with curious and cheeky monkeys.
You can buy a bunch of bananas by the entrance to give to the monkeys but watch out, once they get a whiff of the fact that you are carrying their favourite dish, they will not leave you alone until they have robbed them all.
Out of 50+ friendly monkeys there was one that hissed at our daughter but we just moved on swiftly and didn’t have any further problems.
The elephant safari park is just an hour away and while outrageously expensive ($100 for the four of us) the kids loved the elephant ride and feeding the elephants.
To be honest you can give the 20 minute elephant ride a miss and just enjoy the elephant park.
Favourite restaurant: Cafe Lotus and Wayan Cafe
Favourite stay: Kori Ubud
After a few hectic days in Ubud we decided to relax at the beach for the rest of the holiday.
Out of all the various beach locations in Bali like Kuta, Seminyak, Legian, Nusa Dua and Sanur we opted for Sanur. Crowded with retired ex-pats and families with young children, Sanur seemed like the perfect spot.
bali bird parkHalf-way between Ubud and Sanur is the lovely bird park. Walk around the aviary and see that many, many colorful birds up and close.
The kids loved discovering all the different bird species (from tiny to large) but the highlight was when 3 birds were placed on each of them. Great photos in the park btw!
Sanur is a very laid back town with the usual tourist shops, bars and restaurants but no chaos (like in Kuta). You get the occasional guy on the street calling “taxi?” at you but nothing intense.
We had such a great time in Ubud doing daily excursion we decided to continue with the theme.
First day out was a busy day with Uluwatu temple, white beach and water sports at Nusa Dua, Dreamland Beach and food at Jimbaran (no sunset).
Just a sad word about Dreamland Beach; it is totally wrecked. Car parks, sewage like water, hordes of “local” tourists and an abandoned concrete construction. Give it a miss!
tanah lotGoing north turned out to be a much better direction. More rice fields, temples like Tanah Lot and Batukaru, lake Bedugul and hot springs. All in all some of the best sights Bali has to offer.
Waterbom is a water park in Kuta. Again it is a very expensive experience compared to other less touristy activities in Bali but it is a wonderful break in pace for the kids.
We spent a whole day swimming, running around and sliding down various slides. The kids loved it and it’s needless to say they fell asleep early and hard.
Favourite place: Tanah Lot
Favourite stay: Tandjung Sari
Favourite restaurant: Tandjung Sari
temple at lake bedugulIn summary Bali turned out to be a great beach and sightseeing holiday with the children. The combination of Balinese culture, nature, people and great value was just unbeatable.
DO IT!
PS Wayan, Made, Nyoman and Ketut are Balinese names where Wayan is the first born, Made the second and so on. If you want to get some laughs and instant acceptance from local people call your kids Wayan and Made and watch their sweet reactions.

Logitech Squeezebox receiver with flashing red light

squeezebox_red.jpgGot a Logitech squeezebox receiver the other day and after plugging it in to my switch, I assumed it would just acquire an IP (using DHCP) and just start working.
After 2 hours of changing network cables, restarting various network devices and a little bit of cursing I retreated to Google for some help.
Turns out that the Squeezebox receiver is not to be used on its own. It is to be used together with a controller and the controller is required for initial configuration.
The only reason Squeezebox receivers are sold on their own is for people that want additional receivers for their rooms.
In my case I knew there are mobile applications that can control the music playing or that one can even connect to the web interface of the Squeezebox Server.
The controller is twice the price of a receiver and being the cheapskate I am I didn’t want to fork out extra money just to configure my receiver.
Two options:
1) Borrow a controller from a friend
2) Use Net::UDAP to find your SqueezeBox receiver on the network and to configure it
Net::UDAP is a Perl module so if you are not familiar with Perl programming just download the following executable:
UDAP command shell
For a wired configuration (not WiFi), you can use the below command sequence:

discover
conf 1
set interface=1
save_data
reset

Followed by:

discover
conf 1
set squeezecenter_address=[ip address of your computer running squeeze server]
save_data

For a wireless configuration use instead:

discover
conf 1
set interface=0 lan_ip_mode=0 lan_gateway=192.168.3.1 lan_network_address=192.168.3.10 lan_subnet_mask=255.255.255.0 primary_dns=192.168.3.1 wireless_SSID=3Com wireless_wep_on=1 wireless_keylen=1 wireless_mode=0 wireless_region_id=14 wireless_wep_key_0=[WEP key] wireless_channel=11 squeezecenter_address=[ip address of your computer running squeeze server]
save_data
reset

You will obviously have to be connected to the receiver via a network cable to be able to configure it.
Type help or fields to list all device fields along with some documentation of the values they can take.
Check out the Net::UDP project page for more information and don’t forget to donate if this solves your problem!

Batalha Animal – Do you love animals?

foto_ines_3.jpgDo you love animals and are you thinking about a different way to make a difference?
Do you feel disgusted, angry and heartbroken to see a suffering animal?
Would you rather want to make a difference and truly help out?
This is a remarkable story of an ordinary working mother that all by herself changed the fate of over 150 dogs left to die. This during 16 years of love, dedication and hard work.
If nothing else, it will at least warm your heart to hear it.
Very different from the reality in the UK, abandoned animals in the streets of Sao Paulo, Brazil are numberless. They are living in the most deprived conditions and are suffering from chronic (but often preventable) diseases and starvation.
Most of the abandoned animals are at first perfectly healthy but it is just a matter of time before they are victims of cruelty, disease or fatal accidents in the mad traffic.
For these unfortunate (hairy) souls, there is little to nothing available in the governmental system that could help them. Instead they rely solely on the pity of animal loving individuals.
That is a bit how Ines Sanches, an ordinary working mother of 55 years, started on her path of helping suffering animals in the city.
Living in a busy part of Sao Paulo, she was walking home one evening when a shrieking sound made her head turn: a passing car had hit a young dog with full force. She rushed to the scene, only to hear from the dog owner himself that he had no means to help the poor animal, and that he was going to leave it there to die.
Appalled by the cruelty and disregard, Ines did not think clearly and took the injured dog home. This despite her own busy life full of problems and lack of funds and space.
She named the badly injured dog Madona and against all odds, with time and proper care, Madona made a remarkable recovery. Little did Ines know, that that event would change her life forever.
Madona turned out to be a fantastic companion to all the family. Lifting up the spirits of the household when they most needed it. She turned their lives around with her gaiety, contentment and recognition that in a way, Ines had saved her life.
From that moment on, Ines realized that she simply could not turn her back on the agony of the animals abandoned or injured in the streets of Sao Paulo and despite her own difficulties, she decided to do something about it.
Ines started by taking the suffering animals into her own house, nurturing them, caring for their wounds and diseases and then putting them up for adoption.
Quickly Ines realised that she needed a bigger site to accommodate the dogs while they were getting well enough to be ready for adoption.
16 years has now elapsed since Madona had been left to die on the road and today Ines and a team of volunteers care for 150 dogs collected from the streets of the city in a purposed build kennel, funded solely by the charity of friends, family and passionate dog lovers.
Although this may seem basic compared to the UK initiatives such as the Dog’s Trust, Battersea Dogs Home and the RSPCA, I can’t stress enough how major this is for the cruel reality of Brazil.
Ines’ initiative stands out for the longevity and professionalism. Her dedication to the project has overcome many difficulties in the last decade and despite the total lack of sustainable funding by the government, she has managed to secure a loving home and a much brighter future for the animals she has rescued.
As a fellow Brazilian dog lover, it makes me terribly proud to see what Ines has build up over the years. Facing the related financial challenges is very unique.
I know that many of you already have a continuous commitment to various charities which is maybe why I dare to ask if you can honour this amazing initiative with a donation. After all we are talking about changing the dark fate of suffering animals in one of the most violent and ruthless towns in South America (yes, my home town).
David has created this post to enable non-Brazilian residents to make a donation via paypal. We will collect all donations received and forward them to the Batalha Animal latest appeal (translated on the page) with a note from all of you.




If you have donated then thank you so much for helping, please feel free to share the story with other dog lovers you may know. We truly appreciate it!
If you are not able to donate than thank you for reading this far and please mention a word about Batalha Animal to your friends next time you have the chance.
Batalha Animal cares today for 150 dogs in a beautiful site with 5000 square meters. Batalha Animal has a live website with photos where they keep the interested parties and patrons informed on the use of the resources and on the development of the pets they care for.
For more info, lots of pictures, news and developments, here is the link to their local website:
www.batalhaanimal.com.br
Carla

Who owns photos when uploaded to Facebook

facebook-and-photo-copyright.pngThere is discussion currently going on regarding who owns photos uploaded to Facebook.
One would assume that the user who uploaded the photos to Facebook would retain all rights associated with the photographs but the Facebook Terms of Use suggest otherwise.
A relevant quote from the Facebook Terms of Use:

By posting User Content to any part of the Site, you automatically grant, and you represent and warrant that you have the right to grant, to the Company an irrevocable, perpetual, non-exclusive, transferable, fully paid, worldwide license (with the right to sublicense) to use, copy, publicly perform, publicly display, reformat, translate, excerpt (in whole or in part) and distribute such User Content for any purpose, commercial, advertising, or otherwise, on or in connection with the Site or the promotion thereof, to prepare derivative works of, or incorporate into other works, such User Content, and to grant and authorize sub licenses of the foregoing.

Maybe Facebook is simply protecting itself to be able to display the users images in all kinds of ways but I think the terms are way too restrictive.
However other photo sharing services on the Internet get by with much less assertion over the users content.
If you are worried about this issue and would like to share photos with your friends on Facebook without giving them away to Facebook then the best way is to store the photos somewhere else and use various methods to make them available in Facebook.
You have several options depending on where and how your photos are hosted.
If you have your photos on Flickr, the MyFlickr application is very handy. It shows a selection of your photos on your profile page and when you update your photos on Flickr it posts updates to your news feed so that your friends are notified about it.
One can argue that Flickr (soon to possibly be owned my Microsoft 🙁 ) is another 3rd party that will hold your photos but their TOS are much less restrictive and they support Creative Commons license which is a great way to spread your photos while retaining some rights
Gallery2 is a popular software to host your photos on your own server. The Gallery2 Embed is a Facebook application that embeds a selection of your photos in your profile. If a visitor clicks on the photo, she is then taken to your own website with your photos.
One thing missing with “Gallery2 Embed” is that it doesn’t publish updates in your newsfeed when you upload photos so your friends are not made aware of any updates. I have grand plans to write my own Gallery2 Facebook application that will support updates in your newsfeed but lack of time is very prominent at the moment.
Some other popular photo hosting sites and the Facebook apps for them:
Picasa: Picasa Gallery Slideshows
.Mac: .Mac Web Gallery
DeviantArt: My deviantART
Photobucket: Photo Wall
SmugMug: My Photos from SmugMug
Good luck and make sure to remain the copyright holder of YOUR photos!

London mayoral debate on LBC

Earlier today the LBC Radio hosted a debate with the three major London mayor candidates.
Labour candidate Ken Livingstone, Conservative candidate Boris Johnson and Liberal Democrat Brian Paddick joined Nick Ferrari in the studio to face questions from Nick and from the public.
London crime is on top of many Londoner’s lists of things that need to be taken care of by a new mayor.
Ken claims that statistics show how crime has declined (by a few percentage points) over the last 3 years.
Brian mentioned that telephone polls, which he believes are better indicators, showed no perceived reduction in crime. Instead he suspects that less people report crime thus lowering the crime statistics.
Boris told how he is shocked by the “28% increase of muggings of teenagers” and proclaimed that he will put more people (officers) on the streets.
The rowdy and sometimes violent behaviour on buses was brought up to which Brian Paddick argued that “the driver should get out of the cab and speak to the aggressors”.
Nick was then wondering whether the driver would get assaulted and that maybe we should hire some of the Chinese bodyguards we have seen along the Olympic torch as bus drivers?
Brian Paddick still believed that “somebody has to do something about it”.
The London bombings of July 2005 were brought up and Mr Livingstone
was the first to comment on it. Mr Livingstone handled the situation well back in 2005 by addressing the city with a speech of defiance. In his words the bombings had been “an act by a group of criminal men”.
Ken then attacked Boris Johnson by claiming that Mr Johnson blamed the bombings on Islam.
Boris refuted forcefully by proclaiming that Islam “is a religion of peace” and that he has Muslim ancestors (“his great grandfather knew the Quran by heart”).
All in all it seemed like a cheap shot by Mr Livingstone at mudslinging.
Ken’s private life was brought up. A reporter was wondering whether “his relationship with London is same as his relationships to his out of relationship children”. Ken kept insisting that his private life is of no one’s business.
When asked about Lee Jasper, Ken stated that he “would employ Lee Jasper again if he was cleared of all allegations” to which Boris strongly opposed because he “wants a change and believes that the mayor should have full accountability” for the spending of the tax payer’s money.
Regarding London transport Boris wants to offer alternatives and to improve public transport.
Brian Paddick wants to improve the state of the motorways leading into London.
“Bendy buses” are a hot topic among London drivers and Boris Johnson has promised to “scrape them and replace them with an alternative design buses that cost the same”.
There is still no design on the table however and Mr Johnson was not quite sure of the cost of a bendy bus when first asked.
On the topic of London congestion charge Ken promised that the current level £8 and the future higher level of £25 would not be increased. The income from the congestion charge would go towards “cycling super highways”.
Boris promised to scrap the proposed £25 higher level congestion charge, to remove the West Kensington extension and allow paying on account (no more c-charge late fees).
Further Boris wants to improve the state of London streets to allow for “smoother traffic”.
Finally the candidates were asked why the public should vote for them.
Brian Paddick promised a real change and strong leadership. He continued that he has 30 years of experience as a police officer, understands communities and finally he vowed to improve public transport.
Ken proclaimed to have done many improvements in the last 8 years but that he can do much more. He has won £4 billion from the government to spend on London with which he “can build 30,000 houses for rent” among other things. Mr Livingstone will press ahead with the £25 charge on (what he calls) “gas guzzling” vehicles.
What was my impression of the London mayoral debate?
Ken Livingstone doesn’t seem to listen to the public and is not honest enough. The c-charge is his main politics tool with which he will continue taxing and punishing the London motorists.
Most people voting on Brian Paddick will probably be voting for him to sort out the state of London crime but his previous spat with Ian Blair may complicate things.
Boris in my opinion is the strongest candidate for a change in London. His arguments for crime, businesses, education and transport are very reasonable.
Whoever is your favourite candidate please make sure you are registered to vote and then vote on the 1st of May.
I would recommend you to go for Boris Johnson as your first choice and Brian Paddick as your second choice but ultimately it is up you… just make sure you vote.
P.S. Rather “The grass is greener on the other side” than “Better the devil you know”

April Fool’s Day 2008

Google launches Project Virgle together with Virgin.

Project Virgle, the first permanent human colony on Mars.

All featured videos on YouTubeUK and YouTube Australia lead to Rick Astley-Never Gonna Give You Up. You have been RICKROLLED!
TechCrunch is acquiring the venerable teen magazine and Web site Tiger Beat, will rename it CrunchKids.
Venture capitalists fight back against a website (TheFunded.com) that allows anonymous ratings of VCs by creating their own review site called TheUnFunded.com.
The Pirate Bay is moving their operations to the desert of Sinai in Egypt due to the new copyright legislation in the European Union.
A pre-air episode 9 of the TV show Lost. The episode is leaked from a DVD screener.

Virgin Media takes fight to illegal downloaders

Virgin Media will cooperate with the British Phonographic Industry (BPI) in a pilot to track down users downloading illegally:

“The BPI has teams of technicians to trace illegal music downloading to individual accounts. It will hand these account numbers over to Virgin Media, which will match them to names and addresses.”

You might think that there will be an exodus of users from Virgin Media to other ISPs and that this will hurt Virgin Media but I doubt that.
You see, there are many ISPs in the UK that are offering an “unlimited” service for an ever decreasing monthly fee.
Users that use P2P often use the most of the ISP’s bandwidth so this pact with BPI is a great excuse for Virgin Media to dump those costly users.
In addition if they manage to switch the downloads from public internet to a Usenet server inside their network they avoid most bandwidth charges and capacity problems.
It’s a win/win for Virgin Media (and lose/lose for their customers)!
[read]

20 minutes or so about why Lessig is 4Barack

There is no question that there is a need for change in Washington D.C. but the need is for a fundamental change; a change at the core.
“A change in the power of money or corruption in how Washington DC runs… Edwards/Obama have [clearly demonstrated] their support for this strong version of change… their target is a fundamental reform of the system.”
Professor Lawrence Lessig has some very strong arguments why Barack Obama should be the next president of the United States of America and why you should vote for him.

There is also a transcript of the Lawrence Lessig “20 minutes or so about why I am 4Barack” speech.