Wednesday, November 24, 2010

Ejabberd restore

You may get the following error when you use ejabberdctl to restore an ejabberd database.

Problem 'error {case_clause,{aborted,eacces}}' occurred executing the command.
Stacktrace: [{ejabberd_admin,restore_mnesia,1},
             {ejabberd_ctl,call_command,3},
             {ejabberd_ctl,try_call_command,3},
             {ejabberd_ctl,process2,3},
             {ejabberd_ctl,process,1},
             {rpc,'-handle_call/3-fun-0-',5}]

The fix is to make the backup file and all the directories to it readable to everybody.

I hope this helps :)

Thursday, June 24, 2010

AWS Load Balancer glitches

There is one situation in which an Amazon Web Services Elastic Load Balancer can generate errors in the browser. In my experience this happens when you add instances in different availability zones AND you use SSL in addition to regular http. The ELB keeps track of the instances being added to the queue as it should. In addition to the instances the ELB also keeps track of their availability zones.

Start with an ELB with one instance and add a second instance in a second availability zone.  In the AWS Console you will see two instances and two availability zones.

Let's remove now one of the instances from the ELB. In this case in the AWS Console you will see that there is just one instance available but there are two availability zones. If you have a tool to monitor your site you will start getting access errors on the SSL URL.

The fix is simply to remove the bad availability zone from the ELB.

I hope this helps,

Marius

Thursday, April 15, 2010

RightHere

Here is my first iPad experiment: one small PhoneGap application that allows one to write and execute html+javascript code right on the iPad. A long way to self hosted development :)

The github project is here: http://github.com/decodeideas/RightHere

An example is here. The top left textarea contains the code, it is executed when you hit Run.

The code in this example:
<input type="button" id="hello" value="Hello World">
<script>x$("hello").click(function(){
alert("hello world")})</script>


Thursday, March 25, 2010

EC2 key not found, yet another possible reason

You may get the following error on EC2 when trying to start a new instance.
Client.InvalidKeyPair.NotFound: The key pair 'some-name' does not exist

This may be due to multiple reasons such as you did not generate the key (I use the AWS console nowadays for this) or you have a typo somewhere. One other possible failure is that you picked the wrong availability zone. There is no key sharing between the 3 Amazon zones US West, US East and EU West.

Hope this helps,

Marius

Monday, March 22, 2010

RubyMine cannot find rubygems

Sometimes RubyMine seems to be totally lost and cannot find critical gems including rubygems. Using tools like rvm generally complicate things.

The issue is that the command line environment is different from the application one, specially on OS X. One of the easy fix is to run RubyMine from the command line, for example

/Applications/RubyMine/Contents/MacOS/rubymine


This tip is from the jetbrain support team on their discussion group.

Sunday, March 21, 2010

Grails can't convert ID

If you are getting the following error it may be because you are sending a value that cannot be converted to a long.

Provided id of the wrong type for class com.aaa.Bbbb. Expected: class java.lang.Long, got class java.lang.String


For example this may be caused by the user selecting an option from a html <select> with a missing value attribute.

Friday, January 8, 2010

Enable slow log on amazon rds


rds-create-db-parameter-group primary --description primary --engine MySql5.1
rds-modify-db-parameter-group primary --parameters "name=slow_query_log, value=true, method=immediate"
rds-modify-db-instance YOUR_INSTANCE --db-parameter-group-name primary

Saturday, November 21, 2009

Deploying rails assets to the Amazon CDN

Rails uses a ?timestamp in the URL for cache busting. Together with an expired header in the far future this allows you to get the maximum benefits out of browser caching.

Unfortunately this scheme does not seem to work on the Amazon CDN. I just contributed some changes to the Asset Packager that allow you to better use assets on the CDN

http://github.com/decodeideas/asset_packager

Saturday, November 7, 2009

ec2_upload_bundle and ruby 1.9: can't convert Fixnum into String

The following applies to the following scenari

- ubuntu karmic, ec2 ami
- ruby 1.9.2 installed as /usr/bin/ruby
- the latest ec2 tools

When you use ec2_upload_bundle to re-bundle an AMI that you modified you will get the error

ERROR: can't convert Fixnum into String


The trick to debug this is to pass --debug to the ec2 commands. The fix is on
line 19 of /usr/lib/ec2-ami-tools/lib/ec2/amitools/util.rb
you need to change ?A to ?A.ord to get this line:

(0..19).inject("") {|ident, n| ident+(?A.ord + Kernel.rand(26)).chr}


Before doing the change you can reproduce the problem with

ruby1.9 -r /usr/lib/ec2-ami-tools/lib/ec2/amitools/util -e 'puts
gen_ident'


After applying the patch you should get a short sequence of random
letters.

Friday, November 6, 2009

Plugin not found with ruby 1.9, rails 2.3.4

When using rails 2.3.4 with ruby 1.9.1 you cannot install plugins from git. You will get an error like the following:

script/plugin install git://github.com/giraffesoft/resource_controller.git
Plugin not found: ["git://github.com/giraffesoft/resource_controller.git"]


The simplest workaround is to use ruby 1.8 to run the above. On Snow Leopard you have it very likely as /usr/bin/ruby, so you can do

/usr/bin/ruby script/plugin install git://github.com/giraffesoft/resource_controller.git


On Ubuntu you probably have it as ruby1.8.