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.
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.
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
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... %>
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
Tuesday, November 24, 2009
PAN = FOA
At NIH when you look at a grant they all have a Program Announcement number (PA). When you go to grants.gov they ask for the Funding Opportunity Announcement number (FOA). The first test of eligibility to apply for the grant is to realize that they both mean the same thing...
Wednesday, November 11, 2009
Running a script from the regular python shell
regular python shell: execfile('myscript.py')
ipython: run myscript.py
: run -i myscript.py (if you want the script to have access to the workspace variables)
ipython: run myscript.py
: run -i myscript.py (if you want the script to have access to the workspace variables)
Tuesday, November 10, 2009
Comparison on neural network simulators
A tabular wiki page of GPLd or otherwise open source code that can be used to run neural network simulations.
Notable among them is Brian, which is written in Python. The venerable NEURON also has hooks into python.
Notable among them is Brian, which is written in Python. The venerable NEURON also has hooks into python.
Tuesday, November 3, 2009
affixa = the new gattach
gattach was a handy tool to use for webmail clients like gmail. I couldn't find it anymore, but then from this discussion I found out that gattach is now affixa.
Subscribe to:
Posts (Atom)