Monday, February 28, 2011

ITA Group Project - Part II

If you have not yet read the previous post, first read it. 

29th October 2010

After finishing the lab sheet, I built some web pages with basic interfaces and connected it with the database. I wrote some functions to register customers, to check the login username and password and redirect the user to another web page, if the user name and password matched. It worked successfully. Although these user login functions come in-built with Visual Studio ASP.NET, I had no previous experience in using them. Therefore I thought it would be better to write our own functions so that we know exactly  how they work and we know how to modify them whenever necessary. The other thing was more than learning new things, we had to do something because the deadline was tight. I kept on working and decided to meet other group members next day.

I called Sasika to know about the progress in designing the master page but he had not finished it then. I asked him to come to SLIIT next day but he told me that he was having some important work to do and would not be comming. ( Later on I got to know that important work was a date with a girl  :D )

Therefore I decided not to go to SLIIT next day and I told others to continue writing details of the apartments which we were going to include in the website.

30th October 2010

We all got together at Sasika's place. He had almost finished designing the master page. Others had brought the photos of apartments and we discussed about the features we should add to the website. While Sasika was resizing the photos to add to our website, I added web pages to the master page and showed them how I had managed to provide database connection. For three or four hours we kept on working and ended up with so many bugs in the project. I was confused then and thought that I should go through each coding from the beginning. So I came home and tried to find mistakes. I tried to find help from online forums and finally I could correct all the bugs. From those forums, I learned about the 'On row command' in the Grid View and I used it to generate buttons dynamically to add the apartments to the cart.By that time I understood that I should do more and more work because there was only one day left to meet the deadline. I continued my work and slept only for three hours that night.
(This is the Home Page of the website. Credit should go to Sasika for designing nice interfaces.)
You may think that without doing everything on my own, I should have given the work to others also. Yes you are correct, but what if others are not good in programming ??? If I told a group member to write a function to accept certain inputs and give a specified output, would he be able to do it? In my case, the answer was 'NO'. Although Sasika was good in programming he had a lot to do, designing the interfaces and graphics in the website.


-Tharindu Edirisinghe-
-SLIIT 10'-

Saturday, February 26, 2011

ITA Group Project - Part I

When we were in the 2nd semester of the first year at SLIIT, we had to develop a web site for the Internet Technology and Applications (ITA) subject as an assignment. The important thing was 10% of the final marks for that subject was given for this assignment. So it was really important to do the assignment well and score high marks because every single point counts for the GPA. From this series of posts, I'll tell you how we did the project.

For the DBMS I subject we had a group assignment to develop a database in Microsoft SQL Server according to the selected topic and for this ITA assignment, we had to build a website and connect it with the database we had developed. The group members had to be the same for both the assignments. The topic we selected was 'Apartment Reservation System'. The group members were Sasika (SS), Mezaj, Dasun, Sajee and I was the group leader. 

From left to right -  myself, Sasika, Mezaj and Dasun.

It was scheduled to finish the assignments before the final exams but due to various reasons the deadline for the presentation was postponed to November 1st 2010. Since I was the group leader, I decided not to start the project until the final exams were over because I thought it would be better to concentrate more on the final exam. We had the last exam paper on 27th October and I'll start the story from then. 

27th October 2010

We had the DCCN I paper in the morning. After the exam, all the group members got together and I asked them to be prepared to do what ever I tell them and to come when ever I call them because we had few days  left to complete the project. I didn't know how to implement the solution as my knowledge in web developing  in  ASP.NET using C# was at a low level at that time because we had limited number of practicals in ASP.NET.

I went home and went through the requirements of the website to be developed. They were as following.
  • Three types of users for the website - Admin, Registered user, Visitor
  • Provide user login, password recovery, account modification
  • Dynamically generate data on the web pages from the database
  • Shopping cart feature for products (add to cart, remove from cart, show total products, show the total payment)
  • Make reservations and cancel when necessary.
  • Search option
  • Contact us page
  • About us page
Then I realized that before starting the project, I should improve my programming and web development skills in ASP.NET C# and to be familiar with Visual Studio as it was the IDE we were supposed to use for the project. 

I had a video tutorial series in 'ASP.NET Web Development Essentials' (from Lynda) which Tharinda (a fellow student at SLIIT) gave me. So I started watching it and did the practicals in that. It gave me the essential skills to develop the website.

28th October 2010

I asked all the group members to come to SLIIT in the morning and unlike in ST I Assignment everybody came on time. First we discussed about the project and drew a plan develop the solution. What I realized was that we should design the master page of the website first and so I gave it to Sasika as he was good in graphic designing. I asked Mesaj, Sajee and Dasun to visit the Online apartment reservation websites and study the features they had and also to download images of apartments so that we could use them in our website. The database we developed for the DBMS I assignments was not matching with the requirements of the website so that I decided to build a new database for the assignment.I gave the video tutorials to them so that they also could get familiar with ASP.NET.

I went home and started building the database. First I added tables to store customer account details and apartment details. Then the next problem was how to access the database from the website. We had only one practical lab session on that and I could not even finish the lab sheet correctly.  So I started doing the lab sheet and tried to learn how to provide the database connection through a website.


I went through all the coding given in the lab sheet and did the practical. From that I learned how to Insert data to database and to Update, Delete, Retrieve data in the database using the website. 

To be continued......

Read the Part II of this series.

-Tharindu Edirisinghe-
-SLIIT 10'-

Saturday, February 19, 2011

I love Coder Girl




Coder Girl Lyrics:
to be the keys underneath her finger tips                      
Her class makes a brotha's back buffer wanna flip
and be number one on her link list
and get a callback, I'm in all caps
feels like my first hello world
what it is to run with a coder girl
and it ain't hard to like how she writes
with her pretty interface, plus her source is tight
wanna get in where I fit in like a plug-in
this is the true meaning of computer lovin'
She's got a data stack that's straight stunning
No mismatch, exceptions or debuggin
invariably, how would I pass this
when my coder girl grants me root access
basically, she's a certified A+
yo, it's more than just technolust

(chorus)
Feels like my first Hello World 'cause
She's my Coder Girl
Man, I had to dedicate this one
To my Coder Girl

I'll put it like this, so you can understand
She makes me wanna update to be a better man
When we compile she's easy to interpret
A cross-platform version I can work with
She's not wrapped in flash
all she wants is her java and a shell to bash
While, she's a sight to C, plus
Her smile glimmers just like a Ruby does
She could never be subroutine
The high priority process of my machine
Sharper than most chics ya' know
She's not another shallow copy actin' sudo
It's that good type dependancy
I function better with C.G. next to me
and it always leads to an overflow
When it's runtime and we take it slow


-Tharindu Edirisinghe-
-SLIIT 10'-

Saturday, February 12, 2011

A day without Google is impossible !!!!

Google has become a part of my life. These are the google apps I use.

Google Chrome
 
My primary web browser is Google Chrome. This is very much faster than Firefox and Internet Explorer.

Google Search Engine

 
Google is my home page. With google search, everything is near my fingertips.

Gmail
Gmail is easy to use and having more features than the other email service providers including email forwarding for free. I use this email forwarding for my mail account at SLIIT. I have set it to forward all the emails I get for SLIIT mail to my primary email account. So that I can read emails I receive from SLIIT easily.

Google Books Library
I use Google books to create my own library and read ebooks when I'm online.

Blogger
I use blogger to write my blog. This is easy to use than other blogging platforms.

Picasa
I use Picasa to upload my photos. When I want to add images to my blog, I upload the photos to Picasa and then give the links from the blog. I have installed Picasa 3 software also which allows me to upload multiple photos at the same time.

Feed Burner

 Using google feed burner, I have provided free email delivery for each post I write on my blog. My blog readers can enter their email in the Email subscription box and they can subscribe. Once I write a post, it will be automatically delivered to all the subscribers.

Youtube

You tube was very helpful for me when doing the Software Technology I assignment. There are so many technical videos there. I use this to upload and download videos. The best thing is it does not need to have any software to download Youtube videos....

Google Buzz

I use Google buzz to share my updates with my followers. It is something like twitter.

Google Translate

This was very much useful for me recently. I downloaded some tutorials online and after downloading I realized that it was not in English. It was in German. I used google translator and within few seconds it translated all the tutorials to English.

Google Reader
Using google reader, I can get the updates of all the blogs which I follow. So that I don't need to visit each and every blog to view the updates.

Google Earth
I'm not using this regularly, but it is helpful to get screen shots of geographical areas. I used this to get some screen shots of my school where I had to do a presentation about my school when I was at the university.

Google Groups
I use google groups to join various groups which discuss technical stuff. Currently I have joined so many groups such as Linux forum, hacker community, Unix guide......

Google Docs

Recently I had to write a report for an assignment and in my desktop PC, Office Package was not installed. I prepared the whole report using Google Docs.

Google Maps


This was really useful for me when I participated the Microsoft Student Champs for the very first time. I didn't know where the Microsoft Sri Lanka office was located and so I used this to get the map and found how to reach there.

Google Mobile


Google is with me in my Nokia E71 when I don't have access to a PC and when I'm on the way.

-Tharindu Edirisinghe-
-SLIIT 10'-

Thursday, February 10, 2011

Java program to validate an Email

This java program accepts an email address as a user input and it can validate and give a particular error message if the email is invalid.


import java.io.*;
public class EmailValidate
{
    public static void main(String args[]) throws IOException
    {
        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        String email;
        boolean status = true;

        System.out.print("Enter your email address : ");
        email = br.readLine();

        char firstCharacter = email.charAt(0);

        if( ! Character.isLetter(firstCharacter))
        {
               System.out.println("Invalid Email ! First character must be a letter !");
               status = false;
        }

       if(email.indexOf('@') < 0)
       {
            System.out.println("Invalid Email ! '@' is not present !!!");
            status = false;
       }
       
       else if( email.indexOf('@') != email.lastIndexOf('@') )
       {
           System.out.println("Cannot Have more than one '@' characters !!!");
           status = false;
       }

        if(email.indexOf('.') < 0)
       {
            System.out.println("Invalid Email ! '.' is not present !!!");
            status = false;
       }
       
       else if( email.indexOf('.') != email.lastIndexOf('.') )
       {
           System.out.println("Cannot Have more than one '.' characters !!!");
           status = false;
       }
       if((email.indexOf('@') > email.indexOf('.')) & status)
       {
           System.out.println("Invalid Email ! '@' should come before '.' ");
           status = false;

       }
       
       int indexAt = email.indexOf('@');
       int indexDot = email.indexOf('.');
       int length = email.length();

       if(indexDot == indexAt + 1)
       {
           System.out.println("No service provider spacefied ! Invalid email !");
           status = false;
       }
       if(indexDot+2 > length)
       {
           System.out.println("No Domain name specified ! Invalid email !");
           status = false;
       }

       if(status == true)
        {
            

            char userName [] = new char[indexAt];
            char service [] = new char[indexDot - indexAt - 1];
            char domain [] = new char[length - indexDot - 1];

            for(int iuser = 0; iuser< indexAt; iuser++)
                userName[iuser] = email.charAt(iuser);

            int slimit = 0;
            for(int iservice = indexAt+1; iservice< indexDot; iservice++)
            {
                service[slimit] = email.charAt(iservice);
                slimit++;

            }

            int dlimit = 0;
            for(int idomain = indexDot+1; idomain< 1)
            {
                System.out.println("Invalid username !");
                status = false;
            }
            if(service.length < 1)
            {
                System.out.println("Invalid service provider !");
                status = false;
            }
            if(domain.length < 1)
            {
                System.out.println("Invalid Domain name !");
                status = false;
            }

       }
       if(status == true)
            System.out.println("Valid Email. Successfully Validated.");
        


    }
}


-Tharindu Edirisinghe-
-SLIIT 10'-

Monday, February 7, 2011

C++ inside a Shell Script !!!

From my previous post I told you that I was learning Shell Programming. Once I got familiar with Shell Scripting, I got to know that the commands we type in the terminal can also be executed from shell scripts if we include the command within the grave operators.
eg: In Terminal = date
     In shell script = echo `date`

Suddenly I got an idea. If I write a C++ program and give the run command from a shell script, when I execute the shell script, the C++ program also should work.

I took a new file (a.cpp) and wrote the C++ program in that. 
eg:  vi  a.cpp

 I compiled the C++ program and executed it.

 
Then I wrote my shell script in myscript.sh file
eg:  vi  myscript.sh
I gave the full path of my C++ program so that the location where the Shell Script is saved does not matter when executing the C++ program.

 
It really worked !!!

P.S - At the moment I have completed 120 pages from that ebook

-Tharindu Edirisinghe-
-SLIIT 10'-

Saturday, February 5, 2011

How to master Unix Shell Programming ?

For the 'Systems Programming and Design' subject at SLIIT, we have to learn Unix Shell Programming. Normally I like programming stuff, but from the beginning of this SPD subject I had no interest in learning that. Day by day the content I had to study increased. I had to find a solution to improve my interest towards learning this subject. 

What I realized was that I didn't like Shell Programming not because of anything, just because I was not familiar with Unix environment. Other than programming, it needs to have an understanding of the Unix platform and what its capabilities are. We use Fedora to do the shell programming so first thing I did was trying to find what these Unix, Linux and Shell Programming are. 


So I browsed internet and found that the movie 'Revolution OS' was something related to Unix and Linux. So I downloaded the movie and watched it. Since it was a documentary movie on the development of the Operating System Linux, I found it boring. Somehow I watched the whole movie and it gave me an understanding of Unix and its capabilities and usage. 

Then I tried to find a way to learn Shell Programming. I downloaded the Shell Scripting learning videos (Sinhala medium) from Kuppiya
After watching those video tutorials, I got a basic knowledge in Shell Programming and I understood that more than Programming, I should learn about the Unix Environment. Then I went to the library at SLIIT and found a book which is really helpful to understand Unix and Shell Programming. That is 'Unix Shell Programming by Yashavant P. Kanetkar'. 
After putting some effort, I could download the ebook also from the internet. For the last two days I was reading this book and doing the practicals. At the moment I write this post, I'm doing the exercises in the 95th page of this book. This book is really amazing. This is the first time I'm going to read a book completely and learn it. The author has clearly described the environment, giving simple to complex examples. Now I have gained the confidence and I have improved my interest towards SPD subject. I hope to get good results  for this subject from the upcoming Mid exams at SLIIT.

P.S - Nothing is impossible to learn. All what you have to do is to improve your interest towards what you are going to learn.

-Tharindu Edirisinghe-
-SLIIT 10'-

Thursday, February 3, 2011

PS Mid Exam 2010 Part II answers

Click on the image to view the question.

Now try to answer the questions on your own.Then check your answers with the following.

You can use 'SPSS' software to check your answers.

You can also use "Thariya's Statistical Data Analyzer" to check your answers.


Finally, comment on the distribution on your own.......

-Tharindu Edirisinghe-
-SLIIT 10'-

Tuesday, February 1, 2011

Thariya's Statistical Data Analyzer Version 1.0 (Open Source)

From my previous post I released the Beta Version of this software. Now I'm going to release the Version 1.0 which has some more features than in the Beta Version.


Newly added features

  • Error and exception handling
    • In the Beta Version, when the user enters a character or a string instead of adding a numeric value, the software crashed. The new version is capable of identifying the input and generates a particular error message without failure.
  • Show the remaining data points to be entered
    • When the user enters data, the remaining data points that can be added is displayed.
  • Find the 'Mode' of the data set
    • The Beta Version was unable to find the 'Mode' of the entered data set, but this version is capable of finding it.
  • Increased size of the list boxes
    • Without scrolling, the user can view more data than in the Beta Version. 

Click Here to download the Setup (736.31 KB). This needs installation.

Click Here to download the Portable Version (373.56 KB). No need of installation. 

Click Here to download the Source Code (6.44 MB).  You can customize and use it according to your needs.

You need .NET Framework 3.5 to run the software.
 You can use this software when doing the 'Probability and Statistics' Lab Assignments. You can check your answers in SPSS with this.

P.S - Special thanks to Guruparan Giritharan for his feed back on the Beta Version and helping me in the Exception Handling of the New Version. My previous experience in using Dynamic 2D arrays was helpful when implementing a way to find the 'Mode'.

-Tharindu Edirisinghe-
-SLIIT 10'-