Archive for May, 2007

May 31 2007

Effecient Sorting Algorithm For Applying Median Filter to a Image

Published by under Algorithms,C Programming

Normally median filters are applied to remove speckle noises in an Image. There are many variations of Median Filters but all these variations are for choosing the kernel dimensions and shape. What i mean by kernel is that it could be a 3X3 kernel or 5X4 kernel or a radius 3 kernel.

A 3×3 kernal will have 9 elements to sort

A 5X5 kernal will have 25 elements to sort

A radius 3 kernel will have 29 elements to be sorted before you can pick the median.

Bottom line is you choose any variations of kernals, it boils down to effeciency of sorting. I have come up a one such algorithm that i think is very effecient for Median Filtering

Assumptions:

  1. RGB Planar data. The bit depth Per pixel is 8 bits.
  2. Median Filter Kernel size is Odd Number. Like 5, 9, 25 etc
  3. The following code is PseuodCode and good for one dimensional data.

A pseudo Code implementation of the Algorithm is shown below:

Continue Reading »

Comments Off on Effecient Sorting Algorithm For Applying Median Filter to a Image

May 24 2007

How to Avoid Integer overflow in C?

Published by under C Programming

Here is the General Way to avoid integer overflow.Example 1

value = value + 100;

if ULONG_MAX – 100 >= value
then No Overflow
else
overflowed

Example 2

x = x * 10 + r;

To Check whether x would overflow, do the following before you execute the above sentense

if ULONG_MAX – r/10 >= x
No Overflow
else
overflow

NOTE:ULONG_MAX is normally defined in limits.h. And it is dependent on the Processor.

Comments Off on How to Avoid Integer overflow in C?

May 24 2007

Tree Grown Over a Bike..

Published by under Humor

The image tells the story

Comments Off on Tree Grown Over a Bike..

May 24 2007

Euro English.. Let us Take a break and read this hilarious Stuff

Published by under Humor

One of my friends forwarded this joke and it is really hilarious. This blog is more about technical stuff. But once in a while a dose of humor is good for you. read on and laugh heartily

ENGLISH OF TOMORROW EU ANNOUNCEMENT
The European Commission has just announced an agreement whereby English will
be the official language of the European Union rather than German, which was
the other possibility.
As part of the negotiations, the British Government conceded that English
spelling had some room for improvement and has accepted a 5- year phase-in
plan that would become known as “Euro-English”.
In the first year, “s” will replace the soft “c”. Sertainly, this will make
the sivil servants jump with joy.
The hard “c” will be dropped in favour of “k”. This should klear up
konfusion, and
keyboards kan have one less letter.
There will be growing publik enthusiasm in the sekond year when the
troublesome “ph” will be replaced with “f”. This will make words like
fotograf 20% shorter.
Continue Reading »

Comments Off on Euro English.. Let us Take a break and read this hilarious Stuff

May 23 2007

Installation of SSL on Ubuntu 7.04

Published by under SSL,Ubuntu

First Get Open SSL installed on the server

sudo apt-get install openssl

This will install the latest openssl library that is been tested on the Ubuntu server version you are using. For example, if your are using 7.07, the above command will install openssl0.98 version. If you want to install any other version then you have to specify the exact version name while you install

Creating a Self-Signed ( Private) Root Certificate

A brief primer on certificates in Layman terms.

Suppose let us say that a Client C wants to access a Server S for some transaction. Now Client C wants to make sure that it is indeed connecting to Server S. There are many ways to do it but most common way is through Digital Certificates. I dont want to get into details of the theory behind the technologies behind Digital Certificates. Let us assume that Server S and Client C has a digital certificate. Now Client C connects to the Server S and Server S sends its certificate. But the catch here is that how can Client C trust that Server S is indeed what it claims to be. If Client C and Server S are known to each other, then there is trust established. In a scenario, where Client C and Server S do not know each other, a third party ( Certificate Authority CA) who is trusted by both Client C and Server S will establish the trust.

Difference Between Self-signed Certificates and Authorized Certifiers

The main difference is that in self-signed Certificates, there is no third party involved. So if you are connecting to a Server that you do not trust, you are at risk. There is absolutely no difference in the Certificates you privately sign and the one signed by authorized certifiers like Verizone. (Note: Assuming that you create the certificates properly )

Continue Reading »

Comments Off on Installation of SSL on Ubuntu 7.04

May 23 2007

Setting up a Home Server with LAMP Stack In Ubuntu

Published by under SSL,Ubuntu

Note:This write up describes how i wished to run my Home server and how i did it. Hence the description heavily focuses on settings that are very specific to my requirements. However, you can find bits and pieces that may be usefult to you.

How i want to Run My Homeserver

Homeserver Shall Serve the Following

  1. Have three virtual hosts, each of them serving different audiences. One of the three is purely https host for server admin remotely.
  2. Redirect to a SSL connection and with a Basic User/Group authentication system when anyone access the File Respositry and Image Gallery link on my home page
  3. Home server Adminstration will be allowed only with in the Local Internet. Like PhpMyAdmin and Blog Configuration.

How i went about setting up the Home Server to achieve my Goal?

  1. Installing the LAMP stack

I installed Ubuntu Server Edition. Ubuntu Server edition provides an option to install LAMP stact during the installation phase. Choose this option as it saves you the trouble of configuring later.

2. Setting up the Root password for MYSQL database

The default installation of LAMP stack will not set the Root password for the MYSQL Database. It is essential that you set the Root password or you will not be able to create any database or create databases from PHPMYADMIN.

3. Installing PhpMyAdmin

Ubuntu has a nice way of installing new packages. All i did was:

sudo apt-get update

sudo apt-get install phpmyadmin

Voila!! PhpMyAdmin was downloaded from ubuntu site and installed automatically. Automatic installation has one limitation though. PhpMyAdmin is linked to your DocumentRoot of Apache.

That is if the Document Root is /var/www. then a symbolic link to PhpMyAdmin is created in /var/www.

So if a anyone can access php just by typing www.yourdomain.com/phpmyadmin. The phpmyadmin user interface shows up. Hence you need to be careful. Please read further down how i am handling the phpmyadmin feature.

4. Creating Directory structures

Continue Reading »

Comments Off on Setting up a Home Server with LAMP Stack In Ubuntu

Next »