Friday, December 29, 2006

mistake repeated

I am feeling miserable, sad, down, low, like kicking myself. I did a mistake and it costed me 1 full day. I had committed a similar mistake some time back and had costed too much. This time it was 24 hrs and the extra frustration that i will get now. Ok.. will try to minimize it. What is the mistake? Dint read between lines. May be my hormones were too much excited that i was not able to get it right. I had to write a simple client for blogger. Just a test program to post to atom using Apache Abdera. I found this post of James Snell showing how to post to blogger using Abdera. After looking at the java code, my thinking was : " ok... use google api to login to google and then create an entry using abdera and post...". I got this because there is this code :
 Client c= new CommonsClient();

// Get the authentication token
GoogleLogin login =
new GoogleLogin(c, "blogger"," my@email.address","mypassword");
String auth = login.getAuth();
auth = "GoogleLogin " + auth;

// Create the entry that will be posted
Entry entry = Factory.INSTANCE.newEntry ();
entry.setId(FOMHelper.generateUuid());
entry.setUpdated(new Date());
entry.setTitle("Testing");
where you can see a class by name GoogleLogin. Apparently, this seems obvious that its from google api, rest is abdera. Fine. So, i started to hunt for gdata api. Co-incidently or my bad luck (plus few others still shouting in google groups) the download link for gdata api zip file is broken(even now). I sent a urgent mail to my bosses. Even they tried and the same happened. Then i thought of asking my friend who is in US (online right now), Nitin, to download and mail me. (I got it just now). I was soo relieved that finally i got it till i found that the class is not in gdata. Then where is it? Going back to the post, i read it once again. Not the code, but the text != code. I read this line twice, thrice : "It's fairly simple to create a new post using the APP client in Apache Abdera.." to realise that abdera has some handy class to talk to google!! By that time Nitin came back to his office after getting some food n asked me if i got the file. I was in a not so happy mood as i screwed myself for a day. However i thanked him for that, coz i know how desperately i was looking for the library.

Ok... so where is the mistake? Mistake is :

Read the accompanied documents properly and expect the unexpected (like a cow sneezing mangoes/abdera having google login support)

Will sleep now. Its 2:06am. No, will post this from my atom client!! WOW!! Great idea. Wait....

Update: I was not able to use the abdera to talk to google. Had to use gdata. It works fine. Tested it yesterday night. It was good to see things working.

--
regards/Yogesh

1 comment:

Anonymous said...

Sorry to hear to had problems posting to blogger beta with the Abdera code. I've tested it many times without any problems. There are a few gotchas, however. The most significant is that Gdata/Blogger requires that posts specify a Content-Length header on the request. By default Abdera excludes the header to avoid having to buffer the input to calculate the size. There is a RequestOption to disable chunking in the request. Anyway, feel free to post a note to the Abdera-use mailing list with the code you were trying to get working