Skip to main content

Posts

Showing posts from 2013

Does science exist, if God doesn't?

Scientists have always been believed to have a distinct attribute - reasoning. 

A couple of days ago, I was exploring the ways to prove something scientifically. Proof by induction, by contradiction, direct proofs. For the sake of curiosity, I started digging in deep to find out if there's something that has been accepted but not yet proven. My findings turned out to be shocking. Let me introduce a few examples first:

When studying system of Numbers, we have established that numbers exists, like Natural numbers. Then we further devise certain rules to make them usable. Like Rule A: 1 is a Natural number. Rule B: adding 1 to a Natural number gives us a Natural number. But is there a mathematical proof that  N + 1 = N? A common mind would call this a senseless question, claiming that it is obvious. But mathematics doesn't function on how correct something feels. It demands complete proof to declare something "obvious".

The answer is that there is no proof because we assum…

5 things to do when you cannot trace a bug

Programming today, is more about fixing existing code than writing new. In most of the cases, bugs are easy to trace, especially when you are using a modern IDEs like Eclipse or Visual Studio. However, it is very likely that you get trapped in situations like a specific button not doing anything, application crashing randomly, or a record not updating for a specific ID. Here are some tips you may find lifesavers if you get jammed too often when debugging your code:

Catching random errors Remember, there are no random errors unless you are calling a random function. The code is always consistent, if a function calculates compound interest of an amount over a certain period of time -- within an allowed range -- correctly, it will never do it wrong as long as the parameter values are in range. So, the code is consistent. Data, however, may not be. Here is an example:

public boolean saveRecordInDB (int id, String name, float height, float weight) {
// Do something
}

Test:
saveRecordInDB (1, …

4-step configuration of SSL encryption on Tomcat in Ubuntu Linux using Self-Signed Certificate

First things first, the title makes it clear that the user is expected to know about terms SSL, Tomcat and Linux, so getting straight to the topic. The simple steps below can save hours of your time if you followed them sequentially.

So, you have a web application ready to deploy and you want your communication to be entrypted and make sure that you are talking to the right server. Configuring SSL on your web server and application will do both the jobs for you in 4 steps below:

Creating dummy certificate
- Run: cd /usr/lib/jvm/java-6-openjdk-i386/jre/bin/
- Run: keytool -genkeypair -alias MyCertificate -keyalg RSA -keystore "/home/myhome/MyCertificate.cert"
Here, we used Java's keytool application to generate a self-signed certificate.
Enter all the information asked further: password, name, organization, etc.
This will generate a SSL certificate file, containing encrypted text.
Enabling SSL on your tomcat server
- Run: nano /var/lib/tomcat6/conf/server.xml
- Search for commented…