October 28, 2008 by Himanshu
Guido van Rossum the BDFL (Benevolent Dictator For Life) of Python recently started blogging and his most recent post mentions:
I have now answered the top 20 questions in my section of “Ask a Google Engineer“. Many of the remaining ones sound inappropriate or unanswerable, so I don’t expect I’ll be answering them, unless the popular vote really brings some of them to the top.
One of the questions asked was :
“What is your view regarding python in multi-core processor architecture? How will python community address the evolving multi-core programming paradigm?”
Guido’s response :
I think the panic is greatly exaggerated. We are *not* all going to have to write multi-threaded programs all the time. It would slow productivity to a grinding halt anyway, due to the extreme difficulty of writing correct concurrent code using the current crop of mechanisms. As we get more cores, the cost of accessing memory that’s shared between multiple threads is only going to increase relative to the cost of accessing unshared (cache) memory, and message passing will become a much more appropriate paradigm than shared memory and critical sections.
Python 2.6 and 3.0 are including a new package, multiprocessing, which makes creation of and communication between multiple processes as simple as managing threads was in Python 2.5, and my expectation is that something not entirely unlike the Actor paradigm, but implemented on top of the multiprocessing package, will eventually become the recommended best practice for reaping the benefits of multiple cores. Each process will be self-contained and only communicate with others at specific times when it sends or receives a message.
Guido van Rossum, San Francisco Bay Area
Posted in python | 1 Comment »
October 15, 2008 by Himanshu

New beginning
I have really fallen back on updating my blog but not totally abandoned it. The past few months of silence were necessary for me and I feel more inspired and motivated then ever. Lately I have been following some interesting folks on twitter. Also I have decided to add my twitter updates to the blog thanks to WordPress’s easy to use RSS widget. 2008 is rapidly drawning close to an end but the trends, innovations and issues in technology have not ceased to amaze me. I hope to reinvigorate the state of this blog with my geeky ramblings and unfiltered thoughts. I am not very good at marketing but my excuse is that generally geeks aren’t good in this area. However, Stever Yegge’s interesting talk at OSCON 2007 could be the remedy for folks like me
Posted in rant | 2 Comments »
April 19, 2008 by Himanshu
I posted this originally at a Linux User Group I am involved in. Thought it might be interesting to post here as well :
Since most of us are Linux users and moreover prefer Ubuntu as our primary OS I think it makes sense that we try to contribute something back to Ubuntu also. It is not that hard really and starting out myself hasn’t taken more than a few minutes of time everyday.
Canonical which is the company behind Ubuntu created Launchpad (http://launchpad.net) which is almost like sourceforge.net in that people can use it for their open source project needs ranging from : managing user support to bug reports and even managing teams. Ubuntu itself is listed as a project there and there are other related projects like “Ubuntu Bugs” where users submit bug reports.
So how is it possible to contribute?
- Create an account @ http://launchpad.net
- Join a project. Eg: Ubuntu-bugs (For helping with Bug reports)
- Check the “Answers” or “Bugs” section of the project and post helpful comments or help users with bug reports : https://wiki.ubuntu.com/Bugs/HowToTriage
Well it takes a while to get used to launchpad since it feels a bit overwhelming with so many possible options. Also there are various sub-teams and sub-projects that you can join in launchpad and infact doesnt even have to be related to Ubuntu!
Benefits :
- Karma Points (Updated every 24 hours)
- Expanding technical knowledge (Eg: Helping users debug/fix/investigate bugs that can seem quite daunting)
- Social Networking with fellow loyal Ubuntu users
- etc…etc
I myself just started out and so far it looks very interesting. I have mostly been an open source user for a while. So I feel that this might be baby steps in actually contributing something back. It might not be a big thing but still better than nothing!!
Posted in linux, rant | 1 Comment »
March 19, 2008 by Himanshu
Nepal is a country near and dear to my heart because I spent the first 20 years of my life there. I owe gratitude towards my country in more ways that I can describe. Nepal is behind in terms of education and I.T. penetration but there are individuals and organizations dedicated to improving the situation. Few days ago, nepbabu who is a vocal advocate for the adoption of FOSS in Nepal initiated the call for volunteers to join forces in the creation of an online Nepali Ubuntu community. The response looks promising and already the project idea is gaining momentum as outlined by nepbabu in this blog post.
Now there are some obvious questions that might cross the reader’s mind as to the justification of building an online community of volunteers i.e. ubuntu-np to promote adoption of Linux in Nepal.
- Why Linux ?
- Why Ubuntu?
- Why ubuntu-np?
Answers :
- A lot of people in Nepal use pirated version of Microsoft Windows operating systems because most people cannot afford the hefty pricetag. But that alone is not the reason for justifying adoption of Linux. The main reason is that most people are not aware of the benefits offered by the Linux operating system and the free open source software complementing it.
- Ubuntu has already proved itself a dominant force in the Linux desktop computing landscape due to various reasons . For example : its excellent online community and attractive 6 month release cycle.
- Has to do with the answer for number 2 that talks about “excellent online community”. Ubuntu-np will serve to fill the void of a localized community of Nepali Ubuntu users, enthusiasts, volunteers and newcomers via the mailing list, irc channel (#ubuntu-np @ irc.freenode.net) and website.
I will post further updates as progress is gradually made towards this goal of creating an Ubuntu revolution in Nepal. If you are interested to help or share ideas with our community head to our Irc channel.
For now I will leave you with the Free Sofware Song
Posted in linux, nepal, rant | 2 Comments »
February 9, 2008 by Himanshu
These are some of the interesting and useful stuff that I have come across lately :
- Hacker Public Radio’s interview(mp3) with Jonathan Bartlett. Listening to him helped me understand why the Play Station 3 only has 6 SPUs(cores) enabled and 2 disabled. The simple reason is to save cost during the manufacturing process of the PS 3! Overall a very interesting interview if you are interested in utilizing the power of the PS 3 as a computing platform and I don’t mean for game development.
- Nice C# tutorial I am using for reference to get an assignment done in my programming languages class which is awesome because we study all kinds of languages! Also the lecture on Prolog was interesting and I am hoping to play around with it using the GNU Prolog interpreter.
- Linuxjournal posted a video review of the awesome free open source turn based strategy game Battle for Wesnoth
- I finished reading the excellent free graphic novel nyc2123 It is based on a futuristic cyberpunk setting and is released under the Creative Commons License.
Posted in C#, Prolog, computer science, programming, rant | 2 Comments »
January 27, 2008 by Himanshu
md5 is a cryptographic hash function used to verify file integrity as well as to store passwords in applications especially on the web. However it’s popularity is on the decline because of the discoveries of collisions which makes it less secure then it was assumed to be. Python’s md5 library has support for generating md5 hashes and thus it is very easy to write a program to launch a dictionary attack against a given hash. I use /usr/share/dict/linux.words as the wordlist which is pretty nice with 483,523 words! Anyway this is what I came up with for some quick and dirty dictionary attack :
#md5crack.py by Himanshu : http://cslife.wordpress.com
import md5
def main():
targetHash = raw_input("Enter md5 hash to decipher: ")
success = False
dictionaryFile = "/usr/share/dict/linux.words"
try:
for word in open(dictionaryFile):
if checkMd5(word.rstrip("\n"), targetHash):
success = True
break
except IOError:
print dictionaryFile, "not found!"
if success:
print "Hash found is", word
else:
print "Hash not found"
def checkMd5(getString, testHash):
getHash = md5.new(getString).hexdigest()
if getHash == testHash:
return True
else:
return False
if __name__== '__main__':
main()
ps : Thanks to stylistic suggestions by Ragzouken from #python in freenode.
Posted in programming, python, security | 12 Comments »
January 20, 2008 by Himanshu
If you are faced with the task of coding a card game like blackjack or poker you will need to figure out a way of shuffling your deck of cards. In my case i was trying to help out a freshman CS student regarding her assignment which was making a simple Blackjack game in Java. She wanted to figure out a simple way of shuffling the deck of cards represented by an integer array. So using the idea of random number generation and variable swapping this was the extremely simple solution that I suggested she use in her project :
import java.util.*;
public class shuffle
{
public static void main(String[] args)
{
Random rand = new Random();
int[] cards = new int[52];
for (int i=0;i<52;i++)
{
cards[i] = i;
}
int n = 51,temp=0;
for (int i=0;i<52;i++)
{
// Random integers that range from from 0 to n
int x = rand.nextInt(n+1);
temp = cards[i];
cards[i] = cards[x];
cards[x] = temp;
}
for(int i=0;i<52;i++)
{
System.out.println(cards[i]);
}
}
}
Also Java has a built-in method for shuffling array lists using Collections.Shuffle()
Posted in algorithm, java, programming | 3 Comments »
January 14, 2008 by Himanshu
Right now I am on a mission to learn python. Why you may ask? In my school there is a strong emphasis on java which is introduced to students as their “first-language” when they are starting out in computer science and programming in general. However after taking some classes mostly centered around the usage of java I decided it was time for me to learn a new programming language. I had been hearing the buzz about python for some time and so I decided to see if it lived up to the hype. All I can say now is that it has become my current favorite language because of its philosophy of getting more done with lesser lines of code. Concepts like iterators, recursion and even objects are very easy to understand with python. Lists and dictionaries have become my current favorite data structures. Even with the limited python I have accumulated so far, I already find myself having more fun and being useful. Oh and even though the standard interpretor works nicely, I have found ipython to be useful because it is an enhanced version of the python shell with cool features like TAB completion for keywords, methods, variables and files.
Well learning a new programming language goes beyond just reading a book or just reading the documentation to know its syntax. It is not a big surprise that programming is very much like maths in the sense that it requires practice. I highly recommend Project Euler which is meant to be a place where you sign-up and attempt at solving a series of mathematical problems by using the programming language of your choice. The fun part is that when you submit the correct answer, you are given access to the message board to that particular problem where others post their solutions. The real benefit is by comparing your own solutions to others in the message board, especially when you are relatively new to a programming language and find out how others can code in a more efficient/faster way. Now the other thing I am trying to do is try to convince my professors to let me do programming assignments/ research projects in python unless the nature of the class restricts that. This semester I am taking a class on “Programming Languages” which does give me the freedom to do assignments in the language of my choice. The next step for me would be to start some small project in python that I can work during my free time. I still have a lot to learn in python but I hope that can change soon.
xkcd author has this to say about python.
Posted in computer science, programming, python, rant | 9 Comments »
January 13, 2008 by Himanshu
Hi! This blog will be a place where I archive my thoughts, rants and discoveries in everyday life as a computer science student and an overall geek with the occasional role of being a human being.
Posted in rant | Leave a Comment »