Tuesday, July 12, 2011

Enable the location bar in nautilus ubuntu's file browser.

The more and more I sit with Ubuntu I find myself in gconf-editor doing things, whether it's adding the week to the time (handy in European workplaces), making the minimize maximize and close buttons sit in the correct corner with the correct order, or in this case get that location bar back.

So the steps:

$ gconf-editor

apps->nautilus->preferences->always_use_location_entry

You could do this in one line, but I'm sure there's a few other things in gconf-editor that will keep you busy.

Monday, July 11, 2011

BankID Ubuntu 10.04 64-bit

Ahhh the woes of a 64 bit machine bite again. I'm still Using Ubuntu 10.04 (I haven't seen anything worth upgrading for) so installing BankID isn't a problem as Swedbank's sucurity program has a Ubuntu distribution. But getting it to show up in Firefox is the step that they leave out of the instructions.

The missing line is:

$ nspluginwrapper -i /usr/local/lib/personal/libplugins.so

ns plugin wrapper wraps your 32 bit plugin so that your 64 bit machine can use it. After restarting your browser, in your Tools -> Addons -> Plugins you should see a Nexus entry which is your bank ID.

Now I don't need to switch back to windows for anything.

Thursday, June 16, 2011

Big Apple BBQ

Whilst in the US for a holiday we encountered the Big Apple BBQ Block Party. It was simply amazing. Two sides of Madison Square Park were filled with people barbequing, eating barbeque, and drooling while they queued for more barbeque.

After trying 3 bbq stands, I can far and away say that the the 17th Street Baby Back Ribs were the best thing I ate there. I think a whole lot of people agreed with me judging by the queue that had formed there on the second day of the event.

Since Sweden isn't known for it's barbeque, I thought I'd try and see if I could do ribs anything like the crew did on that day. I'm recording the recipe and lets hope I can get to it before winter sets in.

So this is what you need:

Ingredients


  • 1/2 cup paprika




  • 1/4 cup kosher salt, finely ground




  • 1/4 cup sugar




  • 2 tablespoons mustard powder




  • 1/4 cup chili powder




  • 1/4 cup ground cumin




  • 2 tablespoons ground black pepper




  • 1/4 cup granulated garlic




  • 2 tablespoons cayenne






  • Cooking Directions

    Mix all ingredients and store in a tightly covered container. To make it a little more hot and spicy, increase the mustard powder and black pepper to 1/2 cup each.
    Makes about 2 1/2 cups

    Ingredients


  • 1 cup ketchup (I use Hunt's)




  • 2/3 cup seasoned rice vinegar




  • 1/2 cup apple juice or cider




  • 1/4 cup apple cider vinegar




  • 1/2 cup packed brown sugar




  • 1/4 cup soy sauce or worcestershire sauce




  • 2 teaspoons prepared yellow mustard




  • 3/4 teaspoon garlic powder




  • 1/4 teaspoon ground white pepper




  • 1/4 teaspoon cayenne




  • 1/3 cup bacon bits, ground in a spice grinder




  • 1/3 cup peeled and grated apple




  • 1/3 cup grated onion




  • 2 teaspoons grated green bell pepper






  • Cooking Directions

    Combine the ketchup, rice vinegar, apple juice or cider, cider vinegar, brown sugar, soy sauce or worcestershire sauce, mustard, garlic powder, white pepper, cayenne, and bacon bits in a large saucepan. Bring to a boil over medium-high heat. Stir in the apple, onion, and bell pepper. Reduce the heat and simmer, uncovered, 10 to 15 minutes or until it thickens slightly. Stir it often. Allow to cool, then pour into sterilized glass bottles. A glass jar that used to contain mayonnaise or juice works real well. Refrigerate for up to 2 weeks.
    Makes 3 cups
    Variation: to make this sauce a little hotter, add more cayenne pepper to taste, approximately another 1/4 to 1/2 teaspoon. Be careful; a little cayenne goes a long way.


    This is how to cook them:

    People are mystified about how to cook ribs properly. I'm going to walk you through every step of the way as though you're using a basic charcoal grill. Obviously if you have different or more high-tech equipment, you'll need to modify these procedures. If you're setting up your backyard charcoal grill for indirect cooking, you'll want to use a disposable aluminum pan to capture the grease as the fat renders while cooking. Some people add water to this pan to add moisture to the cooking environment.
    Let me caution you right up front to mop the ribs with sauce no more than 10 minutes before you take them off the grill. Saucing the meat too early is a mistake many people make when smoking or grilling. Virtually all barbecue sauce contains sugar, and your meat will have a burned crust around the outside if you use sauce too soon in the process.
    Ribs are readily available in most grocery stores. When selecting ribs, try not to buy ones that weigh less than 2 pounds. A true baby back rib weighs about 1 1/4 to 1 1/2 pounds; they are very fragile and dry out quickly. This recipe calls for a meatier rib. A loin back rib is preferable; they're easier to cook, less fragile, and have more meat.
    Once you start smoking ribs, you can't leave the smoker unattended for any more than about 20 minutes. You'll need to continually check that the temperature in the grill remains between 200 and 210 degrees at all times. If it gets too hot, open the lid and allow some of the heat to escape. Coals that appear to be glowing red will cause a hot spot. Don't cook the ribs directly over the hot spot; move the ribs to a different, cooler part of the grill. If the temperature dips below 200 degrees, move the ribs to a hot spot for a while. If the temperature gets too low, add some more coals.
    You'll need about 4 cups of apple wood chips to be authentic; you can use hickory, pecan, sweet maple, or cherry, but the ribs won't taste as sweet. You'll also need a chimney starter or another small covered grill or bucket to keep extra hot coals.

    Note: this is all from Mike Mills.

    Ingredients


  • 4 racks of ribs (about 2 pounds each)



  • Magic Dust (click here for the recipe) or your favorite dry rub



  • 4 cups apple juice in a spray bottle



  • Apple City Barbecue Sauce (click here for the recipe) or your favorite barbecue sauce





  • Cooking Directions

    Trim any excess fat and remove the membrane from the back of the ribs.
    Sprinkle the ribs liberally with magic dust, coating both sides. Put them in a shallow pan or on a cookie sheet and cover them with clear plastic wrap or a lid. Refrigerate them until you're ready to use them. I recommend letting them marinate for at least an hour. At the restaurant, we dust the ribs up to a day in advance.
    Start your fire using royal oak charcoal.
    Soak the apple wood chips in water for half an hour. Drain.
    Remove the grate and arrange the medium-hot coals in a grill or smoker. If you are using a grill, it must have a lid. Set an aluminum pan next to the coals as a drip pan. Spread out the wet wood chips on the coals. Replace the rack, close the grill, and check the temperature. It should be between 200 and 210 degrees. If the temperature is too high, open the lid to allow some heat to escape.
    Notice that the meat on a rack of ribs is on the top. The bottom, where you removed the membrane, is called the "bone side." Once the temperature is steady, place the ribs on the rack, bone side down. You want to cook them bone side down as much as possible. Turning them dries out the meat. If necessary, you can cut the racks of ribs in half to comfortably fit your grill.
    Cover and smoke the ribs for about 4-6 hours or until the ribs are done and tender. This is not an exact science; we're not baking a cake.
    You'll want to check the ribs every 20 minutes or so. Examine them to see if the surface of the meat looks dry or moist. Ribs "sweat" about three times during the smoking process. The pores of the meat open, and this allows moisture to escape. This is when the seasoning from the dry rub and the smoke itself are reabsorbed into the meat. When they're sweating, mop or mist them with some apple juice and sprinkle them with a little more magic dust. Opening the lid will lower the temperature; add more coals and wood chips as needed to maintain the temperature.
    About 10 minutes before you remove the ribs from the pit, mop them with the sauce. When you take them off the pit, mop again with sauce and sprinkle some more magic dust on them. Serve immediately.
    Serves 4, or you can cut the racks in half to serve 8.
    Looking forward to trying all that - unfortunately I wont have the right grill, but we'll see what we can do.

    Sunday, January 2, 2011

    Rails 2.3.5 App adding Bundler on Heroku

    After staying up a little later than usual, I pushed the latest ASX value screener code to heroku - only for it to be rejected as now bundler was being used for everything. Bugger.

    If you are following the instructions on converting a 2.3.5 rails app to use bundler and you get an error like this:

    $ rake db:migrate --trace
    (in ...)
    ** Invoke db:migrate (first_time)
    ** Invoke environment (first_time)
    ** Execute environment
    rake aborted!
    uninitialized constant Rails::Boot::Bundler
    /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:105:in `const_missing'

    You have probably misspelt preinitialize.rb in your config directory. Correct it and ensure that it is added into your git and you will get rid of this error.

    Uploading to heroku was where the next trap lay in wait:

    $ git push heroku master
    Counting objects: 24, done.
    Delta compression using up to 2 threads.
    Compressing objects: 100% (17/17), done.
    Writing objects: 100% (17/17), 5.86 KiB, done.
    Total 17 (delta 12), reused 0 (delta 0)

    -----> Heroku receiving push
    -----> Rails app detected
    -----> Gemfile detected, running Bundler version 0.9.9
    -----> Bundler works best on the Bamboo stack.  Please migrate your app:
           http://docs.heroku.com/bamboo
           Unresolved dependencies detected; Installing...
           /usr/local/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line 2, col 8: `  specs:' (ArgumentError)
               from /usr/local/lib/ruby/1.8/yaml.rb:133:in `load'

    To avoid this, switch to the bamboo stack as recommended and bundler will work as expected.

    Eventually, site back up - off to bed.

    Sunday, December 19, 2010

    Value investing screener

    I needed a way to run a series of financial calculations over the entire Australian Stock Exchange (ASX).

    Conventional stock screeners allow you to order by a whole bunch of parameters, but not your own customized formulas.

    So I wrote a ASX value screener that focuses specifically on value investing. It consists of a calculator and a screener allowing you to calculate the future intrinsic value along the likes of Warren Buffett, Benjamin Graham and Australia's Roger Mongomerty.

    I had this as an excel spreadsheet at first, but I figured if I wanted it - maybe someone else would too. So I used Ruby on Rails with the hobo plugin and I was up and running in a few minutes.

    I spent a few months tidying up the design and getting user feedback, I'm pretty happy with the result. There's a small amount of traffic so I'm happy to keep the site up as it's regularly being used.

    Sunday, October 10, 2010

    Stu Bru 2

    Stu Bru 2 was a noticeable improvement over Stu Bru 1. It was an Coopers IPA kit with 500g of light DME, 300 grams of dextrose. The addition of the DME has certainly helped the body and even though the Golding hops aren't 100% to my taste, it's still a very pleasant beer.

    The head retention was good (if that matters at all). The flavour needs a little bit more personality, I'm hoping to use the Cascade hops to make the next version of this, and I'll up the bitterness too, it was a little tame for my tastebuds.

    The alcohol should be quite low but after having just 750ml, I noticed this has a fair bit of kick. So I'll be drinking these slowly.

    Here's a few photos from bottling:
    Beer and bottles
    Building up a sweat capping. Where are my 750ml bottles?
    At least now these bottles contain some flavour. What a pain to cap though.


    Voila! Putting them in containers in case they over-carbonate...aka explode.

    Hobo on Heroku

    Ok, this was an ordeal that I don't want to have to repeat. So here's how to get your Hobo 1.0.0 app up and running on Heroku.

    I'm not going over registering at Heroku or setting up Hobo. I'll presume that you are competent enough to do this yourself with the current guides on their respective sites.
    The basics for this post is Tom Locke's recipe at HoboCentral. Also note that the Heroku default server is Aspen (aspen-mri-1.8.6).

    So I set up a simple Hobo 1.0.0 app with 1 model. Using ruby 2.3.8, I can test on my app on the development server - no problems.

    You will need to add a .gems file in your root directory, that should have all the extra gems that you require. Heroku has a good set, but in order for completeness and futureproofing - add all the ones that you require. Mine looked like this (it will change by the end of this post):

    rails -v 2.3.8
    will_paginate --version 2.3.11
    hobosupport --version 1.0.0
    hobofields --version 1.0.0 --ignore-dependencies
    hobo --version 1.0.0 --ignore-dependencies

    When submitting this to heroku it doesn't start as:
    Missing the Rails 2.3.8 gem. Please `gem install -v=2.3.8 rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.

    I kept hitting this and there appears to be a problem with Heroku's server of choice 'thin' and hobo and 2.3.8 rails - it will not work with 2.3.8 - this means that you will have to roll back to 2.3.5 to get it up and running. I don't know enough about thin, all I know is that getting the thin gem and trying locally has the same error.

    After changing to 2.3.5 in config/environment.rb and .gems:

    rails -v 2.3.5
    pg --version 0.8.0
    will_paginate --version 2.3.11
    hobosupport --version 1.0.0
    hobofields --version 1.0.0 --ignore-dependencies
    hobo --version 1.0.0 --ignore-dependencies

    (I also added pg's gem not 100% sure that I need it, but I saw it on heroku's example)

    This gets you past the rails problems, only to hit:

    /config/initializers/cookie_verification_secret.rb:7: undefined method `cookie_verifier_secret=' for ActionController::Base:Class (NoMethodError)

    This seems to be a hobo version error, some new functionality that doesn't work in 2.3.5, my app doesn't require user protection, so I manually edited cookie_verification_secret.rb, commenting out that line.

    This is not an ideal solution (in fact I would just call it a hack), you would probably need to step back to an older version of Hobo, I'm hoping to look ahead to Hobo 1.3.x so I'm not worried about finding the correct old hobo version.

    Once I did this I was able to:
    heroku rake db:migrate

    ...and finally the app is up and running.

    Hope this helps someone.