Google maps may need a bit of a recalibration: a soccer stadium in the middle of the ocean?
Tuesday, August 25, 2009
Sometimes google maps is not as accurate as it could be. Of course, the application's results are not used for mission critical application that require 100% accuracy, so we forgive it when it returns funny results.
I wanted to see what was around Real Madrid's Santiago Bernabeu Stadium and got the
map below:
A bit off, don't you think?
Should Usain Bolt just run by himself?
Thursday, August 20, 2009
By the looks of his new world record (200m in 19.19 seconds), Bolt should just run against the clock. Not one of other competitors was even close to him: his lead was 6m. In a 200m race, that may as well be the entire 200m.
Is he laughing at the end? I'm not sure Bolt builds lactic acid in his body. Have you run 200m as fast as you can? It hurts; it really hurts. And he can run even faster...Go Bolt, go...
Using the Restlet client connector library
The Restlet framework does not only offer a server stack for developing web services, it also offers a client connector library, which can be used to develop clients connecting to RESTful web services or any other web application.
Let's just get to the code, because all it takes is 1 line to do the whole thing.
For this example, we'll connect to Twitter's URI
http://twitter.com/statuses/public_timeline.xml
, which returns the last 20 public statuses as an XML structure. The code looks as follows:
import java.io.IOException;
import org.restlet.resource.ClientResource;
import org.restlet.resource.ResourceException;
public class StandAloneClient {
public static void main(String[] args) {
try {
new ClientResource(
"http://twitter.com/statuses/public_timeline.xml").get().write(System.out);
} catch (IOException e) {
e.printStackTrace();
} catch (ResourceException e) {
e.printStackTrace();
}
}
}
All we need to provide the
ClientResource
class's constructor is the URI, then we call the
get()
method, and, for this example, we just print the result to the out stream, which looks as follows (part of it; the XML structure is too long):
<?xml version="1.0" encoding="UTF-8"?>
<statuses type="array">
<status>
<created_at>Thu Aug 20 15:29:48 +0000 2009</created_at>
<id>3429406142</id>
<text>(Cont)Returned but From Now on Its all About Byron B. Seriously I honestly care less about other people.Cont. to be in the same boat!(Cont)
<source>web</source>
<truncated>false</truncated>...
</status>...</statuses>
If you recall, the Java net package already has code to open connections over the web. Do we need one more HTTP Client library? Sure, why not.
On the plus side, this Restlet client library provides some extras that make RESTful client development easier. For example, the
ClientResource
class includes
methods for the other HTTP request types (POST, PUT, DELETE). Having these methods already understand REST means that we can pass representations back and forth without manually setting HTTP headers for automatic content negotiation. Mind you that it's not hard to open an HTTP connection, send a request, and consume its response; however, if everything is already wrapped conveniently into a few methods, why go through the pain of adding more code when we can do everything with 1 statement?
If you want to compile and run this sample application, download and unpack the the Restlet package. Then, compile the app with:
javac -cp "RESTLET_INSTALL/org.restlet.jar" StandAloneClient.java
And run it with:
java -cp "RESTLET_INSTALL/org.restlet.jar" StandAloneClient
Once again, Bolt jogs to the finish line...
Wednesday, August 19, 2009
What is it with Usain Bolt? All his drugs test are coming back clean. This means that he's either clean, or his drug guy is really good. Most are hoping for the former, but the latter is still on the table. For now, just enjoy his races:
Usain Bolt is 9.58 seconds fast...
Sunday, August 16, 2009
I remember reading somewhere that the fastest time a man could ever run the 100m dash was 9.60 seconds. The claim was that physiology would get in the way. Apparently, Bolt didn't get the memo. Usain Bolt has to be one of the greatest athletes in history. People in the know claim that we may never see the likes of him again. I'm not sure about that, as someone's future goal will be to break his record and train and train until the goal is accomplished; however, as of today, there's no one
like him.
If you haven't seen his latest race, enjoy:
Usain Bolt is a fast runner
Saturday, August 15, 2009
I just saw Bolt's 100m qualifying race, and it's incredible how he puts the breaks half way through, looks around, and jogs for the last 20 meters of the race, laughing and having a good time.
How fast can this guy go? We'll find out; he's still developing as an athlete. If you haven't seen it, enjoy: