January 28th, 2008
Yea thats right, we finally get a good excuse for taking on less work. For the details, read on. By the way this is ripped off verbatim from Slashdot.
“Multitasking messes with the brain in several ways. At the most basic level, the mental balancing acts that it requires — the constant switching and pivoting — energize regions of the brain that specialize in visual processing and physical coordination and simultaneously appear to shortchange some of the higher areas related to memory and learning. We concentrate on the act of concentration at the expense of whatever it is that we’re supposed to be concentrating on… studies find that multitasking boosts the level of stress-related hormones such as cortisol and adrenaline and wears down our systems through biochemical friction, prematurely aging us. In the short term, the confusion, fatigue, and chaos merely hamper our ability to focus and analyze, but in the long term, they may cause it to atrophy.”
Tags: multitasking, stupid and slow
Posted in Interesting | No Comments »
January 21st, 2008
There is a Google Group setup to discuss Google’s Checkout API only the group sucks. I have no patience to read though thousands of meaningless posts just to find what I’m looking for and sadly searching Google for help on their API is actually pretty tough.
Basically when you are working on the responsehandler.php file, the file that gets callbacks from Google on all kinds of notifications, it isn’t initially clear how you receive the data and then utilize it. Your variables wind up looking something like $data[$root]['shopping-cart']['merchant-private-data']['VALUE'] where $root is a case value switching between the different types of notifications you can receive, in this case it is new-order-notification.
The problem arises when you try and get all of the items out of the shopping cart. An item name for example is $data[$root]['shopping-cart']['items']['item']['item-name']['VALUE']. Now items occurs once in the hierarchy but each cart item is contained in the <item></item> tags. Simply put, in a DFD items:item would be labeled as 1:N.
What does the code to get this done look like? This:
$items = get_arr_result($data[$root]['shopping-cart']['items']['item']);
foreach ($items as $item) {
$insert_into_order_contents=”
INSERT INTO order_contents SET
`google-id`=”.$data[$root]['google-order-number']['VALUE'].”,
`email`=’”.$data[$root]['shopping-cart']['merchant-private-data']['VALUE'].”‘,
`item-id`=”.$item['merchant-item-id']['VALUE'].”,
`item-name`=’”.$item['item-name']['VALUE'].”‘,
`unit-price`=”.$item['unit-price']['VALUE'].”,
`quantity`=”.$item['quantity']['VALUE'].”,
`owner`=’”.$item['merchant-private-item-data']['VALUE'].”‘
“;
$result3 = mysql_query($insert_into_order_contents,$db);
}
Posted in HTML / PHP / CSS | No Comments »
January 21st, 2008
Today I was pulling a query from MySQL and some of my columns were NULL. Now this isn’t the first time I’ve gotten NULL as a result and usually my code has an if statement in there to swap out the NULL values with zero. The problem is this time that I don’t have the option to edit the code after the query has been returned, I need the actual query results to have NULL removed from them. This lead to my discovery of COALESCE.
I have a column SUM(`order-total`) which will return the total dollar amount a user has spent on the website only some users have yet to make any purchases.
COALESCE is used in the following way:
COALESCE(SUM(`order-total`),0.00)
This acts just like str_replace in PHP. You can use COALESCE in any part of your query, it doesn’t only have to be where you specify the columns you want returned.
Posted in Rants | No Comments »
December 24th, 2007
It is widely accepted that over the long term the market will almost always outperform any given fund. The problem with that is the market does on average 8% a year, and well at that rate we will all have to wait until we are old and wrinkled before we invest our way into the seven digits. Below are images courtesy of Morningstar and Vanguard that demonstrate the findings of their study in 2002:

Now with that being said, I am sufficiently stubborn enough to believe that I can in fact buck the market. I haven’t been an investor long (since 2005), but out of the 10 picks I have made since then my performance hasn’t been all that bad (notably AAPL 376% gains and FCX 47% gains), and at the moment I stack against the market 73% to 28%. Not bad, eh? Since I’m saying that I can consistently beat the market, I will let you hold me to that by tracking my progress. If you visit my market breakdown page I will provide you with some neat little graphs to watch my picks against the market. Oh, and just for the record, I follow all the compliance rules of my firm and as a disclaimer I definitely don’t recommend buying what I do. Until I start getting paid to manage peoples money I am but an amateur.
Tags: apple, portfolio, stocks
Posted in Stock Market | No Comments »
"The secret of happiness lies in taking a genuine interest in all the details of daily life, and in elevating them to art." - William Morris