while($alive) LiveAndLearn();

JavaScript, PHP, C# and Life in Viet Nam

Error occured while installing rmagick

without comments

This is the second time I ran into this problem, so now I’m writing it down here:

# export PKG_CONFIG_PATH=”/usr/local/lib/pkgconfig”
# gem install rmagick -v ’2.13.2′


Written by Thomas Bindzus

October 7th, 2013 at 1:32 am

Posted in Ruby

Mount Windows shared folder on Linux from the command line

without comments

I’m running a restore drill where I have a FSArchiver generated file located on a Windows share, and I need to access it from my VirtualBox CentOS server which is booted on SystemRescueCD.

This is how to do it:

mount -t cifs //ip-address-of-windows-share-host/shared-folder-name /mnt/windows -o username=domain//username

If everyone has read permission to the shared folder, then the last part can be ignored: -o username=domain//username

Reference: http://superuser.com/questions/343265/temporarily-mount-windows-share-via-cmd-line-ubuntu-11-04

Written by Thomas Bindzus

September 27th, 2013 at 2:09 am

Vietnamese version of ruby-lang.org

without comments

Awesome, I just saw that ruby-lang.org is now translated to Vietnamese (https://www.ruby-lang.org/vi/), I hope it will get more young Vietnamese interested in Ruby programming, because we all know that real geeks are formed at an early age – right? icon smile Vietnamese version of ruby lang.org

English language isn’t introduced until around year 6, so having information about Ruby in Vietnamese should make it easier to get started, I think I’ll perform an experiment on this…

Written by Thomas Bindzus

September 13th, 2013 at 12:51 am

Posted in Ruby

Building PECL imagick for PHP 5.5.1 on CentOS 6.4

without comments

Came across a plugin for WordPress which needed Imagick, I thought GD took care of it, how ignorant of me… I’m running CentOS 6.4 with Apache 2.4.6 and PHP 5.5.1 at the moment, and being on the “bleeding edge” of the newest stable versions is a challenge *cough* *cough* (no seriously a little sick, coughing all the time).

Searched here and there on Google, but no page seemed to have the complete step-by-step guide needed in my case so here goes:

  1. wget http://pecl.php.net/get/imagick-3.1.0RC2.tgz
  2. tar zxf imagick-3.1.0RC2.tgz
  3. cd imagick-3.1.0RC
  4. phpize
  5. export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
  6. ./configure –with-imagick
  7. make
  8. make install
  9. echo extension=imagick.so > /etc/php.d/imagick.ini
  10. service httpd restart
  11. php -m | grep imagick

And finally the unnecessary but rewarding browser inspection:

Screen Shot 2013 08 11 at 12.44.44 AM 296x300 Building PECL imagick for PHP 5.5.1 on CentOS 6.4

Written by Thomas Bindzus

August 11th, 2013 at 12:47 am

Posted in Uncategorized

Password recovery for Android keystore

with 2 comments

This week started of terrific… NOT! Had to publish an updated App to Google Play, and I completely forgot the password to the keystore icon sad Password recovery for Android keystore

Tried to recover the password by manual trial and error based on made up memories of what I thought the password might be, imagined that I had written it down somewhere and searched my HDD twice to be sure *sigh*, Googled a lot with little success, no luck what-so-ever until I stumbled upon this:


After a failed brute-force attempt (not a good way to recover a lost password) I tried the smart word list option, and I had recovered the password in less than a second, perhaps this week won’t be so bad after all icon smile Password recovery for Android keystore

> java -jar AndroidKeystoreBrute_v1.03.jar -m 3 -k keystore -d wordlist.txt

Written by Thomas Bindzus

June 26th, 2013 at 10:04 am

Posted in Android

Installing MongoDB on Ubuntu 12.04

without comments

The guide provided by MongoDB on their web page is great, however there is a point missing. If you have installed a firewall, then it might be necessary to open port 11371 or temporarily disable your firewall while installing the public key for 10gen.

  1. Disable firewall (or open for port 11371)
  2. sudo apt-key adv –keyserver keyserver.ubuntu.com –recv 7F0CEB10
  3. Enable firewall
  4. echo ‘deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen’ | sudo tee /etc/apt/sources.list.d/10gen.list
  5. sudo apt-get update

Then you should be ready to install MongoDB.

Written by Thomas Bindzus

June 11th, 2013 at 9:59 am

Posted in Uncategorized

After upgrading to Mountain Lions problems

without comments

After installing Mountain Lion my MacPorts installation started acting funny, and my Apache server (installed through port) didn’t work anymore, the installation of Mountain Lion had re-activated the built-in web sharing Apache server.

A guide to install MacPorts on Mountain Lion is available here: http://www.macports.org/install.php

I followed the guide upgrading Xcode to version 4.4.1, then installed the command-line tools, but then I kept receiving this error message when I continued with the MacPorts installation:

Error: Can’t run /Developer/usr/bin/xcodebuild (no such file).

I could not call xcodebuild from the terminal anymore, but then I stumbled upon a setting in Xcode’s preferences where I could choose which command-line tools I wanted to use, a bit silly since there were only one option:

Screen Shot 2012 08 16 at 11.54.34 PM 300x212 After upgrading to Mountain Lions problems

If the drop down box appears empty, then click on it once to activate the command-line tools for 4.4.1

I found this to be the easiest way to restore my command-line tools, and now I’m going to continue my MacPorts installation, perhaps I’ll run into more problems as I continue…

2012.08.19 3:47 – Update: Still not done with MacPorts installation icon sad After upgrading to Mountain Lions problems it stalled at Gimp, turned out that:

sudo xcodebuild -license

was necessary to install Gimp.

It wasn’t long before I was stucked again, because the latest version of MongoDB from MacPorts is not compatible with version 1.50 of the boost library, so now I’m downgrading using these references:


Still building boost 1.49… might as well get some sleep while its getting done.

2012.08.21 2:20 – Update: MongoDB running again, Gimp still not working, and the Apache server cannot be started, which apachectl keeps pointing to /usr/sbin/apachectl, have a strong feeling that it should be pointing to /opt/local/apache2/bin/apachectl. Attempted to start my apache server, some configurations errors, too tired, must fix tomorrow… oh yeah MacPorts all updated now weeee, but Gimp oh Gimp come back!

2012.08.21 2:52 – Update: Grrr… I never listen to myself should be sleeping, but Apache config fixed, so I can start the Apache server manually, hooray for a bit of progress. Tomorrow I’ll have to re-install Gimp I guess… and figure out how to get the right apachectl to respond, already updated my PATH, but apparently I’m too tired to figure it out right now.

2012.08.21 3:05 – Update: Okay I get it… after restarting my Mac all web-sites are loaded, the Apache server is running weeee! But I want to control my server with apachectl, so I’ve made a softlink in /opt/local/bin which is first in my PATH already, now the right apachectl is used! Had to open a new terminal afterwards though, but I’m satisfied.

sudo ln -s /opt/local/apache2/bin/apachectl apachectl

I figured out why Gimp is not loading, X11 is not included in Mountain Lion: http://support.apple.com/kb/HT5293, so I have to download XQuartz from here: http://xquartz.macosforge.org/landing/ and it’s almost ready to install…

2012.08.21 3:28 – Update: XQuartz installed, that was easy enough, logout and login, trembling… Cmd + Space, typing… gimp, Enter weeee, it’s loading, I have my Gimp back, how could I forget, that it’s running on X11 icon smile After upgrading to Mountain Lions problems Now I even think I deserve a bit of sleep! I hope that was my last hurdle after upgrading to Mountain Lion… then again perhaps not, because I’ve just ordered the largest beast of an SSD extension kit for MacBook Air 2011 from Other World Computing, 128 GB simply isn’t enough (for me), and I want dual boot (work requires Windows 7 installed).

Written by Thomas Bindzus

August 17th, 2012 at 12:50 am

Posted in Mac


with 4 comments

This afternoon I found a strange insect swimming around in our fish pool. At first I thought it was a gecko which had lost its tail because it made similar motions as it tried to get out of the water.

Taking a closer look it looked more like a grasshopper, but I’m not sure about that either, perhaps someone could help me with more information about this insect?

It measured around 3 cm long, I took the following picture after rescuing it out of the water:

Insect Vietnam 300x126 Grasshopper?

Some sort of grasshopper?

Written by Thomas Bindzus

August 11th, 2012 at 5:14 pm

Posted in Vietnam

Cannot represent NaN properly using JSON

with one comment

Gosh, this took me almost 2 hours to figure out… gotta write it down, so I’ll never forget it again!

I am working on a project where I communicate with a WCF service using jQuery. The service methods return state objects serialized to JSON which I expect jQuery to correctly parse into JavaScript objects.

One of my state objects contained a property of type double? which were sometimes initialized with double.NaN as the value.

Let’s assume that the state object is called d and the property in question we call Value, so server-side Value was initialized like this:

d.Value = double.NaN;

And when serialized to JSON by the WCF service it turned into a string looking like this:

"{ \"d\": NaN }"

Perhaps I am the only person in the whole world who thought this would be okay, since JavaScript does have the concept of NaN, but JavaScript is not able to parse the JSON string above.

I tried to write a small script to clarify this a bit:

      <script type="text/javascript">


         var jsob = { d: Number.NaN };

         var json = '{ "d": NaN }';

The page above yields the following output:

NaN NaN NaN NaN {"d":null}

And in the console:

JSON.parse: unexpected character

I found this a bit surprising, however in my case I was able to fix it fairly easy by not using double.NaN, but I still don’t understand why, perhaps it’s simply because it’s not part of the JSON specification.

Written by Thomas Bindzus

October 26th, 2011 at 11:17 pm

Posted in JavaScript

Dad draw me a superman!

without comments

Oliver is moving on from YouTube on his iPad, now we are drawing together, well I do most of the drawing and Oliver decides what the motive should be.

We used Brushes to draw the Superman below, it’s a really cool app which let you replay the drawing process.

superman Dad draw me a superman!

Drawed using Brushes for iPad

Written by Thomas Bindzus

July 17th, 2011 at 3:32 pm

Posted in Family,iPad

Switch to our mobile site