Software Developer Library Suggestions
Feb 14th, 2007 by scott
for a connected world
Feb 14th, 2007 by scott
Feb 12th, 2007 by scott
I've been working with soap4r in Ruby to access some Java web services which use AXIS 1.1. The particular api I'm accessing requires an initial authentication call which returns a token that must be passed in all subsequent SOAP headers. This is a pretty common scenario, but it took me awhile to get it working correctly.
There were basically two "tricks". The first which I found on a few other blogs entails creating a HeaderHandler (some suggested SimpleHeaderHandler, but that didn't work for me because of trick #2). Here's what I ended up with:
def initialize(token)
super(HEADER)
@token = token
end
def on_outbound
el = SOAP::SOAPElement.new(HEADER, @token)
el.extraattr['xsi:type'] = "xsd:string"
SOAP::SOAPHeaderItem.new(el, false)
end
end
The second "trick" was in the on_outbound method. What I found was that AXIS was requiring the xsi:type to be included in the header that I added or it wouldn't be recognized. Using extraattr was the only way I could figure out how to coerce it to be included. I suspect at some point this will be unnecessary, but for now it did the trick.
Here's a simple example:
def lookup(stuff)
ws = svc("/services/LookupService")
ws.lookup(stuff)
end
end
Feb 12th, 2007 by scott
I ran across this questionairre last summer. It’s one of those cool ideas that can probably only be done a handful of times (maybe only once). Anyway, this guy sent 10 questions to some of the most famous / interesting programmers he could think of and actually got responses.
Some of my favorite questions/answers:
Q: What do you think is the most important skill every programmer should posses?
A: Written and verbal communication skills. You’ll never make it very far as a programmer in any field unless you can get your ideas across to people effectively. Programmers should read voraciously, practice writing, take writing courses, and even practice at public speaking. (Steve Yegge)
A: A strong sense of value. The ability to ask yourself the question: Is it worth doing what I’m doing right now? So many programmers seem to waste oceans of time on stuff that just doesn’t matter. And not enough on the stuff that does. (David Heinemeier Hansson)
Q: What do you think makes some programmers 10 or 100 times more productive than others?
A: The ability to restate hard problems as easy ones. (David Heinemeier Hansson)
Jan 13th, 2007 by scott
Lorelle has a really great, long post about Hundreds of Resources for Finding Content for Your Blog. Now that I've broken the ice, I'll have to refer back to her post every once in awhile to keep the ideas coming.
Jan 13th, 2007 by scott
A year or so ago I was trying out the Google Maps API. At the time, Google did not provide a means to geocode your own locations (although now they do), so I set out to create my own geocoder. There was a good overview on how to create your own database of locations based on the Census Bureau's TIGER/line data. I took quite awhile to download all the data and then construct the berkley database (about 1gb in size), but in the end it worked great. Next, I made use of the Geo::Coder::US Perl module, wrote a Perl web service and created my Rails app to pull everthing together.
Anyway, I finally sat down to blog about what I did (a year ago) and, of course, some other folks beat me to it. There's also a pretty cool Ruby geocoder Gem that I've just been playing with. It uses the the geocoding webservices provided by Yahoo and geocoder.us. Of course, their are limits on these: the Yahoo service is limited to 5,000 requests per day and the geocoder.us service is for non-commercial use only. In any case, either should acceptable for many purposes. It would be nice if support is added for the Google service, which allows 50,000 request per day. I'll probably keep my service around, but will likely switch to the gem version so I can let Yahoo worry about keeping the database up-to-date.
Here's a basic example using the gem version in irb:
That's all that's needed. You can be getting your own coordinates in minutes.