April 1st, 2008
I’m not sure how everyone else is using Zend_Layout, but I’m doing the following to render my navigation and footer links. It’s not the most DRY code, but works until I learn more about the framework.
In my Action file, I add actions to the stack for nav, footer, Read the rest of this entry »
Posted in Technical Musings | No Comments »
April 1st, 2008
Someone asked how I get a db connection in my models using ZF1.5.1
Basically I have a ConfigDB singleton pattern that gets one db connection, then sets the default adapter so when I extend the Zend_DB_Table_Abstract class, the default connection gets carried around.
class ConfigDB {
static private $instance;
private function __construct() {
}
public static function getInstance() {
if (!ConfigDB::$instance) {
$params = array(
/* redacted */
);
ConfigDB::$instance = Zend_Db::factory('Mysqli', $params);
Zend_Db_Table_Abstract::setDefaultAdapter(ConfigDB::$instance);
}
return ConfigDB::$instance;
}
public static function selectDb($db) {
return ConfigDB::$instance->getConnection()->select_db($db);
}
}
ConfigDB::getInstance();
That grabs the connection and sets the default adapter. So in my model class I can do:
class Country extends Zend_Db_Table_Abstract {
protected $_name = 'countries';
protected $_primary = 'country_id';
function __construct($country = 1, $abbr = '')
{
parent::__construct();
}
}
That’s it
Posted in Technical Musings | 1 Comment »
February 28th, 2008
I’ve finally gotten the time to put up pictures of our newest addition, Kaylan. She arrived Feb. 25th at 9:36AM weighing in just under 8 lbs and measuring 19 inches long. A little bit under her sister Audrey’s weight and length, Kaylan came out very angry and hungry. You see, we interrupted her beauty sleep and she wasn’t quite ready to meet us yet. Mommy Yun is doing very well. This time we skipped the long labor part and went with a scheduled C-section so Mom is recovering much faster. They were doing some pain study at Stanford Hospital so Mommy had a local anesthetic delivery system for the incision. This reduced the pain quite a bit for the 2 days it was in and if your insurance pays for it, I’d highly recommend it. It reduces the side effects of pain pills and IV injections because the medication is delivered straight to the surgery site.
Kaylan is getting in a regular schedule now of crying every two hours, being fed, then sleeping until the next cycle. Great things come in small packages, unless of course it comes in a disposable diaper. Once you get used to the lack of sleep and the fatigue, babies are truly wonderful. Every little tot is a gift to be treasured. Their smiles, cries, and every little movement is something to be remembered. They are growing every day and the challenges of parenting change along with them. Mommy and I are both looking forward to helping our little bit of heaven grow into a beautiful little angel.
-Mom and Dad
Posted in Baby News | 2 Comments »
November 16th, 2007
I’ve been tasked recently with investigating business intelligence tools for our company. Every business has metrics and trends that they need to keep a good pulse on. Sometimes the things to measure are easy to define, and sometimes no one knows what they are looking for.
There are plenty of offerings out there. Most notably MicroStrategies, Oracle, SAP, and more. Of course most of the ones I just listed are simply not cost feasible for a small company to explore. To pay to play, it’s easy to lay out over $100K just to get something basic. Of course my budget was much much smaller than that so my boss pointed me towards an open source project called Pentaho and I have been steeped in it for the past month.
The documentation for Pentaho is pretty comprehensive if you are educated in the technologies involved. But for me, I had to get familiar with quite a few things before getting to do something useful.
Over the next few weeks, I will post up progress and some small tutorials to help someone new get started with the world of Pentaho.
Posted in Business Intelligence | No Comments »
August 2nd, 2007
It’s been more than 2 years since the number game sudoku started spreading internationally. During that time, it has popped up in many daily publications and numerous websites have created their own dedications to the game. A subset of latin squares (or magic squares), it is logic based and purports to help sharpen one’s mind. Nintendo has used it (very successfully) to market their DS game platform [B000EGELP0]. Palm also has multiple publishers of sudoku games. My question is “How long will people play Sudoku?”
When I first found the game, it was Websudoku.com that provided an easy and addictive introduction to the game. I spent numerous free hours trying to improve my solving skills. However, after writing a javascript sudoku solver in 2006, I’ve found that only very occasionally will I even think about it anymore. Is this common? How many of you are/were addicted to sudoku?
Seems like I can’t even goto the grocery store anymore without having sudoku puzzle books taking up valuable checkout line shelf space. Unlike crossword puzzles, sudoku does not expand your vocabulary. It also doesn’t help with making word associations and re-enforce current events. Is it just the biggest productivity sapper ever created?
Well, for me anyway, it’s helped me polish up some javascript coding. I recently finished revamping my solver to allow actual game play. Still needs some more TLC and some sticky features, but some features are fairly unique to the online sudoku games. For instance, my implementation allows you to take a snapshot of your work so you can go back if it gets hopelessly messy. I should allow you to save the progress and come back, but that’s for a future release. My best Sudoku puzzle game can be found at http://www.numbercrazy.com/.
Posted in General Posts | 1 Comment »
June 25th, 2007
This is a follow-up post to my last post Microsoft is desperate. After writing up a quick Anagram solver for Chicktionary, I’ve fixed up the script to handle some other games as well. Now the new GreaseMonkey script can help with Flexicon, Clink, CrossWire and Dingbats. To get the most out of them (for Club Live), you should
Read the rest of this entry »
Posted in General Posts | 100 Comments »
June 13th, 2007
While reading the business news on NYTimes today I noticed an appealing ad for an anagram game at Microsoft’s new club.live.com offering. After clicking over and playing their little game, I realized that they are trying to artificially boost their search volume. Most of the games are somewhat intellectual and requires some searching to come up with answers, this is fine and all, but the game Chicktionary fires off a search for every word attempt. This and the fact that they are awarding ‘points’ for the play seems to point at a desperate grab by MS to increase their daily search volume. The implied value of their points is rather high, you can get a Xbox 360 game machine for 35,000 points. Seems to peg 100 points at over $1. Games award between 10 to 20 points from what I have seen so far.
They must have just launched this because I played 1 game of Clink and actually made their high score list! Seems like the existing scores are all random inserts.
I wonder how long before this hits the news? You can find more at Microsoft is Desperate
Posted in General Posts | 2 Comments »
June 11th, 2007
Monkey See. I was poking around Flickr recently and was amazed at the amount of ‘Interesting Photos’ that users have tagged. Some of the sunsets and scenery photos are absolutely stunning. Naturally, I wanted to fetch and use it as my desktop background. However, (understandably) Flickr doesn’t like people downloading (or referring directly to the images) so they have gone to some lengths to obfuscate and hide the actual image url. If you try to right-click and copy image source, you get an annoying little image called spaceball.gif. How does Monkey get around this?
Monkey Do. Having recently downloaded and installed the GreaseMonkey plugin for FireFox, I searched and couldn’t find a suitable userscript to handle the situation. Being the obsessive type, I went ahead and wrote two quick scripts to help me get at the actual image urls. One, ‘Flickr Img Src Exposer‘, exposes the image url on an individual photo. It adds a link ‘IMG LINK’ underneath the image allowing for easy copying. The second script, ‘Flickr Download Links‘, works when you are exploring the last 7 days’ interesting photos. I got tired of clicking on each photo and then saving the image, so I put a ‘LINK’ under each photo in the page. Clicking on the link takes you to a gallery of all the available image sizes. You can click on the download link to get the image downloaded or copy the images source from the image displayed. The largest size may not be available and you’ll find out if so after clicking on it. I chose not to display the largest image size to save Flickr some bandwidth.
Monkey no get spaceball.gif. This has proved somewhat useful for me and I thought I’d share it with others. You can find the scripts on ‘http://userscripts.org‘.
Posted in Technical Musings | No Comments »
October 5th, 2006
In this crazy world, we want everything now. I want my coffee now! I want my Yahoo Videos now! But, sometimes, the end result is well worth the wait.
After going past our due date of Sept. 30th and visiting the doc, an induction date of Oct. 5th was set, due to Audrey’s large head circumference. At midnight, Audrey pre-empted our scheduled morning call and sent Yun into labor. After waking me (Huey) up a few times, Yun got up at 1:05 to walk around. Still half asleep and somewhat disbelieving Yun, I vaguely remembered to tell her to grab a towel in case her water broke. At this point, contractions were irregular and about 10 minutes apart. Deciding that perhaps she was in false labor, Yun laid down around 1:25 and almost immediately went into another contraction. Breaking her water on this contraction, I rapidly became alert and started looking for the phone. We had been waiting for this baby for the past 3 weeks (Not counting the whole pregnancy of course) and I was ready to meet her. Calling the doctors office gave me an answering service. After letting them know the situation, I was told the on-call doctor would be paged. After what seemed like an eternity, we got the call from the on-call and we were told to head for the delivery room.
Half expecting a relative quick delivery, with the wife having been at 2-3cm for a few weeks, I was completely unprepared for what lay ahead. After checking in and Read the rest of this entry »
Posted in Baby News | 1 Comment »
September 15th, 2006
by Yun,
38th week. Time is ticking. Every night before I go to bed, I’m wondering if tomorrow is the day. Yoyo, that’s her name. When are you ready to meet your parents?
My leave started about two weeks ago. 8 months. Such a long time. I’m tired. Tired from having to get up early everyday. Tired from a full schedule. Tired from walking around with a big belly. Tired generally, especially towards the last few weeks. Now with all the work load gone, I’m at ease. Spent the first week getting ready for the nursery. Crib, mattress, bedding, dresser, changing pad, stroller, car seat…the list goes on and on. Never realized that such a little tiny person needs so many things. And imagine! That’s just the beginning. We painted her room pink, light blue on the ceiling and highlighted with lavender crown molding. She better be a girl.
(Ultrasound is never 100% sure about girls).
2006 is a busy year. Quite a few friends and coworkers became proud parents. Reading their blogs and looking at their baby pictures are my big enjoyment. One of my coworkers used to take his cell phone out around 5pm everyday and announced that it was time to look at the cutest kid ever. haha…… btw, his son is very very cute, with really big eyes.
Except for being heavy; having to wobble and stay away from coffee and coke; not being able to sleep well and exercise regularly; pregnancy itself was not too bad when I think about it. People are always very nice to you. Known or unknown, people asked me about my due date or boy/girl. They talked about their own kids and experiences. Recommended baby products to me. My team all took good care of me, although from time to time they teased me “not to piss off the pregnant woman”. Most of my cravings got satisifed. No need to worry about weight (overweighted anyway). Have excuses for not doing certain things. Get away with mood swings. Best chance to do shopping on behalf of baby and motherhood and so on so forth.
Couple of my friends told me to enjoy the last stage of the pregnancy, as it is such an unique experience and honestly will be our last few free days. However, I’m really anxious. Cannot wait to meet this little tiny person kicking and stretching so hard inside me (doing that right at this minute). Maybe I’ll be regretting that thought soon. But that’s later. I’m not worrying about it now.
Posted in Baby News | No Comments »