Saturday, February 22, 2014

Tutorial: Create Unofficial Midnight Commander package for Debian 7.x

This is a quick hack on how to create debian package using Midnight Commander as an example. The Midnight Commander version that I am using here is MP version. The MP version is without glib dependency.

Midnight commander MP version get from here.
Update 2023: older link above is not exist anymore. Try this link.



I am using version 4.1.40pre9.

$ tar xzvfp mc-4.1.40-pre9.tar.gz
...
cd mc-4.1.40-pre9/
mc-4.1.40-pre9$ ./configure --prefix=/usr

checking whether make sets ${MAKE}... yes
checking for gcc... gcc
...

mc-4.1.40-pre9$ make
mc-4.1.40-pre9$ make DESTDIR=/tmp/mc install
mc-4.1.40-pre9$ cat > control <<-EOF
Package: mcmp
Priority: optional
Section: utilities
Installed-Size: 45
Maintainer: fuyichin <fuyichin@gmail.com>
Architecture: i386
Version: 4.1.40-pre9
Description: midnight commander
this is more powerful version without glib.
EOF

Create the debian package:
mc-4.1.40-pre9$ install -d /tmp/mc/DEBIAN
mc-4.1.40-pre9$ install control /tmp/mc/DEBIAN/.
mc-4.1.40-pre9$ dpkg -b /tmp/mc mc-4.1.40pre9.deb
mc-4.1.40-pre9$ ls mc-4.1.40pre9.deb
mc-4.1.40pre9.deb

mc-4.1.40-pre9$ sudo dpkg -i mc-4.1.40pre9.deb

Thursday, February 20, 2014

Facebook to acquire WhatsApp in USD16 billion

Finally WhatsApp is ready to sell for a price. In the 16 billion deal, 4 billion are in cash. According CNET WhatsApp monthly active users more than Facebook, in terms of growing rate since they start up. This is not truly fair comparison as both company started at different time. In simple word, WhatsApp is growing fast, For Facebook, WhatsApp is rival. By acquiring WhatsApp, Facebook increase their user base and one thing less to worry about.


Photo from flickr

Does WhatsApp has a business model? Yes, the first year is free, but the subsequence subscription fee is USD1 per year. WhatsApp is just a small size company with 55 employees now. WhatsApp has more than 400 million monthly active users.

Last year there was a rumour that Google and WhatsApp in talk of acquisition, but WhatsApp has denial that (refer here Won't sell-out to Facebook or Google: WhatsApp). WhatsApp never need to worry about money, they were funded 8 million by Sequoia Capital, should be enough for them to operate for some time.

There is a story of how Koum and Acton co-founded Whatsapp. Koum and Acton working in Yahoo before the co-founded WhatsApp. Both of them applied job in Facebook but rejected. Read the story here.

Note:
Rumor saying that Google offered 10B for WhasApp.

Saturday, February 15, 2014

Tutorial: Install MySQL with Homebrew on OS X

Normally this is how I install MySQL.

1. Download MySQL binary
2. Extract the binary, I put it at /usr/local
3. Create database
4. Set root password
5. Startup and shutdown

The instructions are for unix like system, even for Mac OS X.

With homebrew, it could be event easier. (Note: Homebrew is a third party software management tool for Mac OS X)

1. Make sure homebrew is working.
$ brew update
$ brew doctor

2. Install MySQL
$ brew install mysql

(mysql command will be installed in /usr/local/bin directory)

3. Create database
Make sure /usr/local/bin is in your PATH environment.
$ mysql_install_db [--basedir=/usr/local/Cellar/mysql/5.6.15]

Without the base dir, the system response with error can not find my.cnf file. The version number of the mysql could be different in your system, mine is 5.6.15.

4. setup my.cnf
$ vi /usr/local/Cellar/mysql/5.6.15/my.cnf
...
# These are commonly set, remove the # and set as required.
basedir = /usr/local/Cellar/mysql/5.6.15
datadir = /usr/local/data
port = 3306
server_id = 1
socket = /tmp/mysql.sock
...

This is my configuration, you might have your own settings, especially for datadir.

5. Startup and shutdown
$ mysql.server start
Starting MySQL
. SUCCESS!


$ mysql.server stop

6. Create root password
$ mysqladmin -u root [-h localhost] password 'new-password'

Once you have your root access to mysql, you can create other users and databases. Note: You need to start mysql server to change the root password.

Saturday, February 08, 2014

Upgrade PHP with homebrew on OS X

I am new to homebrew, whatever I shows here is just my experience with homebrew, might not be the best practise.

Homebrew is similar with Fink and MacPorts, is just a software management tools to install third party software, especially open source software on Mac OS X. It install the software into /usr/local directory, which will not replace your system software.

Update to the latest system if possible. Later system may have a better support, homebrew just download the binary if it is available on your system. Which save you time. I use homebrew on my older system, it download and compile the software, I encounter error and retry and retry...

These are the steps to update php with brew, I refer the steps from the internet:

$ rm -rf ~/.pearrc # remove existing PHP/PEAR config files
$ brew update
$ brew upgrade
$ brew tap homebrew/dupes
$ brew tap josegonzalez/homebrew-php
$ brew install freetype jpeg libpng gd zlib openssl unixodbc

$ brew install php55 # or php53

It takes a few minutes if binary is available.
I experience some issues on my OS X 10.6.2 with 32 bits CPU. I have php 5.3.1 on my system, but the PHP composer need 5.3.2 or above.


Issues with freetype

$ brew install freetype
builds/unix/ftsystem.c:246: error: 'Cannot_Open_Resource' undeclared (first use in this function)
builds/unix/ftsystem.c:369: error: 'Cannot_Open_Stream' undeclared (first use in this function)

Manual compile freetype works! From http://www.freetype.org/download.html. I compile freetype-2.5.2:

$ cd freetype-2.5.2
$ ./configure
$ make
$ sudo make install

$ brew install php53 --ignore-dependencies freetype --without-apache

Please take note, the php I installed doesn't works with Apache web server. Finally I have my PHP 5.3.28.

$ php -v
PHP 5.3.28 (cli) (built: Jan 22 2014 18:27:26)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies