Skip to main content

Posts

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: ...

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.x...

Logging with MySQL

# Be aware that this log type is a performance killer. I read this line from configuration file of MySQL, when trying to enable disabled-by-default general logging option for MySQL Server, in Linux. I decided to dig in deep and find out why? And what are the alternatives? Performance loss: If you enable MySQL logging, you'll notice instant drop in performance if you are dealing with large data, being manipulated by over a dozen connections. The primary reason for this is the IO operation after every database event; if the database repository and log files are on the same storage device, the performance reduces even more due to the simultaneous write operations (not to forget that write is more expensive than read). Secondarily, the size of the log file is from 4 to 20 times than actual data, depending on the architecture of data feeding application (you try this yourself). This is because the file contains not only the actual values present in the data, but also the qu...

Few tips for speedier browsing.

How often have you lost your temper when you are searching a forum's thread for a "how-to-fix" the broken piece of electronics your best mate gifted you on your birthday? Or trying to find a nice greeting card on Google Image search, clicking each thumbnail and exhausting yourself in back and forth browsing exercise? Quite often, right? If you browse the internet, you have experienced the annoyance that multi-page galleries, reviews, and sometimes even Google search creates. By multi-page content, I mean a single piece of information, which is broken into multiple pages, mostly for advertisements that the viewer hates. This small article should help you speed up your browsing. But your browser should be Google Chrome or Mozilla Firefox  (honestly, I haven't tried other browsers). The Solution Fastest Chrome/Fastest Fox: automatically loads next pages whenever possible, when you scroll to the bottom of the web-page. This saves you from trying to locate the...

Yet another Blog on Query Optimization for MySQL Server

If you have been into MIS development for some time, then you may have realized that buying latest, multi-thousand-dollar Machine, stuffed with a top notch processor and an army of memory chips is not sufficient to your needs when it comes to processing large data, especially when your DBMS is MySQL Server. In this article, I have tried to input  the tips and techniques to-be-followed - some in general and some specific to MySQL Server; but I would, as every blogger, repeat the same common phrase that " in the end   it all depends on your scenario ". The results you are going to see will mostly be in milliseconds so before thinking "is it worth the effort if the result is in a few milliseconds?", do know that these results are derived using a very very simple database with not more than 100000 records in a table.  With complex databases and records in millions, the effort will pay you back. Coming straight to topic, here are some points you should not ign...