How to stop webrick from the command line
Rails, Ruby 2 Comments »To create a bash file to stop webrick.
In a terminal type gedit stopWebrick and add the following to the contents of the file and save it. Give the file execute permission with chmod of using the file properties in nautilus.
#!/bin/bash
kill -9 `ps -o pid,cmd –no-heading -p $(pgrep ruby) | grep script/server | awk ‘{print $1}’`
This will kill the first ruby process it finds running as script/srever
Run it as needed.
UserSumChallenge Module
Rails, Ruby 1 Comment »The following module is my first ever Ruby/Rails Module.

The UserChallenge module will create a simple random sum, that can be prompted to the user for solving as part as your authentication scheme during a registration process.
Simply create an instance of UserSumChallenge or UserSumImageChallenge and store against the user session. If you use the image challenge, call render to create the image otherwise just add the question attribute to your output.
|
Here is a simple controller that uses a ImageChallenge. Notice the background being supplied to the render method
class MainController < ApplicationController require "UserChallenge" def welcome @challenge = UserChallenge::UserSumImageChallenge.new session["uc"] = @challenge end def image storePath = "/home/user/path" filename = storePath + "/Camouflage.png" challenge = session["uc"] session["uc"] = nil send_data challenge.render(filename), :filename => "confirm.png", :type => 'image/png', :disposition => 'inline' end end
Installing Ruby and rails on Ubuntu Feisty
Rails, Ruby 1 Comment »
Found these instructions at http://www.aptana.com/forums/viewtopic.php?p=10640
Blogging to ensure I have a copy, credits go to janmartin.
Lets start with a fresh Ubuntu Feisty Fawn 7.04 installation:
- sudo apt-get install build-essential
- sudo apt-get install sun-java6-jdk
- sudo update-java-alternatives –list
- sudo apt-get install ruby irb ri rake rdoc ruby1.8-dev rubygems
- sudo apt-get install libmysql-ruby mysql-server
- sudo gem update –system
- sudo gem install rails –include-dependencies
Some tests:
- ruby –version
- rails –version
- mysql –version
- gem list
END of command line installation
Download
Aptana + Rails (Linux).
Extract it into ~/aptana
Follow these instructions:
# Open up Aptana, and Navigate to the Help > Software Updates > Find and Install menu.
# Select “Search for new features to install”, click “Finish”
# Select “Ruby on Rails Development Environment”, click “Finish”
# Select the Ruby on Rails Development Environment feature.
# Continue through the dialog boxes until complete.
Follow these instructions:
http://www.aptana.com/forums/viewtopic.php?t=1397
Configure:
Menu -> Window -> Preferences
Rails -> Configuration
Rails path: /usr/bin/rails
Rake path: /usr/bin/rake
Ruby
Installed interpreters:
/usr
Ri/rdoc
RDoc path:/usr/bin/rdoc
Ri path: /usr/bin/ri
Finished!
Powered by ScribeFire.
Recent Comments