This file contains 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
<cfcomponent output="false"> | |
<cfset this.name = "testApp" /> | |
<cfset this.clientManagement = false /> | |
<cfset this.sessionManagement = false /> | |
<cffunction name="onError" access="public" returntype="void" output="false" hint=""> | |
<cfargument name="err" type="any" required="true" /> | |
<cflog log="application" type="error" text="onError() called in '#this.name#' application: #ARGUMENTS.err.message#" /> |
This file contains 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
<cffunction name="getTicks" access="public" returntype="numeric" output="false" hint="Returns the number of .NET ticks representing a the given date."> | |
<cfargument name="dateValue" type="date" required="true" /> | |
<!--- | |
http://msdn.microsoft.com/en-us/library/system.datetime.ticks(v=vs.71).aspx | |
http://stackoverflow.com/questions/386341/c-how-do-i-convert-ticks-to-minutes | |
---> | |
<cfset var ticksAtEpochZero = 621355968000000000 /> <!--- Number of .NET ticks at Epoch time (January 1 1970 00:00) ---> | |
<cfset var ticksPerSec = 10000000 /> |
This file contains 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
<cffunction name="onMissingMethod" access="public" returntype="query" output="false" hint="Dynamic finder."> | |
<cfargument name="missingMethodName" type="string" required="true" /> | |
<cfargument name="missingMethodArguments" type="struct" required="true" /> | |
<cfset var searchFields = [] /> | |
<cfset var qRead = "" /> | |
<cfset var searchItem = "" /> | |
<cfset var i = 0 /> | |
<cfset var searchValue = "" /> | |
This file contains 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
<cfoutput> | |
<select name="birthMonth"> | |
<cfloop index="i" from="2010-01-01" to="2011-01-01" step="#createTimeSpan(31, 0, 0, 0)#"> | |
<option value="">#dateFormat(i, "MMM")#</option> | |
</cfloop> | |
This file contains 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 'active_record' | |
require 'logger' | |
class DatabaseSIA < ActiveRecord::Base | |
self.abstract_class = true | |
This file contains 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
# Helper class for logging. | |
# This class will allow the user get a standard Ruby Logger instance. | |
# Any specific log file configuration (e.g. rollover size etc) | |
# should be done within this class. | |
# @todo - should we run all log() calls through this class? | |
# | |
# @author Ciaran Archer | |
class LoggerHelper | |
@log_dir = "./logs" |
This file contains 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
# Helper class for sending emails. | |
# | |
# @author Ciaran Archer | |
class EmailHelper | |
# @author Ciaran Archer | |
# @param [String] to | |
# @param [String] subject | |
# @param [String] body | |
# @param [String] from |
This file contains 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 "singleton" | |
module SIA | |
# Singleton class to enable database access for those occasions where a model will just not do. | |
# @author Ciaran Archer | |
class Database | |
include Singleton | |
@databases = nil | |
# Setup database connections with configuration file. |
This file contains 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
class Client < DatabaseSIA | |
# set a non-defualt primary key | |
set_primary_key :clientid | |
end |
This file contains 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
profile_data = JRuby::Profiler.profile do | |
results = SIA::SIAModels::Client.get_all | |
results.each do |c| | |
puts "#{c[:clientid]} #{c[:firstname]} #{c[:status]} #{c[:customersince]} #{c[:emailactive]}" | |
end | |
end | |
profile_printer = JRuby::Profiler::GraphProfilePrinter.new(profile_data) | |
profile_printer.printProfile(STDOUT) |
OlderNewer