Category: Programming
-
LibraryFind code refactoring
I’ve been spending time this weekend refactoring a major piece of the LibraryFind code partly in an effort to make it easier to add protocol classes. This change affects a lot of the current API code-base, but the biggest change comes in the meta_search.rb file where nearly all the business logic relating to searching, etc.…
-
Ruby and Date classes
I’d seen this somewhere before, but thought I’d benchmark it to see if it was true. Ruby has 3 classes for doing dates. There is Date, DateTime and Time classes. In languages like C# and PHP, the equivalent DateTime class is the one that is generally utilized to do date/time manipulations. However, in Ruby, DateTime…
-
Why I miss strong variable typing in scripting languages
I love strong typed languages. Languages that require you to define all variables before use. They save me from myself, or, from my attrocious spelling. I was working on LibraryFind, OSU’s opensource metasearch service, three days ago making a few tweaks and changes. One of the things that this tool has that is somewhat researchy…
-
Google Spell API — Ruby
Someone had asked if I could post the ruby code we use to interact with the google toolbar spell api. Well, here it is. require ‘net/https’ require ‘uri’ require ‘rexml/document’ class GoogleSpell def GetWords(phrase) results = [] x = 0 i = 0 phrase = phrase.downcase phrase = phrase.gsub(“&”, “&”) phrase = phrase.gsub(“”, “>”) word_frag…
-
Google Sitemaps
I’d run across these a few weeks ago and thought they were pretty nifty. Essentially, I was looking for something that would allow Oregon State University’s CONTENTdm collections to be harvested by Google. Since CONTENTdm has an OAI interface, and Google’s Scholar supports OAI harvesting, I thought there must be an easy way to get…
-
Dspace Community-list; adding most popular collections entries hack
As I’ve started to get more involved in the Dspace work here at OSU, one thing that has struck me is the interface really could use a once over. No place could this be more obvious than the community-list page. While I doubt that this page was every meant to be the default access mechanism…
-
Dspace hack #2 — Did you mean?
Its funny how things work out. As some folks know, we are currently in the process at OSU of re-writing our hybrid metasearch tool from PHP to ruby, and now that much of the heavy lifting has been accomplished (a simple caching engine, wsdl api, oai harvesting, ferret integration, etc.), its been time to start…
-
ruby-oai 0.0.3 — thanks ed
Ed posted revisions to the ruby-oai package. It includes the ability to utilize libxml as the xml parser. For those interested, this can now be coupled with the following class to parse a normal dublin core unqualified record into an object version of the record. BTW, I realize that this code makes some use…
-
ruby-oai and processing metadata elements
Since modifying the ruby-oai module to work with libxml — I’ve found extracting the data from “metadata” to be much easier. And the nice part — using libxml, I was able to do an initial metadata harvest from 4 collections in under 10 seconds. Here’s the code from the harvesting component — see below. –TR…
-
More reasons to avoid REXML (like the plague)
I’ve been having a great time playing with ruby — but one of the things that I find myself constantly running up against is the “ruby way”. The place where I notice this most is when dealing with XML. One of the things I’ve noticed in working with XML in ruby is that the ruby…