Leopard i lookupd

enviat per Ramon Salvadó el divendres 23 de Novembre del 2007 a les 08:49 hores

De vegades ens interessa refrescar el “caché” de dns per exemple quan modifiquem el fitxer /etc/hosts, per a fer-ho en leopard:

1
2
# El que abans era: lookupd -flushcache
dscacheutil -flushcache

Segons el man:

dscacheutil does various operations against the Directory Service cache including gathering statistics, initiating lookups, inspection, cache flush, etc. This tool replaces most of the functionality of the lookupd tool previously available in the OS.

Rutes a la consola

enviat per Ramon Salvadó el dilluns 19 de Novembre del 2007 a les 12:10 hores

Per a depurar les rutes mitjançant la consola de Rails:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
$ script/console
Loading development environment.
# Carreguem la definició de les rutes
>> rs = ActionController::Routing::Routes
=> #<actioncontroller::routing::routeset:0x61d76c>> puts rs.routes
ANY    /feed/suggest/                           {:action=>"suggest", :controller=>"public"}
ANY    /feed/thanks/                            {:action=>"thanks", :controller=>"public"}
ANY    /:page/                                  {:action=>"index", :controller=>"public"}
ANY    /:controller/:action/:id.:format/        {}
ANY    /:controller/:action/:id/                {}
=> nil
# Reconeixement de rutes
>> rs.recognize_path "/feed"
=> {:action=>"index", :page=>"feed", :controller=>"public"}
>> rs.recognize_path "/feed/thanks"
=> {:action=>"thanks", :controller=>"public"}
>> rs.generate :controller => :public, :page => 2
=> "/2"
# Per a testejar rutes de controladors inexistents
>> ActionController::Routing.use_controllers! [ "undefined", "test" ]
=> ["undefined", "test"]
>> load "config/routes.rb"
=> []
>> rs.recognize_path "/undefined/show/1"
=> {:action=>"show", :id=>"1", :controller=>"undefined"}