Tuesday, July 15, 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

Friday, July 04, 2008

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.

Thursday, July 03, 2008

A simple mjpeg streamer for python

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, it just sends a GET to the server and pulls the file one by one in a loop. It's really that simple.
The tricky part was to get it to display properly. Tkinter took care of that with Python Image Library. It would be easier if the files aren't jpeg though. That might be for future implementations but for now it's fine for what I'm doing with my Android project.
Anyways, I decided to open source it entirely at

http://code.google.com/p/mjpeg-stream-client/

That might be useful to someone, if nothing but just to learn a new thing or two about python. It' s fairly unpolished even as a basic tool but I hope to improve it to some degree to learn about multimedia streaming and threading concepts in python.

If the application was any bit useful, do drop a comment.

Here are the sources, if you wanted to view them right away

http://code.google.com/p/mjpeg-stream-client/source/browse/trunk/StreamViewer.py

http://code.google.com/p/mjpeg-stream-client/source/browse/trunk/client.py

Here's my picture after I finally got video in Android.. hehe. That program did serve a purpose. Phew!


Cheers!

Out with Ads, In with analytics

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.

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

Wednesday, July 02, 2008

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.