Tools

Xcode 4.2 and SVN Authentication Fix

I was having issues with SVN for a long time after upgrading to Xcode 4+ from version 3.2+ when trying to commit file changes. No suggestion I found on the Internet solved them until I found a proper solution. After making my /etc/apache2/other/svn.conf file resemble this, I was finally able to get Xcode 4 to change all the red lights to green. Looks like I won’t have to switch to git after all.

 
<Location /repos>
     DAV svn
     SVNParentPath "/usr/local/svn/repos"
     Order deny,allow
     Deny from all
     Satisfy any
 
     AuthType Basic
     AuthName "SVN Repository Realm"
     AuthUserFile /etc/apache2/svn-auth-file
 
     #read-only access
     <Limit GET PROPFIND OPTIONS REPORT>
        Require valid-user
        Allow from localhost
        # Allow from another-ip
        Satisfy any
     </Limit>
     # write access
     <LimitExcept GET PROPFIND OPTIONS REPORT>
       Require valid-user
     </LimitExcept>
</Location>
VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

ReformatCode Project on GitHub

About:

I have added an open source project to the GitHub.  The project, ReformatCode currently only supports reformatting JSON data to human readable format.  Though I hope in the future it can be extended to support CSS indentation structuring with intelligent parent – child relationship styles.   Formatting CSS can be a little complex if you want it to really show properly how the CSS works with other classes and what is a sub element or sub class of another.  So that would be a possible and welcome addition to the code base in the future if effort is put into it.

Download:

ReformatCode Project via GitHub

Usage:

Passing either a JSON object or string, will reformat the JSON to a human readable level.
Second param (optional) is an object of settings to override defaults.

Example:

ReformatCode.formatJSON({"key": {"sub_key": "sub_value"}}, {"indent": "spaces", "debug": true, "newline": "\r"});

Input:

{"key": {"sub_key": "sub_value"}

Ouput:

{
    "key": {
        "sub_key": "sub_value"
    }
}
VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: -1 (from 1 vote)

Snow Leopard PHP Extensions Installation Tutorial

This will help you to setup imagick, magicwand, xdebug, mcrypt and memcached for Snow Leopard’s bundled PHP 5.3.0. Please do expect the installation of ImageMagick to take a bit of time, as it requires a large number of packages. I’m doing it all my preferred way. If you have another way that is faster or better, I’d be glad to take your suggestions and make this tutorial more streamlined.

Step 1:

Make sure you have XCode 3.2 for Snow Leopard installed, from the Snow Leopard install DVD.

Step 2:

Download MacPorts for Mac OS X 10.6 Snow Leopard here.

If you have previously installed MacPorts and installed software with it in Mac OS X 10.5, run this first to remove it, as it won’t work in Snow Leopard anymore.

In Terminal:

sudo rm -rf /opt/local \
/Applications/MacPorts \
/Applications/DarwinPorts \
/Library/Tcl/macports1.0 \
/Library/Tcl/darwinports1.0 \
/Library/LaunchDaemons/org.macports.* \
/Library/StartupItems/DarwinPortsStartup \
/Library/Receipts/MacPorts*.pkg \
/Library/Receipts/DarwinPorts*.pkg \
~/.macports

Step 3:

Open the MacPorts-1.8.0-10.6-SnowLeopard.dmg file, and install the MacPorts package file.

Step 4:

To hide the /opt folder from Finder view that is visible after installing MacPorts.

In Terminal:

sudo chflags hidden /opt

Step 5:

By default, MacPorts for Snow Leopard should use x86_64 arch instead of ppc/i386, so you shouldn’t have to worry much here.

This part most likely will take the longest of all things in the tutorial, as it requires a large group of individual packages. You can cook dinner, eat it, and you might still be waiting for this to complete after you’ve finished eating. It took about a half hour for it to complete on my MacBook.

In Terminal:

sudo port install imagemagick

Step 6:

Download imagick here.

Unpack the file imagick-2.3.0.tgz.

In Terminal:

cd ~/Downloads/imagick-2.3.0/imagick-2.3.0
phpize
./configure --with-imagick=/opt/local
make
cd modules
sudo cp imagick.so /usr/lib/php/extensions/no-debug-non-zts-20090626/

Step 7:

Download magickwand here.

Unpack the file MagickWandForPHP-1.0.8.tar.gz.

In Terminal:

cd ~/Downloads/MagickWandForPHP-1.0.8/
phpize
./configure --with-magickwand=/opt/local
make
cd modules
sudo cp magickwand.so /usr/lib/php/extensions/no-debug-non-zts-20090626/

Step 8:

Download xdebug here.

Unpack the file xdebug-2.0.5.tgz.

In Terminal:

cd ~/Downloads/xdebug-2.0.5/xdebug-2.0.5
phpize
./configure
make
cd modules
sudo cp xdebug.so /usr/lib/php/extensions/no-debug-non-zts-20090626/

Step 9:

In Terminal:

sudo port install libmemcached

When it completes, type this into Terminal:

sudo launchctl load -w /Library/LaunchDaemons/org.macports.memcached.plist

Step 10:

Download memcached here.

Unpack the file memcached-1.0.0.tgz.

In Terminal:

cd ~/Downloads/memcached-1.0.0/memcached-1.0.0/
phpize
./configure --with-libmemcached-dir=/opt/local
make
cd modules
sudo cp memcached.so /usr/lib/php/extensions/no-debug-non-zts-20090626/

Step 11:

Download libmcrypt here.

Unpack the file libmcrypt-2.5.8.tar.bz2.

In Terminal:

cd ~/Downloads/libmcrypt-2.5.8/
./configure --disable-posix-threads --enable-static
make
sudo make install

Step 12:

Download PHP 5.3.0 source code for the mcrypt extension here.

Unpack the file php-5.3.0.tar.gz. We will only need to use the code within the ext/mcrypt directory. No need to compile all of PHP for this.

In Terminal:

cd ~/Downloads/php-5.3.0/ext/mcrypt
phpize
./configure
make
cd modules
sudo cp mcrypt.so /usr/lib/php/extensions/no-debug-non-zts-20090626/

Step 13:

In Terminal:

cd /etc
sudo cp php.ini.default php.ini
sudo pico php.ini

Search for:

display_errors

Set this to:

display_errors = On

Search for:

html_errors

Set this to:

html_errors = On

I placed the following after all the commented out lines for extensions:

;;;;;;
extension=/usr/lib/php/extensions/no-debug-non-zts-20090626/mcrypt.so
extension=/usr/lib/php/extensions/no-debug-non-zts-20090626/magickwand.so
extension=/usr/lib/php/extensions/no-debug-non-zts-20090626/imagick.so
extension=/usr/lib/php/extensions/no-debug-non-zts-20090626/memcached.so
zend_extension=/usr/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so
xdebug.default_enable = On
xdebug.collect_params = 4
xdebug.trace_format = 1
xdebug.show_local_vars = On
xdebug.dump_globals = On
xdebug.show_exception_trace = On
xdebug.collect_assignments = 1
;;;;;;

Set your default timezone. I’ll show mine as an example.

date.timezone = America/New_York

Set your mysql default port.

mysql.default_port = 3306

Press Control-X to exit, it will ask if you want to save changes, so press Y for Yes, and press Enter save and exit completely.

Step 14:

Restart Apache.

In Terminal:

sudo apachectl graceful

That should do it, as this is the exact steps I took to install all of these just now. And everything worked for me just as typed.

Hope this helps you out.

Enjoy.

VN:F [1.9.22_1171]
Rating: 9.7/10 (24 votes cast)
VN:F [1.9.22_1171]
Rating: +12 (from 16 votes)

Mac OS X Snow Leopard, PHP, MySQL, SVN, Xcode, and Me…

With minimal effort, I was able to get the PHP bundled with Snow Leopard to use the PHP extensions that I had compiled for xdebug, imagick, and magickwand to run in 64bit mode.

Snow Leopard comes bundled with Apache 2.2.11, PHP 5.3.0, and SVN 1.6.2.

I upgraded my MySQL install from 5.0.77 to 5.1.37 and then moved my data folder to another location to help keep things sane using the /etc/my.cnf file.

I installed the Xcode from the Snow Leopard CD and downloaded the iPhone SDK 3.1 Beta 3 for Snow Leopard.  Slightly different interface, but I welcome the changes.

So now, instead of using external packages for SVN and PHP (Entropy), now I’m using the prepackaged bundled software.  I did have to reconfigure my svn connection in Apache as it got toasted in the upgrade to Snow Leopard.  It wasn’t a problem though as it was only a few lines.

Now I can sleep good, I hope.

VN:F [1.9.22_1171]
Rating: 7.3/10 (4 votes cast)
VN:F [1.9.22_1171]
Rating: +2 (from 4 votes)