Danni at BITS

Lazy Me…

by Ninad on Nov.26, 2009, under Uncategorized

As you guys can see, I’ve been terribly lazy at writing stuff for the blog. But, I’ve kept myself busy by uploading some snaps to flickr, so am posting links here, hoping to get back on track with writing as well soon.
http://flickr.com/photos/ninadsp
A lot of the recent snaps are from Oasis 09, the cultural festival of BITS Pilani. This year, Photog Club has a Canon 1000D, with an awesome 75-300mm lens. I’ve tried my best to capture some images from the Stage Plays and Choreo. Hope you guys like em…

Leave a Comment :, , , , more...

choqoK – A KDE Client for Twitter

by Ninad on Oct.13, 2009, under Uncategorized

Due to the simple API of Twitter, the world has seen a huge number of applications being written for it, ranging from simple applications that will just post and show tweets, to applications that guzzle the public timeline and apply all sorts of fancy algorithms, generating very interesting results. Today, we’ll have a look at something on the simpler side, choqoK. Currently at version 1.0 alpha, this is a pretty recent application, and has been adding a lot of features since it was released for the first time in late December, 2008.

A micro-blogging client, it includes support for both Twitter and Identi.ca. Also, being a native KDE application, it behaves really well with the KDE4 desktop, unlike the Adobe AIR applications which I’ve been using till now. As a result, all the KDE goodies like global keyboard shortcuts, configurable to your taste and universal settings are a part of the user experience. The best thing that I discovered about this application, is it’s ability to post the track that I am listening to currently, to either Twitter or Identi.ca. Press a shortcut key, and it brings up a nice dialog box which contains track information. The format of the tweet is customisable, and we can include custom hashtags. In the dialog box, you can add your comments if you want, and hit Enter. Bingo, your current track info is posted! :) Also, thanks to the recent Twitpic integration, any tweets which contain links to Twitpic posted photos will automatically pull in photos from Twitpic and show thumbnails of the images :)

There are however, a few glitches, because of which I am still sticking to my current Twitter client, DestroyTwitter.

  • Though there are a few keyboard shortcuts, there still arent any to traverse the timeline, cycle through the tabs and do quick replies/retweets. Absence of keyboard shortcuts really slows down my Twitter experience, which is the reason why I prefer DestroyTwitter over other applications.
  • I could not get choqoK to get more than 20 tweets at one time, even though there is a setting which allows me to change this value. The Twitter API allows upto 200 tweets in one request, and is a setting that I am used to now.
  • The last major issue I have with choqoK is that I can see only tab at a time (either the home or replies or the dm inbox/outbox). This means that I have to continuously cycle through the tabs, with a mouse, which is really not efficient according to me. I’d prefer a full screen option, similar to DestroyTwitter or TweetDeck or other clients.

Hence, my issues with choqoK are really just more features that I’d like to see soon in the client. As this is a very recent application, which is under rapid development, I’m gonna keep a close watch on it, and will report the latest changes to the interface.  :) Do give it a try!

1 Comment :, , , , , more...

Commandline Fu

by Ninad on Sep.09, 2009, under Hobbies, Linux/Ubuntu

People who have been reading this blog for sometime, will know that I am a huge fan of the command line. I love to find new ways to do things from the command line, without leaving the comfort of my keyboard and dragging my hand all the way to the mouse. Recently, I found a site that let’s me do learn brilliant tricks:

http://commandlinefu.com

This is a community driven site, where users submit various commands everyday, to do all sorts of tricks and jobs under the sun. Commands get votes from fellow users, and often, better versions are posted. This makes Commandline Fu one of the must visit sites for geeks. Commands are tagged, and hence searchable. The site also has an API and a simple javascript widget, making it ideal for embedding a command in blog posts. Commandline Fu also provides Twitter and RSS feeds for commands posted to the site, and discerning users can subscribe to commands which have more than 3 or 10 votes. Do visit and join this site! :)

Leave a Comment :, , , , more...

Opera 10 released!

by Ninad on Sep.01, 2009, under Hobbies, Linux/Ubuntu

Today, Opera released the latest version of it’s browser, Opera 10. This release marks a major step forward in the life of the Opera Browser, as it includes a lot of new features that have raised the bar in the browser market.

Some of the features that I loved in the new release are:

  • A new way to search the browser history: In the url bar, type in ‘opera:historysearch’ and you’ll get a cool looking page (yeah, all the opera error and config pages now have a new theme, which is beautiful :) ) with a search bar. Type in Google-esque search parameters, and Opera pops out a list of pages, with snippets of text right under the links.
  • An improved cache manager: Opera now intelligently manages the RAM cache, based on the amount of resources available. On modern beasts, with 2+ gigs of RAM, Opera will cache more pages, giving the user a very snappy browsing experience. On slightly older machines, with scarcity of RAM, Opera will downsize the cache, and hence conserve on resources. As a result of this improved management, the historysearch and Turbo features get a further boost.
  • Opera Turbo: A new service offered by Opera, it does wonders for people like me, who access Internet through relatively slower networks, without the luxury of broadband. All traffic is transparently routed through a proxy, where all the images on a page are processed, and low res images are sent to the browser, hence reducing the bandwidth demand, and loading pages faster. For more details on the working of Opera Turbo, check this post out.
  • Spell Checking finally makes it to Opera in this release. And it’s damn efficient.
    Auto Updates are now a built-in feature. Opera will check with the mother servers, and update itself automatically.
  • Visual Tabs: Opera has provided tab previews for quite a long time. Hover your mouse on the tab, and a preview will pop out next to your cursor. In this release, Opera has taken this a step further, and now embeds previews in the tabs itself.
  • New Themes and Icons: Opera has now redesigned the Themes and icons, and they are a nice sight.

Most of these are changes that you can see when you use Opera. There have been a lot many changes under the hood as well, with the new and improved Presto rendering engine being used in this version. This has improved the speed and response of Opera by leaps and bounds.

You can download the latest version of Opera 10 from the downloads page, or this ftp site. Currently, the Opera servers are under a heavy load, with users all around the world downloading it, so expect a slightly slow download speed for the next 1-2 days.

Leave a Comment :, , , , , , more...

Ganapati Bappa Moraya!

by Ninad on Aug.23, 2009, under Uncategorized

Today is Ganesh Chaturthi.  This day marks the beginning of the Ganesh Utsav, a festival that people wait for more than even Diwali, especially in Maharashtra, Karnataka and Andhra Pradesh.  As we all know, this festival celebrates the birth of Lord Ganesha, or Ganapati, as he is lovingly called in Maharashtra, the lord of wisdom, prosperity, good fortune and the protector.  The celebrations continue for a ten day period (10 lunar days).  During the ten days, people often organize community celebrations, and gather around the Ganesh Idol for various activities.  In this post, I’d like to remind you of the humble and noble beginnings of this festival in its present form, so dear to all.

Initially, Ganesh Chaturthi used to be a very private festival, in the sense that families celebrated the festival in their homes.  Then, during the Freedom Struggle, in 1893, Lokmanya Tilak decided to give this festival a new lease of life.  He initiated the tradition of a community celebration of Ganesh Utsav, where a community of people living in the same vicinity got together, set up the decorations for the Ganesh Idol and performed all the rituals.  The primary objective on Lokmanya Tilak was to unite people, the Brahmins and the Non-Brahmins, and to raise awareness about the Freedom Struggle as well as issues of governance.  The festivals often had people debating over various issues of importance.  Also, a lot of cultural activities like dance, music and drama were performed as a part of the celebrations.  As a result, this brought people close, forging a strong bond between them.  It also served the purpose of portraying the heritage and culture of India.

Over the decades,  the festival morphed into an occasion for people to have fun.  Even though a few Mandals (the community organizations) took up a few social issues, and depicted them very tastefully, most of the decorations and stalls setup near the Ganesh Idols depicted various religious stories.  With time, the festival came to be associated with huge spending to make the decorations, loud (and often terrible) music blaring through speakers late in the night, high environmental pollution due to the use of Plaster of Paris and artificial paints and often (forced) collections from the community members for the funds.

It is now time that we retrospect and take a decision about the direction that this festival should take.  In times of terrorist attacks and global issues affecting the neighbourhood, I feel the need for a concerted effort to raise the social awareness on these issues, and bond the community very strongly.  If this can also break religious barriers, it would be extremely good.  My 2 cents for everyone out there:  Ganesh Utsav is a tradition unique to India.  Very few places in the world can boast of a community festival of such a scale.  We must look at the ideals that inspired Lokmanya Tilak to publicise this festival as a ‘people’s festival’, and constructively use them to solve the problems that face our world, our country and our community.

Wish you all a very Happy Ganesh Chaturthi, and enjoy the next few days.  But, don’t forget to contribute to the society in forms other than monetary donations. :)

Ganapati Bappa Moraya!

1 Comment :, , , , , , more...

Jaagte Raho! Insomniacs Rock

by Ninad on Aug.20, 2009, under Uncategorized

Many BITSians often ask me, why do I tweet.  There are about 100 BITSians I know, who are on Twitter.  But, barely 20 among them are active by any standard on Twitter.  What they don’t know, is that it took a lot of convincing by @jeffjose, to get me on to Twitter.  I won’t get into all the stuff that he told me, but I will tell you about one very amazing person I found on Twitter, which has ensured that I will never stop using it.

In my third year, I spent a lot of time doing work in the night, and got converted into an insomniac.  I would stay up the whole night, and go to sleep at the crack of dawn, or stay up till breakfast, and sleep after that.  But, I found it quite lonely.  I never had anyone to talk to, while I stayed up.  Though I preferred  it that way, as it ensured complete concentration, I did miss company.  Over the holidays, as I started expanding my Twitter realm beyond BITSians, I found out about @JaagteRaho.  It’s name was ‘Insomniacs Anonymous’ and it had a cute Owl as it’s DP.  I instantly liked it, and followed it.  It took me sometime to figure out what was going on, but what happened was this.  @JaagteRaho was the focal point of all insomniac Indians on Twitter.  Everyone posted tweets to @JaagteRaho, and they were ReTweeted (RT’ed) faithfully, for all others to read, and reply to.  The cycle went on and on, and everyone awake ensured that it was a fun place to be.  A lot of links were thrown around, and often, popular tweeple became the center of attention, for their wacky tweets.

I slowly became a regular at @JaagteRaho, and I realised, that I had made lots of new friends at @JaagteRaho.  Now, I stay up at night, with the comfortable knowledge, that whenever I get bored, I’ll always have company and people with similar likes to talk to, at any time of the night. :)  Some of the awesome people I met at @JaagteRaho include @meerasapra, @fossiloflife (these 2 are the founders, which i came to know later), @artihonrao, @kulkarnianiket, @binoyparikh, @metalsaint, @sarvesh and a lot more.

So, if you too spend your nights reading books, watching TV, studying, or typing out code on the terminal, make sure that you are on Twitter, and follow @JaagteRaho, or use this.

1 Comment more...

$(document).ready fails on Internet Explorer 6

by Ninad on Aug.20, 2009, under PHP/jQuery

I have been interning at a company for the past few weeks, where I worked on jQuery. It’s a Javascript framework, and one of the primary reasons for using it was to not to worry about browser incompatibility issues. I happily coded away, testing my code in Firefox, Opera and Chrome as I went along. Internet Explorer compatibility was a very important issue for us, as our target audience had a large set of users who would still be using sucky IE6, and some more would be sing IE7. But, compliance with IE was something we all took up very late into the project.

Two days back, we opened up the site in Internet Explorer, and to our horror, jQuery absolutely refused to work, leaving the pages in an almost unusable state. Being the great product that it is, Microsoft had not provided any sort of an error console, and any amount of coaxing IE6 would do no good. We ran the jQuery test suite, and it gave a perfect score, leaving us absolutely clueless. So, out of desperation, we tried a simple trick, and put in an alert() call just inside the $(document).ready() function. To our dismay, we did not see an alert pop up, no matter how many times we refreshed the page.

Googling gave us a very cryptic solution. A couple of forum and blog posts claimed, that putting all the jQuery code at the end of the bottom of the HTML page, just above the body close tag, made the code work. We tried it out, and this voodo fix seemed to work. This means, that both Internet Explorer 6 and 7 do not fire the ‘ready’ event at all. By putting all the jQuery code at the end of the HTML body, we ensure that all the DOM elements to which jQuery queues actions, are loaded. And then, we just put the jQuery code without putting it in the $(document).ready() anonymous function.

Hope this helps someone, and save him/her a lot of frustration. :)

1 Comment :, , , , more...

How to Tweet using your own PHP script – 2

by Ninad on Aug.05, 2009, under Hobbies, PHP/jQuery

In the last post, we had a look at the HTML and jQuery code which will be used to post tweets from a user to his Twitter profile. Today, we spend some time on the back end, the actual PHP code. As I have mentioned before, this is a sample code, and hence involves very little validation. When writing code for production/personal use, please include necessary validations in it.

The code for the twitter_ajax.php file is:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
if($_REQUEST['ajax_req']== true)
{
    //Process the tweet
    $username = $_REQUEST['username'];
    $password = $_REQUEST['password'];
    $status = $_REQUEST['status'];
   
    $auth_string = $username.":".$password;
    $postdata = array('status' => $status );
   
    $options = array(
        CURLOPT_RETURNTRANSFER  =>  true,
        CURLOPT_POST        =>  true,
        CURLOPT_POSTFIELDS  =>  $postdata,
        CURLOPT_SSL_VERIFYPEER  =>  false,
        CURLOPT_URL     =>  'https://twitter.com/statuses/update.json',
        CURLOPT_USERPWD =>  $auth_string
    );
   
    $ch = curl_init();
    curl_setopt_array($ch, $options);
    $data = curl_exec($ch);
    curl_close($ch);
    Header('Type: application/json')
    die($data);
}
?>

Here’s what this script does:

  • The first if condition checks that the PHP script is being called through an AJAX request. It is a parameter that we have set in the jQuery code.
  • Next up, all the POST variables are stored into PHP variables, with the proper names.
  • Now, we construct the authentication string, which is a string containing the username and password, separated by a colon. This is the format that cURL uses, while accessing sites that require Basic Authentication. So, we prepare the string as per it’s requirements.
  • After this, we create an array that will hold the data to be posted to Twitter, i.e., the tweet. The key to be used is ‘status‘, as cURL will later urlencode this into a ‘key=value’ form.
  • Then, we declare all the settings for cURL, which we want to use. To find out about more values that can be used here, visit the PHP Online Documentation for ‘curl_setopt’.
  • The important thing to note here, is the CURLOPT_RETURNTRANSFER setting, which stores the response in a string, for use later. Also, CURLOPT_POST tell cURL that the request is a POST request, and it is to be made to the CURLOPT_URL url. CURLOPT_SSL_VERIFYPEER is set to false to disable SSL verification.
  • Now, it is time to initiate the cURL session. Then, we set the options for cURL, and execute the request. The response is stored in $data, and we end the cURL session.
  • The last bit that remains, is sending the data back to our page, which made the AJAX request. We first set the appropriate headers, so that jQuery will correctly read the response. And now, we print out the response. I have used a die() statement here, but instead, you could use a combination of echo and exit as well.

As we already know, the jQuery will then process the JSON object, and show the user the posted tweet. To summarize, the steps involved in posting the tweet are:

  1. The user opens the page (twitter.html), and fills up the form with his Twitter credentials and the content of the tweet.
  2. He submits the content, which is now validated by jQuery. If it is satisfied with the validation, it will make an AJAX call to twitter_ajax.php.
  3. The PHP script does server side validation, and then constructs the request. It then executes the request, and prints out the response from the Twitter API endpoint.
  4. The jQuery now reads the output of the PHP script, extracts the relevant details, and inserts them into the response div. In case there is an error, it must notify the user.

And that does it! Do spend some time with the Twitter API. Some links I referred to:

  1. Twitter API Wiki
  2. API Page for status/update
  3. An example of cURL with Twitter
Leave a Comment :, , , , , , more...

How to Tweet using your own PHP script – 1

by Ninad on Aug.04, 2009, under Hobbies, PHP/jQuery

Twitter is the darling for many folks on the internet these days.  The sheer simplicity of Twitter is what makes it so endearing.  This simplicity is observed not only in it’s UI and UX, but also in it’s brilliant API.  With one of the most well documented APIs I have seen to date, for a web service, it is pretty easy to fiddle with Twitter.

In this 2 part post, we will have a look at a small PHP script which posts tweets for a given user.  I have used jQuery along with the cURL library to post the tweets.  This is just an example, and hence has almost no validation.  Ensure that all the requirements given on the Twitter API wiki are met, when writing your own code.

The HTML code for this, which i’ll keep in the twitter.html file, is:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>Twitter Test Page</title>
        <script src="jquery.min.js" type="text/javascript"></script>
        <script src="tweet.js" type="text/javascript"></script>
    </head>
   
    <body>
        <fieldset>
        <legend>Twitter Details</legend>
            <ul>
            <li> <label for="username">Username: </label>
<input id="username" name="username" type="text" /></li>
            <li> <label for="password">Password: </label>
<input id="password" name="password" type="password" /></li>
            <li> <label for="status">Status: </label> <textarea id="status" name="textarea"> </textarea></li>
            <li> <input id="submit" name="submit" type="submit" value="Post Tweet" /></li>
        </ul>
        </fieldset>
        <div id="response">
       
        </div>
    </body>
</html>

This is pretty simple HTML code. We have a form that takes in the users Twitter username, password, and the text for the tweet. The textarea has a maximum length of 140 characters, which should also be validated by the JavaScript and PHP. Twitter expects the clients to validate this.

The tweet.js file contains the following jQuery code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
$(document).ready(function()    {
                $("#response").hide();
               
                $("#submit").click(function(event) {
                    event.preventDefault();
                    $("#response").text("Processing...").show("slow");
                    $.ajax({ type: 'POST',
                             url: 'twitter_ajax.php',
                             data:{
                                ajax_req: true,
                                username: $("#username").val(),
                                password: $("#password").val(),
                                status: $("#status").val()
                             },
                             success: function(data){
                                var output = "";
                                output += "Tweet ID : "+data.id+"<br />";
                                output += "Text : "+data.text+"<br />";
                                output += "Username : "+data.user.name+"<br />";
                               
                                $("#response").html(output);
                             }
                    })
                });
            });

As you can clearly see, this is one of the two main parts of our how to. It makes an AJAX request to our twitter_ajax.php script, with the username, password and text as POST parameters. On a successful response from our AJAX script, it constructs the HTML to be inserted into the ‘response’ div, and then inserts it into that.

In the next post, we’ll have a look at the PHP back-end (twitter_ajax.php) of this how-to, where cURL will do all the hard work of actually posting our tweet to Twitter.

Leave a Comment :, , , , , , more...

How to install Amarok 1.4 on Jaunty

by Ninad on Jul.24, 2009, under Hobbies, Linux/Ubuntu

This is for all those Amarok 1.4 fans out there, who miss it, and are stuck with Amarok 2.x in (K)Ubuntu Jaunty.  A few days ago, I was reading a discussion on Reddit, about the general frustration of users with Amarok 2.x, and I came across this jewel.

A noble soul has taken the efforts to package the Amarok 1.4 sources for Jaunty, and put them up at his Launchpad PPA Archives.   The instructions to add a PPA can be found very easily on Launchpad, but here they are, just for your reference:

  • Add the repository to your sources list.  You can do this by two methods:
  • Add the following line to your apt sources list from a text editor:
    #Launchpad ppa's for amarok 1.4 in jaunty!
    deb http://ppa.launchpad.net/bogdanb/ppa/ubuntu jaunty main
    deb-src http://ppa.launchpad.net/bogdanb/ppa/ubuntu jaunty main
  • OR, Add each of the above lines individually to the ‘Third Party Software‘ in System > Administration > Software Sources, or Settings > Repositories in Synaptic
  • Add the GPG key used to sign the package to your apt.
  • sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys AE74AE63
  • Update your package list, and install the amarok14 package.  It’ll automatically uninstall any amarok2.* packages installed on your system.
Leave a Comment :, , more...

Flickr

Jame Raho!KashmakashYeh Jo Des Hai TeraOpen All NightHello JuniorHello Mister...

My Last.fm records

NASA IOTD

Watching History Unfold

 
Guests look on from the terrace of Operations Support Building II as space shuttle Endeavour launches on the shuttle program's last planned night launch. Endeavour launched from Kennedy Space Center's Launch Pad 39A to begin the STS-130 mission early Monday, Feb. 8, 2010. Mission STS-130 will deliver a third connecting module, the Italian-built Tranquility node and a seven-windowed cupola, which will be used as a control room for robotics, to the International Space Station. Image Credit: NASA/Paul E. Alers
Read More

Categories