<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Neil Ang (apple)</title>
    <link>http://neilang.com</link>
    <description>Neil Ang Feed</description>
    <language>en-us</language>
    <generator>Symphony (build 1701)</generator>
    <item>
      <title>The New MacBook "Felt" (running Hyperspaces)</title>
      <link>http://neilang.com/entries/the-new-macbook-felt-running-hyperspaces/</link>
      <pubDate>Fri, 31 Oct 2008 22:10:00 GMT</pubDate>
      <guid>http://neilang.com/entries/the-new-macbook-felt-running-hyperspaces/</guid>
      <description>&lt;p&gt;Apple are secretly working on a new line of laptops to replace the "Airs". As awesome developers, Apple sent us some preview hardware to see how &lt;a href="http://hyperspacesapp.com"&gt;Hyperspaces&lt;/a&gt; performed on the new systems. I know Apple like to keep their products secret, but I say "NDA... ND-Shmay" - here is the new line, the Macbook "Felt".&lt;/p&gt;

&lt;div style="text-align:center"&gt;
&lt;object codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="320" height="256"&gt;&lt;param name="src" value="/workspace/upload/MacBook.mov" /&gt;&lt;param name="controller" value="true" /&gt;&lt;param name="autoplay" value="false" /&gt;&lt;param name="scale" value="tofit" /&gt;&lt;param name="volume" value="100" /&gt;&lt;param name="loop" value="false" /&gt;&lt;embed pluginspage="http://www.apple.com/quicktime/download/" type="video/quicktime" class="mov" width="320" height="256" src="/workspace/upload/MacBook.mov" controller="true" autoplay="false" scale="tofit" volume="100" loop="false"&gt;&lt;/embed&gt;&lt;/object&gt;
&lt;/div&gt;
&lt;p&gt;Here are the new features expected in this model:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;This is the lightest notebook ever made by Apple.&lt;/li&gt;
	&lt;li&gt;The screen is carved from felt, which has no glare.&lt;/li&gt;
	&lt;li&gt;Due to the flammable nature of felt, all parts have been removed. This has resulted in a 98% reduction in heating.&lt;/li&gt;
	&lt;li&gt;There are no ports, which gives smooth looking edges.&lt;/li&gt;
	&lt;li&gt;New efficient 26 character keyboard.&lt;/li&gt;
&lt;/ul&gt;
					     &lt;p&gt;&lt;a title="What are you, chicken?!" href="http://neilang.com/entries/the-new-macbook-felt-running-hyperspaces/#comment"&gt;Post a comment&lt;/a&gt; (I dare you!)&lt;/p&gt;
					   </description>
    </item>
    <item>
      <title>How to setup virtual hosts on Mac OS X 10.5 (Leopard)</title>
      <link>http://neilang.com/entries/how-to-setup-virtual-hosts-on-mac-os-x-105-leopar/</link>
      <pubDate>Sat, 20 Sep 2008 04:29:00 GMT</pubDate>
      <guid>http://neilang.com/entries/how-to-setup-virtual-hosts-on-mac-os-x-105-leopar/</guid>
      <description>&lt;p&gt;Whilst developing a new project it can be convenient to setup a virtual host on your local machine. For example, if I wanted to have a local development/demonstration version of a website I'm developing (e.g. &lt;a href="http://learnhowtojuggle.info"&gt;http://learnhowtojuggle.info&lt;/a&gt;), I could setup the following virtual host: &lt;a href="http://learnhowtojuggle.dev" rel="nofollow"&gt;http://learnhowtojuggle.dev&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;N.B. Only follow this tutorial if you are comfortable with editing system configurations and are aware of the risks. If you have &lt;a href="http://macromates.com/"&gt;TextMate&lt;/a&gt; installed, you can click the file path links in these instructions to quickly open them on your local computer (&lt;a href="http://manual.macromates.com/en/using_textmate_from_terminal.html"&gt;More Information&lt;/a&gt;).&lt;/p&gt;

&lt;h3&gt;1. Modify the virtual hosts configuration&lt;/h3&gt;

&lt;p&gt;Use terminal to find and modify your virtual hosts configuration file.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mate &lt;a href="txmt://open/?url=file:///private/etc/apache2/extra/httpd-vhosts.conf" class="textmate"&gt;/private/etc/apache2/extra/httpd-vhosts.conf&lt;/a&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Append to this bottom of this file an entry for your virtual domain:&lt;/p&gt;

&lt;p&gt;
&lt;code&gt;&amp;lt;VirtualHost *:80&amp;gt; &lt;br /&gt; ServerAdmin webmaster@learnhowtojuggle.dev &lt;br /&gt; DocumentRoot "/Users/neil/Sites/learnhowtojuggle" &lt;br /&gt; ServerName learnhowtojuggle.dev &lt;br /&gt; ServerAlias learnhowtojuggle.dev &lt;br /&gt; ErrorLog "/private/var/log/apache2/learnhowtojuggle.dev-error_log" &lt;br /&gt; &amp;lt;/VirtualHost&amp;gt;&lt;/code&gt;
&lt;/p&gt;

&lt;p&gt;Make sure the &lt;kbd&gt;DocumentRoot&lt;/kbd&gt; you enter actually exists. For convenience, I've placed mine in my Site folder. You can now save and close this file.&lt;/p&gt;

&lt;h3&gt;2. Check Apache knows about virtual hosts&lt;/h3&gt;

&lt;p&gt;Next we will need to modify the Apache configuration file to make sure it includes the virtual hosts file.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mate &lt;a href="txmt://open/?url=file:///private/etc/apache2/httpd.conf&amp;amp;line=460" class="textmate"&gt;/private/etc/apache2/httpd.conf&lt;/a&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Locate the following line and remove the # sign (also known as an "octothorpe" ) from in front of it.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Include /private/etc/apache2/extra/httpd-vhosts.conf&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Save and close this file as well.&lt;/p&gt;

&lt;h3&gt;3. Restart Apache&lt;/h3&gt;

&lt;p&gt;For any changes to take effect on the Apache server, you will need to restart it.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo httpd -k restart&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;4. Update hosts file&lt;/h3&gt;

&lt;p&gt;Finally, the easiest way to let our browser know to use our local server when it get a request for our virtual host is to modify the hosts file. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;mate &lt;a href="txmt://open/?url=file:///private/etc/hosts" class="textmate"&gt;/private/etc/hosts&lt;/a&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Add the following entry:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;127.0.0.1	learnhowtojuggle.dev&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After you save and close this file, navigate to &lt;a href="http://learnhowtojuggle.dev" rel="nofollow"&gt;http://learnhowtojuggle.dev&lt;/a&gt; in your browser to see the newly created virtual host on your local machine. &lt;/p&gt;


&lt;h3&gt;Additional Configuration&lt;/h3&gt;

&lt;p&gt;Since I am serving my new virtual host out of my Sites folder, and I want to use my .htacess file for URL rewriting, I had to update the Apache configuration again to allow permission for this.&lt;/p&gt;

&lt;p&gt;The configuration for my Site folder was located at &lt;kbd&gt;/private/etc/apache2/users/neil.conf&lt;/kbd&gt; (yours will be different based on your system profile name). I then set my permissions to be pretty loose since it is only my local machine.&lt;/p&gt;

&lt;p&gt;Example configuration: &lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;Directory "/Users/neil/Sites/"&amp;gt; &lt;br /&gt; Options Indexes FollowSymLinks MultiViews &lt;br /&gt; AllowOverride All &lt;br /&gt; Order allow,deny &lt;br /&gt; Allow from all &lt;br /&gt; &amp;lt;/Directory&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After you update your directory permissions, you will need to restart apache again for these to changes to take effect.&lt;/p&gt;
					     &lt;p&gt;&lt;a title="What are you, chicken?!" href="http://neilang.com/entries/how-to-setup-virtual-hosts-on-mac-os-x-105-leopar/#comment"&gt;Post a comment&lt;/a&gt; (I dare you!)&lt;/p&gt;
					   </description>
    </item>
    <item>
      <title>Things to know before going to WWDC</title>
      <link>http://neilang.com/entries/things-to-know-before-going-to-wwdc/</link>
      <pubDate>Sat, 21 Jun 2008 06:59:00 GMT</pubDate>
      <guid>http://neilang.com/entries/things-to-know-before-going-to-wwdc/</guid>
      <description>&lt;p&gt;As most of you know I spent last week in San Francisco attending WWDC ‘08. I had a great time thanks to the &lt;a href="http://www.auc.edu.au/"&gt;AUC&lt;/a&gt;, and highly encourage others to attend this conference next year if they have the opportunity. It is worth it. &lt;/p&gt;

&lt;p&gt;Here are some tips for anyone who is thinking of going in 2009:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Bring a list of issues you want solved&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The conference has sessions that run all day, but they also have labs where you can get Apple engineers to help solve issues with your software. These labs gave me a chance to talk with the actual engineers who work in the field of my software problems. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2. Take business cards&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I didn’t take any business cards with me, but a few people asked for my email address and it would of been perfect if I had a business card to give them. You don’t need a business to have a business card. Just include your name, email address and website (if you have one).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Take your equipment&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This one is pretty much a given, but if you have a laptop, take it along. If you have an iphone or ipod touch, take that as well. Apple set up a convenient website for the attendees with the latest session updates and news which I checked everyday. They also had a version of the site that worked on the iphone. Very handy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Partition your hard drive&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before I left Australia, I backed up and formatted my hard drive to clear up some space. I also made a separate partition incase we got new software. After I got a copy of snow leopard I was able to install it straight away alongside leopard.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. See San Francisco while you are there&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The &lt;a href="http://www.auc.edu.au/"&gt;AUC&lt;/a&gt; had arranged a bus tour for the Australian delegates, and we had an awesome day seeing all the highlights of the area. We checked out the Googleplex, Apple HQ and the computer history museum. Silicon valley is a great place for nerds to site see.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. File bug reports before you attend&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A common response to questions in sessions and labs was “file a bug report”. The engineers are not able to fix things on the spot, so if you have found a major problem with an API or system, its better to file a bug report before you attend. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Prepare to get up early&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Jet-lag along with early morning sessions and late nights out will leave you feeling tired most of the week. Luckily there are plenty of starbuck stores around and other coffee outlets.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8. Attend parties&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;During the week parties are held by various organisations to celebrate WWDC. If you are thinking of attending any, make sure you RSVP. I would also recommend going to the “Stump the experts” event and the Apple design awards. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;9. Don’t be afraid to meet people&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;At the conference you are surrounded by developers, engineers and Apple enthusiasts. It is a great chance to make contacts and spread your own name as well (again, take business cards). &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;10. Don’t feel bad about missing sessions&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;A lot of interesting sessions and labs are run concurrently at the conference which means you will miss sessions that you wanted to attend. If there is a conflicting lab and session, attend the lab as the sessions become available on video after the conference. &lt;/p&gt;

&lt;p&gt;And finally, enjoy the time there as much as possible and take lots of photos. The week will go by very quickly. &lt;/p&gt;
					     &lt;p&gt;&lt;a title="What are you, chicken?!" href="http://neilang.com/entries/things-to-know-before-going-to-wwdc/#comment"&gt;Post a comment&lt;/a&gt; (I dare you!)&lt;/p&gt;
					   </description>
    </item>
    <item>
      <title>Intelleject: An experiment in Cocoa</title>
      <link>http://neilang.com/entries/intelleject-an-experiment-in-cocoa/</link>
      <pubDate>Sun, 23 Mar 2008 00:45:00 GMT</pubDate>
      <guid>http://neilang.com/entries/intelleject-an-experiment-in-cocoa/</guid>
      <description>&lt;p&gt;Earlier this year I was lucky enough to attend a workshop on cocoa (which was kindly sponsored by the &lt;a href="http://www.auc.edu.au/"&gt;AUC&lt;/a&gt;). It was a great 3 days of programming and introduction into the world of cocoa. Since then I have been playing around with ideas for mac applications.&lt;/p&gt;

&lt;p&gt;A crazy app idea I had a while ago was an assistant service to remove mounted volumes. Thanks to the training provided by the &lt;a href="http://www.auc.edu.au/"&gt;AUC&lt;/a&gt; and the advanced assistance that &lt;a href="http://tonyarnold.com"&gt;Tony Arnold&lt;/a&gt; has provided me, I have been able to write my first cocoa application.&lt;/p&gt;

&lt;p style="text-align:center;"&gt;&lt;img src="http://www.neilang.com/workspace/upload/screen-capture-1.png" alt="Intelleject Screen Shot" /&gt;&lt;/p&gt;

&lt;p&gt;Intelleject might not look like much, but I had to learn a lot to create it. It's a service that you call through the shortcut ⌘-e, to visually review and eject (by single clicking) volumes. &lt;em&gt;My aim was to make it simple&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Features:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Core Animation - It uses leopards implicit animations to visual change the number of volumes&lt;/li&gt;
	&lt;li&gt;System notifications - The app listens for mount/unmount notifications to detect if it needs to update its display&lt;/li&gt;
	&lt;li&gt;Bindings - Tricky for a beginner, but great when you work them out.&lt;/li&gt;
	&lt;li&gt;Global shortcut key - Globally binding it to ⌘-e was the most difficult task. I wanted the application to override the default eject shortcut key.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I would like to invite you all to &lt;a href="http://www.neilang.com/workspace/upload/Intelleject.app.zip" title="Download Intelleject"&gt;try it out&lt;/a&gt;, and let me know what you think of my first applicaiton ;)&lt;/p&gt;
					     &lt;p&gt;&lt;a title="What are you, chicken?!" href="http://neilang.com/entries/intelleject-an-experiment-in-cocoa/#comment"&gt;Post a comment&lt;/a&gt; (I dare you!)&lt;/p&gt;
					   </description>
    </item>
    <item>
      <title>Updating the locate database in Mac OS X</title>
      <link>http://neilang.com/entries/updating-the-locate-database-in-mac-os-x/</link>
      <pubDate>Tue, 06 Nov 2007 09:19:00 GMT</pubDate>
      <guid>http://neilang.com/entries/updating-the-locate-database-in-mac-os-x/</guid>
      <description>&lt;p&gt;
			One of my favorite commands in Unix is "locate". It's useful to help find files through terminal - &lt;em&gt;fast!&lt;/em&gt; After freshly installing Leopard, I realised that the database for the command had not been built.
		&lt;/p&gt;
		&lt;p&gt;
			&lt;code&gt;`/var/db/locate.database': No such file or directory&lt;/code&gt;
		&lt;/p&gt;
		&lt;p&gt;
			No problem. To fix this simply run the command:
		&lt;/p&gt;
		&lt;p&gt;
			&lt;code&gt;sudo /usr/libexec/locate.updatedb&lt;/code&gt;
		&lt;/p&gt;
		&lt;p&gt;
			After a few minutes the database will be created, and you can continue using terminal efficiently.
		&lt;/p&gt;
					     &lt;p&gt;&lt;a title="What are you, chicken?!" href="http://neilang.com/entries/updating-the-locate-database-in-mac-os-x/#comment"&gt;Post a comment&lt;/a&gt; (I dare you!)&lt;/p&gt;
					   </description>
    </item>
    <item>
      <title>Dynamically set network location in Mac OS X</title>
      <link>http://neilang.com/entries/dynamically-set-network-location-in-mac-os-x/</link>
      <pubDate>Wed, 24 Jan 2007 10:10:00 GMT</pubDate>
      <guid>http://neilang.com/entries/dynamically-set-network-location-in-mac-os-x/</guid>
      <description>&lt;p&gt;I love macs, but sometimes things could have been implemented better. In particular, I hate having to set the network location on my laptop when I go between work and home every day. I have put together a small shell script which can do this. I run this script on startup and it just checks what day and time it is so it can switch between two profiles (work or home).&lt;/p&gt;

&lt;p&gt;&lt;code&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
day=`date +"%a"`&lt;br /&gt;
hour=`date +"%H"`&lt;br /&gt;
&lt;br /&gt;
if [ $day = "Sat" -o $day = "Sun" ]; then&lt;br /&gt;
&amp;nbsp;&amp;nbsp;`scselect Home` &lt;br /&gt;
else&lt;br /&gt;
&amp;nbsp;&amp;nbsp;if [ $hour -gt 8 -a $hour -lt 16 ]; then&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;`scselect Work` &lt;br /&gt;
&amp;nbsp;&amp;nbsp;else&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;`scselect Home`&lt;br /&gt;
&amp;nbsp;&amp;nbsp;fi&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
exit 0
&lt;/code&gt;&lt;/p&gt;
					     &lt;p&gt;&lt;a title="What are you, chicken?!" href="http://neilang.com/entries/dynamically-set-network-location-in-mac-os-x/#comment"&gt;Post a comment&lt;/a&gt; (I dare you!)&lt;/p&gt;
					   </description>
    </item>
    <item>
      <title>How to install Tomcat on Mac OS X</title>
      <link>http://neilang.com/entries/how-to-install-tomcat-on-mac-os-x/</link>
      <pubDate>Thu, 11 Jan 2007 10:09:00 GMT</pubDate>
      <guid>http://neilang.com/entries/how-to-install-tomcat-on-mac-os-x/</guid>
      <description>&lt;p&gt;A while back I wrote a post on the &lt;a href="http://www.ubuntuforums.org/"&gt;ubuntu forums&lt;/a&gt; on &lt;a href="http://www.ubuntuforums.org/showthread.php?t=44006" &gt;how to install Tomcat on ubuntu&lt;/a&gt;. It was very popular (if I do say myself) so I thought I would post the instructions on how to setup tomcat on Apple's OS X. These instructions work for 10.4 (Tiger) and 10.5 (Leopard).&lt;/p&gt;

&lt;h3&gt;Installing Tomcat&lt;/h3&gt;

&lt;ol&gt;


&lt;li&gt;Download the latest core binary distributions of tomcat from &lt;a href="http://tomcat.apache.org/"&gt;http://tomcat.apache.org/&lt;/a&gt; (do not download the windows service installer).&lt;/li&gt;



&lt;li&gt;Unzip the download and rename the folder from "apache-tomcat-x-x-xx" to something simple like "Tomcat". &lt;/li&gt;



&lt;li&gt;Move the folder to the root &lt;em&gt;/Library&lt;/em&gt; directory (or somewhere else convenient). Tomcat is installed. That's it!&lt;/li&gt;



&lt;li&gt;To start tomcat run startup.sh found in &lt;em&gt;/Library/Tomcat/bin&lt;/em&gt;. To stop tomcat run &lt;em&gt;shutdown.sh&lt;/em&gt; found in the same bin directory. After starting tomcat navigate to &lt;a href="http://localhost:8080"&gt;http://localhost:8080&lt;/a&gt; to see if the server is working.&lt;/li&gt;

&lt;/ol&gt;


&lt;h3&gt;Custom Tomcat Start/Stop Script&lt;/h3&gt;

&lt;p&gt;To make starting and stopping tomcat easier you can create a custom shell script to turn tomcat on and off through terminal. &lt;/p&gt;

&lt;p&gt;Open up your favorite text editor (mine is &lt;a href="http://macromates.com/" &gt;TextMate&lt;/a&gt;) and add the following code:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;
#!/bin/bash&lt;br /&gt;
&lt;br /&gt;
case $1 in&lt;br /&gt;
&amp;nbsp;&amp;nbsp;start)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sh /Library/Tomcat/bin/startup.sh&lt;br /&gt;
&amp;nbsp;&amp;nbsp;;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;stop)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sh /Library/Tomcat/bin/shutdown.sh&lt;br /&gt;
&amp;nbsp;&amp;nbsp;;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;restart)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sh /Library/Tomcat/bin/shutdown.sh&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sh /Library/Tomcat/bin/startup.sh&lt;br /&gt;
&amp;nbsp;&amp;nbsp;;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;*)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo "Usage: start|stop|restart"&lt;br /&gt;
&amp;nbsp;&amp;nbsp;;;&lt;br /&gt;
esac&lt;br /&gt;
&lt;br /&gt;
exit 0
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Save the file with the title "tomcat" (in lowercase and no extension). Place the file in a bin directory which is included in your terminal's path e.g. &lt;em&gt;/usr/bin&lt;/em&gt;. Now when you want to use tomcat, simply write "tomcat start" and "tomcat stop" in terminal.&lt;/p&gt;

&lt;p&gt;Leave a comment if you have any suggestions, troubleshooting or ideas.&lt;/p&gt;
					     &lt;p&gt;&lt;a title="What are you, chicken?!" href="http://neilang.com/entries/how-to-install-tomcat-on-mac-os-x/#comment"&gt;Post a comment&lt;/a&gt; (I dare you!)&lt;/p&gt;
					   </description>
    </item>
    <item>
      <title>Sockets problem with MySQL/PHP and Mac OS X</title>
      <link>http://neilang.com/entries/sockets-problem-with-mysql-php-and-mac-os-x/</link>
      <pubDate>Thu, 21 Dec 2006 10:08:00 GMT</pubDate>
      <guid>http://neilang.com/entries/sockets-problem-with-mysql-php-and-mac-os-x/</guid>
      <description>&lt;p&gt;After installing MySQL 5 on OS X 10.4, you may have noticed that the install package has placed 'mysql.sock' in '/tmp/mysql.sock' instead of '/var/mysql/mysql.sock'. This will cause the following error when you attempt to access MySQL through PHP:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;A simple solution is to place a symbolic link between the expected folder and the install directory. This can be achieved with the following terminal commands:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo mkdir /var/mysql&lt;br /&gt;
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To test a database connection between PHP and MySQL, you can use the following script:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;
&amp;lt;?php&lt;br /&gt;
&amp;nbsp;&amp;nbsp;  $dbServer='localhost';&lt;br /&gt;
&amp;nbsp;&amp;nbsp;    $dbUser='root';&lt;br /&gt;
&amp;nbsp;&amp;nbsp;    $dbPass='root';&lt;br /&gt;
&amp;nbsp;&amp;nbsp;    $dbName='test';&lt;br /&gt;
&amp;nbsp;&amp;nbsp;    $link = mysql_connect("$dbServer", "$dbUser", "$dbPass") or die ('Could not connect.');&lt;br /&gt;&lt;br /&gt;

&amp;nbsp;&amp;nbsp;   echo 'Connected successfully&amp;lt;br /&amp;gt;';&lt;br /&gt;
&amp;nbsp;&amp;nbsp;   mysql_select_db("$dbName") or die('Could not select database.');&lt;br /&gt;
&amp;nbsp;&amp;nbsp;   echo 'Database selected successfully&amp;lt;br /&amp;gt;';&lt;br /&gt;
&amp;nbsp;&amp;nbsp;   mysql_close($link);&lt;br /&gt;
?&amp;gt;
&lt;/code&gt;&lt;/p&gt;
					     &lt;p&gt;&lt;a title="What are you, chicken?!" href="http://neilang.com/entries/sockets-problem-with-mysql-php-and-mac-os-x/#comment"&gt;Post a comment&lt;/a&gt; (I dare you!)&lt;/p&gt;
					   </description>
    </item>
  </channel>
</rss>
