Updates from March, 2013 Toggle Comment Threads | Keyboard Shortcuts

  • Harshad Joshi 11:07 am on March 7, 2013 Permalink | Reply
    Tags: software   

    The care and feeding of software engineers (or, why engineers are grumpy) | NCZOnline 

    http://www.nczonline.net/blog/2012/06/12/the-care-and-feeding-of-software-engineers-or-why-engineers-are-grumpy/

    #nowreading

    Posted from WordPress for Android

     
  • Harshad Joshi 12:24 pm on March 21, 2011 Permalink | Reply
    Tags: Google Voice,   

    XMPP stanzas for Google Voice user in india 

    Google Voice is an awesome service that enables free callings to USA and Canada and has got affordable rates for rest of world..From last few days, I am getting Google Voice’s Call button in my gmail chat window. As Google Voice is not officially launched in India, this service keeps on coming and vanishing randomly..

    I captured some xmpp stanzas using my xmpp bot

    got   <presence from=”purigol@gmail.com/gmail.D63F1C6C” to=”firewalrus@gmail.com/0A882B52” id=”4″>
    <priority>24</priority>
    <caps:c node=”http://mail.google.com/xmpp/client/caps” ver=”1.1″ ext=”pmuc-v1 sms-v1 video-v1 voice-v1″ xmlns:caps=”http://jabber.org/protocol/caps“/>
    <status>Meeeep</status>
    <x xmlns=”vcard-temp:x:update”>
    <photo/>
    </x>
    </presence>

    DEBUG: dispatcher   ok    Got jabber:client/presence stanza
    DEBUG: dispatcher   ok    Dispatching presence stanza with type-> props->[u’jabber:client’, u’http://jabber.org/protocol/caps‘, u’vcard-temp:x:update’] id->4
    DEBUG: roster       ok    Setting roster item purigol@gmail.com for resource gmail.D63F1C6C…

    I have got some screenshots, but i will save them for later stages.

    I am not sure if Google is just testing Google Voice promo in India..i believe its launch in india will radically change the voice and mobile market..

    Dear google, please free us from the tyranny of mobile companies… 😉 😛

     
  • Harshad Joshi 5:54 am on August 5, 2010 Permalink | Reply  

    Django Live | Download Django Live software for free at SourceForge.net 

    Django-OS – Live CD running on hardened kernel and LAMP stack – http://sourceforge.net/projects/djangolive/ #opensource #python #LAMP #india

    via Django Live | Download Django Live software for free at SourceForge.net.

     
  • Harshad Joshi 5:32 am on June 22, 2010 Permalink | Reply
    Tags:   

    Where am I? 

    If you need to find me….get over here – http://moiblogging.wordpress.com or just leave a comment, I’ll get back to you. 🙂

     
  • Harshad Joshi 4:07 pm on April 11, 2010 Permalink | Reply
    Tags:   

    Python Pits.. 

    Q. How many times do we require to convert a python tuple to plain string?
    A. It was during one situation that I required to collect some data directly from the database. If this wasent enough, I had to send the data to a mobile using sms. I used MySQLdb and connected to the database.The program was as follows.

    import codecs
    import MySQLdbconn = MySQLdb.connect(host=’localhost’,use_unicode = True, charset = “utf8″, user=’harshad’,passwd=”,db=’statusnet’)

    cursor=conn.cursor()

    p=cursor.execute(“””select content from notice where profile_id = 1″””)

    g=cursor.fetchall()

    q=[]
    for i in g:
    j=str(i)
    q.append(codecs.encode(j))

    print len(q)

    for e in q:
    print codecs.encode(e)

    The output of the program was as follows.

    python statusnet.py
    5
    (u’Traces, many faces, lost till the end of time… http://localhost/statusnet-0.8.2/index.php/attachment/1&#8242;,)
    (u’hello.c http://localhost/statusnet-0.8.2/index.php/attachment/2&#8242;,)
    (u’Hallo.’,)
    (u’Wussup??’,)
    (u’!harshad hi..’,)
    [“(u’Traces, many faces, lost till the end of time… http://localhost/statusnet-0.8.2/index.php/attachment/1&#8242;,)”, “(u’hello.c http://localhost/statusnet-0.8.2/index.php/attachment/2&#8242;,)”, “(u’Hallo.’,)”, “(u’Wussup??’,)”, “(u’!harshad hi..’,)”]
    root@indiaforce:~# python statusnet.py
    5
    (u’Traces, many faces, lost till the end of time… http://localhost/statusnet-0.8.2/index.php/attachment/1&#8242;,)
    (u’hello.c http://localhost/statusnet-0.8.2/index.php/attachment/2&#8242;,)
    (u’Hallo.’,)
    (u’Wussup??’,)
    (u’!harshad hi..’,)
    [“(u’Traces, many faces, lost till the end of time… http://localhost/statusnet-0.8.2/index.php/attachment/1&#8242;,)”, “(u’hello.c http://localhost/statusnet-0.8.2/index.php/attachment/2&#8242;,)”, “(u’Hallo.’,)”, “(u’Wussup??’,)”, “(u’!harshad hi..’,)”]

    Wow..look at the output. I got a nice tuple. Now do I send a tuple as sms??

    After some time I realized that there must be a way to convert all tuples to a string and then send the strings either to the screen or to the mobile or anywhere…

    Here is the code..

    import MySQLdb
    import codecsconn = MySQLdb.connect(host=’localhost’,use_unicode = True, charset = “utf8″, user=’harshad’,passwd=”,db=’statusnet’)

    cursor=conn.cursor()

    p=cursor.execute(“””select content from notice where profile_id = 1″””)

    y=[]
    while (1):
    a=cursor.fetchone()
    if a == None:break
    print a
    y.append(a)

    print y

    g=[]
    for i in y:
    s=i
    b=[j.encode(“utf-8”) for j in s]

    for i in b:
    print b
    g.append(i)

    print “g > “,g

    Output

    python statue.py
    (u’Traces, many faces, lost till the end of time… http://localhost/statusnet-0.8.2/index.php/attachment/1&#8242;,)
    [(u’Traces, many faces, lost till the end of time… http://localhost/statusnet-0.8.2/index.php/attachment/1&#8242;,)]
    (u’hello.c http://localhost/statusnet-0.8.2/index.php/attachment/2&#8242;,)
    [(u’Traces, many faces, lost till the end of time… http://localhost/statusnet-0.8.2/index.php/attachment/1&#8242;,), (u’hello.c http://localhost/statusnet-0.8.2/index.php/attachment/2&#8242;,)]
    (u’Hallo.’,)
    [(u’Traces, many faces, lost till the end of time… http://localhost/statusnet-0.8.2/index.php/attachment/1&#8242;,), (u’hello.c http://localhost/statusnet-0.8.2/index.php/attachment/2&#8242;,), (u’Hallo.’,)]
    (u’Wussup??’,)
    [(u’Traces, many faces, lost till the end of time… http://localhost/statusnet-0.8.2/index.php/attachment/1&#8242;,), (u’hello.c http://localhost/statusnet-0.8.2/index.php/attachment/2&#8242;,), (u’Hallo.’,), (u’Wussup??’,)]
    (u’!harshad hi..’,)
    [(u’Traces, many faces, lost till the end of time… http://localhost/statusnet-0.8.2/index.php/attachment/1&#8242;,), (u’hello.c http://localhost/statusnet-0.8.2/index.php/attachment/2&#8242;,), (u’Hallo.’,), (u’Wussup??’,), (u’!harshad hi..’,)]
    [‘Traces, many faces, lost till the end of time… http://localhost/statusnet-0.8.2/index.php/attachment/1’%5D
    [‘hello.c http://localhost/statusnet-0.8.2/index.php/attachment/2’%5D
    [‘Hallo.’]
    [‘Wussup??’]
    [‘!harshad hi..’]
    g >  [‘Traces, many faces, lost till the end of time… http://localhost/statusnet-0.8.2/index.php/attachment/1&#8217;, ‘hello.c http://localhost/statusnet-0.8.2/index.php/attachment/2&#8217;, ‘Hallo.’, ‘Wussup??’, ‘!harshad hi..’]

    I dont know how many times we land up in a similar situation, now that we have got a list, we can easily iterate through it and get a sleek string as output. No hassles at all.. It still shows some hiccups, nevertheless it works..kludgy but effective. Can work for any amout of rows that we need..

    Main intention of writing this place is that I couldent find a better example on google and wondered if I write it, might be useful, and if someone is finding a solution for it, here is it.. 🙂

    End of Logs.

    Posted via email from [root@localhost /root]#

    PS – In case you wonder I havent added any exception handling code..it is one of my prime mottoes not to write code generating exceptions. so far its been good. 😉

    print q

     
  • Harshad Joshi 6:46 am on September 12, 2009 Permalink | Reply
    Tags: , The milkman story   

    Some freak economics a milkman taught me 

    Economics is a very facinating mix of theorotical science and practical art of managing money. Apart from spelling the word economics right, theres very little contribution to world economics from my side..

    until now..

    Few days ago, one interesting bill was attached to our common notepad – It was the milkman bill..Out of utter curiosity, I looked at it and was staggered..!! It read that I had to pay almost 1000/- to the milk man, and the service charges were extra. Service charges in this case was the salary given to the milk delivering boy and some supply chain management costs..

    I just calculated – The milkman gets approx 1000 rupees from my house. He delivers milk to adjoining 50 homes. On an average, a family needs 1 litre of milk everyday, and in Pune, the well known brand costs around 32 rupees a litre. So, in all, it works about 30×32 = Rs 960/- per home. Multiply it with 50 families, and the monthly income of the milkman is – 960×50 = 48000..!! The milkman automatically gets a decent discount from the milk supplier since he purchases them in bulk. The other cost is that of the milkboy who delivers those bags early in the morning..I am not sure how much salary he will fetch, lets assume he gets 2500/- pm. Most of the time that boy needs to invest 2 hours per morning and then continue study or any other activity. That leaves Mr Milkman the amount of almost  47000/- pm. Add to it there is no known and official service tax on doing this.Wow..aint that awesome? Add to it that our milkman does work in a bank apart from delivering milk, so this salary is extra to him…

    Incredible.!!

    I read in papers that many freshers in engineering arent getting jobs and even if they land on one, they have to work as a trainee for well over 1.5 years till they start getting the standard salary. Add to it the cutting edge training costs these engineers invest in.

    From the facts based above, I can safely say that I want to be a Milkman…instead of slogging in front of the computer writing cryptic and buggy software, its better I start something like this..!! Till few years ago, milk delivery man was just another poor mans job..today its turned to be a number one earning service with comparative less stress etc. Of course, even this field might have its own unknown risks, losses, and all that stuff, but did anyone ever look at the strange economy behind the scene??

    I dont know..

    PS  – All figures are indicative, your milage may vary. I am an ignorant and untrained economist, so please forgive me if I make mistakes.. 😉

     
    • Prasad Kulkarni 9:25 am on September 12, 2009 Permalink | Reply

      Harshad, no doubt that Milkmen are milking money like anything. But is that the only thing attached to it?

      A milkman needs to buy a cow or buffalo. A price which will break even after 2-3 months. Adding to that he needs to develop the customer base which needs lot of marketing cost (though not much considering the company’s marketing cost).

      Also, he needs to buy food for those cows and buffaloes. That will also get subtracted from his earnings. He needs to buy shampoos and soaps for washing those cattle. If the cattle get sick he needs to take them to veterinary doctor adding to the total expenditure and subtracting from the earnings.

      This is not it, he needs to build a shed for them, keep the surrounding clean, milk the cattle (which is in fact the tough job, to milk the cattle).

      If you calculate all these things you will get very restricted surplus. This all accounts for almost Rs. 10,000 monthly (some pluses or some minuses) so what he gets ultimately in hand is around Rs. 38,000.

      But even then the earnings or profit he makes is hefty. But the hard work it needs to carry all these operations is very much. And if you really want to get into this business, you will not be able to perform all these tasks and for that you will have to hire someone who will share your profit.

      And the main thing is this job or business is unstable and volatile. Because if you under-perform (that means if you don’t produce good quality of milk) the house where you are serving will ask you to stop serving them.

      Now considering all these things, you tell me how good this job is.

    • Harshad Joshi 11:00 am on September 12, 2009 Permalink | Reply

      @Prasad

      Well, you are partially right in this case.

      The milkman I am talking about dosent maintain cows/buffaloes or goats.

      Instead he maintains a heavy duty refridgerator and purchases milk packets in bulk from Chitale, who in turn maintain the milk supply chain and milk producing machinary.

      Obviously I dont want to be Chitale, as its a very heavy invested business..

      I want to be the local milk man who maintains an important position in milk supply chain, and he is the one who comes in direct contact with end customers.

      The profits or expenditures I mentioned are that of the local milkman and not of Chitale or Katraj or Amul..

    • Prasad Kulkarni 2:40 pm on September 12, 2009 Permalink | Reply

      OK, but still the profits you have mentioned have some sharing components. The bill of electricity he will get by using Fridge. Then there are other factors like, if he owns a place then fine, but if doesn’t own then the rent is added thing.

      But he still manages to milk hefty profits.

    • Harshad Joshi 2:48 pm on September 12, 2009 Permalink | Reply

      @Prasad

      Bang on..thats what I am trying ot convey that the milkaman is earning more taxfree profits we can ever imagine..

      Add to the fact that no one ever asks the milkman for discount in milk bottle, say a rupee less, say Rs 31. We should all ask for discount, coz as it is we are going to purchase a guranteed 30 milkbottles from him, arent we supposed to get something in return??

      Shit, this is very dirty politics played all around..! We are wasting money..!

      Save money.

    • subbu 7:47 pm on December 29, 2009 Permalink | Reply

      The MilkMan gets his milk from another supplier. So doesn’t it mean he spends among the 48000 you had mentioned to procure that milk?

      So its not as much profit as it may seem. Even if he gets the milk at 3/4 of its price he is left with 12000 for operations cost. Whatever is leftover of that is his profit.

    • Ed Hartz 7:22 am on December 30, 2009 Permalink | Reply

      I am new to this industry. I only started weeks ago and I can tell you that this is a rewarding business for two reasons; it can be and is for me connected to the sustainable agriculture movement today, and second reason; it is lucrative if you want to sell and market and are good at it. I happen to live in one of the most lucrative counties in the USA. And I project that this business first year with only myself can earn $220,000. That is within a 15 mile radius and with 1-2 towns. I plan to move onto the other towns in my county then into Manhattan, New York. we will train other people to be their own distributors. The Milkman Company will take care of marketing, some of the sales jobs, buying power, product knowledge, and other office administrations.

      Watch for us in the industry. and watch for our Milkman delivery trucks. These same opportunities can exist for entrepreneurs in other regions of the State, the USA, and globally.

      Thank you.

      Ed Hartz
      President
      The Milkman Company

  • Harshad Joshi 10:57 am on August 4, 2009 Permalink | Reply  

    A sneek peek 

    Screenshot-ifl

    Thats the first preview of India Force Linux Desktop. Stay Tuned…

     
  • Harshad Joshi 7:24 am on January 28, 2009 Permalink | Reply
    Tags: , IBM, , Qbasic   

    The first program 

    10 REM

    20 PLAY “CDGFABC”

    30 END

    F5

     

    This isent a 3 lined haiku, its my first program written in Qbasic on a 286 MS-DOS machine in 1993. This was the first step into computing. Had no idea that one day I will be here.

    10 years later, the anatomy of IBM PC’s was revealed in ‘IBM PC’s and CLONES’, a classic cult book by B.Govindraju. Surprisingly, the teacher who taught me PC Architecture had no idea how to generate sounds through PC speaker. It wasent her fault, its the bad education system we have.

     
    • airborne 9:18 am on April 1, 2009 Permalink | Reply

      We have an examination system , not an education system. Quoting a UN representative after a meet with Ashok Ganguly, CBSE.

    • omkarr 4:52 pm on May 3, 2009 Permalink | Reply

      PLAY “CDGFABC”

      these are looking like music tones, great! I did not know it was that simple.

      The first time I generated sound in pc through programming was using C, if I remember correctly.. I specified the frequency and the delay time and it generated correct tone.

  • Harshad Joshi 5:25 pm on July 17, 2008 Permalink | Reply
    Tags: feedparser.py, Google News, Mark Pilgrim,   

    How to write a kludgy news crawler in Python and challenge Google News to its limits 

    A kludge (or, alternatively, kluge) is a clumsy or inelegant solution to a problem or difficulty. In engineering, a kludge is a workaround, typically using unrelated parts cobbled together. Especially in computer programs, a kludge is often used to fix an unanticipated problem in an earlier kludge; this is essentially a kind of cruft.

    I was searching data on my old disk and I found some interesting code I had written(rather abandoned) an year and half ago. At that time, I was very fascinated by the concept of Google News, which scanned and gathered news from almost 450 sources and mash up them together on one single page.  Mnay sources, one destination. Needless to say, Google created a smash hit product.Life appeared easy, all of sudden.

    Given my nature, it wasent surprising  that I desired to write the next Google News Killer app. It began at night…around 10:30 to be precise. I was determined to finish the program in a nights time. Python was my original (and only) choice that seemed suitable for me to create the next biig thing. Googling around I found that a module feedparser.py makes parsing RSS feeds easy(so to say). However, there was a problem – At that time, I had no clue of what XML meant. That was only the beginning. Later, I also discovered that I had extremely limited knowledge of HTML..Then I realized that my Python basics were giving me plenty of surprises…

    Bah..it looked so bad, here I was trying to write a good program, and there were tonnes of difficulties in first path itself. However, determination took over desperation, and after tweaking and pondering for well over 46 minutes, I was able to produce an extremely kludgy , extremely basic, extremely primitive Google News Killer – Wow…..the feeling was so good.  Imagine – writing something out of scratch, and that too without any help(ok, I took help from Mark Pilgrims feedparser.py and python.org) I chose to call it News Crawler.

    Get the python file by clicking the link – check-news Dont forget to rename it the file to check-news.py and also, make sure that identions are proper.

    Now something about the code.

    1. As I said earlier – the code is extremely dumb, extremely kludgy, extremely primitive, extremly basic and theres lot of shoddiness in there. Dont laugh at it even if it appears funny.

    2. The code has heard nothing of security, and is meant to run under controlled environment.

    3. It dosent make use of any SQL database backend, but is wise enough to store the RSS feeds on HDD before dissecting them,and extracting useful content.

    4. It expects that the XML files are in Unicode format. Some rouge sites make use of shabby encoding, which raises an exception in the program.

    5. I havent added any exception handling, just laziness, nothing more.

    6. For reference, I have shown how we can incorporate Slashdot and Reddit feeds on single page. You can add in your favourite feed.

    ToDo

    1. Make use of a good HTML templeting system.

    2. Solve the problem of unicode.

    3. Add error checking and improve its utility by making use of Pythons object oriented features.

    4. Add a SQL backend system for storing the parsed RSS data. To be honest, its the toughest job to do.

    5. Post up a nice powerpoint presentation describing the system. 🙂

    5. PS – I will definately not do anything of above unless someone seriously decides to fund me.

    After a long time I am back to programming world, I got so busy with other things that I had to abandon my dream project, but who knows, someday it may come true..  😉

     
    • Sandy 6:58 pm on July 20, 2008 Permalink | Reply

      hi, I was trying to perform a similar act when I bumped into ur blog. Unfortunately I am nbot able to download your .py script. Can you please email it to me

      san.grad@gmail.com is the Id.

      Thaks in Advance.

    • lobiga 6:24 pm on March 30, 2009 Permalink | Reply

      Hey
      cann you send me the source pls .

c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel