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 'java' | |
#HTMLUNIT 2.8 jar files | |
require 'lib/apache-mime4j-0.6.jar' | |
require 'lib/commons-codec-1.4.jar' | |
require 'lib/commons-collections-3.2.1.jar' | |
require 'lib/commons-io-1.4.jar' | |
require 'lib/commons-lang-2.4.jar' | |
require 'lib/commons-logging-1.1.1.jar' | |
require 'lib/cssparser-0.9.5.jar' |
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 'htmlunit.rb' | |
require 'test/unit' | |
class MyFirstTest < Test::Unit::TestCase | |
def test_main | |
webClient = WebClient.new(BrowserVersion::FIREFOX_3) | |
main_page = webClient.getPage("http://www.asheville-outdoors.com") | |
#this will simply output all the text on the page...nice for screen scraping | |
#puts main_page.asText | |
assert_equal("Asheville-Outdoors.com", main_page.getTitleText) |
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
jlocklear@jlocklear-VirtualBox:~/htmlunit-2.8$ pwd | |
/home/jlocklear/htmlunit-2.8 | |
jlocklear@jlocklear-VirtualBox:~/htmlunit-2.8$ ls | |
apidocs htmlunit.rb lib LICENSE.txt test.rb |
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 'java' | |
require 'rubygems' | |
require 'jdbc/mysql' | |
module JavaLang | |
include_package "java.lang" | |
end | |
module JavaSql | |
include_package 'java.sql' | |
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
require 'java' | |
require 'rubygems' | |
require 'jdbc/mysql' | |
module JavaLang | |
include_package "java.lang" | |
end | |
module JavaSql | |
include_package 'java.sql' | |
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
require 'java' | |
require 'rubygems' | |
require 'jdbc/mysql' | |
module JavaLang | |
include_package "java.lang" | |
end | |
module JavaSql | |
include_package 'java.sql' | |
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
namespace :db do | |
desc "populate random data for testing" | |
task :create_data => :environment do | |
require 'populator' | |
require 'faker' | |
#NOTE These deletions may not work on heroku. You will need to reset/load db for primary key ids to reset | |
#[Site, Therapist, PatientAuthorization, Patient, Visit].each(&:delete_all) | |
#user 1 | |
Site.populate 10 do |site| |
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
#controller | |
def new | |
@questions = Array.new(3) {Question.new} | |
respond_to do |format| | |
format.html # new.html.erb | |
format.xml { render :xml => @question } | |
end | |
end | |
def create | |
@questions = params[:questions].values.collect { |question| Question.new(question) } |
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
<tr> | |
<td>Choosed the correct software | |
(Present info professionally)</td> | |
<input id="results_0_question_id" name="results[0][question_id]" type="hidden" value="3" /> | |
<input id="results_0_student_id" name="results[0][student_id]" type="hidden" value="68" /> | |
<td><input id="results_0_score_0" name="results[0][score]" type="radio" value="0" /></td> | |
<td><input id="results_0_score_1" name="results[0][score]" type="radio" value="1" /></td> | |
<td><input id="results_0_score_2" name="results[0][score]" type="radio" value="2" /></td> | |
<td><input id="results_0_score_3" name="results[0][score]" type="radio" value="3" /></td> |
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
<%= submit_tag 'Submit', :onclick => 'return validate(this)' %><br/> | |
<script type="text/javascript" charset="utf-8"> | |
function validate() { | |
var valid = false; | |
var radio_groups = {} | |
$(":radio").each(function(){ | |
radio_groups[this.name] = true; | |
}) | |
for(group in radio_groups){ |
OlderNewer