Skip to content

Instantly share code, notes, and snippets.

View russellkt's full-sized avatar

Kevin Russell russellkt

View GitHub Profile
import java.sql.*
import com.ibm.as400.access.*
class DbMetaClass{
Connection c = null
DatabaseMetaData dbMeta = null
String[] types =["TABLE", "VIEW"]
DbMetaClass(){
Class.forName("com.ibm.as400.access.AS400JDBCDriver")
def create
params[:check][:transaction_type] = 'check'
@check = AccountingTransaction.new( params[:check] )
respond_to do |format|
if @check.save
flash[:notice] = 'Check was successfully posted.'
format.html { redirect_to( create_success_url( params[:commit] ) ) }
format.xml { head :created, :location => check_url(@check) }
else
flash.now[:error] = 'Check could not be saved'
ActionController::DoubleRenderError in ChecksController#create
Can only render or redirect once per action
RAILS_ROOT: /Users/ktrussell/rails_projects/ledger
Application Trace | Framework Trace | Full Trace
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:838:in `render_with_no_layout'
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/layout.rb:251:in `render_without_benchmark'
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:51:in `render'
ArgumentError in ChecksController#create
wrong number of arguments (2 for 1)
RAILS_ROOT: /Users/ktrussell/rails_projects/ledger
Application Trace | Framework Trace | Full Trace
app/controllers/checks_controller.rb:49:in `method_missing'
app/controllers/checks_controller.rb:49:in `create'
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/mime_responds.rb:106:in `call'
class ChecksController < ApplicationController#ProtectedController
#permit "data_entry or admin or accountant", :except => [:index, :show]
before_filter :setup, :only => [:new, :create, :edit, :update]
before_filter :load_batch
protected
def load_batch
@batch = Batch.find_by_id(params[:batch_id])
end
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.1">
<Document>
<name>beach_boundary.kml</name>
<Style id="sh_ylw-pushpin_copy5">
<IconStyle>
<scale>1.3</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
</Icon>
1) Error:
test_ruby_jasper_can_compile_report(RubyJasperTest):
NameError: uninitialized constant RubyJasper::JRXmlLoader
/Users/ktrussell/jars/jruby-1.1.5/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:102:in `const_missing'
/Users/ktrussell/rails_projects/RailsApplication1/lib/ruby_jasper.rb:12:in `compile_report'
/Users/ktrussell/rails_projects/RailsApplication1/test/unit/ruby_jasper_test.rb:7:in `test_ruby_jasper_can_compile_report'
/Users/ktrussell/jars/jruby-1.1.5/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/testing/setup_and_teardown.rb:60:in `run_with_callbacks_and_testunit'
/Users/ktrussell/jars/jruby-1.1.5/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
/Users/ktrussell/jars/jruby-1.1.5/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
/Users/ktrussell/jars/jruby-1.1.5/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
def self.policies_with_balance start_date, end_date
cond = []
cond << "(policies.delete_code is null OR policies.delete_code = '')"
cond << "expires_on BETWEEN ? AND ?"
cond << "total_premium - payment_amount > 0.00"
find( :all,
:conditions => [ cond.join(" AND "), start_date, end_date ],
:order => 'policies.policy_number ASC' )
end
def xmlFilePattern = ~/.*\.XML/
def iterator = 0
def itemAttributes, contentAttributes
def checkAttributes = []
def checks = []
new File('/Volumes/mac3/cleared_checks/').eachFileMatch(xmlFilePattern){
def xmlFile = new XmlParser().parse(it)
def items = xmlFile.Item
if(itemAttributes == null){
writer = new CSVWriter(new FileWriter("/Volumes/mac3/cleared_checks.csv"))
writer.writeNext(checkAttributes)
checks.each{ writer.writeNext(it)}
writer.close()