Archive for the ‘Website’ Category

Automatically Sorted All-Blogs

Thursday, July 15th, 2004

OKAY! What I am about to say proves the fact that given 24 hours, P-Sharma can do ANYTHING!

Okay so since last night, I’ve been writing this script that AUTOMATICALLY SORTS the blogs on ALL BLOGS. I know I know … you want details.

What it does is this … IT LOOKS AT EVERY WEBLOG (THE ATOM AND RDF FEEDS) AND FIGURES OUT WHEN THE LAST POST WAS POSTED. IT THEN SORTS THE WEBLOGS ON ALL BLOGS BASED ON THESE DATES.

The weblog with the most recent entry gets bumped to the top automatically. Therefore, you only read what is important. All those lazy asses can keep sitting at the bottom. Just read what is the most recent!

What is the drawback? The only drawback is the processing time. It takes roughly 5 -7 seconds for the entire process to finish. This is IN-ADDITION to whatever time it took earlier. Think of it this way … 5 seconds waited is 5 minutes saved!

What if you liked the old one? Well … Old one is still available at http://www.pranavsharma.com/allblogs/old

So HOW Exactly did I do it? This is going to get a bit technical … So I wrote the script ALL by hand and from scratch. I wrote this in PHP. I located the ATOM feeds on the SquareSpace blogs and the RDF feeds on Gokul’s and mine websites. Then I opened a read-only filestream to these feeds. Then I formed an appropriate search criteria and located the date of the latest post and stored it in a string variable

Next, I converted that string variable to a UNIX timestamp. After that, I combined these timestamps with the URLs of the respective weblogs and put it all in a 2-D array. Then, as per Karthik’s recommendation, I used a BUBBLE SORT to sort the dates in descending order. Lastly, I printed the URLs in the sorted order and used these URL’s to create inline FRAMES just like the old ALL BLOGS script.

I know I am excited about this but my excitement doesn’t mean as much as convenience for you guys. I don’t want to turn this into another Chat-Script that is more annoying than useful. So if the verdict from you guys is that you like the OLD one better then the OLD one it will be. I give you 10 days to BETA-TEST.

UPDATE: Here is the Code I used. If you plan to reuse this code then please replace ALL ‘«’ with ‘<' and ALL '»' with '>‘ and I do mean ALL (even the ones in the array declaration).

«html»
«script language=”php”»

//MAIN array that will be sorted based on latest post date
//5 fields: Time Stamp, URL of the blog, URL of the ATOM/RDF feed,
//Tag before timestamp to search for, and, Time Adjustment factor.
$array = array (
0 =» array (”time” =» 1087816162, “URL” =» “http://ambar1.squarespace.com”, “feed” =» “http://ambar1.squarespace.com/display/GetATOMFeed?moduleId=23465″, “tag” =» “«created»”, “adjustment” =» 0),

1 =» array (”time” =» 1087816162, “URL” =» “http://mukta.squarespace.com”, “feed” =» “http://mukta.squarespace.com/display/GetATOMFeed?moduleId=22534″, “tag” =» “«created»”, “adjustment” =» 0),

2 =» array (”time” =» 1087816162, “URL” =» “http://www.gocool.org”, “feed” =» “http://www.gocool.org/index.rdf”, “tag” =» “«dc:date»”, “adjustment” =» 28800),

3 =» array (”time” =» 1087816162, “URL” =» “http://www.pranavsharma.com”, “feed” =» “http://www.pranavsharma.com/index.rdf”, “tag” =» “«dc:date»”, “adjustment” =» 18000),

4 =» array (”time” =» 1087816162, “URL” =» “http://ankan.squarespace.com”, “feed” =» “http://ankan.squarespace.com/display/GetATOMFeed?moduleId=22359″, “tag” =» “«created»”, “adjustment” =» 0),

5 =» array (”time” =» 1087816162, “URL” =» “http://vish.squarespace.com”, “feed” =» “http://vish.squarespace.com/display/GetATOMFeed?moduleId=22651″, “tag” =» “«created»”, “adjustment” =» 0),

6 =» array (”time” =» 1087816162, “URL” =» “http://anu.squarespace.com”, “feed” =» “http://anu.squarespace.com/display/GetATOMFeed?moduleId=22734″, “tag” =» “«created»”, “adjustment” =» 0),

7 =» array (”time” =» 1087816162, “URL” =» “http://divs.squarespace.com”, “feed” =» “http://divs.squarespace.com/display/GetATOMFeed?moduleId=22371″, “tag” =» “«created»”, “adjustment” =» 0),

8 =» array (”time” =» 1087816162, “URL” =» “http://suewije.squarespace.com”, “feed” =» “http://suewije.squarespace.com/display/GetATOMFeed?moduleId=22630″, “tag” =» “«created»”, “adjustment” =» 0),

9 =» array (”time” =» 1087816162, “URL” =» “http://www.squarespace.com”, “feed” =» “http://www.squarespace.com”, “tag” =» “«created»”, “adjustment” =» 0)
);

//*********************************************
//ACCESSING LATEST POST DATES for known blogs
for ($i=0; $i«9; $i++){
$fs = fopen($array[$i][”feed”], ‘r’);
if ($fs) {
$tag = “initialcharacter”;
$subtag = substr ($tag, 0, 9);
while ($subtag !== $array[$i][”tag”]) {
$tag = fgets ($fs, 99);
$tag = trim ($tag);
$subtag = substr ($tag, 0, 9);
}}

$date = substr ($tag, 9, 19);
$array[$i][”time”] = (strtotime($date) + $array[$i][”adjustment”]);
fclose($fs);
}
//finished accessing latest dates from all blogs
//************************************************

//commencing BUBBLE-SORT
for ($i=0; $i«9; $i++) {
$array[9] = $array[$i];
$biggest = $i;

for ($j=$i; $j«9; $j++) {
if ($array[$j][”time”] » $array[$biggest][”time”])
$biggest = $j;
}

$array[$i] = $array[$biggest];
$array[$biggest] = $array[9];
}
//End BUBBLE-SORT
//USED $array[9] as a temporary swapping mechanism
//************************************************

//Begin Printing
echo “\n«head»\n\n”;
echo “«title»All blogs - Automatically Sorted«/title»\n”;
echo “«/head»\n”;
echo “«div align=center»\n”;

for ($i=0; $i«9; $i++) {
echo “«iframe src=\”" . $array[$i][”URL”] . “\” frameborder=0 scrolling=\”yes\” width=97% height=500»«/iframe»\n”;
echo “«br»«br»«hr»«br»\n”;
}

echo “«/div»\n\n”;
//END PRINTING
//***********************************************

«/script»
«/html»

Karthik’s laziness

Friday, June 18th, 2004

I am really disappointed at the laziness of my friend karthik. His weblog was hacked yesterday by somebody and he probably doesn’t even know it yet. This shows how often HE visits his own website … let alone other people. Shame on you karthik!

Changes … and time savers

Thursday, May 13th, 2004

So I have had it with y’all complaining about the tick, tick, tick … when you visit my site. I think mohit was the one who said that he had to turn off his speakers just to visit my site. Well, guess what? The chat script is out of commission now. It never really made it out there. Although I am sad about this loss, all change is for the better isn’t it?

On a different note, I did make an improvement and added a feature that I hope you all would find useful. I made a page called All blogs. Click on it to go to a page which has the blogs of (in order) gokul, ankan, mohit, pranav, anu vishal, karthik, mukta. Of course I tried to organize them in order of how soon they are updated. And if anybody has to bi**h about my position above Anu, Vishal, Karthik & Mukta, then you can kiss my a**. However, anybody else’s position always remains debatable right? Okay anyways, bookmark http://www.pranavsharma.com/allblogs

Any suggestions are welcome and ofcourse you’ll see more features as I progess through my finals. I mean I need something to do between study breaks!

Boat load of new weblogs

Tuesday, May 11th, 2004

Ever since gokul’s advertisement of squarespace, there has been a burst of new weblogs started by his wannabe peers. Hats off to gokul for maintaining his weblog with long and interesting updates almost everyday. I think Ankan rightfully called him the “guru of web logs”. However, that does not make everybody who knows him a guru on weblogs. Some things are best left alone for some people. Hint hint Ankan, Mohit, Mukta, and this other dude who due to some personal reasons wants to keep his name private which, defeats the purpose of a weblog right there.

The buzz is that it “takes an average layman to figure out the working of this website“. I don’t argue that and I’ll admit, the websites do look nice and if some ahem bio majors can do it ahem then it must be very simple. However, it takes a lot to keep a weblog updated. I can tell you that from experience. But then again, if you’re at work and the boss isn’t looking (Ankan), it might be a bit easier.

It is apparent that this ‘blogging thing’ is a repeat attempt for some. And I’m certain that before the ‘30 day rush‘ is over, these weblogs will be over. And, it will then again lead to repeat attempts sometime in the future. These websites just popped up due to the ‘bandwagon effect‘ and before long, they’ll be gone like the cicadas.

Weblogs in question:
● Ankan ke khayal (Kabhi Kabhi Mere Dil Mein Yeh Khayal Aata Hai) @ http://ankan.squarespace.com/

● m o h i t (the journey just begins…….) @ http://mohit.squarespace.com/

● Mukt (The Absolute Freedom) @ http://mukta.squarespace.com/

● Vishal’s (Kick it in Punjab’s Styles) @ undisclosed location by request [Blog Name and description modified to preserve anonimity]

P.S: I think karthik should take inspiration from these amateur bloggers and update his weblog atleast - i don’t know - once a quarter maybe?

Back in business

Tuesday, March 9th, 2004

The website is back in business. If you never noticed that my website was down then shame on you! Now I know how often you visit pranavsharma.com. I have the stats … don’t make me look in there.

Don’t throw the stones … yet!

Wednesday, November 5th, 2003

Looks like somebody has been out of business for what … a mere 34 days? Maaaaaybeeee somebody needs to start updating da website a bit more often. One could easily blame it on the school pressure or the numerous hours wasted at the job. But deep inside, we all know the reason for this lack of attention … LAZINESS!

Its a start I guess!

Tuesday, June 10th, 2003

I promised everybody something by Tuesday and here it is … the index page in a condition that satisfies me. Oh trust me there is a lot of thinking and consulting (mainly Ritu) that I went through before settling for this design. And the other pages are just a mess. Some of them don’t even have links setup for them. The navigation bar is going to have much more stuff on it in the very new future. Feel free to comment on the design under this entry. I am however, going to build a separate section where people can submit their “Ideas for Improvement”. This should be coming very very soon and trust me, I need those ideas … my creative edge is not very sharp right now. Hope you guys are encouraging about the new design. Bon Apetit.