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.
A blog about computer and electronics projects to make life just that little bit sweeter.
Sunday, January 2, 2011
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.
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:
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.
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
);
Sunday, September 19, 2010
First Brew tasting
After purchasing a better bottle capper and re-sugaring the bottles (and waiting about 2 weeks) - Tasting time!
So bearing in mind that it was a bare bones homebrew kit (no dry malt extract - DME, hops etc.) it tasted like a slightly carbonated malty cordial with a slight apple aftertaste. I'd give it a 2 out of 10. Alcohol content really isn't a concern for me, it's all about flavour. But I would estimate about 4% due to some unreliable gravity readings.
The lessons learnt from this brew are:
- Don't skimp on a bottle capper - buy a good one!
- Dextrose is good but still gives a slightly appley after taste.
- No DME makes a fairly body-less beer.
- Thoroughly wash and dry the bottles after bottling and muck on the outside will cause mold.
So I'll report back with the results :)
Saturday, September 11, 2010
Google AI Comp
I'm entering the Google AI comp again this time - looking forward to challenge and aiming for a top ten result. Halla tummarna :)
For starters I'll get a basic bot then explore a few more advanced techniques. Watch this space.
For starters I'll get a basic bot then explore a few more advanced techniques. Watch this space.
Subscribe to:
Posts (Atom)