ranjan

Archive for October, 2008

Project Euler – Problem 5

In Uncategorized on October 29, 2008 at 10:46 am

Problem 5 was easy, but was taking a long time in Python. So I tried it in Java, it took around 8 min to get the answer.

Here’s the code.

public class Problem5 {

public static void main(String[] args) {
Problem5 prob = new Problem4();
double number = 1.0;
while ( !prob.isDivisible(number)){
number += 1;

}

System.out.println( “————-” + number );

}

public boolean isDivisible( double number ){
boolean div = true;

for( int i =1; i <= 20 ; i ++) {
if (number % i != 0){
div = false;
}
}

return div;

}
}

Programming langauge Agnostic – PLA

In Uncategorized on October 8, 2008 at 8:50 am

In Computer world, You will always read one language being compared to another… One web framework compared to another… one javascript framework… widget system being compared to another, and frankly I was ( am, still to some extent )addicted to such post, blogs, wikis etc.

But the real challenge is to identify a problem that you want to solve. Tools have kept changing and will change in the future. ( remember stone age tools and now modern tools ). Tools are made after somebody encountered a problem and tried to solve it. There are problem all around us, all you need is an eye for it and aptitude to solve one.

I bet if you are not solving somebody else’s problem than that’s a problem. Otherwise you will not be in a job for a long time. You work somewhere and get paid because there is a problem and you are in their eyes qualified and competent to solve that. And there is benefit coming to somebody by you solving their problem.

Back to PLA. You want to write something like a number fairly quickly.. you won’t power on a computer, start a spreadsheet and not down the number. You don’t even need a computer to do that. The problem of writing something quickly and conveniently can be done by using pen or pencil. But what if you write too many numbers down…like some phone number or sales order or some document number, and you need to quickly find out what the name of person against that number. For this problem you would require a computing device. What could be the best, efficient and easiest way to do this- i would leave that you.

Point is there are problems and there are solutions and there are tools. But the most important is to identify and solve the problem in best way giving maximum benefit using minimum tool.

Be language agnostic, framework, OS agnostic and look at the problem than at tools. Remember tools will change and you need to figure out how to use but more importantly where to use them.