Could not find generator jquery:install

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem
When you try to replace prototype with jquery in your Rails 3.0.x application, by using the command described in the Agile Web development book:

rails generate jquery:install --ui --force

you get the following error:

Could not find generator jquery:install

Solution
You would need to follow the steps below:

  1. Add gem “jquery-rails”, “~> 1.0.13” in your Gemfile, and run bundle install
  2. run the command described above: rails generate jquery:install –ui –force

Now you should be able to see something like:

remove public/javascripts/prototype.js
remove public/javascripts/effects.js
remove public/javascripts/dragdrop.js
remove public/javascripts/controls.js
copying jQuery (1.6.2)
create public/javascripts/jquery.js
create public/javascripts/jquery.min.js
copying jQuery UI (1.8.14)
create public/javascripts/jquery-ui.js
create public/javascripts/jquery-ui.min.js
copying jQuery UJS adapter (cd619d)
remove public/javascripts/rails.js
create public/javascripts/jquery_ujs.js

Formatting edit field values in a Rails edit view

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem
You have an edit form that displays a value in a format (ie dates) that you want to modify by using a helper method (ie display_datetime).

Solution
According to the suggestion here, you can use the following in your view:

<%= f.text_field :date_field_to_format, :value => display_datetime(f.object.date_field_to_format) %>

SL4Ar4 crashing after installation

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem
After installing SL4A_r4 (Scripting Layer for Android), on your Android phone, and before installing any interpreters every time you start your SL4A app, it keeps crashing after a few seconds.

Solution
If you install an interpreter (ie JRuby), then the application stops crashing.
You would need to be quick to start the installation before the application crashes, by doing the following:

Settings -> View -> Interpreters -> Settings -> Add and then select the interpreter you would like.

/lib/libz.so.1: no version information available

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem
You are following the steps described in the book ‘Hello, Android’, but when you try to change the interface in section 3.3 ‘Creating the Opening Screen’, and try to run the application in either the emulator or the phone you get the following error message in the eclipse console:
/lib/libz.so.1: no version information available...

Solution
You will need to make sure that you add the needed strings, i.e (main_title, continue_label, new_game_label, about_label and exit_label) in the Sudoku/values/strings.xml file, which is described in page 51, but is not clear that you have to do that before running the app. So your strings.xml file should look like:

<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Sudoku</string>
<string name="main_title">Android Sudoku</string>
<string name="continue_label">Continue</string>
<string name="new_game_label">New Game</string>
<string name="about_label">About</string>
<string name="exit_label">Exit</string>
</resources>