Thoughts, rants and commentary of a simple man

Creating a custom XML logger for SugarCRM 7

Posted on October 8th, 2014 in Programming,Web Development,Work | No Comments »

I recently ran across a question on StackOverflow in which the original poster asked about creating a custom XML logger for SugarCRM. He was wondering where to put his custom class and some of the particulars surrounding this so I thought I’d pitch in and help out.

I created my own custom XML logger class – SugarXMLLogger – and saved it at custom/include/SugarLogger/SugarXMLLogger.php. I then applied it to the Ping API for testing both as a replacement for fatal level logging and as a replacement for the default logger. Since the functionality of the logger is intended to be simple, I didn’t feel the need to extend SugarLogger. However, I did feel it at least appropriate to implement LoggerTemplate so that the integrity of the logger among the stack of loggers was kept in tact. If you want the fullness of SugarLogger in your custom loggers then you should extend SugarLogger. However, for a simple XML logger that wasn’t absolutely necessary.

As far as the log is concerned, I kept all the same information as is normally in sugarcrm.log with the only change being how it is stored. Since XML is structured it made sense to structure the logged information accordingly. So, without further ado, here is the code for the SugarXMLLogger…

The SugarXMLLogger Class

<?php
/** 
 * Save to custom/include/SugarLogger/SugarXMLLogger.php
 * 
 * Usage: 
 * To make one particular log level write to the XML log do this:
 * ```php
 * <?php
 * LoggerManager::setLogger('fatal', 'SugarXMLLogger');
 * $GLOBALS['log']->fatal('Testing out the XML logger');
 * ```
 * 
 * To make all levels log to the XML log, do this
 * ```php
 * <?php
 * LoggerManager::setLogger('default', 'SugarXMLLogger');
 * $GLOBALS['log']->warn('Testing out the XML logger');
 * ```
 */
 
/**
 * Get the interface that this logger should implement
 */
require_once 'include/SugarLogger/LoggerTemplate.php';
 
/**
 * SugarXMLLogger - A very simple logger that will save log entries into an XML
 * log file
 */
class SugarXMLLogger implements LoggerTemplate
{
    /**
     * The name of the log file
     * 
     * @var string
     */
    protected $logfile = 'sugarcrm.log.xml';
 
    /**
     * The format for the timestamp entry of the log
     * 
     * @var string
     */
    protected $dateFormat = '%c';
 
    /**
     * The current SimpleXMLElement logger resource
     * 
     * @var SimpleXMLElement
     */
    protected $currentData;
 
    /**
     * Logs an entry to the XML log
     * 
     * @param string $level The log level being logged
     * @param array $message The message to log
     * @return boolean True if the log was saved
     */
    public function log($level, $message)
    {
        // Get the current log XML
        $this->setCurrentLog();
 
        // Append to it
        $this->appendToLog($level, $message);
 
        // Save it
        return $this->saveLog();
    }
 
    /**
     * Saves the log file
     * 
     * @return boolean True if the save was successful
     */
    protected function saveLog()
    {
        $write = $this->currentData->asXML();
        return sugar_file_put_contents_atomic($this->logfile, $write);
    }
 
    /**
     * Sets the SimpleXMLElement log object
     * 
     * If there is an existing log, it will consume it. Otherwise it will create
     * a SimpleXMLElement object from a default construct.
     */
    protected function setCurrentLog()
    {
        if (file_exists($this->logfile)) {
            $this->currentData = simplexml_load_file($this->logfile);
        } else {
            sugar_touch($this->logfile);
            $this->currentData = simplexml_load_string("<?xml version='1.0' standalone='yes'?><entries></entries>");
        }
    }
 
    /**
     * Adds an entry of level $level to the log, with message $message
     * 
     * @param string $level The log level being logged
     * @param array $message The message to log
     */
    protected function appendToLog($level, $message)
    {
        // Set some basics needed for every entry, starting with the current
        // user id
        $userID = $this->getUserID();
 
        // Get the process id
        $pid = getmypid();
 
        // Get the message to log
        $message = $this->getMessage($message);
 
        // Set the timestamp
        $timestamp = strftime($this->dateFormat);
 
        // Add it to the data now
        $newEntry = $this->currentData->addChild('entry');
        $newEntry->addChild('timestamp', $timestamp);
        $newEntry->addChild('pid', $pid);
        $newEntry->addChild('userid', $userID);
        $newEntry->addChild('level', $level);
        $newEntry->addChild('message', $message);
    }
 
    /**
     * Gets the user id for the current user, or '-none-' if the current user ID
     * is not attainable
     * 
     * @return string The ID of the current user
     */
    protected function getUserID()
    {
        if (!empty($GLOBALS['current_user']->id)) {
            return $GLOBALS['current_user']->id;
        } 
 
        return '-none-';
    }
 
    /**
     * Gets the message in a loggable format
     * 
     * @param mixed $message The message to log, as a string or an array
     * @return string The message to log, as a string
     */
    protected function getMessage($message)
    {
        if (is_array($message) && count($message) == 1) {
            $message = array_shift($message);
        }
 
        // change to a human-readable array output if it's any other array
        if (is_array($message)) {
            $message = print_r($message,true);
        }
 
        return $message;
    }
}

The structure of the log

<?xml version="1.0" standalone="yes"?>
<entries>
    <entry>
        <timestamp>Wed Oct  8 11:56:04 2014</timestamp>
        <pid>89160</pid>
        <userid>1</userid>
        <level>fatal</level>
        <message>Testing out the XML logger</message>
    </entry>
</entries>

How to log only fatal logs to the XML log

<?php
LoggerManager::setLogger('fatal', 'SugarXMLLogger');
$GLOBALS['log']->fatal('Testing out the XML logger');
?>

How to log all logs to the XML log

<?php
LoggerManager::setLogger('default', 'SugarXMLLogger');
$GLOBALS['log']->warn('Testing out the XML logger');
Back to top

Speak well of your ex for your kids’ sake

Posted on June 29th, 2014 in For the ladies,For the men,On Relationships | No Comments »

Speak well of your ex... your kids need that from you.I saw this image posted on Facebook a few weeks ago and in the last few days I was reminded of it. In recent months I have encountered a few situations in which an ex, or soon-to-be-ex, was talking either to their children or around their children about the child’s other parent. In most cases when this happens the parent is respectful and mature enough to not bad mouth their ex or, short of that, they are at least somewhat strategic in the words they use or how they deliver their thoughts. I think this is important because defaming your kids’ other parent is both vicious and damaging, and will ultimately end up harming the kid’s relationship with their other parent.

While I think it’s important to treat everyone with respect, I think it is especially important to treat the parent(s) of your kids with respect, even if you have to struggle through doing it. And along with treating your ex with respect, I personally think it is equally imperative that you speak respectfully of your ex in the presence of your kids. I know you might not have any ounce of respect for your ex. And I know that your ex may have hurt you beyond imagination and because of that you can’t muster even the slightest positive thing to say about him/her. But that doesn’t give you license to harm your kid’s relationship with your ex.

If your kids are within earshot please have the courtesy to speak well of your ex or, at the very least, not speak of your ex at that time. If something happens to come on in a TV show or a movie that reminds you of your ex’s shenanigans, keep that to yourself for a bit. And if your kids have the unction to ask you about why you and your ex are no longer together, it’s ok to be vague to a degree. Saying things like “your mom liked other men more than she liked me” or “your dad is emotionally abusive and detached” might make you feel vindicated in the moment but can cause all sorts of confusion in your kid. There is nothing wrong with saying something like “we just couldn’t make it work and to make things as good as we could for you, we decided to split”. There can be a deeper discussion about that later, or even at that moment, without going into specifics. But at that moment the best thing you could do is protect your children and their relationship with your ex.

Now please understand that I am not saying that you need to lie to your kids, or that you need to keep them in the dark forever. But when they are still kids, or are not yet capable of completely digesting your anger toward, or hatred of, your ex, I personally believe it is best to shield them from potential harm to their relationship with your co-parent. It pains me when I hear people talking smack about their ex without even considering the words coming out of their mouths.

Back to top

A boy insulting another boy is not the end of the world

Posted on June 4th, 2014 in For the ladies,For the men,On Fatherhood,On Manhood,On Parenting,Personal Messages | No Comments »

tl;dr Boys are way different than girls and aren’t little meanies because they call another boy a name

Raising a son is hard. And I have to say that raising a son as a single mom or a mom with no help from dad is probably the hardest thing that can be done as a parent today because there are so many societal “norms” that are being applied to young boys that sometimes letting a boy’s natural character out means that he’s in some way a problem child. I am not complaining about raising a son in any way, shape or form. Instead I am saying that raising a son can be challenging, particularly when the natural character of a boy is at odds with what a parent, or society in general, deems appropriate.

The reason I say this is because of an incident I learned about today involving my son. He has had his share of scraps and run-ins this school year, and has been spoken to quite a bit for behavior and behavior related issues. To me, this is to be expected for an eight year old boy. Hell, when I was his age I was doing much of the same stuff he’s doing today. Pretty much every boy in my school was. I think that’s because, in general, boys have a way about them that is unique to boys. We are loud, aggressive, forward, vocal, sometimes condescending, sometimes domineering, sometimes mean and sometimes rude. I am not saying these are all good qualities. I’m just saying, put a group of boys (or men) in a room and in a short amount of time you will see all of these qualities manifest in some capacity among the males in the room.

As boys, we know this. We live this. We expect this from other boys. And because of that, we, as boys, challenge the norms that we are faced with (that is another quality of boys). When we see a boy that might be bigger, stronger, smarter, faster… our inclination is to establish dominance over that boy. We do that in various ways, from hurling insults to competing in sports to physically dominating another boy. And sometimes, as a stronger, smarter, faster boy, we are challenged by another boy trying to establish dominance of his own. Again, this is not only understood among boys, it’s expected. And how we as boys handle these situations begins to identify us among our sphere of influence. This process begins at a very young age and continues for most, if not all, of a man’s life. To understand this concept, observe a group of guys enjoying drinks and talking. How long does it take before one of the guys insults one of his friends, calls him a name or challenges his manhood? How long does it take for a man to establish his own amazingness by telling stories of his work, or how he handled a situation with a coworker, or how he handled something with his kids? It is the way we are with each other.

The incident that my son was involved in went like this… he was playing a game of Mercy with another boy. When the other kid lost, the kid began to whine about it to which my son replied “Stop being a little girl”. Now to those that don’t understand boys, this might come across as rude, condescending or even bullying. To those of us who grew up on the playground, we know this is a way of establishing presence and dominance among our peers. While I am not excusing the conduct of my son, I think it needs to be stated that among boys, games of strength and bravado always come at a cost in that there will inherently be a winner and a loser. In both the winning and the losing, there is a way to conduct yourself that is honorable among other boys. There are also ways to conduct yourself that are less than honorable among boys. So when a boy behaves in a way that is “dishonorable” among the group, it is natural for another boy to call him on that. This happens quite often in regular daily activities of a lot of men (and women, too, but probably not in as pronounced a way as with the guys). Again, I am not saying it is right or wrong, I am merely saying that this is to be expected, particularly among boys.

In the case of my son and his behavior, it is easy to look at him and say he was being mean or bullying the other boy. Personally, I think that’s a load of crap. Bullying, to me, would be something like my son seeing another boy, that he isn’t close with, wearing a pink shirt or sporting long hair and, out of nowhere, approaching him with a “What are you, a girl?”. To me, that is not only bullying but completely unacceptable behavior. It is unwarranted, unmerited and totally inappropriate. But in the case of two boys playing a game of strength and one boy losing then whining about it, to be derided for it in some way, to me, is not bullying. It is playground politics. It’s the same playground politics that say if we’re playing dodgeball and I know you can’t catch, you’re the target I’m throwing at. It’s the same playground politics that say if we’re playing tag and you’re the slow kid, you’re getting tagged first. And it is also the same politics that say if you’ve handled being the slow kid, getting tagged and not being able to get out of it while still being cool about it, you’re probably gonna end up being tight with a couple of dudes that will make sure you are never tagged.

Now moms, this is for you: boys and girls are different in many, many ways. How we feel things is different. How we respond is different. But trying to make your boy understand things from a girl’s perspective – or even YOUR perspective – will more than likely not work most of the time. While your boy may nod at you and say “yes momma, I understand”, the chances of it sticking with him are pretty slim. This is because you can never really take the character out of the boy. You can punish it, discipline it… even make him feel bad for it. But ultimately his character will continue to shine through – good or bad – and he will do what he will naturally do. If you are a single mom raising a son, or if your son’s dad isn’t as involved as he should be, please know that your best bet as his parent is to lead, coach and teach your son how to manage his boyness. Don’t condemn him for being what he naturally is. Don’t try to stifle his character or shut it down, but instead find creative ways to let that character of his flourish. No, that isn’t easy, but it is much less frustrating and much less likely to cause resentment from him later on life.

Back to top

The More Loving One

Posted on December 3rd, 2013 in Personal Messages,Poetry | No Comments »

From my earliest infatuation with poetry, the works of Wyston Hugh Auden have been my very favorite. While he was known for many great and artistic pieces of poetic literature, a select few of his poems have stood out to me immediately upon reading. I’ve said it before, if a piece of art makes me feel, makes me think, it will more than likely end up on my list of favorite things.

The poem The More Loving One is one of those works of art. It is a short, poignant poem about love or the lack of love returned, perhaps even an altogether indifferent response to a love declared. I won’t go into much more than that. But I will leave it here for you to enjoy.

Looking up at the stars, I know quite well
That, for all they care, I can go to hell,
But on earth indifference is the least
We have to dread from man or beast.

How should we like it were stars to burn
With a passion for us we could not return?
If equal affection cannot be,
Let the more loving one be me.

Admirer as I think I am
Of stars that do not give a damn,
I cannot, now I see them, say
I missed one terribly all day.

Were all stars to disappear or die,
I should learn to look at an empty sky
And feel its total dark sublime,
Though this might take me a little time.

Back to top

Do Not Go Gentle Into That Goodnight

Posted on November 29th, 2013 in Poetry | No Comments »

People that know me from way back when (like, high school kinda way back when) know that I’ve kinda always had a thing for poetry. I love reading it, I love writing it, I love analyzing it and interpreting it. I love when writers can capture a thought, a feeling or an emotion with the written word and convey it in a way that may seem to be one thing when in fact it is many, many things.

I also love poetry that stirs up thought and emotion within me. I have a few favorites that have always sparked me, like Sunday Morning by Wallace Stevens, Musee des Beaux Arts BY W.H. Auden and The Love Song of J. Alfred Profrock by T.S. Eliot. But there has always been one poem that has a different effect on me, one that leaves me throwing shadow punches and chanting “LET’S DO THIS THING!” to myself when I read it. That poem is Do Not Go Gentle Into That Good Night by Dylan Thomas.

This poem was written for his dying father and is in an uncommon format known as a villanelle. It screams of the final admonition of a son that will be losing his father shortly, an admonition in which he charges his father to not just accept the fate that is before him. It is a coming to grips with the inevitable, a catharsis if you will, in the life of a son that knows what is just around the corner for his father yet wants his father to fight on nonetheless.

I’m certain that when you read this you will understand what he is experiencing. And perhaps after you read it you’ll understand what it is that gets me so fired up when I read it.

Do Not Go Gentle Into That Good Night

Do not go gentle into that good night,
Old age should burn and rave at close of day;
Rage, rage against the dying of the light.

Though wise men at their end know dark is right,
Because their words had forked no lightning they
Do not go gentle into that good night.

Good men, the last wave by, crying how bright
Their frail deeds might have danced in a green bay,
Rage, rage against the dying of the light.

Wild men who caught and sang the sun in flight,
And learn, too late, they grieved it on its way,
Do not go gentle into that good night.

Grave men, near death, who see with blinding sight
Blind eyes could blaze like meteors and be gay,
Rage, rage against the dying of the light.

And you, my father, there on the sad height,
Curse, bless, me now with your fierce tears, I pray.
Do not go gentle into that good night.
Rage, rage against the dying of the light.

Back to top

Being thankful on Thanksgiving

Posted on November 28th, 2013 in Personal Messages | No Comments »

After a very quiet few years on this blog I’ve felt compelled to write again. I go through times where writing isn’t even a faint blip on the radar of my life. I also go through times where writing is my escape, my way of looking beyond where I am into a place where perhaps I’d rather be. And then I go through time where I want to write but can’t muster up the words I need to convey the reason behind my desire to write. Regardless, today is one of those days where I feel the desire to write so I shall let the words flow.

Thanksgiving is one of those holidays that, to me, really shouldn’t be a single day in the year as much as it should be a lifestyle. In any given day I have an abundance of reasons to be thankful, as most everyone is, yet I don’t bring attention to either the reason or the thanks that I have for it. What makes a single day so special that suddenly all of the things that I have been thankful for all year long are now all of a sudden worthy of finally receiving those thanks? Seems to me that there is something wrong with that. Of course I am talking about myself here, so please don’t take these words to be some form of judgment cast upon you or any of that. I’m just trying to resolve some of the thoughts I have had the past weeks leading up to today. Thoughts like “If the people in your life you loved the most were gone tomorrow, would they know today how thankful you are for them?”. Or thoughts like “When you are called to do a task, as much as you don’t want to do the task, are you thankful that you are breathing, have strength, can walk and move freely, and are well able to perform the task?”

While some of us are thankful for the tangible “things” in our lives – iPods and cars and large TVs and big, comfy houses – I believe there are others that are thankful for the much smaller, and to many, more insignificant, of things. Things like a warm jacket on a cold night or a bite to eat that fills a painfully empty stomach or a visit from a child that hasn’t been seen for months. As I look on the abundance that I take for granted every day I feel like I am kinda missing the mark on Thanksgiving, like perhaps my focus is off or I am simply looking at the wrong things. While I am thankful that I have an awesome job I get to go to everyday, driving my newer model car to the office listening to the music on my iPhone along the way, there are people that are thankful today that they have shoes. Just shoes. Maybe not even newer shoes. Just shoes.

So on this day of giving thanks I hope that I can maintain perspective. Don’t get me wrong, please. I do NOT apologize for doing well for myself or my family. I am thankful that I have been blessed with a provider mentality and that I CAN provide nicely for my loved ones. No, the perspective I am hoping for stems beyond that, to the core of my family and, more importantly, to the core of my life. When I sit around the dinner table tonight I will definitely be thankful for the abundant supply of food and drink before me. But my greater thanks will be for the family that sits before me.

I will be thankful for my daughters and my son, who daily show me many reasons for being thankful. I will be thankful to their mother, who has shown me so much more than I could have ever expected about relationship, parenting, love, patience and diligence. And I will likewise be thankful to her family for opening their home to my family and for always being so welcoming and inviting.

I will also be thankful for my parents – God rest their souls – for raising me to be the man that I am today while I was still yet young. And I will be thankful for my brother and sister who, when my father and then later my mother went to be with God, took up the reigns without needing to be asked to see to it that I would one day become the man that I was destined to be.

I will be thankful for my many long standing friends that have shown me recently what true friendship is all about over the long haul. And I will be thankful for my new friends that have so filled my life with love and warmth in recent years.

I will be thankful for memories of Thanksgivings past, of times spent roughhousing with my cousins at nine o’clock in the evening in a muddy front yard and of times spent trying to get the kids ready to go to two different houses in four hours on a cold afternoon.

I will be thankful for the years to come, the days to come, in which more memories will be made, more time will be spent and more love will be shown. I will be thankful for the future as well as the present, and for the past that it may ever move me forward to better things.

Today, and every day, I will remember the reasons to give thanks and I will give thanks for them. Not because it is Thanksgiving. No, I will give thanks simply because I am thankful.

Back to top

Negative number PHP array indexes, var_export and WTF

Posted on January 17th, 2013 in LAMP,PHP,Programming | No Comments »

Those folks that know me in the programming, web development or technology context know that I am a PHP fanboi to the nth degree. I eat, sleep, breath and live PHP. It is my very favorite programming language and it is the language that I learned how to program in. I stand behind it and have defended it – often – against the attacks of many a strict-type-language zealot from the world of .NET or Java or even Ruby. Seriously, I love PHP with all of $my <3;

However, these same people that know my insane and indescribable love for "my" language also know that I am usually very fast to point out some of it's major stupidities and illogical implementations. Which comes first, the $haystack or the $needle? Is it a str_* function or a str* function? Are the array function args passed by reference or am I expected to handle a return? There are so many of these little issues with PHP that sometimes I, myself, have no choice but to ask... WTF?

Today is one of those days. I am working on a bug for work in which the number -99 is somehow magically being transformed into -9223372036854775808 and is causing significant problems for our application. In doing some trouble shooting, I discovered that, as part of our process of caching some information, we use the var_export() function to write out an array to a file and somewhere between the passing of the data to var_export and the file that the exported data is written to, the -99, when used as an array index, suddenly became 18446744073709551517. This did not happen when -99 was the value of a scalar variable nor when it was a value assigned to an object property.

Looking a little closer I found that this particular server was running PHP 5.2.17 on CentOS, so I decided to dig even deeper and try this on other versions of PHP. On my 5.3.6 version of PHP on my Mac I could not reproduce the issue. But I was able to reproduce it on 5.2.17 on my Mac. My colleague was likewise able to reproduce it on 5.2.10 on his Ubuntu installation. And I was able to reproduce it on several PHP versions using 3v4l.org.

I'm not exactly sure what is going on under the hood, but my suspicion is that because PHP does not support unsigned integers it needs to convert the signed int -99 to an unsigned value in order to store it in the symbol table. I suspect when var_export is called, this unsigned value is being returned rather than the signed value. At the very least, this is an issue that will more than likely never be corrected since PHP 5.2 is now out of date and this problem, as far as I can tell, does not expose itself in 5.3 save for 5.3.3.

Regardless, if you want to see this for yourself and you have a 5.2 build laying around somewhere (or a 5.3.3 build), give this little snippet a shot and see what you get:

<?php
for ($i = 10; $i > -101; $i--) {
    echo "$i...\n";
    $q = array($i => 'this');
    var_export($q);
    echo "\n";
}

Or, if you just want to see it without a bunch of output, try this:

<?php
$a[-99] = 'bilk';
var_export($a);

As an added bonus, take the broken translated value and use that as an array index, then var_export that. You might pleasantly surprised by what you see I'd bet.

All of this is to say, if you are still using PHP 5.2 - and let's be honest, who is really using PHP 5.2 any more aside from those that have it on a test server - and you are using var_export on an array with signed int indexes, you are probably not going to get what you expect out of it. You have been warned.

Also? WTF PHP?

Back to top

Bidding farewell to 2012

Posted on December 31st, 2012 in Personal Messages | 1 Comment »

It seems to be a common thing for me, at New Years, to write a post about the year that is being put to rest and/or about the year that is about to be birthed by the changing of the clock at midnight. I’ve recently read posts I’ve written from the end of 2005, the beginning of 2008, the end of 2008, the end of 2009, the beginning of 2011 and the beginning of 2012 and I have to say it is fascinating to look back on the last few years and see where the year end had brought me.

Tonight I am looking back over 2012 as I sit in my family room listening to my daughter Sarah play the piano. The rest of my family is in the living room watching TV, playing on their iPhones or fiddling with a 3DS. It is a relatively quiet night in the Gonzalez house, and it is a perfect night to reminisce.

There were some things that happened in our family in 2012. They weren’t necessarily earth shattering events, but they have had a definite impact on the landscape of the Gonzalez house and the Gonzalez family in general. Of course, there were many events that took place in 2012 that I could be talking about, but the following seemed to be the most prominent in my mind as I write

  • I got a new job – Starting in the second week of January I went to work for SugarCRM as a software engineer. This could very well be the single most significant job change I have ever made in my life simply because of how much I love the company I work for, the work that I do and the people that I do it with. I have never been so happy in my work as I have been the last year being a “Suga” and I am so looking forward to what 2013 has in store for me personally as well as for my company.
  • We added a new member to our family – In June of this year we brought home Molly, our little shitmaker/noisemaker/smilemaker of a dog. She has been a wonderful addition to our family – as much as I might not like to admit it – simply by the energy and love she brings to our household. She is an amazing playmate for Rico, she is a great little watchdog and she is full of excitement and adoration for everyone in the house. Our home is definitely warmer because of her.
  • We added some boys to our family – Yes, my oldest daughters were officially given the go ahead to call their close male friends “boyfriends”. Both Sarah and Rebekah developed very strong relationships with their significant others and both of these boys have found a place in our family. They are very respectful (and only slightly fearful of me – but it’s a healthy fear) and very courteous to both Sandi and I. They are fun to have around and, most importantly, know how to treat my daughters.
  • We took a trip to Oz – My three youngest kids each starred in two separate performances of The Wizard of Oz over the summer. This is the second summer they have performed in a kids theater production and this year they decided to participate in TWO productions that ran back to back weekends. In one production, AJ stole the show as the Cowardly Lion and in the other show, Adriannah did. All three kids performed their hearts out and had fun doing it, and in turn, I enjoyed working my tail off to make sure they had the summer of their lives in theater.
  • iGot bit by iPhones – Well, the kids did anyway. Adriannah earned enough money for her birthday this year to be able to buy herself her own iPhone, and with the upgrades available, Bekah got her upgraded iPhone as well. In all, we now have four iPhones in our household and as you can imagine, with the propensity for theatrics that this family possesses, it didn’t take long for videos and pictures to start creeping up highlighting just how creative the kids are, even with something as tiny as an iPhone camera. Sarah started her own YouTube channel and Adriannah began recording these amazing videos using an app called Video Star. You will be seeing some of those in the coming months I assure you.
  • I got a new car – I had to. It was time. My Vibe died on me for the last time and, although I did not want to do it, I bit the bullet and decided to pony up for a new ride. So in August I purchased a brand new Mazda3 Touring sedan and I gotta say, I kinda love that car. The gas mileage is insane, the look and feel is very nice and the kids fit in it when I take them to school. As much as I did not want to buy a new car, I am very happy with my car and with Tony Roberts and Dublin Mazda for making that deal one of the best transactions I’ve ever had, let alone for buying a car. If you are in the East Bay Area and are in need of a car and are looking for a smooth transaction, go talk to Tony Roberts at Ken Harvey’s Dublin Mazda. My experience was so good, I actually Yelped them. :)
  • Obama won the presidential election – Much like 2008 when Obama won the presidency, there was much talk of politics, policy and government in my house for a number of months leading up to Super Tuesday. As just as I was devastated in 2008 by his victory, so again was I disappointed in the choice our country made for president. However, what’s done is done and though there is still much talk about politics and governments – and just as much snark and whining from both of the major political parties and their followers – I am happy that the election once again brought about discussion within my family. Regardless of your political bent, when parents and children can come together to talk politics and, in some cases even debate politics, it is a good thing. I learned stuff about my kids I didn’t know. I learned some of their political viewpoints are divergent from mine (which I am totally fine with) and in some cases, they are more extreme in their views than I am. I learned that regardless of political viewpoint, friendships must necessarily extend beyond these viewpoints. And I learned that Facebook is a treasure trove of extremists from all walks of life that love to spew their political venom far and wide. Still, if there is nothing else that I will take away from this election, I can say that my kids were once again very informed, very involved and very interested in the election process and the election results.
  • Violence took it’s toll on the United States – While the most prominent incident of the year in the United Stated was the massacre at Sandy Hook Elementary School, there were undoubtedly many more killings in the United States. But one thing that the Sandy Hook incident seemed to do above anything else was bring attention to guns. My heart goes out to the kids and teachers that were senselessly gunned down by a disturbed idiot that was hellbent on killing innocent people. Equally, my heart goes out to the thousands of other victims of violence – both gun related and not gun related – because their story should be heard as well. As saddened as I am by the violence in our country, I am now ever vigilant of the safety of my household and my family. Being aware is the first step toward actively protecting a family in my opinion and with that, the knowledge that guns – even assault weapons – do not somehow spontaneously sprout an evil conscience and decide to start killing people. I’ve been appalled at the apparent lack of regard for the second amendment by many highly visible members of our state and federal governments and hope that, like the discussions that took place in our household after Sandy Hook, there will be a long, open discourse on the proper actions to take to curb violence in our country. And I pray to God it doesn’t involve rewriting our constitution to further the police state in which we live. Regardless, my family was brought together by the tragedies that unfolded over the course of the year, and many talks were had to discuss just what is at the root of all of this. So even in the midst of tragedy and evil, my family came together and was strengthened.

There were many other notable events of 2012, including a Mayan Apocalypse that never came to pass, the San Francisco 49ers almost making it to the Super Bowl while I was there to witness it and the San Francisco Giants winning the World Series for the second time in three years. There was a retirement of a space shuttle. There was Felix Baumgartner sky diving from outer space. There was the Grumpy Cat. There was the massive response to FunnyJunk’s and Charles Carreon’s lawsuit against Matthew Inman from the Oatmeal. There was just so much stuff in 2012.

Alas, it is time that I wrap it up, lest I go on and on about all that 2012 brought to the table. But as I leave you with this, my final post for 2012, I would like to reach back to 2009, when Sarah penned this little New Years poem and I’d like to offer up this simple blessing to you and yours: May your 2013 be orders of magnitude more amazing than your 2012 and may you be showered with favor, fortune, blessing and abundance. Happy New Year.

On the day of New Year’s Eve
The world is sitting, waiting
For the day we all believe
Has cause for celebrating.

Staying up till late at night
Watching on TV
Down pole to drop a ball of light
And then we scream, “Yippee!”

Another year is o’er and done
And we are satisfied
Recalling days of mirth and fun
And fear, and hope, and pride.

Another year has started up
A new age will begin
We drink from a newer cup
And cast the old to the wind.

– Sarah Gonzalez, 13

Back to top

Why flawed CA Prop 37 should not be passed

Posted on October 15th, 2012 in On Politics,Personal Messages | No Comments »

There has been much talk in the past few months of the upcoming election. And while most talk has centered around who should win our vote for president, there is a growing discussion in my home state of California surrounding a number of proposed measures. Of these, Proposition 37 is one of the more widely debated ballot measures.

At the core of it, the measure appears to seek approval of the people of California to enact a law that will require “labeling on raw or processed food offered for sale to consumers if made from plants or animals with genetic material changed in specified ways” and will also prohibit “labeling or advertising such food, or other processed food, as ‘natural’”. On the surface, this seems like an absolutely wonderful ballot measure, as it will mean that the people of California will finally be able to know which foods they are considering buying or eating that might be genetically modified (GMO) or genetically engineered (GE) while at the same time putting the onus of labeling these foods on the manufacturers and producers of these foods. But as I read the text of the measure, it has become clear to me that the responsibility for labeling seems to lay much closer to the consumer while putting no real accountability at the source of large food manufacturing and the most prominent sources of food distribution.

Prop 37 will put the bulk of the responsibility of the labeling of foods on the retailer of those foods:

Retailers (such as grocery stores) would be primarily responsible for complying with the measure by ensuring that their food products are correctly labeled. Products that are labeled as GE would be in compliance. For each product that is not labeled as GE, a retailer generally must be able to document why that product is exempt from labeling.

Other entities throughout the food supply chain (such as farmers and food manufacturers) may also be responsible for maintaining these records.

Prop 37 will likewise open the door to unsubstantiated lawsuits surrounding the labeling of foods such that someone can in fact bring a suit against the retailer that sells the product in addition to the wholesaler that moves it regardless of whether there was any damage done because of the labeling violation:

Litigation to Enforce the Measure. Violations of the measure could be prosecuted by state, local, or private parties. It allows the court to award these parties all reasonable costs incurred in investigating and prosecuting the action. In addition, the measure specifies that consumers could sue for violations of the measure’s requirements under the state Consumer Legal Remedies Act, which allows consumers to sue without needing to demonstrate that any specific damage occurred as a result of the alleged violation.

Additionally, there are several glaring exemptions allowed in this measure that are troublesome, if not down right confounding:

The measure also excludes certain food products from the above labeling requirements. For example, alcoholic beverages, organic foods, and restaurant food and other prepared foods intended to be eaten immediately would not have to be labeled. Animal products— such as beef or chicken—that were not directly produced through genetic engineering would also be exempted, regardless of whether the animal had been fed GE crops.

This means that beer, wine, spirits and other alcohol drinks will not have to abide by this law. Likewise, restaurants that sell GMO/GE food – restaurants like McDonald’s, Taco Bell, Outback Steakhouse, Chili’s, etc – can still sell GMO/GE food without you ever knowing about it. Additionally, and this is a big one in my opinion, animal products – chicken, beef, pork, eggs, milk, etc – that are not directly GMO/GE but that were fed GMO/GE feed will not have to be labeled as GMO/GE.

I’m of the opinion that, in the end, if this measure passes, all that will end up happening is grocers will up their prices to offset the cost of verifying proper labeling, small producers and farmers will suffer tremendous cost increases in production to either comply with the law or find ways to exploit loopholes and larger producers will have already discovered ways of circumventing this law by way of the many loopholes and exemptions in it. Meanwhile, large prepared food providers will continue to sell GMO/GE food for immediate consumption, the Monsantos of the world will continue to rake in huge profits from their GE foods and food products and will assist the larger food producers in bucking the system while the small farmer is left trying to figure out how they will stay in business.

As bad as I want proper labeling of foods, I just don’t think Prop 37 is the right path to it. It leaves entirely too many ways for the bad guys to win at the expense of the good guys while burdening the grocers that we frequent and not really providing much coverage for the end consumer. It might sound controversial, but there is just no way I can vote for this measure as it is worded. If the exemptions weren’t in place, I’d vote a big fat YES for it. But until that happens, my vote is in favor of keeping the playing field level for small food producers, local farmers and grocers.

References:
Prop 37: Read the Text | Propositions | Elections 2012 | KCET
California Proposition 37, Mandatory Labeling of Genetically Engineered Food (2012) – Ballotpedia
California Secretary of State, Prop 37 (PDF)

Back to top

Why I love working for SugarCRM

Posted on July 11th, 2012 in Geek Stuff,Personal Messages,Work | No Comments »

SugarCRM Chrome Bottle Opener It’s not everyday that a man finds work that he loves. Hell, in today’s economy, a lot of men can’t find work at all, let alone rewarding work that he enjoys. I’m one of the fortunate few who has been very blessed in my career path as it relates to doing work that I enjoy doing, being good at what I do and being able to provide for my family. But I have to say that I have never been quite as happy with my job as I have been since January of this year.

Backstory
In mid-December 2011 I was approached by a recruiter through email. Why I remember this is pretty simple: he didn’t sugar coat his email with a bunch of recruiter mumbo jumbo and buzzwords, nor did he include a job description or any of that. He straight up said he was a headhunter and was looking for a Senior Software Engineer for a well funded, private company in the bay area. After a couple of emails, we setup a time to talk on the phone. That in and of itself is a rare occurrence because I don’t talk to too many recruiters since most bomb out during the email phase. But what made this an especially odd thing was that as we talked, he engaged me very quickly about what I like to do, what I am good at and what I wanted to do with my career. We talked for about a half hour and he asked me if I’d be open to interviewing with his client if he could get me in for an interview. I told him I would be for a couple of reasons, the most prominent being that A) I was looking for work as I wrapped up a short term contract project, and B) the company he was talking about – SugarCRM – was a company I had known about and was interested in for quite some time. This call took place on a Friday. On Saturday he called me to tell me that he had scheduled an interview for me on Monday, December 19 at 2:00 in Cupertino. And from here on begins the real story of why I love working for SugarCRM.

In the beginning
The Monday that I was supposed to interview came around and I hadn’t heard from the recruiter. I thought it was kinda odd but figured that maybe something needed to be hashed out on his end so I went about my business that day. Then, at about 12:30, I got an email from him with the address for SugarCRM and a message saying they were expecting me at 2:00 pm. Since I was still out with the kids I had to hustle home and get myself somewhat presentable for an interview at 2:00 in Cupertino. I did my best, and managed to get some jeans and a golf shirt on before heading out the door. I got to Sugar just before 2:00.

I was given some papers to fill out while I waited for the person that was going to interview me to come get me. Turned out, there were several people that were going to interview me and the first fellow came out pretty quick. As we walked through the halls toward the interview room I began to get a little nervous. But once we sat down and started talking, I had the pleasure of experiencing the funnest interview I had ever been on. I actually interviewed with three different Engineers, all of whom asked me questions that were both challenging but practical. And all of them had a coding exercise that we worked on together to solve. I got a really good vibe from the first three guys but when the fourth person walked in, things changed a little bit. You see, the fourth person was a VP and there really weren’t any technical questions at that point. From there it became more a matter of when I could start and some of the other logistical questions that you might find in the late stages of an interview. And when I left there, just before 5:00, I had an odd sense that it might have gone pretty well. I didn’t know how well until, about 20 minutes later, I got a call from my recruiter telling me they had drafted an offer letter for me.

I started working for SugarCRM on January 9, 2012. My first day at the office was the first day of the 2012 Sales Kickoff week. It was also the first day of an Engineering Sprint featuring a good number of engineers, including all HQ engineers and remote engineers from just about everywhere. It was chaotic to say the least, and the pace in the office that day was absolutely frenetic. In all honesty, I was a little taken aback by it all because I had never been involved in such a large scale engineering effort nor had I ever been part of a large engineering team before. But after spending my first day getting my development environment set up, I was off and running with my first assigned tasks. Looking back on those first few days at work now feels like a big blur because of how fast things went, how much I learned and how many people I met. It was a crazy, fast, amazing week and without a doubt, it was the best first week I’ve ever had at a new gig ever.

Can it really be this good?
Fast forward to today. I’ve been with Sugar for six months now. I’ve learned a lot about our product, our codebase, our engineers, our company and our future plans. I’ve survived the on-boarding process, made it through a couple of team transitions and have made some pretty decent contributions to the application. I’ve made some friends, helped some folks and have essentially become part of the team. But of all the things that the last six months have brought to my life, what stands out to me the most is how much I enjoy going to work everyday.

It might sound strange to hear someone talk about how much they love their job. I know there are a lot of people that are either out of work right now or are working at a job that is killing them slowly. I’m not trying to make anyone jealous, but I am happier in my work now than I have ever been before. And anyone that knows me knows that this is not only a truth but one that I’ve not been able to say for a long, long time.

So what is it about my job that makes it this good? Well, I’ve been thinking about that as I drive to and from work from time to time (one of the many things I love about my job is the ability to work remotely). So I decided that I’d share the love a little bit. I mean, you never know, you might just be an engineer looking for a new place to call home, right? :) So here are just some of the reasons why I absolutely love working for SugarCRM, in no particular order and not necessarily inclusive of all of the reasons I love this place.

  1. What we’re working on
    I’m not sure if everyone knows yet just what CRM is. I know I didn’t until my last job, and even then, it wasn’t nearly as clear to me as it is now. Customer Relationship Management… it sounds like an industry buzzword used by someone trying to sell you something when you read it like that. But when you listen to our founder – Clint Oram – describe his vision of CRM, and what gave him the idea to develop a CRM application to begin with, you’ll see that what we are working on at Sugar is so much more than an application or a buzzword. We are working toward the success of every organization that chooses our software and services. We are working on the notion that if we can help others become successful we in turn can become successful. And the vision that our company has to ensure the continued success of our users floods our entire engineering organization. There’s just something exciting about working toward a goal that is bigger than you.

  2. How we’re working
    If, as an engineer, you’ve never been involved in agile development you are missing out. I had never been involved in true agile development, although I had employed some of the methodologies in previous jobs, so that was a bit of a shock to my system at first. But it happened that I learned to love it pretty early on and have been able to embrace the speed and iterative nature of it. There is also something to be said about accountability, which agile also necessarily involves, and the freedom to engineer in the way that works best for you while taking full credit for your successes and standing behind your mistakes. Yes, I said mistakes. They happen, even (if not especially) in agile environments. And the best part about that is, when things break, no one flies off the handle or starts panicing. You simply engineer your way through it and let your brilliance flow.

  3. Who’s doing the work
    There’s something to be said for working with absolutely brilliant people, especially when those people are really cool and really friendly while being brilliant. I have the pleasure of going to work everyday with some of the smartest, most intelligent, sharpest minds that a company could put together. These folks are from all over the world as well as right here in the United States (some are even in Cupertino ;) ). The engineers that I get to work with are never short of ideas, never slow to offer help, are always thinking of new and challenging ideas, and simply do not even consider that something can’t be done. And it seems that there isn’t a single person in Engineering and Development that doesn’t always have some sort of idea, some knowledge that you never even knew existed or some way of doing something that is totally fresh and new.

    Something else that totally amazes me everyday are some of the names within the PHP community that I get to work with. I know that distilling things down to PHP seems a little concrete in nature, but anyone that knows me knows that I am a PHP fanboi to the core. It’s the language I learned on and the language that has led to the career that I enjoy. So for me, getting to mix it up with some of the more well known names in the PHP world on a daily basis is kind of amazing. I won’t spill the beans on these people are out of respect for their privacy, but if you are as in love with the PHP language as I am, then you’d love working here.

  4. What we’re working with
    As much a fanboi as I am of PHP, I am more a fan of doing things the right way and the best way possible. To that end, PHP is NOT the end all, be all of technologies even if it is the core technology of the product we ship. And that right there is another thing I love about Sugar. We use tools from a mixed bag of technologies. We use Ruby applications, Python applications, Java applications… we use different databases, different environments and different platforms. There isn’t anything that is really off limits when it comes to making our jobs more efficient and more effective. And this appeals to me greatly because that means that whatever is the best tool for the job, that’s the tool we get to use, even if we don’t know it that well or it isn’t the same platform as our product is.

  5. Freedom to be creative
    I’m pretty sure that of all the cool qualities of working at Sugar this one right here is the one that speaks the loudest to me. Never before have I been a part of an organization that literally puts you in the driver’s seat. When you’re given a task, you own it. What you build, you stand behind. It’s yours. And whatever it takes to allow you to be able to produce something worthy of putting your name on it, you’re allowed. Need snacks, coffee, red bull or chips? Done. Need beer? Done. Need leather couches to kick back on while you code? Done. Need to take a break and school an intern on what ping pong is really about? Done. Or perhaps you’re feeling like working in the office isn’t the best way to get things done for the day. Perhaps you want to work at a local coffee shop or even work at home. Well, guess what? You can do that to. You are literally put in command of your own destiny and given whatever tools you need to be a successful engineer.

    I don’t think I’ve ever been as productive in my work, and in as enjoyable a fashion, as I have been while at Sugar. For me, there hasn’t really been a way to not be productive because whatever makes me the best programmer I can be for that day is offered to me.

  6. The learning never ends
    Not a week goes by that I don’t learn something new from someone. The experience that our engineers have, the curiosity that we all have, the development we are all doing leads us down a path of continued learning that can only make us better as we progress toward our goals. I mean, just in the last four weeks alone, I’ve learned more about Javascript than I think I had ever known before, I’ve learned about PHPUnit data providers place in the call stack and I’ve learned about Git submodules. In the weeks and months prior I’ve learned about some oddities in the way that Google manipulates email headers when being sent through their SMTP gateway when using credentials that don’t match the sender information, I’ve learned about licensing variations and I’ve learned how to automate some common development tasks by creating macros in my IDE. I am always learning, and at the same time, I am teaching. Which allows our entire team of engineers to continue to sharpen our skills while helping other engineers sharpen theirs.

Wrapping it up
I know it sounds a lot like I’m doting on my company. The truth is, I am. I am quite literally happier in my work now than I have ever been before. I feel a sense of purpose, a sense of determination and a sense of pride in doing what I do. I feel like there is a much bigger effort at play and that, while my contribution to that effort might be small, it is still significant. And even though I’ve laid down probably 2,500 words to describe why I feel this way, those words still fail to capture the essence of why every software engineer should have the experience of working at SugarCRM.

To that end, let me say that I am so not ashamed to plug the employment opportunities at Sugar right now. We are growing so fast right now that, even though we are bringing new engineers in regularly, we are still looking for top level talent. So if you’re looking for a change in your career, and you are stellar software engineer, you really should give us a look. Making that choice has been one of the best things I’ve ever done in my life.

FULL DISCLOSURE NOTICE: The links to the open positions at SugarCRM that I’ve added to this post contains information that will associate your click through and subsequent interest in SugarCRM jobs to me. It is yet another perk of the job, getting bonuses for bringing new talent on board. If this troubles you feel free to hit the SugarCRM careers page directly. Just know that if you do that, Cthulhu will invade your sleep and eat all the kittens that you dream about nightly. Ok, that probably won’t happen, but if it does, you can’t say I didn’t warn you.

Back to top