Sunday, May 30, 2010

Boot Snow Leopard in 64 bit mode by default

 First check if your mac has 64bit EFI open up a terminal window and type the following:
ioreg -l -p IODeviceTree | grep firmware-abi

Your result should be: "EFI32" or "EFI64"
If it is the latter then your good to go.

You can either hold down the '6' and '4' buttons during boot up every time or you can modify the following file to permanently boot in 64bit mode:
/Library/Preferences/SystemConfiguration/com.apple.Boot.plist 
All you need to do is add the "arch=x86_64" as the value for the "Kernel Flags" key and restart your machine.  I recommend using a terminal window to do this as you will need to do a sudo.
I use "vi" so I will do the following:
sudo vi /Library/Preferences/SystemConfiguration/com.apple.Boot.plist 
[if prompted enter your user password]
 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
 <key>Kernel</key>
 <string>mach_kernel</string>
 <key>Kernel Flags</key>
 <string>arch=x86_64</string>
</dict>
</plist> 
 
Save and close the file.
Reboot your machine and your done. 

Wednesday, May 19, 2010

Creating Mysql User Accounts

shell> mysql -u root [-p]
shell> CREATE USER 'user_name'@'localhost' IDENTIFIED BY 'some_pass';
shell> GRANT ALL PRIVILEGES ON *.* TO 'user_name'@'localhost' WITH GRANT OPTION;
shell> CREATE USER 'user_name'@'%' IDENTIFIED BY 'some_pass';
shell> GRANT ALL PRIVILEGES ON *.* TO 'user_name'@'%' WITH GRANT OPTION;

Monday, May 17, 2010

iPhoto always asks to import photos on startup

Opening iPhoto, you always see an alert similar to the following:
  • "A photo has been found in the iPhoto Library folder that was not imported. Would you like to import it?"
Easy to fix.
  1. Open up finder and navigate to the "iPhoto Library" package
  2. Right click and choose "show package contents"
  3. Locate the "Recovered Photos" or "Import"
  4. Move it to your desktop
  5. Restart iPhoto
  6. Make sure your photos are still in iTunes
  7. Delete the "Recovered Photos" or "Import" that you placed on your desktop
Important: Be careful not to remove any other folders or items from the iPhoto Library folder. Doing so could cause your iPhoto library to become unreadable.

Thursday, May 13, 2010

Setting SSL certificates for svn and svnX and other svn clients

On Mac OSX locate your .subversion directory usually under the user home directory.
cd into it and edit the servers file with your editor of choice.

Add the following line under the [global] section
ssl-client-cert-file = /Users/[your_user_account]/.subversion/auth/[CERT_FILE]

This will cause the subversion server that requires a certificate to ask you for a password the first time. After this you don't need to keep specifying the file location or password.

Recursively remove folders

To remove a set of directories with the same name recursively is quite simple under unix/linux

Finding the directories to delete in this example .svn directories the following command can be used: "find . -type d -name .svn"

This command says "find from within (.) the current directory files of type (d [directories]) with the name .svn. This is done recursively.

Combining this command with an rm -rf will achieve the desired result.

rm -rf `find . -type d -name .svn`