« Posts by admin

shell_exec silent error

This is likely a common error yet might be hard to detect. If you run shell_exec(), make sure to use the full path to the binary file. It might be obvious but many for convenience does not do so, including myself at times. You forget that .bashrc does these for you while running PHP script via crontab is entirely different.

For example, shell_exec(‘ifconfig’) returned empty (it happened at times, on different servers, intermittently, not always, that made thing even harder to understand). However, the path was the issue since the logic only went through in certain cases and it worked 2/4 servers. Weird! And if you run the script directly, it gets your path. Running it via cron does not have that luxury so you need the full path: shell_exec(‘/sbin/ifconfig’); Oh well, lesson learned.

Wget/cURL – Pretend to be a real browser

wget -d -S –referer=”http://…” –user-agent=”Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv: Gecko/20101203 Firefox/3.6.13″ –header=”Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8″ –header=”Accept-Language: en-US,id-ID;q=0.8,id;q=0.6,en;q=0.4″ –header=”Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3″ –header=”Keep-Alive: 300″ –header=”Connection: keep-alive” –load-cookies cookie.txt –save-cookies cookie.txt –keep-session-cookies “http://…”

curl -v -L –referer “http://…” –user-agent “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.68 Safari/534.24” –header “Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5” –header “Accept-Language: en-US,id-ID;q=0.8,id;q=0.6,en;q=0.4” –header “Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3” –header “Keep-Alive: 300” –header “Connection: keep-alive” “http://….”

Blueberry Varieties

With my small garden in San Jose (Northern California, South Bay Area), I found blueberries to be quite easy to maintain in the containers and good for the kids. I’ve been harvesting 20lbs since early May 2011. I’m collecting blueberry varieties and these are the ones I have with my comments and sources. I will update these yearly as well.

  1. Abundance – Recommended. Sweet, big, thick skin (from Half-Moon Bay Nursery, $13/#1)
  2. Berkeley – Recommended. Excellent, sweet (from Alamaden Valley Nursery, $15/#1). 2012: dying, don’t know why yet
  3. Bountiful Blue Blueberry – likely similar to Sunshine Blue, very bushy, great color, likely created for landscaping (from Payless Nursery, $20/#3). 2012: very early, already flowering in mid-Jan this year, maybe winter is too mild. Sweet and really bountiful as its name implied. Recommended
  4. Bluecrop – (from Lowes, $7/4″). 2011: Not too impressive, fruits were small and not tasteful. +1 Feb 2012 Lowes $7/plant-in-a-cup
  5. Blueray – (+1 no record, +1 Feb 2012 Lowes $7/plant-in-a-cup)
  6. Bluegold – 2011: Not sure if it’s still young or it’s like this but it’s quite tart and not very tasty (from Lowes, $8/4″)
  7. Camelia – (from Lowes, $7/4″) 2011: no fruits yet
  8. Chandler (Feb 2012 x2, from GrowOrganic.com, $7.5/4″+s/h)
  9. Duke x2 – Good size, sweet (from Lowes and Summerwinds). $6/4″ Lowes (23 May 2012)
  10. Earliblue – Indeed early, good size, few fruits but likely because it’s still young (got from Alamaden Valley Nursery)
  11. Elliot – (from Payless Nursery)
  12. Emerald (Feb 2012, GrowOrganic $7.5/4″+s/h)
  13. Jersey (+1 no record, +1 Feb 2012 Lowes $7/plant-in-a-cup)
  14. Jewel (OSH, $17, #2, Sep 2011). 2012 – Big and sweet. Good!
  15. Jubilee – Small, not so good, cling to branches
  16. Legacy – (from Lowes, $25/#2), 2011: no fruits yet
  17. Misty x2 – (from HomeDepot, $5 bareroot)
  18. Northcountry – (from Lowes, $7/4″)
  19. O’neal – 2012: very early, big and sweet
  20. Ozark Blue – Recommended. 2011: Sweet, big (from Payless Nursery, $10/#2, clearance)
  21. Patriot (Feb 2012 – GrowOrganic $7.5/4″+s/h)
  22. Pearl – $6/4″ from Lowes May 23, 2012
  23. Pink Lemonade Blueberry – (from OSH, $14/#2 promo), 2011: no fruits yet
  24. Powderblue – Recommended. Very late, extend all the way to Sep, distinct, sweet berries (from Alamaden Valley Nursery, $15/#1)
  25. Rebel – (from Lowes June 2011, $7/4″)
  26. Reka – A bit small, maybe it’s still young, also for some reason, this season has very bad taste, really bad. Maybe next year (from Lowes)
  27. Reveille x2 – Recommended. 2011: Early, good size, sweet, green bushy and not show too much branches (from Payless Nursery, $10/#2, clearance)
  28. Sharpblue x2 (from HomeDepot, $5 bareroot)
  29. Southmoon – Recommended. Payless Nursery
    2011: Excellent, shape is definitely different from other blueberries, good size, sweet , long season
    +1 Feb 2012: Groworganic $7.5/4″+s/h
  30. Spartan – Excellent, really big, sweet (from Summerwinds)
  31. Star – Good, a bit tough, cling to branch and tougher skin (from Payless Nursery). 2012 – It’s good, diff from 2011, big and sweet, maybe it need time to mature. Fruit is distinctive with star-shaped bottom
  32. Sunshine Blue – Recommended. Good, heavy bearing, compact plant, bigger fruits after 3rd year (from Payless Nursery)
  33. Top Hat – Small, low bush but good fruit size and sweet. Bush/Plant is a bit too small for a decent fruit yield (from Payless Nursery)

I want to buy in-store since it’s much better to judge the quality than buying it online/mail order. Thus, there are varieties that are not available in stores in my area. These are the one I’m looking for: Chandler (got it!), Darrow.

The best place for blueberry variety descriptions is from Fall Creek. Too bad they don’t sell retails and don’t even list those retails/nurseries/stores they ship to so I can find and buy. Maybe will buy from Raintree. Heard good things about Nourse but they require phytosanitary cert. for Calif, which make it more expensive.

2012 Update (May, June)

Favorites for this season so far are Star, Abundance, Early Blue (early varieties), Bekerley and Bountiful Blue. Powder Blue died, don’t know why. Reveille aren’t doing so well, maybe irregular watering during my house painting project.

Firefox 4 – AJAX JavaScript Execution

Upgraded to Firefox 4, it’s alright, may feel a bit faster (advertised placebo?). It looks a lot like Safari. I guess there is a convergence of best practices going on.

Anyway, here is the point of this post:

– Firefox 3: innerHTML will execute any JavaScript code inside it (normally loading via AJAX). Other browsers do not.
– Firefox 4: innerHTML will not execute JS code. Same as other browsers

Solution for those who needs this functionality: have to reorganize the code so that it calls back later, or manually extract and create nodes. But I guess it’s more consistent between browsers now. Enhanced security I guess

Man, these bugs are the worst, you just don’t know/remember what changes (your code, your external libraries, something else). Wasted couple hours just to get back to my last conclusion.

Investing lessons from a market sell-off

As a beginner in stock investing, I’ve learned some basic lessons, hopefully not too painful to shun stocks all together. They sound very simple but are not easy for amateur investors to avoid. So you would need to be constantly reminded. In your portfolio, there will be stocks that are going up/down since you bought them. Stocks going down can signal a bad sign, or simply a longer wait before they shine. Always think what-if scenarios since they could happen, no matter how unlikely. When doing that, you’ll have a better chance to fight against your emotions.

– Gains are good, until they’re no longer there
– Timing for a top is very difficult. I sold BA and MCD before they went down for a correction and I thought it was simple. Wrong! And now I’ve missed several opportunities to sell
– Set a trailing-stop-limit to sell stocks that are still flying high, even if you like it, but might turn around and go down. This locks your gain in case the correction is bigger than just a blip
– Opportunities always exist, do not think you have missed the boat, the next one is coming sooner than you expect.
– If you really like the stock, or waiting for dividend: You can sell a portion of your position, not all at once


  • Money is limited, cash is king, think about tomorrow
  • Timing the bottom is very difficult
  • Averaging down on a good stock is good, until you’re out of money
  • Monitor the fundamentals and market signs for negative changes that could make it a bad stock
  • Looking at intraday charts with the technicals, you’ll get quite excited! You can finally buy the stock! Yay! But it might not be the best price

Demand from a Natural Disaster

With the strong 8.9 quake just happened in Japan and living in California, I would have to think really hard about what happens before, during and after a natural disaster, more specific, a quake. Let’s imagine what people and businesses would have to deal with and who can benefit from the increased demand. I’ll be direct and might sound too materialistic but the fact is that companies are there to fill demand and that’s the reason for their existence.


  • Awareness: the public needs to know what could happen here. Companies: printing services, graphic designers, advertising firms, public service ad brokers
  • Education: teach people what to do, how to prepare for a natural disaster specific to their cities.
  • Planning: prepare a plan to communicate with families, communities. Companies: communication companies, SMS, cellphone operators, food/water suppliers


  • Communication: report damage, shut down equipment. Need: electricity, telephone, cellphones, radio, TV, Internet. Companies: power generator, batteries, cellphone maker/operator, radio, media/news broadcasters. Companies: ATT, VZ, local utilities (ED, PGE, etc.)
  • Information: report from the damaged areas to central control to prepare aids. Need: similar to above


  • Food and basic necessities: water, can foods, light, tents, blankets. Companies: PG, KMB, UL, KFT
  • Cleaning: remove debris, tear down houses, clean roads, remove fallen tree branches
  • Waste Management: waste from the cleanup ops need to go somewhere and it’s gonna be huge. Recycling will be also significant since a lot of items (cars, houses) will be only partially damaged. Scavengers, recyclers will have to work hard.
  • Burial/Funeral: sad but there will be casualties in such strong quakes. Companies: coffin makers, funeral services
  • Rebuilding: home builders, architects, structural engineers, urban planners, inspectors, construction workers
  • Repairs: replace broken windows, broken plumbing pipes, fix light poles, fix holes in roof, repaint house
  • Insurance: bad for the insurance companies with many claims. They will need to hire temp people to handle incoming claims, documents.
  • Labor: increase demand for temp workers to cleanup, file claims, rebuild homes/buildings
  • Medical Supplies: needles, bloods, consumables within hospitals. Companies: BDX, MDT
  • Medicine: painkillers, antibiotics,
  • Hospitals: likely local hospitals but patients might have to move to a more special hospital with their injuries/conditions
  • Transportation: helicopters, airlifts, airlines to bring aids, fuel/gas, people going to/from shelters, people go to find their loved ones
  • Building Materials: rebuilding needs wood, nails, tools, paint, etc. Companies: Home Depot, Lowes, SHW
  • Appliances: broken appliances will needed to be replaced. Companies: WHR

Recommended software

Some software I cannot live without:
– Keepass (Mac/PC)
– TrueCrypt (Mac/PC)
– Terminal (Mac), Putty (PC)
– ExFAT (for read/write an external HDD for both PC+Mac

Security camera

Here is a wonderful combination: an IP camera (SharX, LTS, YCam), FTP server (VSFTPD), online image browser (http://minishowcase.net/). You don’t have to install fancy tools, just go online, browse the archive images when you receive a motion detection email alert from the camera. Gotta love technology

Tips for beginners with Puppet (server automation)

Since Puppet is written in Ruby, some of its syntax are Ruby-specific (I would not know for sure since I have not learned about Ruby yet). I’ll try to update this post so beginners to Puppet and strangers to Ruby can get pass the unwanted headache.


Case-changing is one of the source of confusions. If you see this error:

"Could not find dependency Class[changeTimeZone] for Node[baseserver]"

And in your nodes.pp you have:

node baseServer {
  require changeTimeZone

Change it to all lower case will fix the problem

Require a definition within a class

The syntax is

exec { "RunSomething":
  command => "abc",
  require => MyClass::MyFunction["def"],

DIsplay return code of a shell command

If you need to determine the return code for shell scripting, you can use “$?”

# ifconfig | grep eth0 >/dev/null 2>&1
# echo $?
0 => good/found
# ifconfig | grep eth1111 >/dev/null 2>&1
# echo $?
1 => bad/not found