This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$:.unshift File.join(File.dirname(__FILE__), "..", "lib") | |
require 'rubygems' | |
require 'sinatra' | |
get '/' do | |
haml :'comms/home' | |
end | |
get '/message_log/?' do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# use local copy of sinatra in ../../sinatra/lib/ | |
$:.unshift File.join(File.dirname(__FILE__), "..", "..", "sinatra", "lib") | |
require 'rubygems' | |
require 'sinatra' | |
get '/' do | |
"Hello World" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'main' | |
configure :development do | |
use Rack::Reloader, 0 | |
end | |
run Sinatra::Application |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "sinatra" | |
require "dm-core" | |
# get the database rolling. | |
DataMapper.setup(:default, :adapter => "sqlite3", :database => "test.sqlite3") | |
class Account | |
include DataMapper::Resource | |
storage_names[:default] = "accounts" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Test decoding of 10,000 messages of each type. | |
lantins@macpro:~/development/iris/iris_protocol$ ruby bench.rb | |
user system total real | |
TTU Sign On: 2.210000 0.460000 2.670000 ( 2.663857) | |
VAM Event: 2.400000 0.420000 2.820000 ( 2.826599) | |
Upload Request: 1.120000 0.230000 1.350000 ( 1.354911) | |
Unsolicited Message: 3.300000 0.970000 4.270000 ( 4.263633) | |
Software Version: 2.140000 0.390000 2.530000 ( 2.528167) | |
Health Check: 2.480000 0.460000 2.940000 ( 2.946636) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.all_for_select(customer = nil) | |
vehicles = self.filter(:customer_id => customer.id) | |
select_options = [nil => "-- VEHICLE SELECTION --"] | |
vehicles.each do |vehicle| | |
select_options << {vehicle.serial_number, vehicle.name} | |
end | |
return select_options | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# When a connection has identified it should let us know using this method. | |
# | |
# @param [IRIS::IPGateway::Connection] connection | |
# @param [String] serial_number serial number of the unit. | |
# @return [true, false] | |
def identified(connection, serial_number) | |
return false unless known_connection?(connection) | |
if @identified_connections.has_key?(serial_number) # check if we already have a connection for this serial number? | |
@identified_connections[serial_number].connection_stale! # close the stale connection. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ SWAP CODE COMMAND | |
21894 daemon 20 0 28304 17m 4204 S 0.0 3.5 0:00.62 10m 932 httpd | |
16595 daemon 20 0 28304 17m 4308 S 0.0 3.5 0:00.88 10m 932 httpd | |
16997 daemon 20 0 27828 16m 4252 S 0.0 3.4 0:00.34 10m 932 httpd | |
17011 daemon 20 0 27540 16m 4244 S 0.0 3.3 0:00.80 10m 932 httpd | |
16999 daemon 20 0 27536 16m 4112 S 0.0 3.3 0:00.48 10m 932 httpd | |
6893 root 20 0 20616 10m 4852 S 0.0 2.0 0:11.46 9.9m 932 httpd | |
17121 daemon 20 0 21012 9436 3472 S 0.0 1.8 0:00.04 11m 932 httpd | |
24539 daemon 20 0 21036 9308 3320 S 0.0 1.8 0:00.02 11m 932 httpd | |
24602 daemon 20 0 20996 9240 3296 S 0.0 1.8 0:00.00 11m 932 httpd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:development: &defaults | |
:adapter: postgres | |
:database: iris_comms_hub | |
:username: iris_comms_hub | |
:password: DEFAULTpassword | |
:host: 127.0.0.1 | |
:test: | |
<<: *defaults | |
:database: iris_comms_hub_test |