Interview Practice 11 – Greatest Distance Between Two Nodes in Binary Tree

Get the greatest distance between two nodes in a binary tree. Assume links between nodes are bidirectional. Distance is defined as the amount of nodes connected along the path linked two nodes.

Read more...

Ssh with password saved

Ssh is a very convenient way to remotely command or control other devices. We use ssh to push commits to git server, to access remote server, and even to manipulate the content of our iphones and ipads. However it’s usually distributing to type your long and elusive password every time. Therefore here I would like…

Read more...

Thanks for the referral from WinAndMac.com

Recently my blog has been referred by winandmac.com to show how to install the Samsung Kies on Lion. I have been subscribing winandmac.com for a long time and I am so grad to be linked by this international and informative blog. And the followings are the posts. =] English version: How to: connect Samsung Galaxy…

Read more...

Handle unwanted character changes in Json for unicodes encoding in PHP

Json has been an efficient way to handle information and message exchanges in web programming. For example, I usually use PHP to connect MySQL and retrieve information, then display as Json. So a webpage can “AJAX” the displayed Json to create a dynamic view on itself. However, while the information involves unicode characters, PHP turn…

Read more...

Reading configuration file in Java

In order to make a program more flexible, it is normal to create an external file to store all the setting. For example, resolution setting of a game is saved in “config.ini” or “settings.prop” so that we can easily modify a program without recompile it. Here I would show you how to do it. First, we…

Read more...

Multiple network adapters, I wanna use one only, how?

Suppose we have more than one network adapter, how could we designate the adapter used to access the Internet? One way would be manually configure the default gateway. Easy way (2 adapters and with little networking knowledge): Suppose you want to use wireless connection in the condition of having both wire and wireless connection at…

Read more...