Wednesday, April 9, 2014

Find birthday from NIC number (Sri Lanka) PL/SQL code

This program is design to find birthday from NIC number (Sri Lanka). Fell free to comment and optimize the code.

DECLARE
    TYPE daysInMonthArray IS VARRAY(12) OF VARCHAR2(2);
    days daysInMonthArray;
    year1 VARCHAR2(4);
    idText VARCHAR2(12);
    dayOfMonth NUMBER;
    j NUMBER;
    dateOfBirth DATE;
    daysOfYear NUMBER;
    month1 VARCHAR2(4);
BEGIN
    daysOfYear := 0;
    idText := '900780826v'; -- Enter your NIC number here
    days := daysInMonthArray('31','29','31','30','31','30','31','31','30','31','30','31');
    year1 := '19' || SUBSTR(idText,0, 2);
    daysOfYear := SUBSTR(idText,3, 3);
    IF (daysOfYear > 500) THEN
        daysOfYear := daysOfYear-500;
    END IF;

Sunday, February 16, 2014

Java Fraction Calculator Example

This example show you how to implement a simple calculator which can calculate fractions. Some best practices have been used. This example also will be helpful with University of Westminster / Informatics Institute of Technology - BEng(Hons) in Software Engineering 1st year modules.

Validated For :

  • Non numeric inputs
  • x/0 type fractions
  • 0/0 and 0/y type fractions
  • x/1 and x/x type fractions
  • -x/-y and x/-y  type fractions

IDE used : Eclipse (Kepler)

Download source from GitHub (Eclipse project)


Join code review
         http://codereview.stackexchange.com/questions/43084/java-fraction-calculator


How to Open Existing Project in Eclipse

In Eclipse opening existing project is called as importing project into Eclipse. These steps tell you how to do it.

1. Open Eclipse and go to File > Import

2. Select General > Existing Project into Workspace and click Next.
























Restrict Followers (Non Friends) From Commenting On Your Public Facebook Posts

Sometimes you have experienced that people who are not your friends commenting on your public Facebook posts and sometimes it's embarrassing. This post show you how to restrict those comments.

1. Go to Settings.

Step 1: Click on Settings.