Posts

Showing posts from June, 2008

Sending Binary files over xml rpc

I'm posting this because I finally figured how to send files(pictures in particular) over xmlrpc. It took me a while to figure it out since I was mostly concerned with saving the files into database but here it is. #!/usr/bin/env python from  twisted.web import  xmlrpc, server import  os class   PositRPC (xmlrpc.XMLRPC):          def   xmlrpc_savefile (self, file):                 datum = file.data                 thefile = open(' /tmp/gnu.jpg ', " wb ")                  #filebuffer = file                 thefile.write(datum)                 thefile.close()                  #os.spawnl(os.P_NOWAIT, '/usr/bin/display', '/tmp/gnu.jpg')                    print  datum                  return  1 if  __name__ == ' __main__ ':      from  twisted.internet import  reactor     r = PositRPC()     reactor.listenTCP(7080, server.Site(r))     reactor.run() Then I opened trusty IDLE >>> import xmlrpclib >>> s = xmlrpclib.Server('http

Locking screen from command line

I use gnome and so far I've been happy with my Ctrl+Alt+L shortcut in gnome. It used to lock up the screen when I was away from the desktop. However, recently, I've started to use XFCE and sometimes ratpoison, which didn't have this shortcut. Anyways, the simpler way to lock your screen is from command line and it seems to work everywhere I've tried so far. $xscreensaver-command -lock I just kept in here so that I don't forget. Maybe this little tip would be useful for some. I just found an alternate method that can work too. $gnome-screensaver $gnome-screensaver-command -l

Code Highlighting in Blogger

Don't you just love syntax highlighting that we've become so used to these days? Be it the venerable emacs editor or the new and upcoming Notepad++es, we love our syntax highlighting editors. But the codes on our sites still do suffer this problem of being black and white. I solved this problem for our college's hfoss wiki by installing the GeSHi CodeTag Extension for mediawiki but while looking at my own posts in here, it seems the idea needs to be extended to blogger. It really looks too ugly to my used-to-pretty-IDE eyes. In my quest to look for a solution, I hit this blog http://codeshepherd.blogspot.com/2007/09/syntax-highlighting-for-code-embedded.html Which had two ideas. First one, to use vim's TOhtml. But being lazy to modify all my files over and over again, I decided to forego it. I copied the prettfy.js and prettify.css files to my ubuntu.org.np server and followed the instructions at http://google-code-prettify.googlecode.com/svn/trunk/README.html The effec

Follow me on Twitter

After facebook, I haven't really got around to most of the social networking things, but after reading about it (a lot) and seeing some really famous people actively using it, I decided to give it a try. Guess what, I'm loving it. So, if you are interested in following me, do follow me at www.twitter.com/prasannagautam Or if you want me to be notified of your tweets, do post in here so that I can give some thoughts to that :)

Implementing xmlrpc database server in twisted

A while back, for my POSIT project (for google android), I wrote a small application in python that sent out some data from the server's repository and saved to the database. I never really got around the saving part because I couldn't get the database to send pictures back and forth. In part, I went back to working on the phone itself and my studies because I was being a little too unfocused in necessary stuffs which was bugging me off. Yeah, that was during the semester. Now, over the summer, I am getting to continue the same project and it's more fun with a better idea about what I want to do and especially how I need to do. Also, getting sick for a while helped because I wasn't really able to work much so I just read up a few books on software engineering. The best one undoubtedly is the Gang of Four's Design Patterns. I have yet to finish that one but truly good book indeed. OK, enough ranting. You didn't come here to know about my reading patterns, did yo

Firefox 3 on debian etch

First, some updates: These days, I've been busy doing my summer research (finally learning to document properly) and working part/full time for the computing center here as the system administrator (well, assisting the system administrator to be correct). OK, the release of firefox 3 was big and I participated heavily and encouraged everyone to participate by downloading the browser within the 24 hours. So, now everyone I know of is running firefox 3 except the computers in my lab that I am managing. So, today after my research was over, I decided to look into the matter. There were a few problems that I was facing 1. I didn't want to kill of the old firefox 2. I didn't want to use what's considered to be unstable by debian etch in the core system First of all, I got the error that firefox 3 needed gtk+2.10. I just downloaded the file from http://ftp.gnome.org/pub/gnome/sources/gtk+/2.10/gtk+-2.10.14.tar.bz2 and installed it at /opt/gtk Here are the commands: $ wget