Monday, June 8, 2009

The Sims 3 doesn't run (Application Error 0xc0000135)


Having problems getting your install of The Sims 3 to run? I couldn't find any help on their support page. If your local drive was installed as a different letter than C: , you may have luck running the application directly by double clicking the game executable instead of the launcher.

Found mine installed at:

I:\Program Files (x86)\Electronic Arts\The Sims 3\Game\Bin\TS3.exe

Make a shortcut while you're there

Monday, March 23, 2009

Fisheries provide insight into how to stabilize the economy

A few days ago I was reading through my backlog of dead-tree Scientific Americans and I came across an interesting article tucked in the back. It's essentially a summary of a study conducted by George Sugihara, a mathematician and theoretical ecologist at the Scripps Institution of Oceanography. The study supports the idea that the best way to manage fisheries is not to throw back the small fish, as is currently done, but throw back the big ones. I have believed this same theory for a long time, because we don't want to put an evolutionary pressure on the system to produce smaller individuals, but the article provides evidence that the effects are more immediate and extreme than evolutionary processes alone would produce:

Imagine, Sugihara says, a 500-pound fish in an aquarium. Feed it more, and it gets fatter. Feed it less, and it gets thinner. The population (of one) is stable. But put 1,000 half-pound fish in that aquarium, and food shortages could result in the deaths of hundreds, because the small fry have less stored body fat—and therefore cannot ride out a short famine. Food abundance does not necessarily mean all the fish get bigger, either; it could en­courage reproduction and a population boom—which might in turn overwhelm the food supply and lead to another bust. It is an unstable system. “That’s the reality of fisheries, of economies, of a lot of natural systems,” Sugihara says.


Another researcher actually reproduced this effect in fish tanks. Over five generations, David Conover of Stony Brook University harvested large fish from his tanks, and then discovered that the population had a smaller average size. That should come as no surprise.

This idea is very obviously applicable to economics, which is widely regarded as a chaotic system (though to be fair, there is still some debate on that point), and the article makes mention of that many times, even noting that the chaotic systems of fisheries are so like financial networks that Deutsche Bank hired Sugihara for a time. The article does not expand on this connection as much as I would have liked, but even so, this study can be seen as evidence in favor of the idea that penalizing the big players for their success leads to both a less stable economy and a smaller average size. It's open to debate as to what the correct analogy with the economy is (fish as individuals or corporations, for example), but the specific analogy doesn't matter when we're talking about the broad trends of this class of mathematical system. I don't think anyone thinks those two outcomes are desirable, regardless of their ideology. I'd hesitate to say that it's actually evidence in support of trickle-down economic theories without some more direct information, but it is very plainly evidence against punishing the successful and rewarding the unsuccessful. That shouldn't come as any surprise either.

Saturday, March 14, 2009

Chocolate Peanut Butter Pi


CHOCOLATE PEANUT BUTTER PIE 

1 9" oreo cookie pie crust
8 oz. softened cream cheese
1 cup. granulated sugar
1 cup. Reese's creamy peanut butter 
2 tbsp. melted butter
1 cup. whip cream
1 tbsp. vanilla

TOPPING:

4 oz. Giradehli dark chocolate
2 tbsp. butter
2 tbsp. olive oil
4 chopped Reese's Crunchy Bars

Whip cream cheese until fluffy. Slowly add sugar, peanut butter and butter. In another bowl, whip cream and vanilla until firm. Blend 1/3 of whipped cream into peanut butter mixture. Fold peanut butter mixture into remaining whipped cream until thoroughly incorporated. Fill pie crust, smoothing top. Chill.

Combine chocolate, butter and oil in top of double boiler until chocolate melts. Cool slightly. Spread chocolate on cooled peanut butter filling. Start at center and work out. Sprinkle top with chopped candy, chill pie thoroughly. Serves 12.


based off the recipe at http://www.cooks.com/rec/view/0,1928,157183-248200,00.html

Monday, December 1, 2008

HOWTO: Make the perfect office mocha

First off I'm not going to get into the discussion of what a "mocha" is. If you are going to go all high brow on me and start complaining that there is no espresso in this drink then just go away now, this post is not for you.


These are desperate times with limited low quality supplies, and our goal is to make the best tasting chocolate flavored coffee beverage possible from what we can scrounge from the break room.

Ingredients:
  • Coffee
  • Hot Chocolate Mix
  • Half and Half
Preparation:
  • Begin preparing a new batch of "delicious" Newport coffee. 
  • Empty the Smiss Miss hot Chocolate powder (make sure you get the one with sugar, not the "No sugar added" stuff) into the styrofoam cup.
  • Add five (5), no more no less, of the Mini Moo's Half and Half to the hot chocolate mix
  • Stir mixture with a red coffee stirrer until well combined.
  • Add freshly brewed coffee to fill the cup and stir to mix.
Notes:
  • DO NOT use the white coffee stirrers, they are too weak and will bend and frustrate you. I reccomend using two white stirrers held together if a red one can not be found.
  • DO experiment with different flavors of coffee. The hazelnut blend tastes great with the chocolate flavor.
  • DO NOT use any more or less than 5 of those little tubs of Half and Half. 5 tubs is the perfect amount.
  • DO NOT put the coffee in the cup first, it is too dificult to mix the cocoa powder evenly, and you lose out on the foam created when you mix it beforehand.

Pictures to come when I get around to bringing my camera into work.

Tuesday, September 2, 2008

Google Chrome overlooks one small security flaw

The release of Google Chrome today, the new open source browser by Google today has the whole internet talking. If you want an exhasutive review you can look elsewhere, everyone has it covered.


One thing I haven't seen discussed anywhere is the lack of the ability to secure my stored passwords. I often let other people just my laptop to check the internet, and while I would trust almost everyone I give access to, I still feel unsecure when all of my passwords can be revealed to someone with just a few simple clicks.

Google Chrome - Show Saved Passwords

What they did get right is that (at least for Gmail) the browser doesn't attempt to store my password until I successfully log in, so I no longer have 2 or 3 incorrect credentials in every login box.

It's a simple fix that the Google engineerers overlooked and hopefully will be released in the next iteration.

Monday, August 4, 2008

Inheriting before_filters and naming collisions

I've been using Ruby on Rails on and off now for over a year for different kinds of projects. It's great for a quick prototype or creating simple web applications, but there is so much "rails magic" that goes on behind the scenes that I doubt anyone really knows how Rails works.

As a programmer, I like to know how every part of my application works, especially when I need to debug a problem when something isn't working right.

When I started working today I updated my local copy to the head revision in the repo, and after I logged into our application, I was redirected to the edit user page (this was expected), but I was shown the error "Couldn't find User without an ID". As I continued to play around, I noticed that logging in worked fine until I went to a page handled by my Users controller.

The only change since the update in the users controller was in the login method:


class UsersController < ApplicationController
def login
session[:user] = nil
end
end
The addition of the single line in it was the only change, but it makes sense; when someone accesses the log in page, the current user should probably be logged out. Since this was the only change, I removed the line, and magically everything seemed to work again.

But why would this cause the session[:user] to be set to nil whenever I hit the Users Controller. The answer to that lies within my Application Controller which users a before_filter :login to make sure you are logged in before you can access anything in the site.

class ApplicationController < ActionController::Base
before_filter :login

def login
if !session[:user]
session[:previous_page] = request.request_uri
redirect_to "/users/login"
end

end
end p.s. Yes, I do irrationally hate the unless method :P


As it turns out, the before_filter is inherited by all of the subclasses of my Application Controller, which is all of them. This allows the before_filter to be called no matter which controller is hit.

However, since I also have a login method in my Users Controller, a naming collision occurred and whenever I accessed the Users Controller, the login method (the one in the Users Controller) would be called. This would clear session[:user], which is what caused the errors.

My first step in solving the problem was to rename the login method in my Application controller

class ApplicationController < ActionController::Base
before_filter :check_user_logged_in

def check_user_logged_in
if !session[:user]
session[:previous_page] = request.request_uri
redirect_to "/users/login"
end

end
end

This should stop the naming collision, but it also caused a new error for me; I would go into an infinite redirect loop when I would go to the log in page. The application would check to see if a user was logged in, which there was not, and redirect to the login page. Before loading the login page, the filter was called again, and the same result happened ad infinitum.

The solution to this problem was to add a skip_before_filter to my Users controller, which would override the before filter in the Application controller so it would not be called.

class UsersController < ApplicationController
skip_before_filter :check_user_logged_in, :only => ["login", "authenticate"]

def login
session[:user] = nil
end

def authenticate
#code for handling user authentication went here
end


Now, when we access the login page, we still clear any logged in user, but the before_filter doesn't check for a logged in User when we go here, as well as when we go through the authenticate method.

This should fix the problems I was having, but with Rails theres always another mysterious bug lurking behind the great unknown.