Sunday, December 31, 2006

Quote A Day Widget For Blogger

Quick quick, i have to take bath n go to the temple. The title says everything, i need not elaborate on what i am gonna write. Ok, why am i wasting time writing this.

What it does?
Displays random quotes on your blogger page.

Got the idea from?
This and this. I dowanna debate on who came up with the idea first. Its obvious that you guys also got the idea from somewhere else.

Advantage over the above ideas
Any number of quotes and no hard coding of the quotes. You can change them on the fly with some effort.

Disadvantage
Some extra network bandwidth is utilised each time it is displayed. Not too much. Depands, if 100Kb is too costly for you.

Things to do first

* Go to your blogger account settings page and enable full feed. By default, blogger gives only the first para or 256 chars. Change this settings to full feed.

* Create the quotes file with quotes in it. Quotes should be delimited by "%".e.g file contents below.

mary had a little lamb and it ran away
%
Where did the lamb go?
%
Who are you to ask? It went its way!!!
%
This should be enough for you to know the quotes file format.

Note that, "%" should not appear before the first quote and after the last quote. This can be handled in js but i am bit lazy now to do it and got lot other work too.

* Create a new post, go to the html view and paste the contents of the quotes file there. Publish the post. If you dowant the post to appear on front page, change the post date back to your school time.

* Go to the quotes page and copy the post id form the comments link. e.g :

http://www.blogger.com/comment.g?blogID=18356831&postID=358823621417987856

Red coloured number is blog id and blue coloured is the post id. Make a note of it.

* Add a page element to your template and add this js code where you want to quote

<script language="javascript">
function displayQuote(root) {
var content = root.entry.content.$t ;
var quotesArray = content.split('%');
var index = Math.floor(Math.random() * quotesArray.length);
var quote = quotesArray[index];
var d = document.getElementById ("quotesDiv").innerHTML = quote;
}
</script>
<div id="quotesDiv"></div>
<script language="javascript" src=" http://www2.blogger.com/feeds/DDDDD/posts/full/OOOOOOOO?alt=json-in-script&callback=displayQuote"
></script>


Wait, dont close the widget editor. Replace DDDDD with your blog id and OOOOOO with your quotes post id.

* To add flavour, add css for the quotesDiv if you want.

* Next time when you want to change the quotes, just edit the post and change the contents and republish it.

You can see it working. I followed the same steps. Still if there are any typos, let me know.

Cool!! I like that.

--
regards/Yogesh

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

Thursday, December 28, 2006

Party with giri n college snaps

Just now came home from my evening C/O place. My friend giri has come. We went to our college, took some snaps there. Our classroom is now upgraded/degraded?? to staff room. Some sports center is also started. Notices here and there. Some students have written "beware of sem 1...". Some have put up the danger sign which usually appears on electric poles. It was a good college until we passed out ;) All the kids have become freak now. I know most of the people will say the same " when i was there.... it was so nice...", so am i :D. Others who dont like it, please excuse, its my personal opinion. Then we came to Ajanta.Had noodles, manchuri and tea. Talked to giri a lott! Also pinned him to get my RAM exchanged with one of his dealer friend.

That's Giri... (kya re....)















me....















College library...




















Some note on the college door..



















Elegant Ajanta plate....












Giri got a call from his home, hurrying up....














Once upon a time, there was a classroom, on the first bench used to sit these guys: yogesh n girish. Then the classroom turned to staff room ...













Computer lab..





















Giri and the newly constructed school in the backdrop...









powered by performancing firefox

Tuesday, December 26, 2006

My Pharmacy, inspired by dad

My dad has a habit of keeping every small note written or anything just scribbled on. Most of them all, he keeps all the medical prescription. Prescription in the sense, just the tablet name, nothing detail. Some given for tooth ache, other for joint pains, like that. That too, he just goes to the medical shop n tells the person there to give some medicine explaining him the problem. After some time, he does not even remember which medicine is for what purpose. He just remembers, pink note for cold, white one for joint pains, this is joshi's handwriting, its for tooth ache etc. Some time back now, me n mom came up with an idea on this habit of dad. A personalized pharmacy. We start with an empty shop. People come with their prescription. For every person, we allot some space big enough to store the prescriptions for 1 year.We then order the medicine(initially get from the nearby shop).Every person's account is maintained as is done in any bank. Well done. All medicines of all the customers are available anytime. A ATM(Any Time Medicine) machine is also available. Swap your card, select your prescription based on your hints stored, collect the medicine n leave. Though we dont force you to leave, its your wish. Advantages are that the customer can be carefree for his medical needs. He feels good that he owns his own pharmacy(btw, pharmacy name is my pharmacy) n from our point of view, we order only what is required + some error margin. Some kind of statistics has to be used to get the correct figure. Ok. We are all set to put it up. Hey, look out! We have an ATM just beside your house ; )
--
regards/Yogesh

firefox tip

If you want to open some link in a new window, press shift + click. I found it interesting when i wanted to open some(maid has come... will take bath and come she has some work in bathroom...) bookmarked tabs. I already had many tabs opened and i dint wanted to open more as the tabs currently opened were belonging to a category and i dint wanted to mess up with the other tabs. So i shift+clicked the open all tabs in the bookmark. It opened all the tabs in a new window. Thats cool!

--
regards/Yogesh

OMG!! this is too small ... :(

Why cant there be uniformity. Though the web runs on strong standards, some things are not done right. Now dont ask me what is right and what is wrong! Ask shresh, i can eat ones head and still chase all the endocrine system. hahahaha....
--
regards/Yogesh

test failed... :(

Ok, text is not justified and font is not "small". Let me try this size...

--
regards/Yogesh

new blogger is cool

Just now i upgraded to the new blogger. The best feature i liked about it is the adding and deleting page elements. Before this everytime i used to change the template i had to edit the layout. So i had sticked to only a one template for a long time. Now with this templatable dnd interface, its a breeze. Also these days i am concentrating more on the usability aspect. Got to deliver a product by jan 5! Will i be able to do it? Ummm.... dunno. You never know.

BTW, the ajaxified blogger is using google ajax toolkit or some other :-\ ... just out of a curiosity...

Oh! I am blogging from gmail, and gmail does not let me make the text justified :( Dunno about the font size also, what is small to gmail may be big to blogger and vice versa. As long as they are internally using font-size=small | small-x, lange, large-x (pure html right?) then no problem, but if they have their own definitions fro small and big... then i got to figure out some way. Lets see....

--
regards/Yogesh

Wednesday, December 20, 2006

tit bits

Its only a matter of seconds to tell how much you love, but a lifetime to really mean it. - ME

Some things never change as if they never end. May your love for your love be like the latter and the above - TM

Dont go through life so fast that someone has to throw a brick at you to get your attention! God whispers in our souls ans speaks to our hearts. Sometimes when we dont have time to listen, He has to throw a brick at us. Its our choice. - From a short story that appeared in TOI June 6 2004

A foolish man proclaimeth his qualifications;
A wise man keepeth them secret within himself;
A straw floateth on the surface of water,
But a precious gem placed upon it sinketh. - Subhashita Ratna Nidhi.

A nice poem
LOST FRIEND
You stayed in my heart all these years
And shared with me, my laughter and tears
You shared my dreams, my heart.
I always wished that we were never apart.
You shared with me, when I was in pain
Moments I spent with you were never in vain.
How many times with you, I did fight
And you took it all so light.
You let me know what life realls is.
To me, you were an angel bringing bliss.
But today, I'm in pain
I wish you'd be with me again,
You are the greatest gift I ever received
O Friend! Today for thee I grieve. - N Deepak Haitei, std 10A

Being defeated is often a temporary condition. Giving up is what makes it permanent. - Marilyn Vas Savant

Fame is a communuicable disease. - PJ O'Rourke

Fate brings you together ; but it is still up to you to make it happen. - Julia Roberts

I want to know God's thoughts. The rest are details. - Albert Einstein

A man is not where he lives, but where he loves. - Latin Proverb

When you realise you want to spend the rest of your life with somebody, you want the rest of your life to start as soon as possible. - When Harry Met Sally

We waste time looking for the perfect lover, instead of creating the perfect love. - Tom Robbinss

We are not the same persons this year as last; nor are those we love. It is a happy chance if we, changin, continue to love a changed person. - W. Somerset Maugham

Put your heart, mind, intellect ans soul even to your smallest acts. This is the secret of success. Swami Sivananda

Concentration is the key to results. - Peter F Drucker.

I could never have done what I have done without the habits of punctuality, order and diligence, without the determination to concentrate myself on one subject at a time. - Charles Dickens

The ability to concentrate and to use time well is everything. - Lee Iaocca

When every physical and mental resource is focused, one's power to solve a problem multiplies tremendously. - Norman V Peale