#!/usr/local/bin/ruby require 'rubygems' require 'dbi' require 'cgi' require 'GINA' begin cgi=CGI.new("html3") web_conf = GINA::load_config("l5_tracker/web_front.yml") conf = GINA::load_config("l5_tracker/database.yml") dbh = DBI.connect(conf['production']['dbi_connector'] , conf['production']['username'], conf['production']['password']) name = "vis_" + (Time.now.to_i % 100000).to_s out = [] start_tm = Time.gm(Time.now().year, Time.now().month, Time.now().day, 0,0,0,0) sql = "select distinct " + " EXTRACT(EPOCH FROM date_trunc('day', time )) as time " + " from " + " l5_frames " + " where " + " time >= '#{Time.now.getgm()}' and time <= '#{Time.now.getgm()+16*24*60*60}'" sth = dbh.prepare(sql) sth.execute out << "" out << " " out << "
" out << "" out << "
" out << "
" out << "
" out << " " out << "
" out << " " out << "
" cgi.out { cgi.head { cgi.title{ web_conf['web']['title'] } + "" } + cgi.body { out.join("\n") } } exit(1) catch StandardError => e cgi= CGI.new("html3"); cgi.out { cgi.head { cgi.title{"Sadness.. Something not good has happened.."} } + cgi.html { "Something bad has happened.. Perhaps it is this:
 #{e.to_s}
" + " or
 #{e.backtrace}
" } } exit(-1); end