Posts

Showing posts from 2008

HashMap loop in java

This is how you loop through the Key Value pairs in a Hashmap Iterator iter = values.keySet().iterator(); while (iter.hasNext()) { String key = iter.next(); String value = values.get(key); System.out.println("Key ="+key+"\n Value"+value) } Here, I have implicitly assumed that values is a HashMap but as you know it can be of any Object that you like. I just used it for string and felt it might be a good example if someone is looking for it

Viewing firefox status bar in full screen

Using firefox in full screen is rather cool but I was missing the status bar which gives a lot of information about the link whenever I hover or whatever is being done by the browser. After digging up a few places, I came to this link in mozilla's site http://support.mozilla.com/en-US/kb/Editing+configuration+files about editing configuration files and in particular userChrome.css Used to change the appearance of the browser. userContent.css Used to change the appearance of web pages. user.js Can be used to change various preferences . They are in the profiles folder of your user account. Go to your current firefox profile folder, and into the chrome folder. You should see two files. userChrome-example.css and userContent-example.css, remove the example and add this: /* Make status bars visible */ #status-bar { visibility: visible; } restart firefox. And voila, you have your status bar in full screen.

My Links

I just added a links section there on the sidebar so that you can see what I'm bookmarking lately. Most of them might end up being incorporated on the front page. If they are any bit useful to you, tell me. I might not have read them(or sometimes might want to read them again, so that might be useful to go over.) If you are a fellow programming, hacking enthusiast, I'll be glad to share some links in del.icio.us.

A simple mjpeg streamer for python

Image
I've been working with networking stuffs lately, like XML, parsing and lately streaming. Originally, I wanted to do this for my Android project which is still slightly veiled in secrecy. It will be open sourced completely though, when it matures. So, I wrote this application in an effort to understand the networking behind it and get it to work on Android. Frankly, I am not so good with Java and working with networking stuffs with objects. Everyday I appreciate more of that power though and it's fun to learn new things. I tend to practice with python first and after the proof of concept works there, I do it in Java. It's slightly roundabout way of doing things but it works for me. What this application does is that it takes snapshots of the jpeg files from the server fast enough for making it seem like it's video.. Well, that's what it is anyways. Let's just say I haven't understood streaming and multi part files properly enough to implement. So, basically,

Out with Ads, In with analytics

Image
Finally, I got rid of the annoying ads and included Google Analytics instead. I hope it helps me track users better (HEHE, evil laugh). Nah, I just want to see my traffic from a fairly trusted source. Since I've started updating the blog again, I want to see how many people are coming. And yeah, the ads won't EVER come back on this site. PROMISE!!! I wonder if that news belonged to twitter than over here. I've become a bit more conscious about twittering after I saw this. Hah, I wonder what would take to make me a twitter shitter! (An iPhone perhaps?.... the Dark side is strong there I can feel it).

Thank You Firefox.

Image
Yep, it's official. And I've grabbed my copy of the thank you letter that Mozilla is giving away. I actually like the way this has been handled by Mozilla with all the hype about Firefox 3 that was circulating. Albeit, I felt it was a bit cheesy to go around downloading, or asking someone else to download for a while but it was fun. I had the download link on my desktop for every one to see. So, here's my copy of mozilla certificate. So you better get one from here Hurry up, they might be in Limited supply. Hehee

positServer online

"Release early, release often" These were the words that sparked the open source revolution. I'm finally trying to follow this by releasing my positServer application under GPLv3 on googlecode. It's rather half baked right now and I intend to use it mostly for backup purposes. Hehe, it's hard to screw up when your backup server is the mighty Google Inc. http://code.google.com/p/positserver/source/checkout If you do checkout, do send me a comment. I'll start posting some screenshots and details about what I've been upto soon.

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

What? a Beowulf in room?

I recently got 4 SUN ultrasparc 5 boxes from the compsci lab. The most interesting thing is that when I got them, basically 1 by 1, I had no idea what I was going to do with them. For a while, I tried assigning them static IPs and ran rtorrent through them. I wanted to put a web interface for it too. Then I turned them off for a substantial amount of time because playing around with them was disturbing my studies at that time. Now they are on and running and the most interesting thing about them so far is that they were all part of a beowulf cluster before they got dismantled into what they are now. The next step here I guess is to turn them into a nice beowulf cluster. There are still a couple of computers left in the lab which I might be able to get to expand it but so far it seems like a rather worthwhile use of the summer time. At least I now have a nice 19" monitor to play with and with some extension cords I can manage these computers very easily. Hopefully, from my desk its

How to run sugar on ubuntu- the easy way

Are you finding yourself lazy to go through the installing, git-pull update procedure for your ubuntu system to work on the olpc sugar interface? There's an easier way to do it $sudo apt-get install sugar-emulator sugar-activities This should do it. If you still want to do it the old way... go for it http://wiki.laptop.org/go/Sugar_with_sugar-jhbuild\ :)

todos

Hey, it's been 19 days since new year and I haven't made all the resolutions yet so I decided to make them now. I don't make resolutions often but keeping them here might actually force myself to stick to them 0. Improve grades I admit they are really really important, it just can't be over stated. So, it obviously goes on the first. 1. Learn regular expressions From experience, I know that learning regular expressions is he only way to be able to use them. You find their uses only later after you know some of them. I just need to learn them. 2. Get better at social stuffs It doesn't mean getting drunk every so often in a frat. I learnt that last semester altho I didn't do that. It's just meeting new people, getting away from all the programming works for sometimes and maybe even socialize with fellow programmers every so often. 3. Become a better writer, write often to blogs I'm not committing myself to a certain time scale but it's a good skill

Busybox on Android

As good as android is, it does lack some of the rather interesting linux tools that could be of a great use like busybox. Its good to have a command line interface to play around often to get information that click around in gui which makes things a bit too slow sometimes. While I did try to compile the busybox binary and loading onto the phone, that didn't quite work. So I got one from here. http://benno.id.au/android/busybox Then I copied the binary into the tools folder after running the emulator with ./emulator, I ran the ./adb push busybox /data/busybox/busybox I logged into the shell with ./adb shell # cd /data/busybox (you might need to set permissions here if you downloaded the file) # ./busybox --install remember to export the path export PATH=/data/busybox:$PATH voila! got my busybox applets!!

How to make your window Full Screen in gnome?

Image
I have often had this problem of getting quite seriously distracted while coding and I always like to use as much screen real state to work on but then again, there are other applications that need it too and it can be a lot of distraction with gmail messages popping up and all sorts of nasty stuff happening. One option is to just go into some other desktop manager but I kind of like solving the problems at hand and gnome does provide me with some really good features that I've become used to. I started wondering if I could make eclipse full screen so that I can just focus on the code and hopefully nothing else. Then I came across this useful link http://www.enigmacurry.com/2007/02/17/gnome-kiosk-mode-make-any-app-fullscreen supposed to be a rant about the feature gnome lacked but updated to add this instruction. There is a nice feature that lets users set keybindings. Here are the steps: 1. Open gconf-editor using the trusty old Alt-F2 combination Now go to /apps/metacity/window

Checking integrity of cdrom drives

I had this problem for a while, so I wanted to take a look at it... how do i check the integrity of the drive. I did this... to find that it was quite okay... the same can be done with md5sum but sha1sum is better sometimes $ sha1sum KNOPPIX_V5.1.1CD-2007-01-04-EN.iso | grep cdc0e9181d9dd2f2fc71aa9c59391001c46afa3e cdc0e9181d9dd2f2fc71aa9c59391001c46afa3e *KNOPPIX_V5.1.1CD-2007-01-04-EN.iso but then again, after burning the cd, I wasn't too sure if it had data integrity. So, I had to check if it was working I tried md5sum on /dev/cdrom but that was taking a lot of time. Then I saw a description on http://wiki.sabayonlinux.org/index.php?title=HOWTO:_Checking_the_integrity_of_a_LiveCD_or_LiveDVD The process goes like this: $ isoinfo -d -i /dev/cdrom CD-ROM is in ISO 9660 format System id: LINUX Volume id: KNOPPIX Volume set id: Publisher id: KNOPPER.NET Data preparer id: www.knopper.net Application id: KNOPPIX LIVE LINUX CD Copyright File id: Abstract File id: Bibliographic File