Monday, January 28, 2013

Kobe-like

Let's be Kobe-like. :)

Meaning, let's continue to adjust our game so we can counter whatever struggles that come our way.

We all know the game changes and it becomes more and more challenging as the years go by but if we have a Kobe state of mind, everything's going to be alright.



:)

Sunday, January 27, 2013

XForwarding With Putty On Windows Over SSH

So I was writing some scripts for my automated web functional testing using PHPUnit and I encountered an error that prevented me from opening the Firefox browser from the server.

When I tried to run my PHPUnit script, I was bothered by this error:

Error: no display specified


I tried running "firefox" on my CentOS CLI and it gave me the same error message. So I found out that my script is trying to run Firefox within the server but the GUI should pop up on the client side.

Apparently, I need to configure some stuff before I'd able to do this.

Problem: I needed to run Firefox from a Linux server remotely and display the GUI locally in my Windows client.

Solution: XForwarding

WHAT'S IN MY MACHINE: Assumptions

  • CentOS Linux

  • PHP 5.4.4

  • Yii 1.1.12


WHAT TO DO: Installations

Your server must have the following installed:

  • Firefox (if not installed, just run this: yum install firefox)

  • X Windows System (if not installed, just run this: yum groupinstall X Window System)


In your client (Windows 7), install the following:

Putty - for the SSH client

Xserver - to display X11 applications

The installation procedure is pretty straightforward so I won't write it here anymore.

THE TRICKY PART: Configuration

Once you've installed the applications, do the following:

1. Double click on the Xming shortcut on your desktop. Your X Server is now running.

2. Click Putty.

3. In Sessions tab, fill in the details:

Host Name (or IP address) - you should put here the IP address of your server
Port - 22
Connection Type: SSH


4. Expand the Connection tab and find and click the SSH branch.

Check the "Enable X11 forwarding"
Check the MIT-Magic-Cookie-1


5. Go back to Session branch and Save it and then click Open.

6. Log in using your account details and try running "firefox". It should be working by now.

Thus, your PHPUnit functional tests should be able to run using Firefox as well.

Generally speaking, you should now be able to run X applications from the server on your local desktop.

Also, make sure that the following are set to "yes" in your server's /etc/ssh/sshd_config

X11Forwarding


X11UserLocalhost


: )

Installing PHPUnit

WHAT'S IN MY MACHINE

  • CentOS Linux

  • PHP 5.4.4

  • Yii 1.1.12


HOW TO MAKE PHPUNIT WORK

1. You have to have PEAR installed and the version must be 1.9.2 or higher:

pear upgrade pear


2. Register PHPUnit with the local PEAR environment (pear.phpunit.de)

pear channel-discover pear.phpunit.de


3. Install the PHPUnit and its dependencies

pear install --alldeps phpunit/PHPUnit


4. You're done. To test it in your command line, just type:

phpunit


You should get something like:

PHPUnit ver. # by Sebastian Bergmann

: )

Happy testing!

Wednesday, January 9, 2013

Occam's Razor The Kolmogorov Complexity

Blah. I've never been good at explaining things especially when I am nervous or emotionally disturbed or uncomfortable. Or maybe, I just simply suck at it.

I'm not good at it at all. Sometimes I think I put too much detail on things and leave out the most important things. Other times I choose to just NOT explain at all or explain it too shortly because I get annoyed by the thought that I won't be able to explain it well anyway.

I have to learn how to "Occam's Razor" the "Kolmogorov Complexity" of my ideas.