Friday, 27 May 2011

A Painful Safari - Crashes, stalls?


Ever had one of those days, where everything just seems to be going wrong? Over the last 6 hours, I’ve been trying to debug why Safari, Mail.app, iTunes and Adium crash without ANY explanation, after any of said applications tried to load a webpage.
It started randomly (haven’t made major changes in the last few days), so I assumed it was something corrupted. The only hint was that after Safari, Mail, iTunes or Adium crashed, PubSubAgent would use 100% CPU time. So, I fire up Instruments and look at the trace for PubSubAgent. It seems to be calling CFHTTPCookieStorageFlushCookieStores many times, which is odd, because a quick Google doesn’t return anything useful about this system call, obviously related to CFHTTP.
Fast forward 4 hours later when I’ve cleared caches, nuked my Safari config, tried removing PubSubAgent (which just made it worse). The fix? Removing ~/Library/Cookies/Cookies.plist.

Oddly enough, it has a companion – ~/Library/Cookies/Cookies.plist – corrupt.
So, just a recap; somewhere the system knew my Cookies file was corrupted. But instead of spitting this out to the Console, throwing a Dialog, or ANY form of useful information, I had to trudge through my Library looking for something which could be causing the problem, and manually removing it. It was by chance that I noticed the Cookies folder, which is strangely not in the Safari folder where one would normally expect it.
And just to make matters worse; Safari’s “Reset Safari” did nothing to solve the problem. That’s right, checking the “Remove all cookies” checkbox did NOT remove the cookies!

Tuesday, 24 May 2011

Creating Linux (Centos) Live CD image on a USB Flash Driv


Then follow these steps:
  • Type : diskutil list in the Terminal and hit Enter
  • Plug in your USB flash disk and repeat step 1
  • Compare the result and you’ll have the device node assigned to your flash media. Usually something like "/dev/disk2" (sans quote)
  • Type : diskutil unmountDisk /dev/diskN in the Terminal and hit Enter. You’ll have to replace the /dev/diskN with the device node that you got from step 3. From the picture above you can see that the device node assigned for my USB flash drive is "/dev/disk1" (sans quote)
  • Type : sudo dd if=/path/to/downloaded.img of=/dev/diskN bs=1m in the Terminal and hit Enter. But there are several things that you have to change here before you hit Enter:
    - first the /path/to/downloaded.img is the location of the downloaded UNR installer file. As we’ve already taken care of this before, all you’ve got to do is to change the string into/unr.img
    - second, the /dev/diskN is the device node which is the same as step 4
    - and the last, if you see the error line:
     dd: Invalid number ’1m’ 
    then you need to change thebs=1m into bs=1M (notice the capital ‘M’)
  • Write your password, hit enter, and wait until the process is finished. Please be warned that all the data in the USB drive will be lost.
  • Type : diskutil eject /dev/diskN in the Terminal and hit Enter.
  • Unplug your USB drive.