Hackintosh iMessage login error fix

February 21, 2013 Leave a comment

Started not long ago iMessage suddenly stopped working on my hackintosh laptop (A 1080p HP 4530s) with the following error when trying to setting iMessage account:

The server encountered an error processing registration. Please try again later.

After struggling for a few weeks (going through the official apple support forum, messing around with firewall, system date/time, and /etc/hosts) I found the solution here (actually this Chimera solution just came out 2 days ago), http://www.tonymacx86.com/336-chimera-2-0-now-available-imessage-login-fix.html

Link for the newest Chimera (2.0.1) is here: http://www.tonymacx86.com/downloads.php?do=file&id=164

Here are the steps (specific to my HP 4530S with HP Probook Installer version 6)

  1. Download and install Chimera 2.0.1
  2. Open the HP Probook installer and install “Graphic glitch fix” under “Optional hardware-specific fixes” if you did not install that when you set up your probook (doesn’t harm to re-install though)
  3. Reboot and enjoy

Note: Step 2 might not apply to you. I did step 2 because I got some choppy black boxes on the screen after upgrading to Chimera 2.0.1.

Using twilio without a public web server howto

October 7, 2012 Leave a comment

Why bother:
Most of the twilio tutorials on how to make phone calls require a twiml url and (optionally) status call back url, which might not be desired because either 1) not easy to set up a publicly accessible web server 2) for security reasons it’s better not to to expose some urls to the public even they are just intended for twilio to access. If your application doesn’t require a status call back check, you can follow this post to use twilio for phone calls without setting up a web server.

Basic concept:
1) prepare a twiml url through twimlet echo call
2) create a twilio service object
3) make a call with the service object using the url in step 1, use null as StatusCallBack
4) get the sid for the call made in step 3)
5) wait for a period of time which is enough for step 3) to finish
6) get the status for the call through sid obtain in step 4

Example code (in PHP):
1) go to https://www.twilio.com/labs/twimlets/echo and put in the following xml code into the textarea:

<Say>Testing 123.</Say>

and save the resulting url for the next step

define('ACCOUNT_SID', 'your_twilio_account_sid');
define('AUTH_TOKEN', 'your_twilio_auth_token');
// from step 1
define('TWIML', 'http://twimlets.com/echo?Twiml=%3CResponse%3E%0A%3CSay%3ETesting%20123.%3C%2FSay%3E%0A%3CHangup%2F%3E%0A%3C%2FResponse%3E&');
require_once 'Path/To/Services/Twilio.php';

$sleep=30;  // seconds to pause before checking the call status
$from='###'; // nbr verified through twilio
$to='###';  // nbr to call
$tw=new Services_Twilio(ACCOUNT_SID, AUTH_TOKEN);

// make a phone call
$call=$tw->account->calls->create($from, $to, TWIML, $opts);

// get its sid

// sleep for some seconds
printf("sleeping for %d seconds now...\n", $sleep);

// now check the call status
printf( "status for [%s] is %s.",  $sid, $call_check->status );

// todo: do something with the $status

As you can see from the above code, the trick is to take advantage of the twimlet echo service (basically we are using that to provide a twiml url which is hosted by twilio.com).

Categories: twilio

A few zsh tricks I’ve learned so far

September 30, 2012 Leave a comment

It’s the second day since I installed zsh onto my Mac OSX Lion (the exact procedures work on Mountain Lion as well) and I couldn’t help to sharing a few tips that I’ve learned so far:
1. Find all .pdf files under current directory
ls **/*.pdf

2. Go to folder ~/Documents/things/2nd_backup, current folder is ~
cd D/t/2, followed by Tab, autocompletion will change the command into
cd ~/Documents/things/2nd_backup

3.stop a process without running ps
kill, followed by space, tab
If you already know part of the process name, simply, for example
kill ht, Tab (intend to kill running htop process), if htop is the only one that matches ht, command will be automatically converted to
kill pid_of_htop, pretty neat, isn’t it?

4. change default theme from robbyrussell to gentoop The reason I did the switch is because robbyrussell lacks the indication if a user runs “sudo -s” to become root (given the user is given the privilege) and I happened to be a Gentoo fan.
Find the following line in ~/.zshrc and change robbyrussel to gentoo

[UPDATE 10:05PM EDT, 9/30/2012]
I found robbyrussell to be very attractive so I decided to tweak it a bit so it will indicate sudoer status:
vi ~/.oh-my-zsh/themes/robbyrussell.zsh-theme
add “%# ” to the end of PROMPT setting:
PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}%# '
With this change I can easily find out if I am running shell as normal user (%) or root (#), see the screenshot below:

Categories: zsh

Mac OS X Lion zsh installation with brew guide

September 30, 2012 2 comments
brew install zsh
cd $HOME
git clone https://github.com/robbyrussell/oh-my-zsh.git .oh-my-zsh
sudo chsh -s /usr/local/bin/zsh yourusernamehere
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc

Since I am a git nut, I fell in love with zsh right away after I saw the following when I was testing the auto-completion feature of zsh (glad the default zshrc.zsh-template has git enabled in the plugins setting):

The big yellow X means there are changes under current repository, “exp” in red is the name of the current branch. Once I committed the changes, the big yellow X sign disappeared. In other words I don’t even need to type git status to check if current repository is clean – can’t stop loving this feature.


Categories: zsh

Array min, max with Coffeescript

September 19, 2012 Leave a comment

Quite simple actually:

  Math.max.apply(null, this)

  Math.min.apply(null, this)

a=[6, 5, 17, -3, 4.5]
console.log a.max()
console.log a.min()


Categories: coffeescript, Programming

Yet another must have node.js module – underscore-cli

September 12, 2012 Leave a comment

If you love underscore.js and happen to be a CLI nut, you should not miss out underscore-cli, see


for details, or simply install via (assuming you are already using node.js)

sudo npm install -g underscore-cli

Test Drive:
curl https://api.github.com/users/midnightcodr|underscore print --color

Categories: javascript, node.js

Calling initialization function only once with this js trick

September 12, 2012 Leave a comment

There are times when an initialization function in a js object needs to be called only once. Here’s one of the solutions I came up with. When F.paint() is called, a check on the initialization tag (need_init) is performed. need_init remains undefined until init() is called for the first time.

The code:

var F=(function() {
	var self=this;

	var init=function() {
	return {
		paint: function() {
			if(typeof self.need_init==='undefined') {
			console.log('Now I am ready to paint.');


Output from the above example:
Now I am ready to paint.
Now I am ready to paint.
Now I am ready to paint.

Enjoy coding.

Categories: javascript, Programming