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.

Wednesday, October 6, 2010

JNI - where's the env->CallStringMethod?

It makes me cry. JNI is a necessary evil, but still evil.

Why isn't there some nice way to call a CallStringMethod? Especially when working with
Android's bundles, which have getString. It would make life a million times easier.


Anyway here's a workaround:

jstring my_java_string = (jstring)env->CallObjectMethod(bundle, myBundle.getString, env->NewStringUTF("test"));
if(
my_java_string == NULL){
// Error
return;
}
char*
my_c_string = strdup(env->GetStringUTFChars(my_java_string, 0));
env->ReleaseStringUTFChars(
my_java_string, my_c_string);