Check It Yeah, It's On


Setting Up The Comeback

A set-back is a setup for a comeback

- Eric Thomas

Today is a new day. To some, today is the best day. The best.

But let today be a reminder. A reminder for myself at least, and hopefully a reminder to you. If we are, at our core, who we believe we are and who we believe we can be... then this is not the time to be deterred.

This is not the time to lament. This is not that time.

This is the time, if ever, to work.

Filed under: Check It! No Comments

San Francisco Pace

I moved out of San Francisco several years ago and don't venture up there much anymore, particularly in the downtown area.

Today, as I walked through SOMA and across Market, I find myself thinking, "has my life slowed down?". Look at these people, all these people, from the business woman, to the Giants fan, to the runners and bicyclists, to the loiterers... they are all out there.  Cars honk by and the hustle and bustle of the city moves around you like a swift current around a rock in the river bed.

I find myself wanting to walk faster than my normal fast.  To catch up to some and to rush by others.  If I went this fast in the peninsula, say San Mateo Downtown, or in the south bay, say Castro Street, people would think I'm rushing to something urgent.  But not here in San Francisco.  The pace here is the norm.

A quick trip to San Francisco is what non-Franciscans like me need to get a reality boost.  The pace is addictive.  It appeals to your every moment.  At the crosswalk waiting for the light, you feel the urge to do something.  A tweet, an email check, a chat, something to continue the momentum until the light turns white.

I miss the city.  I miss your energy.

Until next time, I'll catch you again.

Filed under: Check It! No Comments

Mentorship – So It Begins

This summer, I have the unique and privileged opportunity to be a mentor for an intern at work. I am excited and nervous of the opportunity. I do not yet know much about this person and can only hope for someone with an open mind.

As I look back at an old mentorship entry I wrote nearly 3 years ago, I see the truths in my past values now resonating in my preparation for this experience.

In thinking about the concepts I'll try to instill upon the mentee, I have asked him to start a blog. I asked this because I believe that writing is a key skill that will be needed in many facets in life and career. In the future, it will matter less what you write or how you write, so long as you create the momentum of doing.

In doing so, I am reminded that I have not written in my own blog in quite some time. I must try to be prepared and willing to do myself what I ask of others. Though not always capable, where I can, I must try.

Filed under: Mentorship No Comments

Code Poetry: We are the 99 Percent

"We are the 99%"

class Warfare
    public $we = 0.99;
    private $bigMoney = 0.01;

Filed under: Code, Code Poetry No Comments

Ready, Fire, Aim

If we wait for perfection, we may die waiting.

A change in one's perspective is ultimately the difference between good and bad, perfect and flaw, positive and negative.

The approach we take to invoke the changed perspective varies.  Who can really flip a bit in their head and have the desired outcome?  Can we train ourselves to in fact be more dumb and less emotional about the way we perceive the world?  Or perhaps we need the stars to align in a formation conducive to being able to see that which is right in front of our eyes?

I am taking a risk.  A leap of faith.  Knowing that the activation energy needed to produce change greatly surpasses the energy needed to sustain it.  The first part of this is making a decision.  A sheer mental decision in laying out new paths in our cognitive roadmap is vital to starting anything.  Now, it is time to step onto the road with which I have laid these cognitive bricks from the future. 

The future is created in our minds.

Filed under: Check It! No Comments

A Change in Tide

The sky is changing.
The wind blows softly in staggered bursts.
There is a disturbance in the waves.

Do you feel that?

I feel a major shift is coming. 
I'm not sure what it is yet.
But the stars are aligning.

It is time for a change in the tide.
The path once walked in the sand is being washed away by the waves.
A new path shall be forged.

I do not know where it will lead me.
This is the uncertainty of the time.

Filed under: Check It! No Comments

Sleep and the Buzz of Sleep Deprivation

I've had an on again off again relationship with sleep.

Sometimes I think I'm able to beat the system.  This system, is the human body's and mind's "requirement" of sleep.

I think of the monks who are able to meditate and generate body heat to dry off a wet towel.  I think of mind over matter.  I think of the mind's control over the functions (including healing and regenerative functions) of the body.

And if I can somehow... some way...  train the mind to perform these functions more effectively and efficiently, then by golly I should be able to reduce the amount of sleep "required" to sustain myself.

I have tried to desensitize my body and mind.  Numb the urge and feeling of sleepiness.  This is my training.  Hard body training of the martial artist meets hard mind training against sleep.

There is this feeling.  There is this feeling you get when you are a bit sleep deprived.  When you feel that your mind is running at higher RPMs.  When it's 3AM and yet you're not as tired as perhaps 95% of people are around this time (in your same timezone).  When you're thinking of the possibilities of yourself, of the world... endless.

This feeling may be one of delusion.  It may be clouded judgement.  This feeling, is the buzz of sleep deprivation.

And perhaps I've become drunken from this feeling.  An addict to the substance, or lack thereof.  To the point where sleep itself becomes the downer.  When you go to sleep excited, determined, confident, and focused... and yet, awake in a sense of hopelessness.  I awaken more tired and sleepy than I did before I lay my head upon the pillow.

Where art thou, the restorative nature of sleep?  Show forth yourself, the being with which you proclaim!

I do not see it.  I do not feel it.  I do not like green eggs and ham... and yet, I surrender.  I surrender to the beast.  I am a slave to it.  I accept it as my keeper.

Filed under: Check It! No Comments

Similar Minds

I have been wondering if there are minds similar to myself.

I do not think I have met someone who thinks the same way as I do.  Perhaps it is a good thing?  One of those "you're special" responses?  Well, I do not think so.

I have met a few people who think somewhat the same way as I, though the more I examine, the more I seem to digress from that initial observation.  I'm not saying that it is a bad thing to think unlike me... not at all.  In fact, it may be a good thing.

But nevertheless, I ponder.

When someone is on the same wavelength as me, it magnifies our amplitudes.  There is something magical about someone who seems to understand things the same way you understand them.  Certainly there is high value in having multiple perspectives.  I'm not talking about opinions as much as the thought process involved in deriving that understanding, which may ultimately lead to the opinion.

Call it narcissism if you want, but it's not.  It is seeking self understanding through mutual confirmation.  Confirmation that can only really be brought upon by similar minds.

Filed under: Check It! No Comments

Mentorship – Part 1 (Being a Mentor)

MentorshipI've been thinking more about the idea of mentorship recently. I've been pondering about its pros and cons, the type of things I would look for in a mentor, and the type of things I would try to instill into someone (my mentee) if I were a mentor.

The idea of mentorship is generally thought of being a positive one. From the viewpoint of the mentor, I think you have the opportunity to make a meaningful and, hopefully, a positive impact on the life of your mentee. From the viewpoint of the mentee, I think you have the opportunity to gain experienced insight from someone with more experience who can guide you towards what you want to achieve.

This is not an article on the details of mentorship, of course, but I do want to write down some thoughts as they pertain to someone in my position (and I imagine these thoughts may pertain to you as well).

Being a Mentor

First, let me say that I haven't been a mentor before... at least not officially? Well, do such formalities even exists for mentorship? In martial arts, you can imagine that the student makes a pledge and vow towards their teacher. There is some sense of informal mentoring in that capacity whenever you are in a teaching position. In either case, I want to reflect on this concept of being a mentor in order to better prepare myself in becoming a mentor in the future. Please excuse my ignorance on the matter.

1) Building trust

Trust is probably the single most important aspect that I see in mentorship. Having a solid trust relationship between the mentor and the mentee to both understand each other better and to accept wholeheartedly, the information that is exchanged between them. Without fundamental trust, the relationship can turn into unproductive or even destructive.

2) Teaching principles first, specifics second

I think it is important to instill the principle into the mentee first. These principles are what guide the mentee into being better prepared to making their own decisions as it relates to them in their lives later. Specifics can serve the purpose of examples or put things into context in helping to teach the principle or provide guidance in a particular area.

3) Plan for the future

I think as the more experienced mentor, you should have foresight into putting the mentee's future into consideration when providing advice. Ultimately, the mentor should be trying to do what helps the mentee make improvements in their life as a whole. Therefore, it should be emphasized that the mentor thinks about the mentee's future when providing advice.


That's it for now. I will return to this topic later as I gather my thoughts.

Filed under: Mentorship No Comments

Code Poetry: Everyday I’m Shufflin’

"Everyday I'm Shufflin'"

$day = date('l');

switch ($day) {
    case 'Sunday':
    case 'Monday':
    case 'Tuesday':
    case 'Wednesday':
    case 'Thursday':
    case 'Friday':
    case 'Saturday':

Everyday I'm Shufflin' in PHP

Everyday I'm Shufflin' in PHP

Filed under: Code, Code Poetry No Comments

Sites That Don’t Allow Special Characters in Passwords, WTF

Drives me nuts when a site, especially a financial site, which do NOT allow passwords that contain special characters.

Sites like these make me wonder if they do other stupid stuff like store passwords in plain text.

Let's comprise a list of sites which are stupid like this, go!

[EDIT: August 15, 2014]
Let's expand this to any poor password policy restrictions. For example, sites that don't allow numbers in passwords, sites that limit password lengths, etc.

Filed under: Code 4 Comments

First Time Bouldering

Went bouldering for the first time today. 🙂 Went to Planet Granite in the Presido.

It was pretty cool, but was pretty difficult considering how out of shape I am. Plus my wrist has been injured from tennis, so I've been inactive for nearly a month. So performance wise, I totally sucked.

I don't work on grip strength that much. Perhaps I should focus on that a bit before I return to try it again.

Filed under: Check It! No Comments

Will Smith, Role Model

I've been hearing these wise, motivational quotes... these inspirational perspectives on life and success. I didn't even know they were from Will Smith.

Wow. I mean I love his acting and his movies. But never knew he has such a masterful drive that he embodies into his own life and career.

Will Smith, my new role model.

Filed under: Check It! No Comments

2012 New Year Resolutions

Here's a quick list of my thoughts on what should be focused on and accomplished in 2012. Some are repetitive but oh well!

For body

  • Eat healthy
  • Stop eating so much god damn junk food!
  • Get regular sleep
  • Work out regularly
  • Run regularly
  • Lift them weights!
  • Stretch!

For soul

  • Laugh more 😀
  • Be thankful everyday
  • Pay it forward

For people

  • Keep in contact with friends better
  • Meet new people
  • Be more personable 🙂
  • Appreciate and enjoy people's company more
  • Be kinder to family and friends

For progress

  • Learn and focus
  • Review and practice things learned before regularly
  • Learn and practice a new language!
  • Blog and video blog more

For achievement

  • Run Bay to Breakers
  • Hike Half Dome
  • Run 2nd Half of SF Marathon
  • Travel to a new country

... more added as I think of them in the coming week...

And of course... Happy New Year! 🙂

Filed under: Check It! No Comments

Code Poetry: Do or do not while… there is no try catch

"Do or do not [while]... there is no try [catch]."

//try {

    do {
        echo "Do!";
        $do = rand(0, 1);
    } while ($do);

//} catch (Exception $e) {

// Yoda
Yoda: Do or do not while... there is no try catch

Yoda: Do or do not while... there is no try catch

Filed under: Code, Code Poetry No Comments

Code Poetry: It’s not the size of the dog in the fight, it’s the size of the fight in the dog

"It's not the size of the dog in the fight, it's the size of the fight in the dog."
-Mark Twain

$fight = new stdClass();
$fight->dog = array(
	"large dog", 
	"big dog"

$dog = new stdClass();
$dog->fight = array(
	"refuse to quit", 
	"strive for your dreams"

if (sizeof($fight->dog) > sizeof($dog->fight)) {
    echo "It's not this";

if (sizeof($fight->dog) < sizeof($dog->fight)) {
    echo "It's this";

// Mark Twain
Filed under: Code, Code Poetry No Comments

Code Poetry: Of all the things I’ve lost, I miss my mind the most

"Of all the things I've lost, I miss my mind the most"
-Mark Twain

$lost_things[] = "my mind";
$missed_most = end($lost_things);

// Mark Twain
Filed under: Code, Code Poetry No Comments

Failure as Knowledge

As social humans, we are always concerned with how others perceive us throughout our lives. We have been brought up in a society, where winning is awarded and failure is punished. This creates a mentality where we are so self conscience of our actions that we often deprive our lives of potentially amazing experiences. We are hesitant to take risks. We are afraid to take the road less traveled.

I say, let failure be thy knowledge. Let the things that we screw up in life be the things we learn from the most. Let these life experiences be the glory days of battle, from which true life lessons are learned. Failure... embrace it when it happens, because that is how we grow. That is how life is meant to be lived. That is how we change... for the better.

Filed under: Check It! No Comments

The Anatomy of a Weekend

I always seem to be unmotivated all weekend until the last minute. That is, Sunday night. I'm sure a lot of people feel the same way.

Knowing that the impending doom of the inevitable work/school week that starts the next day brings to the forefront the ending of the weekend. This can be compared to people with terminal illnesses, who live rather "fulfilling" lives doing the things that they really wanted to do their whole lives, after learning about their illness. They stop sweating the small stupid things in life and really focus on the things that matter to them, such as their family, their friends, their legacy, their passions, etc.

This made me think about the contrast between the work week and the weekend and how our behavior changes during the weekend.

The Anatomy of a Weekend

I believe the typical weekend can be characterized by the following phases.

  • Anticipation

    The anticipation phase may start as early as Thursday evening. Knowledge that the last day of the week is coming may conjure up weekend planning or cause participation in activities such as Thursday night happy hour. As Friday morning comes around, behavior such as listening to Rebecca Black may be exhibited, evident of the lackluster "who cares, just party" attitude. Anticipation is further exacerbated during Friday lunch hour, as the duration of lunch increases significantly. Time watching and Friday office shenanigans are common symptoms of the Weekend Anticipation Syndrome (WAS).

  • Confrontation

    The confrontational phase starts as soon as you leave the office on Friday evening. Here, people will tell their job to suck it by engaging in activities they didn't have time for or were too stressed out to do during the work week, such as going to bars, having nice dinners, or hitting up the clubs. This is generally aimed towards the goal of erasing any bad memories about work during the week by simply getting shit faced and wasted.

  • Recovery

    The recovery phase begins whenever we happen to wake up on Saturday morning. Hangovers and feelings of regret can typically be seen during this phase. The recovery phase may be characterized by lounging around, eating junk food, and frankly doing absolutely nothing most of the day. For those who have not yet subdued the stresses of the work week, the recovery phase may be short lived, as they fall back into another confrontational phase Saturday evening followed by another recovery phase early Sunday.

  • Denial

    The denial phase starts first thing Sunday. Here we go into a brain dead relaxation mode. Unconsciously, we attempt to make ourselves believe the weekend was worth it by relaxing our asses off, eating more junk food, and more brain un-intensive activities.

  • Acceptance

    Acceptance usually takes place Sunday afternoon as we realize it is the last day of the weekend. As we accept the fact that it's the last day, we try to fit in things that seem to make the weekend more productive, such as doing chores or getting some exercise. We want to counteract the guilty feelings of laziness.

  • Motivational

    Then it hits us... late on Sunday nights, the motivational phase finally comes. This is when the greatest ideas come to us. This is also when we feel a magical spurt of energy to work on interesting things. The idea and desire to do bigger and better things. Self improvement and reflection. To make the world a better place. We go to sleep with a new found motivation and outlook on life. Unfortunately this is immediately crushed as the the alarm clock goes off on Monday morning.

A comparison between these weekend phases can be compared to that of the Kübler-Ross Model for the stages of grief. The fact that I am writing such an absurdly thought out blog post on a Sunday night should speak for itself. 😛

Filed under: Check It! No Comments

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

Motivating Children

Motiviating Children

The task of motivating children to do something is one that requires a different solution on a case-by-case basis. Different children will obviously respond differently to various stimuli. Determining which way to approach the problem will require you to study the child over time in order to create a more planned out attempt to motivate him or her.

WTF am I talking about? Well, basically there is no sure way to get a kid to be motivated. It's trial and error every time.

And even if the approach is sound, the effects can be vastly different depending upon what environment the child is in. Children who have a reputation to uphold among his/her peers, will likely stand by their reputation. Or if the child has people to show off to, their behavior will likely be influenced by surrounding peers. The same stimulus, when presented on a one-on-one basis may produce totally different results.

Positive encouragement and reinforcement is probably the best way to psychologically influence a child. It may take longer, but will more likely come to fruition. If you tell a child "you're doing really well at your piano playing" more often, the child is more likely to think "hey, I guess I AM pretty good at this"... and would more likely try to play well or practice consistently so that they don't lose a good thing. But if you tell the child "you're not playing well enough, you need to practice a lot more", the child is likely to think "hey, I guess I'm not that good at this, I wouldn't be losing much if I didn't practice".

Filed under: Check It! No Comments

Oscar Who?


I don't get why people are all upset about certain movies/actors/actresses winning or not winning an academy award. They get all worked up about it and bash down the movies they don't think deserve to win and praise the movies they think should (have) won.

Heck, everybody has their own right to opinions regarding what movies are good or not. But damn, chill the fuck out please. 🙂 Frankly, I don't really care who wins or who doesn't win. I like some movies and others not so much. No need to get all worked up about things as meaningless as the Oscars (unless you have a direct financial stake in it I suppose).

Filed under: Check It! No Comments

Inside Job

Inside Job - Documentary

With regard to my last post about how people attain such financial wealth... I just watched the documentary "Inside Job", which looks into the causes and effects of the recent global financial crisis. Nuff said.

But really folks, the old saying is true. The rich get richer, and the poor get poorer. That is the fact of the current state of the global economy, particularly in the United States. The documentary also looks at the players in government, and how much they gained from the financial recession. It also shows how those same people are still in power.

Cheat, lie, and steal you way to the top. Otherwise, you'll just be a stepping stone for others.

Filed under: Check It! No Comments

Smart? Work Hard? Lucky?

San Francisco Luxury Home

Looking at the eloquent mansion-like homes in the more affluent areas of San Francisco makes me wonder how people be come so financially successful.

Are they really smart people who know how to invest? Did they work really hard to achieve what they have? Are they just really lucky and happen to struck it rich? Or perhaps it's both smart and lucky?

I wonder if they just inherited their fortune from their family (aka Old Money). I wonder if they had to really work hard to achieve what they have. I feel like I work pretty hard at my job, yet why am I not as fortunate as them? I think the answer there is because I am not as lucky as them. I mean, I don't want to toot my own horn here but heck, I'm not THAT dumb! 😛 So if I'm above average in education and I work hard, the only other factor is luck right?

Luck, the immutable variable.

Filed under: Check It! No Comments

Take That, Spammers!

Just enabled a CAPTCHA WordPress plugin into my comments, so now comments are open!

I still left it to be administrator approval though. 😛

Filed under: Check It! 1 Comment

Hunger is the Best Sauce

I like food. You like food. But the difference between you and me is that you crave flavor. You want your chicken to taste like salt and cheese. You want your pies to taste like sugar. I want my chicken to taste like chicken. I want my pies to taste like pies.

I often think that cook and chefs who are insecure or not confident with their cooking abilities will therefore over compensate by drowning their food in seasoning and sauces. This results in often over salty, over sweet, over everything type of food.

Surely there is skill in the ability to match and accentuate natural flavors, there's no disagreement about that. It's just that I would like to be able to appreciate more natural flavors and not kill my taste buds with sensory overload.

Hunger is the best sauce. This hunger sauce takes time and energy to prepare. Take a stroll around the block. Go for a run in the park. Do some yoga. Play some sports. Have some sex. Have more sex. Whatever floats your boat to get that hunger sauce to perfection.

Filed under: Check It! Comments Off

Snow Flurries in San Francisco

There were reports of light snow fall in certain San Francisco neighborhoods last night. People were saying it was snowing on Facebook. I put on my jacket and ran outside with my camera hoping to capture the moment, but nothing! It wasn't even raining! Boo!

I guess it was only in higher elevation neighborhoods. Oh well. Today, it's even sunny in San Francisco. Not that I'm complaining, bring on the sun! 🙂

Filed under: Check It! Comments Off

Sleep Schedule

I haven't been sleeping very consistently lately. Or actually, let me re-phrase that... I haven't been sleeping early enough lately. I've been staying up pretty late for the past month or so more so than before. We're talking about 2AM+. Today, I even woke up at 11AM! I haven't woke up so late in a long time. Thank goodness I had the day off from work today.

I need to get my sleep schedule back in order. Sleep is so easy to take away from and is so often neglected. So tonight I'm going to bed before 2AM for a change. What's that you say? Sleep is for the weak? If sleep is weak, then I am weak. We'll see who's stronger in the morning! 😀

Filed under: Check It! Comments Off

Decisions Made

Making and finalizing decisions can be a huge milestone in one's life. Not making those decisions can manifest a monkey on your back for a long time, throwing feces and scratching at your head over time. The smell of the monkey is a constant reminder of your unclear path and direction. Lack of good decision making skills can cause you to stay constant or even degrade in your life.

As we've all heard, yet, I'll state it again... life is fleeting, life is short. I want to improve in my life. Staying constant is no longer acceptable. I think I need to become more decisive with my life. Heck, if I haven't figured out what I want out of life by now, then FML. I am tired of having these old monkeys on my back. It's time for change.

Yeah, it's on...

Filed under: Check It! Comments Off


I'm thinking of starting to write some PHP related post.  I think that by writing them, it will help me to learn and remember certain PHP/programming concepts.

It may just be me rambling about code though. 🙂  Either way, hope you will learn something from them and not get confused.

  print "Hello World!"
Filed under: Code Comments Off

Sunny in San Francisco

It's suppose to snow in San Francisco tonight?  Tomorrow?  From the looks of it, that ain't gonna happen, but we'll see.  The weather can change quickly.  The weather forecasts say that if it does snow, it is unlikely that it will accumulate.  Oh well, I prefer sunny days anyhow!

Filed under: Check It! Comments Off

Snow in San Francisco?

So weather forecasts say that it's going to snow in San Francisco on Friday Night into Saturday.  Wow!  They say that it has not really snowed here (like an inch) since 1976.  So will it happen?

Obviously native San Franciscans are mostly chattering about this and how awesome it would be.  Sure, great.  I mean, I didn't move from New York to San Francisco to go where the snow is.  I wanted to get away from it and the cold.  If I want to see snow, I'll drive up north to Tahoe.  It's been pretty cold the past week.  Can't wait till our one week of summer gets here.  Oh well, this will be surely the photo opportunity for many people if it does snow enough to blanket the city.

Filed under: Check It! Comments Off

The Social Network

The Social Network is such a good movie.  Here I am starting up this new blog because I love just how that movie portrays the essence of blogging back in the early 2000s.  The movie starts out portraying Mark Zuckerberg writing on his blog, "Zuckonit", and creates as something to get his mind off of his newly-ex'd girlfriend.

The movie makes it seem that he did this, and as well as create because of a girl.  Later in the movie, Sean Parker's character talks about why he started Napster.  He said that the girl he liked in high school was with the co-captain of the varsity lacrosse team.  So to impress her, he wanted to create the next big thing.  How funny is it that most of what we, guys, do is because of girls?

"Easy enough, except I need an idea"... "Yeah, it's on!"

Filed under: Check It! Comments Off