Food for Thought

Friday, May 9th, 2008

I don’t want to get into any lengthy debate on this issue, but I know a lot of people are up in arms thinking that Ethanol production is causing the price of food to rise. While that may be partially true, you do have to also consider the fact that a big part of the cost of food rising comes from the fact that oil has reached record levels, and, though you may not always think about it, much of the food in the grocery store comes from far away and expends an enormous amount of food getting to you.

Thus, while I remain cautious on whether ethanol is an appropriate solution to our petroleum dependency, I think that whenever someone wants to complain about it, they should also remember the high prices being imposed by OPEC.

Also, you should consider buying locally grown food. It should not be as price inflated by gas costs of either kind.

An interesting method of acquiring pocket change

Wednesday, May 7th, 2008

Whenever you sign up for an online bank account, you are nearly always expected to link it up with another account. I assume that they figure the person will logically choose a brick-and-morter bank for this purpose. To protect users, most sites make two small deposits of between 1 and 99 cents to the account and force you to verify these deposits before you may use this account as a funding source. I assume this is meant to protect from accidents and account fraud. Additionally, many sites allow you to link up to 5 or 6 accounts at once. Anyway, if we assume that these sites have no way of remembering deleted accounts (I am not sure if this is the case), you could set up a large amount of checking and savings accounts among the various high yield savings accounts and take a few minutes out of every day (or couple of days if the deposits are slower) to mutually link these accounts to each other. Over time, you should average a dollar profit for each transaction. If you have accounts at 6 financial institutions that all allow adding 5 linked accounts, then you could make an average of $30 re-linking accounts. Even if you could only do this once a week, that still leads to $1560 a year.

The only major problem that I see with taking advantage of this is that if you did it too regularly, you might be noticed and have your account closed. I think that realisitically if you wanted to employ a strategy of making money through this medium, you would need to have a large number of accounts that you applied this strategy to sporadically. This way, you would not go back to the same account too many times and if caught you could use the excuse that you had more than the allotted number of linked accounts and you kept deleting and changing accounts in order to make transactions between more accounts. With so many accounts open though, you do run an increased risk of identity theft.

If anyone wants to try this, let me know how it goes.

Asset Allocation

Monday, May 5th, 2008

I thought I would present my current 401k asset allocation for your enjoyment. I know that from a traditional asset allocation point of view, I am way too heavy into my company stock, but it is cost prohibitive to constantly rebalance the portfolio when my matching contributions come in the form of company stock (not to mention that the stock is currently fairing better than my other holdings). I plan on rebalancing my portfolio to reduce the holdings either twice a year in the short term. Eventually, the company contributions will only be a small part of my overall portfolio and I may rebalance more infrequently, likely whenever SCANA common stock passes being 10% of my assets. Of course, this schedule is subject to modifications based upon market performance of the stock and the other equities I hold.

My asset allocation as of today is 74.9% domestic equities, 18.1% foreign equities, and 10% domestic bonds.

Domestic Equities - 74.9%
50.2% - Vanguard Total Stock Market Index
24.7% - SCANA

Foreign Equities - 18.1%
7.4% - Vanguard European Stock Index Fund
5.3% - Vanguard Pacific Stock Index Fund
3.2% - Vanguard Emerging Markets Stock Index Fund
2.2% - Euro Pacific Growth Fund

By country this is roughly
10.2% - Europe
5.3% - Pacific Basin
2.6% - Emerging Markets

Domestic Bonds - 7.0%
7.0% Vanguard Total Bond Market Index Fund

For what its worth, excluding SCANA common stock, the asset allocation is 66.7% Domestic Equities, 24.0% International Equities, and 9.3% domestic bonds.

Red (Not So) Delicious

Saturday, May 3rd, 2008

I previously reviewed the Braeburn apple. Read this first if you want more information about why I review apple cultivars.

I recently bought some Red Delicious apples because they were on sale. They were really quite bland. I mean, they were not that juicy and they did not have a strong flavor. Maybe I got a bad batch, but this goes toward confirming everything that I have read about Red Delicious apples being inferior. I must admit that they are beautiful though, being the iconic apple and whatnot.

But really, thinking back, I cannot remember the last time I had a Red Delcious apple and thought “wow, this is excellent, I need to go out and buy more apples soon”, it is more like “oh, cool, there are apples around, I will eat them before they go bad”.

Schrodinger’s LOLCat

Tuesday, April 29th, 2008

This may be the best LOLCat ever.

Removing Tom’s Friend Updates on MySpace

Sunday, April 27th, 2008

So I wrote my first user script for Greasemonkey. You can find it here if you are interested. For some reason, whether intended or as a bug, they have the “Friend Update Subscriptions” feature on MySpace gimped so that even if you are not friends with Tom you still get his updates. Anyway, my script goes through, finds all updates associated with Tom and purges them from the list.

I must admit it was pretty neat to learn a bit about writing them. They are basically just Javascript. It may include some non-standard items though. I am not sure how much is “out of the box” since I basically stole my algorithm from another script with some modifications until it worked right.

For those unfamiliar with GreaseMonkey, it is basically a Firefox Add-On that allows you to download scripts such as the one I created that will modify the content of a webpage when it loads. It is most commonly used to add functionality to a page or remove unwanted content though it could be used to re-skin the page’s look, but that is kind of overkill since that could be done with just a stylesheet.

A wasted hour/How to find out the age of a Facebook user in FQL

Sunday, April 27th, 2008

So, I needed to do a comparison on age for my Facebook implementation. The problem is that Facebook only returns “birthday” in the format “August 31, 1984″ or “August 31″ if the year is hidden rather than returning the age directly. At first, I did the logical thing and wrote a short bit of code that got the birthday string, split the string in code and then checked the component parts to build the age. Here is my basic code for that:


$birthday = $user->getDataField("birthday");
//There is no birthday set for the current application user.
if($birthday == NULL)
return false;

$bday_array = split(”, “,$birthday);

//There is no year set in the birthday field.
if($bday_array[1] == NULL)
return false;
else
{
$month_array = array(”January” => 1, “February” => 2, “March” => 3, “April” => 4, “May” => 5, “June” => 6, “July” => 7, “August” => 8, “September” => 9, “October” => 10, “November” => 11, “December” => 12);
$current_year = intval(date(”Y”));
$current_month = intval(date(”m”));
$current_day = intval(date(”d”));

//Age at the end of the prior year.
$user_age = $current_year - $bday_array[1] - 1;

//If their birthday has already occurred this year, add one to their age for this year.
$date = split(” “,$bday_array[0]);
if($date[0] != NULL && $date[1] != NULL && ($month_array[$date[0]] < $current_month || ($month_array[$date[0]] == $current_month && $date[1] <= $current_day)))
$user_age += 1;

//Return true if the field is set to equalage and the user age is equal to the value of the field
$int_value = intval($this->value);
if($this->field == “equalage” && $user_age == $int_value)
return true;
}
//If a case was not matched, return false
return false;

That may be a bit hard to understand without getting the underlying model, but I think the gist of it can be gotten pretty easily (if you know how to program that is).

Of course, then I decided to be CUTE. I thought “you know FQL has some functions that I can use. I bet I can verify if the user is a certain age in FQL”. Sure I thought it would be a bit hard because I’d have to do the month word to month number conversion and have to split the string into the component pieces, but I am sure it is possible. An hour later, I had this monstrosity.


$current_year = intval(date("Y"));
$current_month = intval(date("m"));
$current_day = intval(date("d"));
$query = <<
select uid from user where uid = $this->application_user_id and strpos(birthday,”,”) > 0 and (
(($current_year-substr(birthday,strpos(birthday,”,”)+2,4) = $this->value) and (
(substr(birthday,0,strpos(birthday,” “)) == “January” and ($current_month > 1 or ($current_month = 1 and $current_day >= substr(birthday,strpos(birthday,” “),strpos(birthday,”,”)-strpos(birthday,” “))))) or
(substr(birthday,0,strpos(birthday,” “)) == “February” and ($current_month > 2 or ($current_month = 2 and $current_day >= substr(birthday,strpos(birthday,” “),strpos(birthday,”,”)-strpos(birthday,” “))))) or
(substr(birthday,0,strpos(birthday,” “)) == “March” and ($current_month > 3 or ($current_month = 3 and $current_day >= substr(birthday,strpos(birthday,” “),strpos(birthday,”,”)-strpos(birthday,” “))))) or
(substr(birthday,0,strpos(birthday,” “)) == “April” and ($current_month > 4 or ($current_month = 4 and $current_day >= substr(birthday,strpos(birthday,” “),strpos(birthday,”,”)-strpos(birthday,” “))))) or
(substr(birthday,0,strpos(birthday,” “)) == “May” and ($current_month > 5 or ($current_month = 5 and $current_day >= substr(birthday,strpos(birthday,” “),strpos(birthday,”,”)-strpos(birthday,” “))))) or
(substr(birthday,0,strpos(birthday,” “)) == “June” and ($current_month > 6 or ($current_month = 6 and $current_day >= substr(birthday,strpos(birthday,” “),strpos(birthday,”,”)-strpos(birthday,” “))))) or
(substr(birthday,0,strpos(birthday,” “)) == “July” and ($current_month > 7 or ($current_month = 7 and $current_day >= substr(birthday,strpos(birthday,” “),strpos(birthday,”,”)-strpos(birthday,” “))))) or
(substr(birthday,0,strpos(birthday,” “)) == “August” and ($current_month > 8 or ($current_month = 8 and $current_day >= substr(birthday,strpos(birthday,” “),strpos(birthday,”,”)-strpos(birthday,” “))))) or
(substr(birthday,0,strpos(birthday,” “)) == “September” and ($current_month > 9 or ($current_month = 9 and $current_day >= substr(birthday,strpos(birthday,” “),strpos(birthday,”,”)-strpos(birthday,” “))))) or
(substr(birthday,0,strpos(birthday,” “)) == “October” and ($current_month > 10 or ($current_month = 10 and $current_day >= substr(birthday,strpos(birthday,” “),strpos(birthday,”,”)-strpos(birthday,” “))))) or
(substr(birthday,0,strpos(birthday,” “)) == “November” and ($current_month > 11 or ($current_month = 11 and $current_day >= substr(birthday,strpos(birthday,” “),strpos(birthday,”,”)-strpos(birthday,” “))))) or
(substr(birthday,0,strpos(birthday,” “)) == “December” and ($current_month > 12 or ($current_month = 12 and $current_day >= substr(birthday,strpos(birthday,” “),strpos(birthday,”,”)-strpos(birthday,” “)))))
))
or
(($current_year-substr(birthday,strpos(birthday,”,”)+2,4) = $this->value+1) and not (
(substr(birthday,0,strpos(birthday,” “)) == “January” and ($current_month > 1 or ($current_month = 1 and $current_day >= substr(birthday,strpos(birthday,” “),strpos(birthday,”,”)-strpos(birthday,” “))))) or
(substr(birthday,0,strpos(birthday,” “)) == “February” and ($current_month > 2 or ($current_month = 2 and $current_day >= substr(birthday,strpos(birthday,” “),strpos(birthday,”,”)-strpos(birthday,” “))))) or
(substr(birthday,0,strpos(birthday,” “)) == “March” and ($current_month > 3 or ($current_month = 3 and $current_day >= substr(birthday,strpos(birthday,” “),strpos(birthday,”,”)-strpos(birthday,” “))))) or
(substr(birthday,0,strpos(birthday,” “)) == “April” and ($current_month > 4 or ($current_month = 4 and $current_day >= substr(birthday,strpos(birthday,” “),strpos(birthday,”,”)-strpos(birthday,” “))))) or
(substr(birthday,0,strpos(birthday,” “)) == “May” and ($current_month > 5 or ($current_month = 5 and $current_day >= substr(birthday,strpos(birthday,” “),strpos(birthday,”,”)-strpos(birthday,” “))))) or
(substr(birthday,0,strpos(birthday,” “)) == “June” and ($current_month > 6 or ($current_month = 6 and $current_day >= substr(birthday,strpos(birthday,” “),strpos(birthday,”,”)-strpos(birthday,” “))))) or
(substr(birthday,0,strpos(birthday,” “)) == “July” and ($current_month > 7 or ($current_month = 7 and $current_day >= substr(birthday,strpos(birthday,” “),strpos(birthday,”,”)-strpos(birthday,” “))))) or
(substr(birthday,0,strpos(birthday,” “)) == “August” and ($current_month > 8 or ($current_month = 8 and $current_day >= substr(birthday,strpos(birthday,” “),strpos(birthday,”,”)-strpos(birthday,” “))))) or
(substr(birthday,0,strpos(birthday,” “)) == “September” and ($current_month > 9 or ($current_month = 9 and $current_day >= substr(birthday,strpos(birthday,” “),strpos(birthday,”,”)-strpos(birthday,” “))))) or
(substr(birthday,0,strpos(birthday,” “)) == “October” and ($current_month > 10 or ($current_month = 10 and $current_day >= substr(birthday,strpos(birthday,” “),strpos(birthday,”,”)-strpos(birthday,” “))))) or
(substr(birthday,0,strpos(birthday,” “)) == “November” and ($current_month > 11 or ($current_month = 11 and $current_day >= substr(birthday,strpos(birthday,” “),strpos(birthday,”,”)-strpos(birthday,” “))))) or
(substr(birthday,0,strpos(birthday,” “)) == “December” and ($current_month > 12 or ($current_month = 12 and $current_day >= substr(birthday,strpos(birthday,” “),strpos(birthday,”,”)-strpos(birthday,” “)))))
))
)
FACEBOOKAGEQUERY;
$results = $this->facebook->api_client->fql_query($query);
if($results == NULL)
return false;
else
return true;

It actually *does* work, but the problem is that if it needs to be called more than once on a page, it hangs up the page loading. I guess Facebook is like “wtf” at such a huge query. The important lesson? Yes, it is better to do something in SQL/FQL to save slower code normally, but if you are going to have to write a terribly inefficient query the savings of doing it on a faster server do not make up for the horrendous asymptotics introduced.

For what it’s worth, the basic format of the query is “if the user has the year field set, we check to see if this year minus the year the user is born is equal to the target age. If that is true, then it means the user will be turning the target age this year. In that case, we check to see if the user’s birthday has passed. If that is so, then we are good. If that is not so then we check to see if this year minus the year the user is born is equal to one year greater than the target age. If that is ture, then it means the user will turn the age past the target age this year. In that case, we check to see if the user has not had his birthday yet. If that is so, then we are good. If not, then the check returns no results.

The Blue Cactus - Chicken Curry

Saturday, April 26th, 2008

We went to Blue Cactus tonight. I had the Chicken Curry. I think I may have had it before but forgotten about it. It was really good. Afterwards, I had a sorbet at Adriannas. It wasn’t gelato, but it was pretty good.

RevolutionMoneyExchange

Friday, April 25th, 2008

So I found out about this thing that is like PayPal called RevolutionMoneyExchange. Supposedly the fees are lower, but the only reason I joined is because there is a $25 referral bonus until May 15th for joining. You get this immediately without having to fund any money. I was wary at first because you are required to give them your social security number since it is banking related, but I checked out the information about it and found two important things:
1. It is backed by an FDIC banking institution.
2. Everyone that has done it that I have heard about got their money.

Anyway, I mention it here because I can sweeten the pot a bit more so to speak. If you want to get in on this action, you can click my referral button below and I’ll get $10 each time up to $500 total, and I think free money is good. It will all be going to a worthy cause of debt reduction as well. Anyway, let me know if you have any questions.


Refer A Friend using Revolution Money Exchange

Pepsi Stuff

Saturday, April 12th, 2008

I may have mentioned this already, but I am doing Pepsi Stuff. If you come across any of the yellow Pepsi caps, e-mail me the code. You could post it here, but if someone else sees it first, I can’t enter it.