About ruby on rails, hackintosh, iphone3g and etc.

Thursday, December 3, 2009

Enable Multiple Buttons in a Form in Rails

Sometimes we need more than one button in the form. To do so in Ruby On Rails, we have to do the following:

Create a method in the controller to accept the form input
e.g

def approve_form
case params[:submit]
when "Approve"
redirect_to :action=>"approve"
return
when "Reject"
redirect_to :action=>"reject"
return
end
end


in your form, do this

Wednesday, December 2, 2009

link_to popup error in IE

If you encounter problems that the popup does not appear in link_to function in IE browser, below will solve your problem.

Make sure there is no space between the names of the window

e.g.

link_to "View This Image", :action=>:show_image, :popup=>['window_name', 'height=300,width=300']

window_name should not have spaces.

Thursday, November 19, 2009

Rails Model Generate and Destroy

Sometimes for beginner's to Rails, generating model and not knowing how to delete or remove the unwanted model.

To generate a model called cart:

script/generate model cart

To remove this model called cart:

script/destroy model cart


Tuesday, November 17, 2009

Cannot install rails. Set that proxy.

If you are installing gems or rails over a proxy, you may encounter the following problems.

Remember to set your proxy first as below:

In Windows:
gem install rails
ERROR: http://gems.rubyforge.org/ does not appear to be a repository

Before we begin, if you are behind a proxy, open the command prompt and give the following command:

 >Set HTTP_PROXY=http://:

For example, if the address of the proxy server is 192.168.1.1 and the port number is 9090, then you would have to give the following at the command prompt:

 >set HTTP_PROXY=http://192.168.1.1:9090 

Next, give the following command at the prompt:

 >gem update

Monday, October 19, 2009

Cannot Remove WD SmartWare. Disable It.


Here’s another way to keep the virtual CD volume from mounting (tested on Leopard):

1. Connect the new WD My Passport or other drive “infected” with this firmware
2. Open a Terminal and type something like:

diskutil info “/Volumes/WD SmartWare”

(this corresponds to the volume you want to get rid of)

3. Copy the large string of numbers that corresponds to “Volume UUID:” in the info.
4. Edit /etc/fstab as root using vifs:

EDITOR=nano sudo vifs

(if you want your usual editor, drop the “EDITOR=nano” part)

5. Add a line like the following, putting your UUID in from step 3:

UUID=that_big_number_from_step_3 none hfs ro,noauto 0 0

6. Save the file to quit out of vifs
7. Disconnect the My Passport and attempt to plug it back in and watch!

It’s a bit more involved than DSW, but you only have to do it once and the virtual CD volume won’t remount. WD really need to issue a firmware update that removes this virtual drive. At least give some of us the option of not having it!

Thursday, October 15, 2009

Text mode in browser

Found an interesting service called viewtextmode.com. It is a bookmarklet based service which will strip out all images, embedded contents and others leaving only text on the page. Clean and clear. This makes easier to read blog post as well as follow up on news.

Here is the url:

Need to register to start to use the service.

Wednesday, October 7, 2009

The terminal server has exceeded maximum number of allowed connection, mstsc


  • Open Command Prompt.
  • Type: "mstsc /admin".
  • Remote Desktop Connection will start. Type the computer name or IP address of the computer you want to connect to in the Computer box.
  • Configure any other desired options, and then click Connect.