Thoughts on Rails

Riding the Train of Thought

Archive for the ‘python’ Category

Ghost Redirects in Django…

leave a comment »

Image

What happens when you add a redirect to django urlconf, and later remove it? The browser, keeps redirecting without acknowledging the change in your urlconf! The solution is quite simple, but when in the middle of a deployment marathon, you might just overlook the simplest solution… clear the browser's cache!

Well… I made that mistake of hunting for a difficult solution when answer was obvious, so instead of hiding the fact – let me put it out here, so I'll remember it even better if I encounter a similar problem again ;)

Cheers! Keep calm and hack on!

Written by hiway

April 23, 2012 at 4:13 am

Posted in programming, python

Updates to @BigLoserApp #bigloser

leave a comment »

Screen_shot_2011-04-07_at_4

If you have registered with @bigloserapp and are tracking your weight, you can monitor your progress here…

http://bigloserapp.appspot.com/user/[your-twitter-username]

If you are sponsoring someone or others are sponsoring you, you can check the statistics too. This update should make it easy to monitor your team easily.

There will be bugs, please don’t hesitate to leave a comment if something is amiss. I’ll fix ASAP.

Written by hiway

April 7, 2011 at 4:16 pm

Posted in python, software

Software: Torrent Finder

leave a comment »

torrentfinder.swf Download this file

Sometime in the near future, I want to queue torrents for downloading via email/chat/sms, which are picked up by my workstation for downloading. The whole setup will be fairly complex, so I’m working on smaller components – first being able to get a torrent file form given keywords.

First thing to do is search if someone else has solved your problem, I found this: http://danfolkes.com/2008/02/06/torrent-search/ . It gave me direction and ideas to begin writing code.

My current script looks nothing like it though, and can be used as a library to get list of torrents, their seeders, size and comment count. Do note that this will break when the site changes design.

If run as a standalone, tfind.py simply takes in command line arguments, performs a search, gets the torrent url, downloads the file in current directory and exits. No fuss, no questions.

You can grab app/source code here: https://bitbucket.org/hiway/torrentfinder/

I’ll leave you with a quote: “You are what you don’t automate.”

Written by hiway

April 7, 2011 at 11:15 am

Posted in python, software

FreeBSD, Wine, IrfanView and Python

with 7 comments

Wine support in FreeBSD isn’t exactly as fine as it is in Linux… or so I hear. Maybe they are right – because I wasn’t able to run Picasa2, neither was I able to run the latest version of Winamp (even without themodern skin). The fun part was that the installations go super smooth… but the applications don’t run at all.

Then I decided to try a small application, one that I was using everyday when I was on Windows – IrfanView 3.99. The shock came when the installer refused to work! Apparently one dll file, the mfc42.dll was not found on the (wine) system. Getting the file wasn’t painful. [ search ] But the program kept getting creative with the error messages.

Finally I decided to try installing version 3.95 of the program and it worked!

Now I had a working IrfanView, but it was still not the default application for image files. So I tried setting it in Control Centre/ Open With in KDE. Nothing seemed to work.

Finally I came across a discussion where it became apparent that IrfanView cannot handle UNIX style forwad slashes in the filename. The solution was to write a script that changes the slashes to windows-style backslashes and then calls IrfanView.

So I wrote a small script that should make life easy for me. It converts the slashes and calls appropriate program via wine for a given file extension.

Now all I have to do is install the Windows programs into wine, update my script to associate the programs with extensions and point KDE to the script which automatically calls the right application.

Somewhat redundant, but I think it serves the purpose for now. I’m looking for a way to find out the proper associations from wine itself and not have to maintain a list of file handlers.

Here’s the code: launchWineProgram.py

Written by hiway

January 21, 2007 at 9:39 pm

Posted in computers, python, software

Another Python Post

leave a comment »

Congrats to python! As i type this, a program is being written. Once i finish writing it, i will save the file, open it up in the mobile phone’s file browser and select to install it as a Python script. Then exit the browser and fire up the Python runtime environment. Select to run a script and execute this program. It will connect to wordpress via xmlrpc and post this as a clog entry.

I find this exciting!

Tools used: python for series 60, easyedit, wordpresslib, few extra libraries from python 2.4 installation on my desktop, that were transferred to the mobile.

Now I need to write a gui frontend to this script soon…

Written by hiway

July 19, 2006 at 5:19 pm

Posted in computers, python, software

New Stuff…

leave a comment »

Evening RideToday, me and Amit went on a pleasant evening ride. Came back with a photo of the modified motorcycle handle, and a few more. Tested my new toy – Nokia 6680 for its photographic capabilities – and sadly, due to my aquaintance with better cameras, it miserably failed :( Well, can’t really help it! I dont feel like uploading photos from the 6680′s camera here. Someday, if I get an exceptional photo, I might think again. Anyway, a review from me is coming soon. I seem to really like the phone except for it’s silly camera!

About my plans for Nikon D50, it waits another fortnight… because I spent some decent amount on this smart phone. I don’t feel very smart now. But well… this is a nice handy tool to show a prospective client a slideshow – about anywhere. and it helps me keep myself running on time – which I usually miss, because I simply forget other things while riding on the train of thought… (that’s how this blog got it’s name – thoughts on rails)

Work stuff: I am working on a project that requires surveys – both in online and paper based format, the results of both will be later collected for further processing. So the idea is to create a software that can store a questionnaire/survey in an open format (think: XML) and convert it to online form (think: XHTML + CSS2 + PHP + XML) and also in printable form (think: XHTML + CSS2)

Later, I need to write a small translation software to convert these responses (in XML) to whatever format the client requires. I am working on the prototype using Python, Qt4 GPL and PyQt4 GPL. Ah, that means good news! The software will be open sourced… but not until I can at least make it do the expected work! If you really really need to satisfy the urge to peek at the code, mail me at harshad dot sharma [at] gmail dot com. At the time of writing, it is in alpha stage… hardly anything works, but pieces are taking shape.
The whole project consists of four modules:

  1. Survey XML Generator
    Creates an XML file, which gives the complete document structure, sections, questions and possible responses for each question.
  2. Survey Creator
    Generates XHTML/HTML and PHP from the given XML data.

    1. Simpe XHTML, for generating printable survey (CSS will be hand-coded)
    2. XHTML/PHP, for creating online surveys and mailing the responses back.
  3. Online Survey
    Takes responses from users and mails them as XML files to a predefined email address, also stores a copy on the server. As for the paper based surveys, we expect to have a bunch of people to sit and feed the gathered data into the online form at the end of the day.
  4. Response Translator
    Translates XML to database/spreadsheet format, as required by the client.

Now you know what’s keeping me busy ; Not just that, a website design to go along with the whole survey work… yes that and my own website :) Thankfully I don’t have a girlfriend to add to the list ;)

Anyway, I guess I will go grab a nap… somewhere in the scale of 9 to 10 in the following Python program

amount_of_sleep = {
1:”very”,
2:”a little”,
3:”some”,
4:”considerable amount of”,
5:”seriously long”,
6:”more than average”,
7:”slight overdose of”,
8:”a lot of”,
9:”hell lot of”,
10:”insanely crazy long”}

for x in range(1,10):
print “I need %s sleep.” % amount_of_sleep[x]

P.S. I just turned back to be greeted with a very friendly bed!!! Oh and here comes a photo from the Nokia 6680 ;)

My Welcoming Bed!

Peace!

Written by hiway

July 11, 2006 at 1:36 am

Follow

Get every new post delivered to your Inbox.