Monthly Archives April 2010

It’s the same thing!

Posted by admin on April 29, 2010  /   Posted in Web Development

After spending an hour to come up with this:

function mapName($th_name, $th_order)
return(array($th_name => $th_order));
$order = array_map("mapName", $_POST['thFilename'], $_POST['raw_orders']);
$order_collapsed = array();
foreach ($order as $k => $v) {
foreach ($v as $k2 => $v2) {
$order_collapsed[$k2] = $v2;

… I found out that I can achieve the same goal by doing this:

$order_collapsed = array_combine($_POST['thFilename'], $_POST['raw_orders']);

To make a lemonade out of lemons, I did learn quite a bit about Array handling in PHP.

Got to hand it to the PHP community,due to their maturity (I’m using PHP 5, not even the latest 6), they have quite a collection of some nifty stuff that you often need to do with arrays. It’s just a matter of knowing what’s in the API before reinventing the wheel.

A good Spring book

Posted by admin on April 28, 2010  /   Posted in J2EE

Book review: Pro Spring 2.5
Click here to go to the Publisher’s link.

Spring 2.5

I had the pleasure of reading through this book — yes all 1,000,000 pages in it — at my favorite Barnes & Nobles bookstore while preparing for a session. One and a half hour later, I find myself strangely educated.

Despite the bad reviews that I read about this book, I think it strikes just the right level of complexity and I appreciate the realistic problems that is tackled throughout the book. Such as how to measure the performance of your Hibernate layer via JMX.

This book is perfect for those who would like to have it as a reference that you can flip back and forth depending on which section of Spring Framework you’re tackling at the moment.

Lightweight GUI on Linux servers

Posted by admin on April 27, 2010  /   Posted in Linux


By definition, a Linux server is designed to host long-running processes unattended.  It is the opposite of a Linux-based desktop environment.

Yet a lot of time you do need or miss the convenience of GUI tools when working on your Linux servers.  Or sometimes you use your Linux server as your development platform; and development tools, unless you’re a masochist, are typically GUI-based.

A relevant example would be in a setting where you and your co-workers need to connect to a cloud-computing instance.  Obviously you want the minimal GUI without having to clog the network with unnecessary eye-candy and “smooth-rounded edges” of the mainstream GUI, or maybe you just prefer minimalistic and quick-response over polish.   Either way, you can use this article as a stepping stone to join the fun.

NOTE: You can apply this to any modern UNIX system as long as you can get to the programs that we are discussing below.

As the world’s most flexible and (arguably) powerful OS, UNIX and its derivatives do not disappoint in this regard.  Discovering the right combination of so many good programs out there is a big part of the thrill of putting together an environment.

In this article, I’m using Ubuntu 9.10 (Karmic).  You can substitute almost 90% of apt-get command with yum if you’re using Fedora, or emerge for those of you Gentoo wizards.

First Part: Server-side setup

The reason I came across this exercise is a few months ago, I was upgrading my server to the latest Ubuntu release.  A power outage shutdown the server when it’s in limbo-mode, rather than trying to recover from the unknown state, I decided to went ahead and re-install Ubuntu from scratch and rebuild the server.

TIP: I was able to “wing-it” because I have done the due diligence of backing up my data, otherwise, I’d have way less hair to worry about when combing.

Anyways, on to the history lesson (a practice of using UNIX history command to learn a great deal about how to setup a server):
3  apt-get update
4  apt-get upgrade
5  apt-get install apache2
10  apt-get install mysql-server-5.0
11  apt-get install libapache2-mod-auth-mysql phpmyadmin
19  apt-get install lamp-server^
20  apt-get update
21  apt-get install openbox
22  apt-get install obconf
23  obconf
30  vi /etc/xdg/openbox/menu.xml

Here we start by a pristine Ubuntu server install, nothing on it, and we add to it the LAMP stack, which gives us Apache 2.x, MySQL, and PHP.

Next here’s the lightweight window manager: Openbox. It’s not only a window manager that can run on top of Gnome or KDE, it’s can also run as a stand alone session. And this is the path we’re going in this article, since our goal is to go lean.

Two words: 1) ~/.xinitrc and 2) openbox-session. Put the second one inside the first one; and the next time you start Xwindows you’ll be running Openbox. Like this:

Follow this thread for much more details and interesting aspects of Openbox.

Next, what file manager?…

We serve businesses of any type and size
Contact Us Today