Friday, May 7, 2010

The Producers had it right

Last month This American Life (which if you don't listen to, you should) did a special report called "Bet Against the American Dream (MP3)" with Planet Money and ProPublica to find the company or companies that were responsible for making the financial crisis worse.

Basically this company gets hedge funds to build really risky investment portfolios, they buy up the riskiest portions of it and then take out bets (credit default swaps) that they will fail (safe bet considering they helped BUILD those packages). 

This is an amazing listen, and so is the broadway-ish song they commissioned!




Bet Against the American Dream from Alexander Hotz on Vimeo.

Tuesday, March 23, 2010

Amusing commentary on Healthcare

This morning I was awoken by my alarm clock powered by electricity generated by the public power monopoly regulated by the US department of energy. I then took a shower in the clean water provided by the municipal water utility. After that, I turned on the TV to one of the FCC regulated channels to see what the National Weather Service of the National Oceanographic and Atmospheric Administration determined the weather was going to be like using satellites designed, built, and launched by the National Aeronautics and Space Administration. I watched this while eating my breakfast of US Department of Agriculture-inspected food and taking the drugs which have been determined as safe by the Food and Drug Administration.

At the appropriate time as regulated by the US Congress, and kept accurate by the National Institute of Standards and Technology and the US Naval Observatory, I get into my National Highway Traffic sSafety Administration-approved automobile and set out to work on the roads built by the local, state, and federal departments of transportation, possibly stopping to purchase additional fuel of a quality level determined by the Environmental Protection Agency, using legal tender issued by the Federal Reserve Bank. On the way out the door I deposit any mail I have to be sent out via the US Postal Service and drop the kids off at the public school.

After work, I drive my NHTSA car back home on DOT roads, to my house which has not burned down in my absence because of the state and local building codes and fire marshal's inspection, and which has not been plundered of all its valuables thanks to the local police department.

I then log on to the Internet, which was developed by the Defense Advanced Research Projects Administration and post on freerepublic.com and Fox News forums about how SOCIALISM in medicine is BAD because the government can't do anything right. So keep up the good fight!


Found here.

While I am not generally one for big government and there are a lot of instances where the cost/benefit ratio of a government run system is bad. I think this one will have enough vested interest from the community to theoretically keep it in check. Here's hoping.

Saturday, February 6, 2010

Late Night Find: BookBook

BookBook

This is a case for the 13" MacBook and MacBook Pros. I want one so badly and literally almost bought it on impulse. $80 is a little steep for me for an impulse buy, so I'll just ogle it and restrain myself.

Thursday, February 4, 2010

Life of a Vendor

Props go out to WoW Moviewatch for making me aware of it, but more specifically to Galenmereth for making a simple yet thought provoking look at the World of Warcraft, Life of a Vendor. This video excellently features the song "I don't know" by Lisa Hannigan which I absolutely love.

The youtube video captions read:
This is a video dedicated to all the vendors who usually only get our coin and not our love. We all love you, even if you are just ones and 0´s!

I enjoyed this and wanted to share.


Hashes are fun

Another day gone and another fun day of Mason and Perl learning.

I should preface this by saying as I am still learning there most likely WILL be errors. Please comment and correct me. I'll gladly edit the post to correct. I am still learning here. :)

#1 Gripe, dealing with Hashes.

Don't get me wrong, I love 'em, and they are incredibly handy, but I spent a good part of the day figuring out multi-dimensional hashes, declaring them and using them. When all is said and done I forgot about how hashes are stored how Perl wants to store them, for better efficiency. Whenever you alter it, it could be in a different order. Oh well. Multi-dimensional arrays that emulate hashes, GO!

Hashes and arrays, as compared to PHP

PHP:

$var = array();
//Empty Array

$var = array(12,23,2);
// Normal Array, each item in their ordered position
// $var[0] == 12, $var[1] == 23, $var[2] == 2

$var = array('coke' => 'soda' , 'paper' => 'wood');
// Associative Array (this is like a hash in perl)

$var = array(
'Dinner' => array(
'steak' ,
'veggies',
'wine'
)
);
//This is a multi-dimensional array and can be used simply by calling the values
//$var['Dinner'][0] == 'steak';

END PHP

<%perl>

# Some background about variables in Perl
# $var - scalar (single variable)
# @var - list (an array)
# %var - hash (an associative array)

$variable = 'ice cream';
@variable = ('breakfast','lunch','dinner');
%variable = { 'breakfast' => 'cereal', 'dinner' => 'Cheese Steak' };

Correction (ty cole)
The '%' sigil represents a symbol that *is* a hash. When you create a hash using curly braces, you're returning a reference *to* a hash. So if you do the assignment you talked here, it doesn't work the way you want.

#So in other words, my free use of { } was wrong. Here is the proper definition of that datatype that actually will return the hash and not the reference to the has.

%variable = ( 'breakfast' => 'cereal', 'dinner' => 'Cheese Steak' );

<%/perl>

You will notice the difference in ( vs. { when you're using an array vs. a hash. For added fun, if you want to reference anything you want to treat it like a scalar. It assumes you want to return a scalar when you reference a hash.

In this case: %variable = { 'breakfast' => 'cereal', 'dinner' => 'Cheese Steak' };

print $variable{'dinner'} will return the scalar 'Cheese Steak' so perl has done right. (note the { brackets again)

Dereferencing
When you read from a hash remember, Perl assumes it's a scaler, to tell it to be something else you need to apply the appropriate prefix.

If %variable had been
%variable = {
'dinner' => {
'Cheese Steak',
'Chips',
'Soda'
}
}

$variable{'dinner'} will still return a scalar but now it'll be the pointer to the sub-hash.

To get to the hash I need to tell perl that what it is returning needs to be another hash which means wrapping it in the hash indicator %{}.

%new_hash = %{$variable{'dinner'}}; #congrats, we now have our sub-hash to read.

Fun stuff. I love that I'm learning!

Wednesday, February 3, 2010

Mason and Me

I've spent the better part of the last couple weeks neck deep in Perl and Mason and really trying to understand the workings of the languages.

Perl:
I think I was spoiled by PHP somewhat. It's a web language, it's made by people who want to do web things so there are functions throughout the language that do the most common things. Perl has libraries, a lot of them, and I'm sure they do everything that PHP could only dream to do, but right now I'm spending most of my time looking for how to do some things that is a simple function call in PHP. I'm sure once I know the tricks/shortcuts/secret handshakes I'll be singing Perl's praises. Regex is nice though.

Mason:
It's very interesting. As a template system it's very convenient. Oh, I just put all my design stuff in the root folder and then every subsequent sub folder will just use the content in the last folder? Swell. It's a lot to think about. I'm making a relatively small section of a site right now in Mason and I can see how it could bloat up very very quickly. My immediate goal for this site (not just the piece I'm working on) is to get a real grasp of how it's laid out and what is really important in the system.