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
Reader in = new BufferedReader(new FileReader(fileName)); | |
Input Source input = new InputSource(in); | |
DOMParser parser = new DOMParser(); | |
int whatToShow = NodeFilter.SHOW_ALL; | |
NodeFilter filter = new NodeFilter() { | |
public short acceptNode(Node n) { | |
if (n.getNodeType() == Node.TEXT_NODE) { | |
if(((Text)n).getData().trim().length() == 0) | |
return NodeFilter.FILTER_REJECT; | |
} |
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
<company> | |
<building address="123 Main Street">Main</building> | |
<legal name="Main Street productions"/> | |
<org> | |
<manager empID=456>Bob Smith</manager> | |
<employee empID=987>Margie Jones</employee> | |
<employee empID=721 role="SysAdmin">John Johnson</employee> | |
</manager> | |
</org> | |
</company> |
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
for (i = 0; i < _numFiles; i++) { | |
try { | |
//get the next file name | |
fileName = _fileList[i].substring(_fileList[i].lastIndexOf("/")+1); | |
//associate file (URL) with the httpMethod | |
HttpMethod getXMLFile = new GetMethod( | |
_fileList[i]); | |
//go get the file | |
_filehttp.executeMethod(getXMLFile ); | |
//header info is useful (modified d/ts & size) - |
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
<table> | |
<%for result in @search_results %> | |
<tr> | |
<td><%= auto_link(CGI::unescapeHTML(result["text"])) %></td> | |
</tr> | |
<tr> | |
<td><i>(Follow <a href="http://www.twitter.com/<%= result["from_user"] %>"> | |
<%= result["from_user"]%> </a>)</i></td> | |
</tr> | |
<% 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
def index | |
@search_results = twitter_search('SEARCH KEYWORDS HERE', 10, Time.now.strftime("%Y-%m-%d")) | |
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
def twitter_search(query,rpp,search_day) | |
base_url = "http://search.twitter.com/search.json" | |
url = "#{base_url}?q=#{URI.encode(query)}\&rpp=#{rpp}&since=#{search_day}&until=#{search_day}" | |
data = Net::HTTP.get_response(URI.parse(url)).body | |
result = JSON.parse(data) | |
result["results"] | |
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
C:\RubyDevKit>gem install devise --platform=ruby | |
Temporarily enhancing PATH to include DevKit... | |
Building native extensions. This could take a while... | |
Successfully installed bcrypt-ruby-2.1.2 | |
Successfully installed devise-1.1.3 | |
2 gems installed | |
Installing ri documentation for bcrypt-ruby-2.1.2... | |
Installing ri documentation for devise-1.1.3... | |
Installing RDoc documentation for bcrypt-ruby-2.1.2... | |
Installing RDoc documentation for devise-1.1.3... |
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
C:\RubyDevKit>ruby dk.rb review | |
Based upon the settings in the 'config.yml' file generated | |
from running 'ruby dk.rb init' and any of your customizations, | |
DevKit functionality will be injected into the following Rubies | |
when you run 'ruby dk.rb install'. | |
C:/Ruby/lib/ruby/1.9.1/syck.rb:135:in `load': syntax error on line 16, col -2: | |
' (ArgumentError) | |
from C:/Ruby/lib/ruby/1.9.1/syck.rb:135:in `load' | |
from dk.rb:151:in `block in review' |
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
# This configuration file contains the absolute path locations of all | |
# installed Rubies to be enhanced to work with the DevKit. This config | |
# file is generated by the 'ruby dk.rb init' step and may be modified | |
# before running the 'ruby dk.rb install' step. To include any installed | |
# Rubies that were not automagically discovered, simply add a line below | |
# the triple hyphens with the absolute path to the Ruby root directory. | |
# | |
# Example: | |
# | |
# --- |
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
C:\RubyDevKit>ruby dk.rb init | |
Initialization complete! Please review and modify the auto-generate | |
'config.yml' file to ensure it contains the root directories to all | |
of the installed Rubies you want enhanced by the DevKit. |