Tuesday, October 23, 2012

/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc: No such file or directory

Here I had an issue while trying to create the mod_rewrite.so (DSO).

After updating to MacOS X 10.8.x apxs is no longer using the correct path to the cc compiler

So a

$ sudo apxs -c -i mod_rewrite.c

give you

env: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc: No such file or directory

You do have a cc it's just in another place so simply symlink to it

sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc

Then run apxs again.

Wednesday, October 10, 2012

How to do continuous deployment

Continuous Deployment (CD) allows companies like Etsy.com to do up to 30 or 40 deployments a day. Here's a slideshare of how they do it and I've picked some interesting slides.

1. Definitions

2. Deploying frequently with config flags

3. How to do Continuous Deployment for database schemas

4. Ramping up the percentage of users

Monday, October 1, 2012

Cannot find autoconf. Please check your autoconf

I just upgraded to Mountain Lion 10.8.1 and found that doing a pecl install apc failed.

The fix for me was:

Step 1: Download, install and make autoconf

curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-2.68.tar.gz .

tar -xzf autoconf-2.68.tar.gz

cd autoconf-2.68

./configure --prefix=/usr/local

make

sudo make install --prefix=/usr/local

Step 2: pecl install your apc

sudo pecl install apc

Afterwards you should be able to find the .so file here:

/usr/local/lib/php/extensions/no-debug-non-zts-20090626/apc.so


Step 3: Add the extension to your php.ini file

extension=apc.so


Step 4: Restart Apache

Wednesday, September 19, 2012

Retina effect with jQuery

This is seriously one of the coolest jQuery effects I've seen recently.

/tmp/mysql.sock not found on Mac OS 10.8.1

  1. Step 1 Kill all the mysql processes you have
    ps aux | grep mysql sudo kill -9 PROCESS_ID
  2. Step 2 Find your mysql.sock file
    locate mysql.sock
  3. Step 3 User this file to symlink to /tmp/mysql.sock
    ln -s /private/var/mysql/mysql.sock /tmp/mysql.sock

Adding Google Analytics to your Blogger.com page


  1. Step 1:Create your new analytics account if you haven't already.

  2. Step 2:Go to the account and click the admin button
  3. Step 3:Choose the Tracking Code tab
  4. Step 4:Copy and paste the tracking code you'll find near the bottom
    <script type="text/javascript">
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-34933034-1']);
      _gaq.push(['_trackPageview']);
      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();
    </script>

  5. Step 5:Open your account in Blogger.com and go to the blog account

  6. Step 6:Click Edit HTML and proceed. Then paste in the script code from above underneath right about the tag.
  7. Step 7:In your developer tools you can check that this works by looking in your Network secton to see if the __utm.gif is set with the correct account number. To do so click the gif and look for the utmac value (UA-XXXXXX-1) and it should match that value found in the JS you just pasted in.

Adding the GCC compiler for Mac OS 10.8.1 and Xcode

I just installed Mountain Lion on my machine and suddenly my apache would not start due to an error with the mod_rewrite.so file.
sudo /usr/local/apache2/bin/httpd --restart httpd: Syntax error on line 56 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/libexec/apache2/mod_rewrite.so into server: dlopen(/usr/libexec/apache2/mod_rewrite.so, 10): no suitable image found. Did find:\n\t/usr/libexec/apache2/mod_rewrite.so: mach-o, but wrong architecture
Doing a file on mod_rewrite.so gives the following:
file /usr/libexec/apache2/mod_rewrite.so /usr/libexec/apache2/mod_rewrite.so: Mach-O 64-bit bundle x86_64
This tells me that the .so file I have has a 64 bit architecture but my apache is 32 bit.
file /usr/local/apache2/bin/httpd /usr/local/apache2/bin/httpd: Mach-O executable i386
Great, so now I need to find a way (quick and easy without having to change too many things) to compile mod_rewrite for a 32 bit architecture. After alot of Googling I finally decided to update my Xcode to 4.4.1 The download was 1.56G.

Now the download is finished and after updating my locate I did a

locate gcc | grep bin

With this I found the gcc from Xcode that I just installed.

Doing a file gave me

file /Developer/usr/bin/gcc
/Developer/usr/bin/gcc: Mach-O universal binary with 3 architectures
/Developer/usr/bin/gcc (for architecture i386): Mach-O executable i386
/Developer/usr/bin/gcc (for architecture ppc7400): Mach-O executable ppc

So what's the flag for using gcc for the 32 bit architecture?? (IN PROGRESS)

Using Google Search Operators

Today I found a good link on using Google's search operators. I stumbled across it while looking for a way to find a website's backlinks. Google Guide Search Operators Here you'll find tips like these and others To find the backlinks to a page use the following as search query: link:www.somepage.com