Friday, August 14, 2009

First Derivative

I had a snapfish coupon for a free 8x10 so i created this to keep me focused. Its based off one of my favorite posts. Essentially, focus on constant improvement and learning and you will surpass those that are more gifted than you. Did you know cluefulness isn't a real word?

Wednesday, June 17, 2009

Why all the Sonic commercials?

You've seen the commercials a million times. Two goofballs are riding in a car and one makes a bad pun. "It's no normal breakfast.. its like a breakfeast!". Hilarity ensues. Now you're hungry and ready to head off to the closest Sonic's. The problem: google maps says the nearest Sonic's is 50 miles from where you live! why?

Pre-market saturation. There's no Sonic's near you now but the idea is that there will be. A couple reasons come to mind on why they are using this strategy:

  1. Advertising is cheap enough - they aren't losing a ridiculous amount of money
  2. There's a natural human tendency to want what they can't have. The commercials are meant to stir up interest, and combine that with a lack of availability causes people to desire it more.
  3. The best advertising is word of mouth - you want people to talk about your product and pass the word along. Everytime I watch a Sonic's commercial with a group of people someone points out the fact that the nearest Sonic's is miles away. This is good.

In-n-out used a similar marketing campaign which was highly successful. Don't be surprised when theres finally a Sonic's near you!

Tuesday, June 2, 2009

Every Base Is Base 10

(image from

Took me some time to get this one. Basically every base is called 'base 10'. Even though the alien actually does count in what we would call 'base 4'. The alien would still call it base 10.

This makes more sense when we count in different bases.

decimal(how spaceman counts): 0,01,02,03,04,05,06,07,08,09,10
quaternary(how the alien counts): 00,01,02,03,10
binary: 0,01,10,11
hex: 0,01,02,03,04,05,10

Thus you can see how both the spaceman and alien end up with base 10. Maybe we should really call it by the highest number before 10. So decimal would be 'base 9' and the alien would count in 'base 3'

Wednesday, April 15, 2009


I have a little development server for a website project i am working on. It is running in my home which is also the host of a SVN server and acts as a test server. My friend who is also working on the project needs access to the server every now and then but mostly the server just sits there idle. So in an effort for conservation(save the planet!, save me money!), I figured I could implement a wake-on-lan solution.

Great. So I check to make sure that my card supports wake-on-lan
:~$ sudo ethtool eth0
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Full
Port: MII
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: pumbg
Wake-on: d
Current message level: 0x00000001 (1)
Link detected: y

Yes it does, but it's disabled. No problem.

~$ sudo ethtool -s eth0 wol g
(later on i had to add this command to the /etc/rc.local file because it gets reset back to disabled).

And then I modify port forwarding on the router.

Using the neat tool WOL- Magic Packet Sender, I set the hostname, the mask to Internet and the MAC address and send the packet of the magii.

It works!

Well so i thought. It turns out that the next day my friend tells me that it doesnt work for him. When I try I find out the same.


I found that its not working because when the server goes down the ARP cache(mapping of ip to MAC address) will expire after a short time and so the router won't know where to send the packet. Theres 2 solutions to this.

1) Have the router forward the packet to the broadcast address.
2) Set a static arp address

I tried the first but apparently LinkSys routers don't support sending to the broadcast address. Instead it just drops the packet on the floor. I haven't found a way to do the second yet.

Monday, March 30, 2009

i18n in the LAMP stack

i18n should be done server side.

There are 3 main options for organizing the database schema:
1. Separate column for each language
2. Translation table with columns for each language
3. Translation tables with rows for each language

3 looks to be the most versatile, but 2 is feasible since if requirements are relatively simple.

Mysql will need to be configured to save the data in unicode

Best practices