opml to csv converter

This is a first step in being able to make all  my  planets    configurable from anywhere. The following ruby script parses the opml file specified on the command line and generates a comma separated file with XML feed URL and feed title. In case of nested outline elements, it just picks the elements which actually have xmlUrl attribute (this will flatten the opml hierarchy which is used by google reader - for implementing labels and bloglines - for implementing folders)

require 'csv'
require "rexml/document"
include REXML
if ARGV.length >=1
fname = ARGV[0]
else
fname = "opml.xml"
end

doc = Document.new File.new(fname)
CSV.open('csvfile.csv', 'w') do |writer|
doc.elements.each("//outline[@type='rss']") {|element|
writer < <  [element.attribute("xmlUrl").value, element.attribute("text").value]
}
end

Hridaynath Mangeshkar in Los Angeles

Had the pleasure of attending the live concert of Pandit Hridaynath Mangeshkar (Feb 21, 2009). It was a blast - with Panditjee's rendition of the memorable songs that he has composed and sung (in some cases). There were around 400 people attending and still it had a feel of a private mehfil with Panditjee responding to farmaish for most of the concert. He also broke into the background stories of each of the songs and the people behind the magic of them. He also showed his typical tricks like making plenty of fun of the Marathi Mandal's secretary and testing the local singer by starting out the opening lines of the duets in different scales 🙂

Here is a list of all the songs in sequence: (The video links are not the videos from the program, but just links to youtube videos of the same song)

  1. Gagan Sadan Tejomay - गगन सदन तेजोमय (Video)
  2. Tu tevha tashi - तू तेव्हा तशी (Video)
  3. Sarja Raja - सर्जा राजा (Video)
  4. Sunya Sunya Maifilit majhya - सुन्या सुन्या मैफ़िलीत माझ्या (Video)
  5. Ti Geli Tevvha Rimjhim - ती गेली तेव्हा रिमझिम पाऊस निनादत होता (Video)
  6. Jambhul Piklya Zada khali - जांभुळ पिकल्या झाडाखाली (Video)
  7. Yaara Seeli Seeli - यारा सीली सीली (Video)
  8. Gorya Dehavarati Kanti - गोर्‍या देहावरती कांती (Audio)
  9. Ne Majasi Ne Parat Matrubhumila - ने मजसी ने परत मात्रुभुमीला (Video)
  10. Valhav Re Nakhava - वल्हव रे नाखवा (Video)
  11. Daya Ghana - दया घना (Video)
  12. Runu Jhunu Re Bhramara - रूणू झूणू रूणू झूणू रे भ्रमरा (Video)
  13. Sarnar kadhi raN Prabho - सरणार कधी रण प्रभो Video
  14. Shur amhi sardar - शूर आम्ही सरदार आम्हाला Video
  15. Vedat marathe veer doudale saat - बेडात मराठे वीर दौडले सात Video
  16. kevha tari pahate - केव्हा तरी पहाटे (Video)
  17. malavoon taak deep - मालवून टाक दीप (Video)
  18. chandanyat phiratana - चांदण्यात फिरताना (Video)
  19. Mee maj harapun basale - मी मज हरपून बसले (Video)
  20. Jivalagaa - जिवलगा (Video)

Password protect GNU screen sessions

Or, How do i get a crypted password for .screenrc ?

Here is a quick tip, hopefully it helps someone, I struggled with this for some time...

I have been using GNU screen program since a long time. This program is like a window manager for terminals and is especially useful for ISP and home shell accounts. You can have multiple shells running under the same session and can easily detach the sessions and reattach them from a different computer later etc.

I usually password protect my sessions by using the password command (ctrl A :password). But I had a hard time figuring out how to set that password in .screenrc file. The file obviously does not store it in plaintext and uses a crypted version of password. To get the crypted password, simply set your password in the screen session (ctrl A :password and then enter the password twice), then the crypted version gets automatically saved to screen's copy buffer! All you need to do is have a line in your .screenrc which looks like this
password DTWxS2voQWkgI

After this all your new screen sessions will be automatically password protected (meaning you will need the password to reattach a session.)

Sony Bravia Internet Link Unofficial API

Some notes from experimenting with my new toy!

The device (DMX) plugs into HDMI port of the TV and has its own HDMI input allowing pass-through. The control of DMX is done from a USB cable which is attached from the TV to DMX (Wonder why they do not use the HDMI for that!). DMX has an ethernet port which can get autoconfigured using DHCP (or can also be configured for manual settings from the TV). Sony has licensed a lot of content providers (slacker for radio and tons of other video providers like youtube, Amazon, Yahoo, Blip.tv). They have a portal (http://internet.sony.tv/) which allows you to add your own video links and some browser extensions which allow you to link your favorite videos which the DMX can then play for you. The firefox extension unfortunately requires older (2.X) version of firefox and does not work with newer versions (3.X). I tweaked that extension and it now works okay without significant changes. Here is a link to it. This extension adds a context menu to firefox and you can use it to direct the DMx to start playing the linked video, bookmark it etc. The caveats are that the link needs to be a raw video file (mp4, mov, avi, divx etc.) and not HTML file or any other kind.

Here is what I learned from reverse engineering the extension code.

The DMX runs a primitive web browser on port 9784. The server is reportedly called "Callisto Debug Server v0.2". There is a php script running which responds to URLs like the following
Send commands using the following REST API:

http://192.168.0.101:9784/renderer.php?method=play&url={encoded URL}

The firefox and internet explorer generates these URL's.

Here is what I gathered from the extension code about the API:

Available commands and arguments:

  • play (url => encoded URL to mp4, AVI, MOV file to play)
  • pause
  • stop
  • addbookmark (title=> encoded bookmark title, description=>encoded description, icon => ???, source =>encoded URL)

It seems to play the mp4 files quite well (I had good success with HD mp4 links from youtube and dailymotion websites which have a lot of bollywood movies). The streaming is very smooth and video quality is acceptable. You can use a website like http://keepvid.com/ to see the hidden video links. These links are then directly playable by DMX. I will experiment with AVI, MOV, DIVX files next...

Next step for me is to create a simple webservice which does all of these steps and posts the link to the DMX! Can't wait till I can manage to do that...

बाल विहार प्रार्थना

To play the file, click on the small triangle before the name. (needs javascript and flash plugin)
To download the file, right click on file name and select “Save Link As” or “Save Target As”

१ एकदन्तम्‌ महाकायं लम्बोदर गजाननम्‌ ।
विघ्ननाशकरम्‌ देवं हेरम्बं प्रणमाम्यहम्‌ ॥
(Ekadantam mahakayam lambodaragajananam
Vighnanashkaram devam herambam pranamamyaham)

O Lord Ganesha, who has a single tusk, mighty body, pendant bellied,
I pray to Thee Oh Lord, to remove the obstacles from all actions I intend to perform

२ गुरूर्ब्रह्मा गुरूर्विष्णु: गुरूर्देवो महेश्वर:।
गुरूरेव परं ब्रह्म तस्मै श्रीगुरवे नम:॥
( Gurur Brahmaa Gurur Vishnuh Gurur Devo Maheshvarah;
Gurureva param Brahma tasmai Shree Guruve namah)

Gurur Brahma Gurur Vishnu Audio

Guru is Brahma, guru is Vishnu, guru is Lord Maheshwara; guru is the visible
supreme divinity incarnate, salutation to that guru.

३ सरस्वति नमस्तुभ्यं वरदे कामरूपिणि ।
विद्यारंभं करिष्यामि सिद्धिर्भवतु मे सदा ॥

(Sarasvati namastubhyam varade kaamaroopini
Vidyaarambham karishyami siddhir bhavatu me sadaa)

Salutation to you, O Saraswati, grantor of blessings and embodiment of all wishes;
I am getting inducted to studies, may there be fulfilment for me forever.

४ कराग्रे वसते लक्ष्मी: करमध्ये सरस्वती ।
करमूले तु गोविन्दम्‌ प्रभाते करदर्शनम्‌ ॥

(Karaagre vasate Lakshmi, karamadhye Sarasvatee
Karamoole tu Govindam prabhaate karadarshanam)

Karagre Vasate Laxmi Audio

At the fore of the hands resides Lakshmi, and at the middle, Saraswati;
at the root is seated Gauri, (so) see the palm of the hand at dawn (first).

शांति मंत्र
ॐ सह नाववतु सह नौ भुनक्तु, सह वीर्यं करवावहै ।
तेजस्वि नावधीत्मस्तु मा विद्विषावहै ॥
ॐ शान्ति: शान्ति: शान्ति: ॥

Shanti Mantra (Om saha naavavatu saha nau bhunaktu saha veeryam karavaavahai
Tejasvinaavadheetamastu maa vidvishaavahai,
Om Shaantih, Shaantih, Shaantih.)

May he protect us both—the teacher and the taught. May he nourish us both.
May we acquire more strength (from knowledge).
May our study be enlightened and may we not dislike each other.

६ सर्वे भवन्तु सुखिन: सर्वे सन्तु निरामय: ।
सर्वे भद्राणि पश्यन्तु मा कश्चिद्‌ दु:खभाग्‌ भवेत्‌ ॥

(Sarve bhavantu sukhinah, sarve santu niraamayaah;
Sarve bhadrani pashyantu, maa kashchid duhkhabhaag bhavet.)

Oh Loard in Thee may all be Happy, may all be free from misery
May all realise goodness and may no one suffer pain.

गायत्री मंत्र

ॐ भूर्भुव: स्व:।
ॐ तत्सवितुर्वरेण्यं भर्गो देवस्य धीमहि।
धियो यो न: प्रचोदयात्‌ ॥ ॐ ॥

Gayatri Mantra
(Om bhur bhuvas suvaha, Om tat savitur vareNyaM, bhargo devasya dhimahi
Dhiyo yo nah prachodayaata, Om.)

Listen to ॐ भूर्भुव: स्व:
We meditate on the glory of the Creator, ; Who has created the Universe;
Who is worthy of Worship; Who is the embodiment of Knowledge and Light;
Who is the remover of all Sin and Ignorante; May He enlighten our Intellect.

८ ॐ पूर्णमद: मूर्णमितं पूर्णात्पूर्णमुदच्यते ।
पूर्णस्य पूर्णमादाय पूर्णमेवावशिष्यते ॥

(Om poornamadah poornamidam poornat poornamudachyate
Poornasya poornamadaaya poornamevaavashishyate.)

That (pure consciousness) is full (perfect); this (the manifest universe of matter;
of names and forms being maya) is full. This fullness has been projected
from that fullness. When this fullness merges in that fullness, all that
remains is fullness.

महा मृत्युंजय मंत्र
ॐ त्र्यंबकं यजामहे सुगन्धिं पुष्टिवर्धनम्‌।
उर्वारूकमिव बंधनान् म्रूत्योर्मुक्षीयमाम्रुतात्‌॥

Maha Mrutyunjay Mantra
(Om Tryambakam yajaamahe sugandhim pushtivardhanam
Urvarukamiva bandhanaat mrutyor mukshiya maamrutaata.)

Om. We worship the three-eyed One (Lord Shiva) Who is fragrant and
Who nourishes well all beings; may He liberate us from death for the sake of
immortality, even as the cucumber is severed from its bondage (to the creeper).

१० असतो मा सत्‌ गमय। तमसो मा ज्योतिर्गमय।
म्रुत्योर्माऽ म्रुतं गमय। ॐ शान्ति: शान्ति: शान्ति: ॥

(Asato Maa sat gamaya, tamaso maa jyotir gamaya
mrityor maa amrutam gamaya, Om Shaantih, Shaantih, Shaantih.)

O Lord, please lead me from unreal to real. Please lead me from darkness to light.
(i.e. from ignorante to knowledge). Lead me from death to immortality.

११ वक्रतुण्ड महाकाय सुर्यकोटी समप्रभ ।
निर्विघ्नम कुरुमे देव सर्व कार्येषु सर्वदा ॥

(Vakratunda mahaakaaya suryakoti samaprabhaa
Nirvighnam kurumedeva sarvakaryeshu sarvadaa)

Vakratunda Mahakaya Audio

O god with the twisted trunk, broad-bodied, brilliant as thousand suns, bless me with
freedom from obstructions and hindrances in all my works and for all times.

१२ ओंकारम्‌ बिंदुसंयुक्तम्‌ नित्यं ध्यायन्ति योगिन:।
कामदं मोक्षदं चैव ओंकाराय नमो नम:॥

(Aumkaaram bindusanyuktam, nityan dhyayanti yoginah;
Kaamadam mokshadam chaiva, aumkaaraaya namo namah.)

Yogis meditate forever on Aumkara associated with the Bindu, salutation to the
Aumkara, the grandor of wishes and salvation.

१३ कायेन वाचा मनसेंद्रियैवा बुध्यात्मना वा प्रक्रुते: स्वभावात्‌।
करोमि यद्यत्‌ सकलं परस्मै नारायणायेति समर्पयामि ॥

(kaayena vaachaa manasendriyairva, budhyatmanaa vaa prakruteh swabhaavaat;
Kaaromi yadyat sakalam parasmai, naaraayanaayeti samarpayaami.)

Whatever I do either by body, speech, mind or sensory organs, either with my personal
knowledge or natural trait, I surrender and submit all to that supreme divine Narayana.

१४ त्वमेव माता पिता त्वमेव त्वमेव बन्धुश्च सखा त्वमेव।
त्वमेव विद्या द्रविणं त्वमेव त्वमेव सर्वं मम देवदेव ॥

(Tvameva maataa cha pitaa tvameva, tvameva bandhushcha sakhaa tvameva;
Tvameva vidyaa dravinam tvameva, tvameva sarvam mama devadeva.)

You are the mother, you are the father, you are the relative, you are the friend,
you are education, you are wealth, you are everything for me, O Lord, O Lord.

१५ शुभं करोति कल्याणं आरोग्यं धनसंपद: ।
शत्रु बुद्धि विनाशाय दीपज्योति: नमोऽस्तुते ॥

(Shubham karoti kalyanam, aarogyam dhanasampadah;
Shatru budhhi vinaashaaya, deepajyotih namoostu te.)

The grantor of auspices, welfare, health, wealth and prosperity, salutation to you
O flame of the lamp, for the destruction of the thought of enmity.

Did wordpress upgrade destroy all your unicode posts ?

I upgraded wordpress software for this blog to version 2.5.2. After that none of the posts that had devanagari (unicode) text looked okay. After comparing the configuration files, I discovered that the troubling variable is DB_CHARSET. The default config setting is 'utf8'. But if you have been updating the software versions, your database table is probably in 'latin-1' charset, though wordpress has been saving unicode data to the tables. Once you remove the DB_CHARSET setting (or setting it to latin-1 or ''), things return to normal.

The setting is in the file wp-config.php in the wordpress install directory.
The value before change:
define('DB_CHARSET', 'utf8');

The value after change:
//define('DB_CHARSET', 'utf8');
define('DB_CHARSET', '');

So maybe I should try to recreate the tables with correct charset defined in mysql some day ?

Google jumps into custom hosted application bandwagon!

Google has launched appengine which provides developers with a platform SDK (python based!) and hosting with access to own Google BigTable database! This competes with Amazon.com's SQS , S3 (storage) and EC2 (hosting) services which are used by many startups... The applications will get google's massively scalable infrastructure, failover. Apps would also be able to easily use google's user authentication, analytics and other google API's.

The applications gallery points to some cool goodies... The applications would get a subdomain under appspot.com. So it is possible to run a search on google to find the existing applications.

Here is a python shell web app. You can see the loaded modules, enter and run some small programs...

Both companies are trying to entice developers from hot startups into using their infrastructure, so just in case they start getting bigger, it is easier to assimilate them! Let there be competition!

Book updates

Finished the following books:
Little Book that Beats the Market Great book on investing! Very easy to read and short too! Joel Greenblatt describes a "magic formula" to rank stocks (based on two criteria: Return on Assets and Earnings yield (reverse of P/E!), rank stocks with higher numbers for both. Add the two ranks and rerank based on sum of the two ranks). Then buy a basket of 20-30 stocks who are top ranked and hold them for 1 year. Sell them all after 1 year, re-apply the formula and buy new stocks with highest rankings. Rinse and Repeat. Based on backtesting with different ways, this portfolio has handily beaten the market averages. I wonder why backtesting was only done for past 13 years when comprehensive US market data is available for 75+ years.

The strategy seems sound and is well supported by theory. (High ROA companies means, good earnings on slim assets. High Earnings yield means they are currently cheap. Using the book's website you can very easily find the rankings and stocks that you need. The only problem I see with this strategy is implementation. Buying and selling 30 stocks every year (60 transactions) is not cheap (okay, I am an index fund person - 0.19% fund expenses). I could possibly use buyandhold.com or foliofn.com, but they are not cheap. Also the author might turn the website into a paysite (so you have to use something like moneycentral.com to screen your stocks. I will make a couple of mock portfolios to keep watching the strategy for sure.

The Tipping Point I guess I am not a Malcom Gladwell person! This book was on my to-read list for a long time and though I liked the basic premise of the book, somehow I was disappointed by the presentation. I had the exact same reaction after I finished Blink. Anyway...

Seminar: Morgan Dene Oliver – CEO OliverMcMillan

Today's speaker was Morgan Dene Oliver who is a CEO of OliverMcMillan, a real estate development and management firm. While his projector was getting fixed, he started by doing some show-of-hands about who in the audience:
1. believes "Art and Design" are essential for their future success ? (Many hands went up)
2. believes they are left brained ? (some - much less that I anticipated)
3. believes that people can use both left and right side of their brain ? (Huh ? almost all hands)

Then he offered some introduction about the left and right brain functions and recommended a book by Daniel Pink: A Whole New Mind which talks about how your right brain is going to help you achieve differentiation. Morgan also mentioned that Creativity, Tenacity as very important values for entrepreneurs. "You can always find someone who is more brilliant than you, but not someone who is more creative than you". With this theme, the presentation started. On the showcase were several of the stunningly beautiful and familiar buildings in La Jolla, UTC, Downtown area. He touched upon how they started to introduce complete community-in-a-building feeling to all their development, the importance of location for real-estate (I have yet to see any real-estate guy not utter location-location-location phrase in any talk), strategically buying properties in downturn and also some of the mistakes that they made and some of the unfortunate bad timings. Someone asked about Green Buildings (eco friendly) in San Diego downtown and his answer was that this was no longer a fad, but a requirement. Also mentioned about supporting the art tax bill from all commercial development. Had an interesting advice for real estate locations - buy properties near art galleries, gay communities!

Date: Nov/02/07

Seminar: Leo Spiegel – Mission Ventures

This was the first professional seminar. Leo Spiegel is a managing partner with Mission Ventures, a hi-tech venture capital firm. Leo has been a president of Digital Island, CEO of Sandpiper Networks. He is also a member of Dean's advisory Council of Rady School of Management, UCSD.

This was an interesting and engaging presentation about Leadership Lessons (the subtitle was funny but I cannot remember it). One interesting thing was that all the slides were a single point followed by a cartoon describing that. Presentation Zen!

The actual message in the presentation was same-old. Good values, Vision, Choose Great People. Common sense (so uncommon in practice!). The anecdotes after each point were very interesting. The following question-answer session was also great - He talked about the startups in San Diego and Orange County area, the profiles of the companies they are currently "incubating" (Entropic, Slacker - which he was very enthusiastic about), his greatest investments so far...

All in all, a great kickoff to the seminar series.

Date: Sept/21/07

Seminar: John Mutch – MV Advisors

John Mutch has been a CEO of HNC software and was appointed the CEO of Peregrine Systems by Federal Bankruptcy court. He took Peregrine Systems from bankruptcy condition to the price tag of $425 millions (HP was the buyer). Since then he started a MV Advisors, an "Activist hedge fund".

What is an Activist Hedge Fund ? The strategy is to find technology companies which are undervalued compared to peers because of corporate governance issues and organize shareholder activism to improve them and in the process create market value. They do this by establishing big stock positions (starting from 4.9 percent which keeps you under SEC radar!), bargaining for board seats and then improving matters by possibly restructuring products, reviewing executive compensation, spin-off, merge as necessary and kick away non-performing executives!

An interesting business model and a good conversation...

Date: Oct/05/2007

Quick tip – how to extract audio from youtube videos

Here is a quick tip for extracting audio from youtube videos. I assume you have a reasonably recent linux distribution. (Things might work on other operating systems as well as all the applications that I mention below are ported to other operating systems)

Step 1: Download the flash video file from youtube. Either use greasemonkey script or a python script to extract it. (I use the python script way BTW) You can also use the online site VideoDL.org to show you the download link.
Step 2: Use ffmpeg or mplayer to extract audio from the flv file that you just downloaded:
ffmpeg -i f7v9NhmF3SY.flv johny.mp3
OR
mplayer -dumpaudio f7v9NhmF3SY.flv -dumpfile johny.mp3

Enjoy!

Some excel functions

I keep forgetting some of the functions in excel and it is embarrassing to search for the same things every time.

PERMUT(n, r) = nPr = n! / (n - r)!
COMBIN(n, r) = nCr = n!/((n-r)!r!)
FACT(n) = n! = 1*2*3*...*n
BINOMDIST(s, n, p, cumul) Probability that there will be exactly s successes in n trials, each trial having a success probability of p (cumul = FALSE). If cumul is true it returns the probability that there will be at most s successes in n trials.

श्री गणपती आरती

श्री गणपती आरती ध्वनी मुद्रित
http://amit.chakradeo.net/files/aarti/Sampoorna/01 Sukhkarta Dukhharta.mp3
सुखकर्ता दुखहर्ता वार्ता विघ्नांची
नुरवी पुरवी प्रेम कृपा जयाची |
सर्वांगी सुंदर उटी शेंदुराची,
कंठी झळके माळ मुक्ताफळांची॥१॥

जय देव जय देव जय मंगलमूर्ती|
दर्शनमात्रे मनकामना पुरती ॥धृ॥

रत्नखचित फरा तुज गौरीकुमरा|
चंदनाची उटी कुमकुम केशरा|
हिरेजडित मुकुट शोभतो बरा |
रुणझुणती नूपुरे चरणी घागरिया|
जय देव जय देव जय मंगलमूर्ती ॥२॥

लंबोदर पीतांबर फणिवरबंधना |
सरळ सोंड वक्रतुंड त्रिनयना|
दास रामाचा वाट पाहे सदना|
संकटी पावावे निर्वाणी रक्षावे सुरवरवंदना|
जय देव जय देव जय मंगलमूर्ती|
दर्शनमात्रे मनकामना पुरती ॥३॥