Set upstream master in Git

If you wish to set tracking information for this branch you can do so with:

[code language=”bash”]git branch –set-upstream master origin/<branch>[/code]

Where could be master.

An example would be:

[code language=”bash”]git branch –set-upstream master origin/master[/code]

With this, you can just do a git pull and git push without having the branch specified.

How to install PHP 5.4 into OS X Mountain Lion

To do so, we are going to get most of the stuff from Jose Gozalez’s formulae. You will need a copy of homebrew installed, you can read about how to install homebrew here.

Let’s start by setting up the dependencies in homebrew.

[code language=”bash”]brew tap homebrew/dupes
brew tap josegonzalez/homebrew-php[/code]

Now php54 is available for install through:

[code language=”bash”]brew install php54 –with-mysql[/code]

To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php5_module /usr/local/Cellar/php54/5.4.5/libexec/apache2/libphp5.so

The php.ini file can be found in:
/usr/local/etc/php/5.4/php.ini

If pear complains about permissions, ‘Fix’ the default PEAR permissions and config:

[code language=”bash”] chmod -R ug+w /usr/local/Cellar/php54/5.4.5/lib/php
pear config-set php_ini /usr/local/etc/php/5.4/php.ini
[/code]

After you enabled PHP in Apache, make sure you restart Apache too!

[code language=”bash”]sudo apachectl restart[/code]

Troubleshooting

If you get an error that looks like this:”

[code language=”bash”]configure: error: freetype.h not found.
Error: uncaught throw Failed executing: ./configure --prefix=/usr/local/Cellar/php54/5.4.5 --disable-debug --localstatedir=/usr/local/var --sysconfdir=/usr/local/etc/php/5.4 --with-config-file-path=/usr/local/etc/php/5.4 --with-config-file-scan-dir=/usr/local/etc/php/5.4/conf.d --with-iconv-dir=/usr --enable-dba --with-ndbm=/usr --enable-exif --enable-soap --enable-sqlite-utf8 --enable-wddx --enable-ftp --enable-sockets --enable-zip --enable-pcntl --enable-shmop --enable-sysvsem --enable-sysvshm --enable-sysvmsg --enable-mbstring --enable-mbregex --enable-zend-signals --enable-dtrace --enable-bcmath --enable-calendar --with-zlib=/usr/local/Cellar/zlib/1.2.7 --with-bz2=/usr --with-ldap --with-ldap-sasl=/usr --with-xmlrpc --with-kerberos=/usr --with-libxml-dir=/usr/local/Cellar/libxml2/2.8.0 --with-xsl=/usr --with-curl=/usr --with-gd --enable-gd-native-ttf --with-freetype-dir=/usr/X11 --with-mcrypt=/usr/local/Cellar/mcrypt/2.5.8 --with-jpeg-dir=/usr/local/Cellar/jpeg/8d --with-png-dir=/usr/X11 --with-gettext=/usr/lo[/code]

It is because your freetype is not working right. It happened to me after I upgraded from Mac OS X Lion to Mac OS X Mountain Lion. To do safe, uninstall and install freetype back:

[code language="bash"]brew uninstall freetype
brew install freetype[/code]

Also if you get a permissions error, you might have to fix it:

[code language="bash"]➜ ~ brew install php54
==> Downloading http://www.php.net/get/php-5.4.5.tar.bz2/from/this/mirror
Already downloaded: /Library/Caches/Homebrew/php54-5.4.5
==> ./configure --prefix=/usr/local/Cellar/php54/5.4.5 --disable-debug --localstatedir=/usr/local/var --sysconfdir=/usr/local/etc/php/5.4 --with-config-file-path
==> make
==> make install
==> /usr/local/Cellar/php54/5.4.5/bin/pear config-set php_ini /usr/local/etc/php/5.4/php.ini
no write access to /Users/kahwee/.pearrc!
Error: uncaught throw
Failed executing: /usr/local/Cellar/php54/5.4.5/bin/pear config-set php_ini /usr/local/etc/php/5.4/php.ini'[/code]

I changed the owner from root to kahwee (my username):

[code language=”bash”]sudo chown kahwee /Users/kahwee/.pearrc[/code]

That’s all, hope it helps!

Twitter removes “via”

TheNextWeb reports Twitter no longer displays what client a tweet was posted with on web.

Twitter has removed the ability for users to determine exactly what client was used to post a message to its service from the web client. This was previously removed from its official iPhone client and that change has been removed from the web version as well.

Twitter is likely attempting to reduce the exposure of third party applications. Applications such as gladlyCast and Seesmic are affected.

Georgia is most credible font

Interesting finding:

We all know that we are influenced in many, many ways — many of which we remain blissfully unaware of. Could fonts be one of them?

Renaud had written 52 essays in total. Eleven were set in Times New Roman, 18 in Trebuchet MS, and the remaining 23 in Georgia. The Times New Roman papers earned an average grade of A-, but the Trebuchet papers could only muster a B-.

And the Georgia essays? A solid A.

Source: New York Times

Most of us in college has been told to use Times News Roman though.

Google self-driving cars deemed ready

I’m all for this:

Google’s Self-Driving Cars Complete 300K Miles Without Accident, Deemed Ready For Commuting

Google’s self-driving car project is probably one of the most audacious experiments the company has embarked upon. Today, Google announced another milestone for this project: its fleet of about a dozen autonomous cars has now driven 300,000 miles without a single accident under computer control. While this is obviously very positive news for the project, Google warns that “there’s still a long road ahead.” The cars still need to learn how to handle snow-covered roads, for example, and how to interpret temporary construction signs and other situations that could throw its systems for a loop.

Google also announced that it has added the Lexus RX450h hybrid car to its self-driving car family.

Source: Techcrunch

People can be affected by the emotions when they drive, with driver-less technologies this can be circumvented. I’m waiting for this, it puts back the auto in an automobile. I can’t wait for this to be in Singapore one day. We could very well have our first accident-free day.

[And meanwhile, I am hearing some rumors about Mr. Lee Kuan Yew.]

I do not display the Singapore flag

I do not hang the Singapore flag outside my window. It is not because I don’t like the country as much as others.

For some, having the Singapore flag displayed out is a pride thing. I feel proud of Singapore even without the flag and the flag just doesn’t represent the same thing as my compatriots which could represent a sense of duty, allegiance, sovereignty or whatever.

There’s a lot more to do than just displaying a flag. You could, for example, give up seats for others who needs it more than you. Just do little actions that can result in a more gracious society in your own little way. Be proud of Singapore being the better place you want to be in by making it a little better everyday. Have that represent Singapore and we do need flags.

How to troubleshoot Mountain Lion’s Apache

After I install Mac OS X Mountain Lion, it seems like my Apache server can no longer start successfully:

[code lang=”bash”]bash-3.2# sudo tail /private/var/log/apache2/error_log
[Thu Aug 02 09:36:46 2012] [notice] caught SIGTERM, shutting down
[Thu Aug 02 09:37:57 2012] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
httpd: Could not reliably determine the server’s fully qualified domain name, using kahwee-mba.local for ServerName
[Thu Aug 02 09:37:57 2012] [notice] Digest: generating secret for digest authentication …
[Thu Aug 02 09:37:57 2012] [notice] Digest: done
[Thu Aug 02 09:37:57 2012] [notice] Apache/2.2.22 (Unix) DAV/2 mod_ssl/2.2.22 OpenSSL/0.9.8r configured — resuming normal operations
[Thu Aug 02 09:46:17 2012] [error] [client 127.0.0.1] File does not exist: /Library/WebServer/Documents/favicon.ico
[Thu Aug 02 09:54:19 2012] [error] [client 127.0.0.1] File does not exist: /Library/WebServer/Documents/r, referer: http://home.internal.kw.sg/
[Thu Aug 02 09:54:19 2012] [error] [client 127.0.0.1] File does not exist: /Library/WebServer/Documents/favicon.ico
[Thu Aug 02 09:54:31 2012] [notice] caught SIGTERM, shutting down
[/code]

To find out why, run apachectl -t:

[code lang=”bash”]
bash-3.2# sudo apachectl -t
httpd: Syntax error on line 106 of /private/etc/apache2/httpd.conf: Cannot load /usr/libexec/apache2/mod_dav_fs.so into server: dlopen(/usr/libexec/apache2/mod_dav_fs.so, 10): Symbol not found: _dav_add_responsen Referenced from: /usr/libexec/apache2/mod_dav_fs.son Expected in: flat namespacen in /usr/libexec/apache2/mod_dav_fs.so
[/code]

Seems like it is caused by my disabling of mod_dav. mod_dav_fs acts as a support module for mod_dav and provides access to resources located in the server’s file system.

So I go to line 106 of /private/etc/apache2/httpd.conf and I comment out that line too.

[code lang=”bash”]sudo nano /private/etc/apache2/httpd.conf[/code]

Try to run the syntax check of Apache configuration again:

[sourcecode language=”bash”]
bash-3.2# sudo apachectl -t
Syntax OK
bash-3.2# [/sourcecode]

That seems to be working, now we start Apache:

[code lang=”bash”]sudo apachectl start[/code]

Useful apachectl commands include:

  • apachectl start
  • apachectl stop
  • apachectl restart
  • apachectl -t

Hope it helps!