Cory O'Daniel – These are just words Software development, thoughts, and randomness

24May/102

Lost finale – did i get it?

I think I understood the lost finale? What I understood was that everything that happened on the island was REAL. It all happened. The monster, the time travel, the dharma initiative. Everything. As the losties died off they went to the side world where they could meet up and "move on" together. So when we saw the plane leave, those people left the island, went on to have lives and eventually died. Hurley and Ben stayed on the island for however long and eventually died.

This is supported by the following statements I think?

Hurley to Ben - you were a good #2

Christian to Jack - everybody dies some die before you some die way after you

Christian to Jack - the time on the island was the most important part of your life

Am I on the right track?

Post to Twitter Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

Tagged as: 2 Comments
17Mar/092

MovingParts: Auto versioning your Javascript and CSS

This tutorial has a few moving parts.  It could be easily recreated with any stack, but for this post I used Nginx and Merb.

Why?

We like to keep things fast.  Two ways we do that is compress the hell out of our js/css and set the cache time on our assets to max.  This is cool to do and obvious, the thing that sucks is when its time to roll out new javascript or css making sure the clients get the updates.

What?

For this example I am using merb and merb-assets (w/ my latest merb patch), nginx and ruby-yui.

Step1 - Add version info to assets with merb-assets

In our code base we have a version for our site, set in a variable like WWW_VERSION.  Using this variable it is easy (with the newest merb-assets plugin) to modify the path of all of your assets on the fly.

Stick this in your init.rb...

1
2
3
4
5
6
7
8
9
10
11
12
 
WWW_VERSION = "0.1.0"
 
# this will make require_js "application"
 
# => /javascripts/application.0.1.0.js
 
# instead of /javascripts/application.js
 
Merb::Plugins.config[:asset_helpers][:js_suffix] = ".#{WWW_VERSION}"
 
Merb::Plugins.config[:asset_helpers][:css_suffix] = ".#{WWW_VERSION}"

 

At this point in time merb is going to start outputting modified paths to your assets that contain version numbers.  This is cool because now when we modify javascript or css and bump the version number it will cause the clients that have cached the static assets to redownload them since the file path is different.  The part that sucks is renaming a bunch of javascript and css files.

Step2 - Lying about file names

Renaming a bunch of files does suck!  So don't do it.  Instead have that sneaky russian Nginx lie about it for you.

Stick this in you nginx.conf...

1
2
3
4
5
6
7
8
9
10
 
location ~ ^/(javascripts|stylesheets) {
 
  rewrite ^/(javascripts|stylesheets)\/([^\d]+)(?:\.[0-9]+)*\.(js|css)$ /$1/$2.$3;
 
  expires max;
 
  break;
 
}

This rewrite rule will make nginx route any javascript/stylesheet to the original file if it contains a version number.  So a request like to '/javascripts/application.0.1.0.js' will be rewritten to '/javascripts/application.js'.  Nifty.

 

Step3 - Compress those assets

You can compress your assets in a number of ways, I'll go with shameless self promotion and recommend RubyYUI.  RubyYUI is a ruby wrapper for the Java-based YUI  Compressor.  It lets you glob paths instead of doing one file at a time and add suffixes to files.  All sorts of things.

You can do something like this in a vlad or capistrano task during deployment.

1
2
3
4
5
6
7
8
9
10
 
require 'rubygems'
 
require 'ruby-yui'
 
# this will cause the files to be compressed in place
 
Yui.new("./public/javascripts",:stomp => true, :suffix => nil).compress
 
Yui.new("./public/stylesheets",:stomp => true, :suffix => nil, :type=>:css).compress

 

Now you have compressed assets in place in your deployed app and nginx will rewrite any versioned paths to your compressed files.  Bump your version number and all your clients will start getting the new compressed files.  Wee.

Post to Twitter Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

5Nov/0810

A Congratulations is in Order

Congratulations to everyone that voted against Same-Sex Marriage.  We won, now we can begin to live in a United States that oppresses people and condones hatred and inequality, I never dreamed I'd see the day, I'd say that Im the Ann Nixon Cooper of hatred.  </sarcasm>

Seriously though, I hope that everyone that voted to Eliminate Rights of Same-Sex couples realizes that we have taken the first step as a country in eliminating the rights of mankind in general.  Americans have been fighting inequality since we landed here, and now we've taken a giant step backwards.

Everyone that voted to Eliminate Rights of Same-Sex couples for the 'sake of the children', I hope you are ok with your children being taught in their history classes about how hateful and oppressive their parents were way back in 2008.

And please remember to spread the hate this holiday season.

Post to Twitter Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

10Oct/086

The Unified Independent Vote

There are a lot of Ron Paul supporters that are left without a candidate to vote for this November. A lot of people think you can just write Paul in, well you can't in most state (if any). Instead look into other candidates besides the Dems and the GOP. Nader is running (when isn't he) and so is Chuck Baldwin, Bob Barr and Cynthia McKinney.

What I'd like to do is get as many people as possible that are frustrated with the 'lesser of two evils' voting practices to debate on the best independent candidate and then make a pact to vote for that candidate come November in one great unified independent vote.

Please spread this post if you are not planning on voting for Obama or McCain. Post your favored independent candidate and why as a comment on this blog. Come back November 4th before you vote and see who is in the lead. Let's all vote for whoever is most posted come November and unite to for a change in our broken election system.

Post to Twitter Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

5Oct/085

Bailout Signed into Law – Politics, dirty tricks.

I really just want to hear some people's opinions on my proposition.  Critique positively or negatively as you may.

People listed in the 'yea' columns need to lose their jobs next election.

Congressmen

Senators

I am generally not really into politics, but this bill has infuriated me.  I have seen lots of polls online about the number of Americans against this bailout, numbers range from 62% -> 80+%.  So many people against it, but we are doing it anyways [1, 2, 3, 4].  Not only are so many people against it, but it was shot down by the House only to be crammed back down the throats of the American people three days later with $100,000,000,000 in pork attached to it.

America, Uncle Sam, this is goddamn ridiculous.  We are treating our currency and the Federal Reserve like a whore, we continue to put out and put out and just ruin the value of our currency and what America stands for.

We aren't talking about $700b dollars here, we are talking about $700,000,000,000 dollars, one obviously has more impact.  $700,000,000,000 dollars, that is $3,300 per American, if you count all of the children, it is estimated at $5,000 to $9,000 if you don't.

My favorite part is that this is the 'only solution.'  Some politicians and a majority of citizens believe it will only do more harm to our failing economy, and does not address the true problems.

So what do you do when their is nothing you can do.  American's yelled, we wrote congress, the senate, state representatives and we were ignored.  What's the point of having a vote if it doesn't get counted.

What is the point of all of this?  I was thinking, if this money 'has to' be put into the economy at the expense of American tax payers, why not offer an optional solution that could benefit the people as well, and still help the economy.

The first thing to do is calculate the cost to a household.  Since this is going to be costing tax payers for generations to come, count your children.  I'll use my wife and I for the example.  Two of us, no kids, at $3,300 dollars each comes to $6,600.  Instead of our $6,600 going to people who have already poorly invested the money given to them, give the $6,600 to us.  We are going to pay for it in the long run.  Think of it as an interest free loan from yourself.

If the US 'has to' print/borrow this money and pump it back into the economy, give it to the people, with restrictions of course.  Each household would receive one of the following investment packages based on personal preference or financial situation.

* Mortage Assistance - If you have a mortgage that is not 'toxic' your contribution to the economy (number of people in your household times $3,300) is applied directly to your mortgage.  Banks that were less risky and were not shuffling toxic debt around will receive a vast amount of funds, banks that were irresponsible with their lending would receive less funds.  Either way, homeowners will be X amount of dollars closer to paying off their home.

* Stock Investment - If you have a toxic mortgage or are not a home owner, you would have the ability to select from pre-packaged stock investments.  These investments would be packages with low, medium or high levels of risk depending on your personal choice.  The packages would consist of the banks in trouble as well as other stocks to balance out risk.  Again, as a household you would get X amount of dollars to invest in the market.  The DOW would start to recuperate, the stock market would get billions of dollars pumped into it, and the American people would have the potential to even make profit off of their interest free loan.

* Retirement - If you already own your home, or don't have a mortgage and are not fond of the stock market, the third option would be to have your contribution added to your 401k or IRA.  Just like the stock market option this money would begin to be dispersed into corporations and banks via money market accounts or stocks that are backing the retirement package.  It would also offer citizens concerned about their retirement some additional security.

There are obviously details that would have to be worked out for this to work, but there are details that have to be worked out for giving $700,000,000,000 to a group of people that irresponsibly destroyed the US economy for their own benefit.

The bill has already been passed, but it may not be too late to find a better way to invest the money into America's failing economy without it being a complete burden on the tax payer.  If you found any logic in this, please write the Congress, the Senate and your State Representatives and say, "We don't agree with the bailout, but if we have to do it, let's try to do it right, honesty and fair."  Three things that haven't been done in a long time.

Post to Twitter Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon