space, → | next slide |
← | previous slide |
d | debug mode |
## <ret> | go to slide # |
c | table of contents (vi) |
f | toggle footer |
r | reload slides |
z | toggle help (this) |
class ConfigurationFacade
def method_missing(name, *args, &block)
@config[name.to_s]
end
def capital_investment
@config["capital_investment"].present?
? @config["capital_investment"]
: 0
end
end
class AgingReportView
def view
@table_model = ReadOnlyTableModel.new
@aging = JTable.new(@table_model)
@aging.row_selection_allowed = false
@aging.cell_selection_enabled = true
end
end
def invoke_later(&block)
if javax.swing.SwingUtilities.
is_event_dispatch_thread
block.call
else
...
end
end
SwingUtilities.invoke_later(Runnable.impl do
begin
block.call
rescue Exception => ex
puts ex.message
puts ex.backtrace.join("\n")
end
end)
def add_row(row)
invoke_later do
@table_model.add_row row.to_java
end
end
def clear_rows
invoke_later do
@table_model.clear
end
end
credit Torquebox website
run
methodjobs
key in torquebox.yml
TorqueBox::Messaging::Backgroundable
foo.bar
synchronouslyfoo.background.bar
asynchronouslyon_message
methodTorqueBox::Messaging
messaging
key in torquebox.yml
config.cache_store = :torque_box_store
class Processor < TorqueBox::Messaging::MessageProcessor
always_background :send_thanks_email
def on_message(msg)
thing = Thing.create(:name => msg)
inject('/queues/post-process').publish(thing.id)
send_thanks_email(thing)
# raise "rollback everything"
end
end
User.transaction do
User.create(:username => 'Kotori')
User.transaction do
User.create(:username => 'Nemu')
raise ActiveRecord::Rollback
end
end
TorqueBox.transaction do
User.transaction do
User.create(:username => 'Kotori')
User.transaction do
User.create(:username => 'Nemu')
raise ActiveRecord::Rollback
end
end
end
>> rake torquebox:archive
=> knob
export JAVA_OPTS="-d32"