One of the handier tools in the GWT toolbox is a built in AJAX framework referred to as RPC or Remote Procedure Calls. Here’s the thing: Internet Explorer version 7 and prior is not awesome. IE pre-8 restricts the number of simultaneous XmlHttp requests to two for a given host. In most cases, this restriction doesn’t pose a real problem. For a rich client application (like the kind GWT is a good choice for) that may be leaving one of those two allowable connections open for a long poll while
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
UserAgent userAgent = UserAgent.parseUserAgentString((String)request.getHeader("User-Agent")); | |
String browser = userAgent.getBrowser.getName(); | |
String os = userAgent.getOperatingSystem().getName(); |
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 'active_support/core_ext' | |
class YamlToXml | |
def self.yaml_to_xml file_to_read, file_to_write | |
doc = String.new | |
File.open( file_to_read ) { |yf| doc << YAML.parse( yf ).transform.to_xml } | |
File.open( file_to_write, 'w' ) { |f| f.write( doc ) } | |
end | |
def self.xml_to_yaml file_to_read, file_to_write |
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 'active_support/core_ext' | |
class YamlCompare | |
def self.compare_keys first_file_info, second_file_info, results_location | |
first_file = Hash.new | |
second_file = Hash.new | |
deltas_file = Hash.new | |
File.open( first_file_info[:file_location] ) { |yf| first_file = YAML.load( yf ) } | |
File.open( second_file_info[:file_location] ) { |yf| second_file = YAML.load( yf ) } | |
first_file[first_file_info[:root]].each_pair do |k,v| |
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
# Here’s a way to do http basic authentication and tie it in | |
# to the Restful Authentication mechanism to make current_person accessible: | |
def authenticate_person | |
authenticate_or_request_with_http_basic do |login, password| | |
person = Person.authenticate(login, password) | |
return false if !person or person.nil? | |
session[:person_id] = person.id | |
end | |
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
#! /bin/bash | |
ifconfig -a ppp0 | grep inet | awk '{print $2}' | xargs -0 -I ip sudo route add default gw ip ppp0 |
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
#! /bin/bash | |
gem list | cut -d" " -f1 | xargs gem uninstall -aIx |
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
gem -v = 1.8.17 | |
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01. |
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
$ gem list | |
*** LOCAL GEMS *** | |
actionmailer (2.3.12) | |
actionpack (2.3.12) | |
activerecord (2.3.12) | |
activeresource (2.3.12) | |
activesupport (2.3.12) | |
addressable (2.2.6) |
OlderNewer