Sharding for real?? (Week 7).

This post is just one among the various rants available online that use a bad-mouth for PHP despite the fact that it is successfully used in various sites such as Facebook, wikipedias, etc

So here’s what got me thinking working on my GSoC project on SemanticMediaWiki (an extension for MediaWiki), I mistakenly deleted some text from a .php file which was a public variable of a class. I tested and found that things are working fine and committed my patch when looking at the diff I was amazed how things were working. Then I ran some tests

<?php
class hello{

	public function __construct($name){
		$this->name = $name;
	}
}

$wy = new hello('sdfs');
echo $wy->name;

to my amazement this worked perfectly even though I hadn’t initialized $name earlier. This definitely prevents some bugs, but then I prefer bugs than unmanageable code.

GSoC midterm.

Claiming to be “SOCIAL” we humans continually try to do things to prove that we are in fact social beings, but ARE WE?

Long time back, we settled into civilizations all across the globe, we even tried to populate the moon and the Mars, we grew larger and larger in numbers started to build stuff, discover things, imagine things and what not. With this approach we kept on doing things thinking only of the near future (ofc we cannot think beyond that). While doing this we cut off lots of trees and forests and never cared about them.

Suddenly, we see now everyone is worried about the Global Warming, Extinction of Species and other issues that we try to address now. We tend to move to renewable sources of energy to minimize our impact on the world, become Vegans, not use leather products, etc. When asked “why?” we say “because we are social and we believe all living beings have equal shares on the earth”, REALLY??

The Ugly Truth is that we are concerned of our own future and nobody else’s. We only try to look social to hide from our inner self, but the bottom-line is we are GREEDY

P.S. I don’t know why I am writing this, probably I am fussed enough by the useless acts of people who state we are social

Problems 18 and 67 of Project Euler were the most interesting ones to me, as I almost brute forced them and yet without taking twenty billion years as claimed.
Here’s the problem
By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23.

3
7 4
2 4 6
8 5 9 3

That is, 3 + 7 + 4 + 9 = 23.

Find the maximum total from top to bottom of the triangle below:

75
95 64
17 47 82
18 35 87 10
20 04 82 47 65
19 01 23 75 03 34
88 02 77 73 07 63 67
99 65 04 28 06 16 70 92
41 41 26 56 83 40 80 70 33
41 48 72 33 47 32 37 16 94 29
53 71 44 65 25 43 91 52 97 51 14
70 11 33 28 77 73 17 78 39 68 17 57
91 71 52 38 17 14 91 43 58 50 27 29 48
63 66 04 68 89 53 67 30 73 16 69 87 40 31
04 62 98 27 23 09 70 98 73 93 38 53 60 04 23

NOTE: As there are only 16384 routes, it is possible to solve this problem by trying every route. However, Problem 67, is the same challenge with a triangle containing one-hundred rows; it cannot be solved by brute force, and requires a clever method! ;o)

Here is my analogy to solve this problem,


And here’s my solution in Python

	n = []
	for i in range(15):
		n.append(map(int,raw_input().split()))
	newresult = n.pop(0)
	for i in range(14):
		x = n.pop(0)
		result = list(newresult)
	#	print len(result)
		newresult =[]
		t = len(x)
		for j in range(t):
			if(j==0):
				newresult.append(result[0]+x.pop(0))
			elif(j==t-1):
				newresult.append(result[0]+x.pop(0))
			else:
				newresult.append(max((result.pop(0)+x[0]),result[0]+x.pop(0)))
		print newresult
	print max(newresult)

I essentially keep a list of all possible values by limiting to the max at each step, isn’t that amazing 😉

Really “don’t discount your education”

Rachel Lim's Blog

There was a great question on Programmers about graduating with a programming degree, but not knowing how to program. I see this kind of question a lot, and I felt the same way when I first got my degree, so I thought I’d write about my experiences and what I learned when first started programming.

This was originally an article I wrote for the Programmers.SE blog, however the blog doesn’t appear to be happening at this time so I am posting it on my own blog instead.


Start with baby steps

First off, don’t expect to be able to code enterprise-level applications or the next Facebook right away. You really can’t become a good programmer without a lot of practice, so practice any way you can. This can include hobby projects, reading books or source code, or even answering questions on Stack Overflow.

The book Outliers: The Story of…

View original post 973 more words

As I have read in my Database Course that normalization is efficient and but is it really efficient?

I think I am moving rather to a no-normalization database for my GSoC project GreenSMW and why is that?

As per our needs we have to answer queries for properties or subjects and very rarely for values. So, I am considering to store the data duplicated -once with sharding (horizontal partitioning) based on properties and secondly based on subjects. I am having other considerations also and will update this post if I come up with some other idea

Most engineering students in India are from a non-coding background. They get into a CS degree course by knowledge of Maths, Physics and Chemistry and learn their first programming language (C mostly) only in their first year at college; by this time they are already 17 or so.

After the first loss i.e. loss of years (by when an average US coder writes excellent code) the second loss comes from the unrevealed truth that coding is learnt by practice. Many students don’t like to code much, others that do learn the lesson very late. By this time (when the students know the need to do actual programming) they get to their final years when another horrible phenomena comes into picture; yes, you guessed it right the PLACEMENTS. This stuff takes into account your CGPA and knowledge of computers but they usually don’t check your code made by you in the past. Some challenging companies do test coding skills but on the basic of problem solving skills.

Only a few of the engineers get into good companies. As a result there are a lot of students who have their dream of a high salary crushed down. They take this as an epic fall and don’t realize the immense possibilities that lay ahead.

We need to change this mentality. Placements shouldn’t be given such a higher place in society. There are many other resources to make a good life. Open Source is one such example

Yay!! I got into GSoC’12

It has been a very nice experience so far for me that I thought of writing about it. Hope it might end up somewhere in the Google results for the query “how to do a GSoC?” and help some fellow coders.

Let’s get it started!

For anything that you don’t understand please fire up Google with the to know more about the stuff. I don’t have time to point all such query results to you 😛 and you should at least know how to search the web.

What you should already know/be/have:
• You should have a good internet connection (A must as GSoC involves working on-line most of the time).
• Know some programming language(s) (even beginner level is fine). C/PHP/C++/Python/Java are common languages you can learn. But try to get deeper expertise in one.
• Get some knowledge of what Open Source Organizations are and how they work and also learn about Openhatch.org
• Have a summer (2-3 months) available for full time dedication to the job – I am sure you have this 🙂

That’s enough! Go to ‘How to start’ as soon as possible (don’t waste much time just thinking, but act)

How to start?
• Learn what is Internet Relay Chat (IRC) and how it works.
• Now that you know about IRC you can find the channel #gsoc using your favourite IRC client and talk to anyone. (This is a great place to ask but please try finding the answers yourself first)
• See the list of participating Organizations for this year (if available) and previous year, filter them by your preferred programming languages or other interests.
• Jot down few Orgs that you are interested in, go to their home page, visit their IRC channel and say ‘I would like to know about the org and volunteer’, someone will definitely turn up to help you out.
• Pick one (or more) of these Orgs you selected which interests you the most and ask them on IRC ‘Hi I am interested in your organization how do I start contributing to it?’
• Join the mailing lists of the Org and read some of the mails to get an idea of how conversation takes place. (Learn about public mailing lists too)

Good! You will now mostly tackle all difficulties yourself from here.

Important miscellaneous points:
• Don’t take Gsoc as a job rather take it as an experience where you will learn new stuff specifically: how a large org works, how they communicate, etc. I am sure you will notice GSoC brings you closer to Open Source Organizations and the idea of FOSS.
• Never ever send a mail with no subject
• Before sending a mail remember to use a spell-checker.
• Always search the internet before asking any questions on IRC or mail.

Now I have finally realized that JavaScript is not for me, I am neither interested in it nor I need it for any projects right now.So, for now C,PHP,Java,Python will be my working areas.

However if time requires I might actually work on some JS or jQuery related stuff