Subversion or SVN, Basic Tips for Beginner

Been using svn for years, but always couldn’t remember what are the steps for setting it up. Better put this down here, for my future reference and sharing with people who would like to start using subversion (svn). Lets start now;

Creating Subversion SVN repository

Start creating your svn repo by this command;


svnadmin create $SVNREP_DIR/project-name

Creating trunk, tags and branches directory


svn mkdir -m "trunk creation" file:///$SVNREP_DIR/myproject/trunk
svn mkdir -m "tags creation" file:///$SVNREP_DIR/myproject/tags
svn mkdir -m "branches creation" file:///$SVNREP_DIR/myproject/branches

I believe you already have your project in a working directory, import it into your svn repo;


svn import -m "importing my project" $PROJECT_DIR/project-name file:///$SVNREP_DIR/project-name/trunk

Now you have done the setup of your repository for your new project, to build a working copy of svn on your machine, start checking out the code into your working directory.


svn co file:///$SVNREP_DIR/project-name/truck $my_project_directory

This is the basic code repository setup for with svn.

Restore Missing Menu Bar or Menulet in Mac OSX Leopard

One of my colleague menu bar / menulet is missing on her Max OSX Leopard. The time and date icon, airport icon, battery icon and others all gone missing some where. I refer to the system.log, it seem like systemui crash with some application. Here is the quick and easy way to restore your OSX Leopard Menu Bar / Menulet if you have the same problem happened to your Mac.

Click on Finder, refer to your Home directory (usually it’s your Mac’s login name), go to Library folder. And now, rename the Preferences folder to Preferences.Backup. Next, restart your Mac (not logout, restart). Please take note that it will take some time to boot up, if it freeze, turn it off and turn it on again.

Now, I believe you can see your menu bar is back, if you want the previous Preferences files to be loaded, copy it from Preference.Backup folder you have renamed earlier to Preferences folder, DO NOT replace the file it has created by the system default because the same problem may occur again.

That’s it!

How to Flush DNS Cache in Apple Mac OSX Leopard

Many of you might not know that beside Microsoft Windows has DNS caching, Apple Mac OSX Leopard does too. In order to flush the cached DNS in your Apple Mac OSX Leopard and get the latest resolve value, you can do this in your Mac Terminal.

Flush Cached DNS

In your shell, type;


dscacheutil -flushcache

To see the caching statistic on your machine, type;


dscacheutil -statistics

This command doesn’t required sudo privilege cause it’s flush base on user’s cache statistic.

Format Your External Hard Disk That Support Mac and Windows with Apple OSX

If you have an external hard disk or thumb drive and you would like to access(read/write) the hard disk on both Mac and Windows, you can format the hard disk with Disk Utility in Mac into several partitions like FAT32, UFS and Max OS Format.

Disk Utility

Go to Finder, and Application > Utilities, and launch the program Disk Utility. Next, I will show you how to format a Thumb Drive into 2 Partitions. When Disk Utility is launched, you can see your Hard Disk/Thumb Drive is shown on the left Panel as the picture shown below;

Next, go to Partition tab to start partition your Drive, you can split the Drive into 2 partitions and on the Format menu, select one for MS-DOS (FAT) and another as Mac OS Extended. Depend on your own requirement, you can split it into 50% 50% or 70% 30%. After you have configured the setting, click on apply (If you are confirmed with the setting.). Your thumb drive will now partition and format.

MySQL 5 Server Cannot Start on Apple Mac Leopard

There were some problem during configuring MySQL5 Server on Leopard with MacPorts when creating default db with command;

sudo -u mysql mysql_install_db5

Error Messages;

shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
mkdir: /opt/local/var/db/mysql5: Permission denied
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
chmod: /opt/local/var/db/mysql5: No such file or directory
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
mkdir: /opt/local/var/db/mysql5: Permission denied
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
chmod: /opt/local/var/db/mysql5/mysql: No such file or directory
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
mkdir: /opt/local/var/db/mysql5: Permission denied
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
chmod: /opt/local/var/db/mysql5/test: No such file or directory

It’s the permission issue, to generate default, try this command;

sudo mysql_install_db5

Now MySQL5′s default DB should be successfully initializes to /opt/local/var/db/mysql5. But there is some problem when starting MySQL;

shell> sudo /opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper start
Starting MySQL
/opt/local/share/mysql5/mysql/mysql.server: line 159: kill: (31272) – No such process
ERROR!

Have a look at the system.log file on your Leopard;

Jun 9 17:09:59 redarrows com.apple.launchd[1] (0x10bac0.nohup[31285]): Could not setup Mach task special port 9: (os/kern) no access
Jun 9 17:09:59 redarrows com.apple.launchd[1] (0x10bac0.nohup[31286]): Could not setup Mach task special port 9: (os/kern) no access
Jun 9 17:09:59 redarrows com.apple.launchd[1] (0x10bac0.nohup[31291]): Could not setup Mach task special port 9: (os/kern) no access

This should be the permission issue on MySQL database folder, to solve this, chown your mySQL db folder to _mysql:_mysql…

sudo chown -R _mysql:_mysql /opt/local/var/db/mysql5

Now go to the db dir and see the permission;

shell> cd /opt/local/var/db/
shell> ls -al mysql5
drwx—— 5 _mysql _mysql 170B Jun 9 17:09 mysql5

Now, try to start MySQL5 Server again;

shell> sudo /opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper start
Starting MySQL
SUCCESS!

Hell ya, MySQL5 successfully running on your machine! Voila, Happy MySQL-ing with your Apple Mac Leopard!