Check It Yeah, It's On


Zend Studio 5.5 vs Eclipse Based Zend Studio

Zend Studio 5.5 was the last version of Zend Sudio that was a standalone IDE. Since then, Zend Studio has been released as an Eclipse based IDE.

I've been doing PHP development since 2005, have been using Zend Studio 5.5 for over the past 3 years and have learned to love it for PHP development. Then last week, I started to use Zend Studio 8 (based on Eclipse)... and boy was it painful!

Here are just SOME of the reasons why Zend Studio based on Eclipse sucks balls and makes it painful to switch from Zend Studio 5.5. Of course there might be a fix for some of these issues, but out of the box it doesn't work and drives me crazy. How would you like it if you bought a computer and out of the box it doesn't do what you expect unless you configure/patch/hack/install plugins for... in order to get it to work?

  • Working with files with 2000+ lines of code is SLLLLLOOOOOWWWWWWW!!!!! Even typing on the editor in a large file, there is like a half a second lag between pressing the keyboard and it showing up on the screen. This is NOT acceptable and is completely horrendous! And I'm running a fucking Intel Core i7 (quad core processor) with 8GB of memory! Zend, you totally fucked up here!
  • No word wrap. Yea, are they fucking serious? Yea, Eclipse doesn't have word wrap, therefore Zend Studio now doesn't have word wrap. How do you go from having word wrap, a basic functionality in nearly ALL text editors and IDEs alike, in Zend Studio 5.x to not having it in the Eclipse based Zend Studio?!
  • You have to create a physical file in order to write any code. WTF?! Why can't I just open up the damn thing and write some code, pseudo code, whatever... without having to create a fucking Eclipse project and file first? In Zend Studio 5.x, I used to always just write/paste in some code and run it in the internal debugger. Now, I have to create an actual file first, which has to be part of an Eclipse project. FML!
  • Shift+Tab doesn't work unless all lines selected have actual tabs. I use Shift+Tab all the time to re-align code. But with this Eclipse based Zend Studio, it doesn't work unless the lines you selected to shift all have actual tabs before them. If one of the lines has a space in front of it, nothing will shift! WTF?! This worked so beautifully in Zend Studio 5.5, in which it would shift all selected lines regardless of what kind of whitespace is before the lines. God damn it, this drives me nuts!
  • No code completion or code hints when opening a remote file. Often times, I work off of remote files. I simply set my WinSCP to edit *.php files using Zend Studio. But when I do this in the Eclipse based Zend Studio, nothing! It doesn't even recognize the functions I declare right there on the same fucking file! And when I go to write a PHP function, no code completion or hints on what the parameters are for the function! You've got to be kidding me! This is suppose to be the Zend fucking Studio IDE, and it fails to give me any code completion or PHP code hints just because I opened a fucking remote file?!
  • Ctrl+D which used to be duplicate a line in Zend Studio 5.5 is now delete a line. This is a tough switch to make. It's virtually completely backwards! How would you like it if Ctrl+V is now copy and Ctrl+C is paste? Would you not want to just break the fucking computer if that was the case?!
  • Syntax highlighting is the Eclipse default purple/bluish color scheme. Well I figured out how to change this one in the preferences, but still. If you're going to ship your product as Zend Studio and not as Eclipse, then fucking make it look better! Cater it to PHP, Mr. Zend, you are suppose to be the PHP company, not the Eclipse company!
  • F5 for debugging no longer works. So again, I used to just open up Zend Studio, write a snippet of code and run the damn thing to see the output. But now there's a whole PHP Debug view that I have to switch to to view debug information. And I don't see right away any short cut to run the god damn code! Plus, the debugger is slow compared to Zend Studio 5.5. Why does it take so long?! Even if I just do a fucking echo "Hello World"; it takes like 2 seconds before I see any output!

All of the above mentioned issues worked beautifully in Zend Studio 5.5. Hence my aggravation with it not working in the Eclipse based Zend Studio like the latest Zend Studio 8. Going from a fully working product to one that just drives me crazy. Of course, you could say that I just don't know how to use the Eclipse based Zend Studio correctly. Sure, you could say that. But I also could say FUCK YOU! 🙂

Zend Studio 8 retails for $299/license. Totally NOT worth it if you ask me. If you're still using Zend Studio 5.5, don't switch or else you will suffer the wrath.

Zend Studio 8...

Filed under: Code 12 Comments

Escaping CDATA in XML

What is CDATA?
CDATA is designated as unparsed character data for XML. That is, it should not be parsed by the XML parser.

What is the use of CDATA?
CDATA declarations in XML are used so that they are not parsed by XML. This way, you are able to use characters such as "<" and "&" as data values. CDATA sections are often used to declare code snippets in XML.

Declaring CDATA
In order to declare CDATA in XML, you need to encapsulate the data string in CDATA tags "<![CDATA[" and "]]>" as follows.

Let's say your data string is:

Hello World!

To declare this as CDATA:

<?xml version="1.0" encoding="UTF-8"?>
<mydata><![CDATA[Hello World!]]></mydata>

Now, if your data string contains the CDATA ending tag "]]>" as part of the data, you will need to somehow escape to prevent mis-interpretation. To do this, you should break up the end tag ]]> into two separate CDATA declarations "]]" and ">" as follows.

Let's say your data string is:


The proper way to present this data string as XML CDATA is to separate it into two separate CDATA declarations "Hello]]" and ">World!" as follows:

<?xml version="1.0" encoding="UTF-8"?>
Filed under: Code No Comments

Empty Strings Are Hashable

This came to me as a bit of a surprise, but empty strings are hash-able! 🙂

So I decided to see the return on various hashing algorithms in PHP.

$emptyString = '';

print "md5:\t\t";
print "hash md5:\t";
var_dump(hash('md5', $emptyString));

print "\n";

print "sha1:\t\t";
print "hash sha1:\t";
var_dump(hash('sha1', $emptyString));

print "\n";

// crc32 function returns differnt data type than 
// hash using the crc32 algorithm?
print "crc32:\t\t";
print "hash crc32:\t";
var_dump(hash('crc32', $emptyString));

print "\n";

print "ripemd128:\t";
var_dump(hash('ripemd128', $emptyString));

print "iger128,3:\t";
var_dump(hash('tiger128,3', $emptyString));

print "snefru:\t\t";
var_dump(hash('snefru', $emptyString));

print "gost:\t\t";
var_dump(hash('gost', $emptyString));

print "adler32:\t";
var_dump(hash('adler32', $emptyString));

print "haval128,3:\t";
var_dump(hash('haval128,3', $emptyString));

print "whirlpool:\t";
var_dump(hash('whirlpool', $emptyString));


md5:		string(32) "d41d8cd98f00b204e9800998ecf8427e"
hash md5:	string(32) "d41d8cd98f00b204e9800998ecf8427e"
sha1:		string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
hash sha1:	string(40) "da39a3ee5e6b4b0d3255bfef95601890afd80709"
crc32:		int(0)
hash crc32:	string(8) "00000000"
ripemd128:	string(32) "cdf26213a150dc3ecb610f18f6b38b46"
iger128,3:	string(32) "24f0130c63ac933216166e76b1bb925f"
snefru:		string(64) "8617f366566a011837f4fb4ba5bedea2b892f3ed8b894023d16ae344b2be5881"
gost:		string(64) "ce85b99cc46752fffee35cab9a7b0278abb4c2d2055cff685af4912c49490f8d"
adler32:	string(8) "01000000"
haval128,3:	string(32) "c68f39913f901f3ddf44c707357a7d70"
whirlpool:	string(128) "19fa61d75522a4669b44e39c1d2e1726c530232130d407f89afee0964997f7a73e83be698b288febcf88e3e03c4f0757ea8964e59b63d93708b138cc42a66eb3"
Filed under: Code No Comments

Tomorrow Is Not Just Another Day

Today is in your hands

Tomorrow is not just another day.

For it is the beginning of improvement and the end of complacency.

Tomorrow is another opportunity to be a better person.

Tomorrow is another opportunity to learn and teach.

We should take advantage of every day.

We should live life one day at a time.

We should be the best that we can be every day.

We should not take for granted what can be accomplished in a day.

I will start with today. And hope for tomorrow. 🙂

Filed under: Check It! No Comments

2010 Taxes: Done!

Turbo Tax

Turbo Tax it up!

I'm done with filing my 2010 taxes! For The Win!!! 😀

I think this is my first time filing on time, so this is a breakthrough for me.

Yea! Go suck it, IRS! 😛

Filed under: Check It! No Comments

Bay To Breakers 2011: Registered

Starting line of 2010 Bay To Breakers

Getting a piece of history... being part of history... the 100th Bay To Breakers 12K race. I am registered! I'll be in the last Corral though cause it's almost sold out. This should be fun! 😀

Filed under: Check It! No Comments

No Progress In Comfort

Your future is in your hands

Progress is best made when we are uncomfortable. Consistent norm or false successes will keep you on the same path that you have been on because if something isn't broken, you are less likely to want to fix or change anything.

In order to make real progress, your mindset has to be one of continual change and upgrade. I do not mean in terms of time, to change before the effects are realized. I mean that your approach needs to be seen as one that can be improved upon.

When we get too comfortable with our lives, we often stop improving ourselves. Our personal progress is often hindered by our comfort or acceptance; comfort in our jobs, comfort in our relationships. It is comfort that is the damper on innovation and creativity. The industrial revolution didn't happen because people loved the way they were living before. No, it happened because people wanted and needed something better.

Now, I'm not saying that if your life is perfect or is going really well, to change it. Nor do I mean to diminish the small steps we all try to take in our lives towards self-improvement, such as learning a language, working out, or practicing mastery of our passions. What I'm saying is that if you believe your life is "ok" or "could be better", that continuing to do the same things is only going to give you the same results. As noted by many including Albert Einstein, "doing the same thing over and over again, expecting different results" is the definition of insanity. So, let's not be insane about this.

Let's make a real difference, not a half-ass one. If you are not happy with your physical shape, drinking two sodas a day instead of three is a drop in the bucket. Let's really create some discomfort in our lives in an effort to improve. If you hate your job, don't stick with it because it's "uncomfortable"... no, that's not logical and is not to the point of this article. You have to be able to see the value or improvement in yourself from the discomfort for it to be worth it.

Sure, your life might be pretty nice, and you've got more things to be thankful for than many other people. And if you're satisfied with that, then it is fine. But if you are one of those people who believe in yourself and that you are destined for more in life, then go for it!

The kind of uncomfortableness that I'm talking about isn't ones of crazy illogical acts like go swim in the freezing water instead of sleeping in your cozy bed. You should think in more broad scopes of evaluating where you are in your life. Could you be in a better situation? Could you do more to make the world a better place? The answers to those questions is typically always yes, so why not? I'll tell you why not, because it requires work. It requires commitment. It requires risk. It requires sacrifice.

The grass is greener on the other side

Hard work, commitment, risk, and sacrifice creates the kind of uncomfortable situation that I am talking about. Put yourself in uncomfortable situations, and you'll surely learn something new and gain valuable life experience that you can build progress upon. Even if you fail, you would have learned and gained experience that will help you to move on. Progress through failure.

Filed under: Check It! 1 Comment

San Francisco Half Marathon 2011: Registered

San Francisco Marathon Logo

I've committed... I've registered for the 2011 San Francisco Half Marathon!

The race day is July 31, 2011. I signed up for the 1st half, which runs across the Golden Gate Bridge.

Filed under: Check It! No Comments

PHP: Common Header Redirection Mistake

PHP is known as a server side language, so when developers write a header redirect, they might be making a common mistake, thinking that the client is not involved until their PHP script finishes running.

First, let's see a sample redirection header sent using PHP:

// check if the user is logged in
if (!$loggedIn) {
  // user is not logged in, redirect them out of here!

// otherwise, welcome the user
print "Welcome user!";

Can you spot the bad practice?

You should understand that a header() call simply issues a raw HTTP header to the client (user's browser). And that the interpretation of that HTTP header is entirely the job of the client, not the server.

With that in mind, the client may not interpret the HTTP header in time or maybe not even at all! Therefore, even if $loggedIn is false, the PHP script will continue processing. And the "Welcome user!" message might be printed, which is unintended behavior.

So, in order to play things safe, a good practice is to always terminate your script after your header redirection calls.

// check if the user is logged in
if (!$loggedIn) {
  // user is not logged in, redirect them out of here!
  exit(); // terminate the script here!

// otherwise, welcome the user
print "Welcome user!";
Filed under: Code No Comments

Drive and Motivation

This animated video of Dan Pink's RSA talk about motivation is very insightful. Particularly, I love how it talks about how employees' best work comes when they are not thinking about the money. And that some of the best ideas come when people are allowed to work on what they want to work on. 🙂

This video speaks directly to my mindset at the moment. Seeking autonomy, mastery, and purpose!

Filed under: Check It! No Comments

PHP: The Generic Standard Class

I've been using a generic class as the foundation for simple objects as I find it makes sense for me to overload object properties (PHP5), so that I don't have to update object class variables and add them as parameters to constructors. This works for me particularly well when representing database records as objects. Perhaps it will make sense for you too.

Let's take a look at a simple classic object class definition:

class Apple {
  public $type;
  public $color;
  public $sweet;
  public function Apple($type, $color, $sweet) {
    $this->type = $type;
    $this->color = $color;
    $this->sweet = $sweet;


As you can see, this approach will likely create a lot of tedious code and is subject to needing to update the class member variables and constructor when a new property is added or an existing one is modified (or deleted). Developers would have to know the parameter order of the constructor so that they will pass in the data correctly. This is error prone and is not a best practice.

Now let's look at the generic class. Basically, I have a generic object class upon which other classes inherit from. This generic object exhibits an infoArray protected variable that serves as the storage mechanism for the properties of objects that inherit from it. Then, the use of the magic __get() and __set() are used to access the properties. Let's take a look...

The Generic Object

 * The Generic Object
 * @source
class GenericObject {

  protected $_infoArray = array();
   * Constructor takes in an optional array containing initial key-value data
   *   for the object.
   * The information is stored with the keys lower-cased.
  public function __construct($infoArray = array()) {
    foreach ($infoArray as $key => $value) {
      $this->_infoArray[strtolower($key)] = $value;
   * Magic getter looks up the property and if it exists in the infoArray, 
   *   returns it
  public function __get($property) {
    if (isset($this->_infoArray[strtolower($property)])) {
      return $this->_infoArray[strtolower($property)];
    } else {
      return null;
   * Magic setter sets (or updates) a property into the the object
  public function __set($property, $value) {
    $this->_infoArray[strtolower($property)] = $value;

   * Magic isset to check the _infoArray as well as the member properties
  public function __isset($property) {
      if (isset($this->_infoArray[strtolower($property)])) {
          return true;
      } else if (isset($this->$property)) {
          return true;
      } else {
          return false;


First, let's see how it is easily extended and used.

class Apple extends GenericObject {
  public function __construct($infoArray = array()) {
    // call parent constructor


// instantiate new Apple object and set some properties
$myApple = new Apple();
$myApple->type = 'Red Delicious';
$myApple->color = 'Red';
$myApple->sweet = true;

// perhaps you queried a bunch of Apple records from the database 
// (using an associative fetch method)
$appleObjs = array();
$appleRecords = $dbHandler->query("Select * From Apples");

foreach ($appleRecords as $appleRecord) {
  // create new Apple objects by passing the associative data array 
  // to the constructor
  $appleObj = new Apple($appleRecord);
  // we can start access the object's properties using object notation
  $appleObjs[$appleObj->Id] = $appleObj;

Inheriting from such a GenericObject class doesn't limit you from customizing your classes to have its own member variables and functionality.

class Apple extends GenericObject {
  public function __construct($infoArray = array()) {
    // call parent constructor
  public function eat() {
    // if this fruit is sweet, then proceed to eat it
    // here, the "sweet" property can be accessed as if it were a 
    // local member variable
    if ($this->sweet) {
      // before you eat an apple, wash it!

  public function wash() {
    // wash the fruit


class Banana extends GenericObject {

  public static $ripeColor = 'yellow';

  // this class member variable is specific for the Banana class
  public $monkeyObj;
  public function __construct($infoArray = array()) {
    // call parent constructor
  public function eat() {
    // if this fruit is of the ripe color, then proceed to eat it
    if (strtolower($this->color) == self::$ripeColor) {
      // before you eat a banana, peel it!
      // if a monkey is set, feed it to the monkey!
      if (isset($this->monkeyObj)) {

  public function peel() {
    // peel the fruit



  • This may not be suitable for storing more complex or large data types.
  • You can not assign references to properties to the overloaded GenericObject, therefore references should be assigned to class member variables instead. (for example, the $monkeyObj in the Banana class above)

Hope this helps!

Filed under: Code No Comments

Skylar Grey

Skylar Grey - I Need A Doctor

I've been discovering a lot of new music this weekend, and one of the names that jumped out at me was Skylar Grey. Seems like she just exploded onto the mainstream scene with her recent work with Eminem's "I Need A Doctor" (Featuring Dr. Dre) and with Diddy's "I'm Coming Home". Both of these songs are widely played on the radio now a days, the former being a better song than the latter. 🙂

Skylar's rendition of Rihanna part in "Love The Way You Lie" is said to be even better than the original. She also has been working with Lupe Fiasco in "Words I never Said". In these songs, she provides a heavenly inner voice backdrop for the songs. I'm impressed by what I hear so far, and looking forward to seeing more of her work!

Check out her voice in this rendition of "Love The Way You Lie" with Eminem:

Filed under: Check It! 4 Comments

PHP: Arithmetic Operations in Strings

PHP QUIZ: Consider the following code, what is the output?

$applesBought = 5;
$applesSold = 3;

echo "Now I have " . $applesBought - $applesSold . " apples left";

Do you know what the output is? Read on for the answer and explanation...

Filed under: Code Continue reading

PHP: Finding Duplicates in Array

Using array_diff_assoc() and array_unique() to find duplicate values in an array.

$fruitBasket = array(

$duplicates = array_diff_assoc($fruitBasket, array_unique($fruitBasket));



    [3] => banana
    [4] => apple
Filed under: Code 1 Comment

Spam Friend Requests on Yahoo Messenger

Yahoo Sucks

I'm going NUTS! Because, there doesn't seem to be a way to block all friend requests on Yahoo Messenger!!!

Why?!?! I get so many spam friend requests on YIM! I have my Yahoo profile hidden. I set my "Ignore" list to "Ignore anyone who is not in my Yahoo! Contacts". But that doesn't seem to ignore friend requests!!! WHY?!?!

Yahoo, why?!?!??!?!?!?!?!

Does anyone have a solution?!?!?!?!??

Filed under: Check It! 4 Comments

Blogging Communities

Live Journal

I heard some interesting things about blogging communities today. It makes sense that if someone is passionate about a particular topic, whether it be movies, travel, cars, etc. that they might blog about it. And with that, they may want to find other people who share the same interest. Certainly some people blog about random stuff (like this one), and these blogs wouldn't fit the community.

Hence, the blogging community. Think, the web rings of the 1990s. Bloggers' articles from the community would be rated by others in the community. Bloggers seeking larger distribution of their content would want to join the community.

Outside users who want to find information on particular topics would visit the community "hub" where they can see the highly rated articles or get the latest articles from the community. Bloggers essentially create a social network amongst fellow bloggers. I suppose getting the bloggers to join the community would be the hardest part.

The Blogging Social Network anybody?

Filed under: Check It! No Comments

Timex to Workout!

Timex Watch

I wanted to get more serious about my running, so I figure I better start timing myself. I got the Timex T5E231 Ironman 100-Lap FLIX System Watch.

Timex T5E231

Who really needs 100 memory laps?! But sure! This watch features its FLIX Technology, which is a mode that you can set the watch to so that you can enable it's indigo light with a "flix" of your wrist. No need to press any buttons! I think this will be especially helpful for those nighttime runs!

The display face of the watch is nice and large for easy read. I'll have to road this this one for awhile to see how it holds up in action.

Timex Watch T5E231

Filed under: Check It! No Comments