« Archives in March, 2011

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