Well, the right click (alt fire) on the suppressed pistol activates some magic device that can temporarily knock out a light - for about 10s or so. Why did I have to search on the internet and track down vague clues until I hit this page and found out for sure? Shouldn't there be a manual somewhere? UPDATE: I gotta read the notes on the equipment screen more carefully...
UPDATE2: The manual is useful. Save trees/animal skins, don't print it out.
Sunday, December 6, 2009
Friday, December 4, 2009
Max os x service start up : StartupItem
A good guide is available here
File: /Library/StartupItems/RRiki/StartupParameters.plist:
File: /Library/StartupItems/RRiki/RRiki
To manipulate the service:
File: /Library/StartupItems/RRiki/StartupParameters.plist:
{
Description = "RRiki server";
Provides = ("RRiki");
Uses = ("Ruby");
OrderPreference = "Last";
Messages =
{
start = "Starting RRiki server";
stop = "Stopping RRiki server";
restart = "Restarting RRiki server";
};
}File: /Library/StartupItems/RRiki/RRiki
#!/bin/sh
##
# RRiki service startup script
##
. /etc/rc.common
StartService ()
{
ConsoleMessage "Starting RRiki"
cd /Users/kghose/Source/Rriki2/
/usr/local/bin/thin start -eproduction -d
}
StopService ()
{
ConsoleMessage "Stopping RRiki"
cd /Users/kghose/Source/Rriki2/
/usr/local/bin/thin stop
}
RestartService ()
{
ConsoleMessage "Restarting RRiki"
cd /Users/kghose/Source/Rriki2/
/usr/local/bin/thin restart -eproduction -d
}
RunService "$1"To manipulate the service:
sudo SystemStarter restart RRiki
Thursday, December 3, 2009
Moved from mongrel to thin
Now using thin rather than mongrel. Seems to be fast and responsive and most importantly installs without errors.
Labels:
ruby on rails
Calling an action when a selection box changes
in partial (view)
changing the select will call the action select_item_in_history with params['history_sel'] set to the selected value.
<%= select('history', 'sel', history_list, {:selected => selected}, {:class => 'historyselect'}) %>
<%= link_to_remote 'x',
:url => {:controller => 'rriki',
:action => 'clear_history'},
:html => {:title => 'Clear history'},
:method => :get %>
<%= observe_field 'history_sel',
:url => {:controller => 'rriki',
:action => 'select_item_in_history'},
:with => 'history_sel' %>changing the select will call the action select_item_in_history with params['history_sel'] set to the selected value.
Labels:
ruby on rails
Testing to see if a variable exists in ruby
Partials can take parameters (called locals), but can crash your app if a caller does not pass a local and you try and access it in the partial. You can use the following construct to initialize a variable if it does not exist
where
var = nil unless defined?varwhere
var is your variable
Labels:
ruby on rails
Rails: Debugging form helpers generated with remote calls (AJAX)
When parts of a webpage are updated using AJAX calls (e.g remote functions) these updated parts do not show up when you ask Firefox for the webpage html (using CTRL+U). A hack to see the generated html from a suspect rails call is to simply print out the html on the webpage instead of executing it by doing:
<%=h ...rails command... %> Instead of<%= ...rails command... %>
Labels:
debugging,
firefox,
ruby on rails
html_options for rails select tag
I had a select tag that I wanted to mess with a little to apply some styles etc. to. The select tag has an html_options hash and I was trying to use that. My initial attempt was
This is not python, and even though the rails docs setout the syntax as:
ruby can not accept keyword arguments. Only positional, so you have to do:
The empty braces signify the empty 'options' argument, and the next set of braces signify the html_options hash
select('history', 'sel', history_list, html_options => {:class => 'historyselect'}) WRONGThis is not python, and even though the rails docs setout the syntax as:
select(object, method, choices, options = {}, html_options = {})ruby can not accept keyword arguments. Only positional, so you have to do:
select('history', 'sel', history_list, {}, {:class => 'historyselect'})The empty braces signify the empty 'options' argument, and the next set of braces signify the html_options hash
Labels:
gotcha,
ruby on rails
Subscribe to:
Posts (Atom)