Friday, May 17, 2013

Memories of SLIIT Codefest 2012 - People's Award Winner

It's been a long time since I blogged the last post.... thought of recalling the memories of the SLIIT Code Fest 2012 as this year's event is coming nearby...

It was the toughest coding project I've ever done up to now.... not because of it was hard.. but because of the limited time we got to develop our project... 

As I can remember we had the 3rd year 2nd semester exams at SLIIT until October 17th... and the Code Fest Competition was on 19th. Until the exams were over we couldn't find any time to develop something for Code Fest although we had got registered for the competition. Soon after the exam was over on 17th evening, we got together to plan something to be developed.. As always, Guru, Mihiran and Hiran were with me in the team... In order to align with the theme 'Mobile Gaming', we had to develop a game to be run on a mobile platform. The following are the photos that were taken while we were planning the game to be developed.

Guru & Mihiran

Hiran & Me

The planning was very quick.. we had no time to waste as the clock was ticking.. I had the idea to develop a game that I used to play when I was in Grade 3 at school (in 1998) in a 2D brick game where it had a life guard and the player had to save the passengers of a sinking ship from a shark. 

We divided the tasks where Mihiran took over designing all the graphics in the game. I had to take over most of the coding part as Hiran and Guru were in their internships at MIT and Virtusa.. (At that time I had just finished my internship at Central Bank and was waiting for the internship at Virtusa to commence). 

Mihiran and I spent the 17th night at Hiran's place where we had a sleepless night developing the game.. We didn't use any game engine.. programmed everything from the scratch... We used images in the game and controlled their movements using threads. Windows Phone 7.5 was the platform we selected and used Silverlight and C# for programming. 

We also had to design a banner for the game to be displayed during the competition. Mihiran designed it and we printed it on a canvas.    


Mihiran holding the banner he designed

Here's the final product. We named our game as 'Shark Attack'. It came really nicely with all the animations and graphics. 



Until last minute I was coding... fixing bugs in the threads.. as for each animation.. it had separate threads..  This photo was taken few minutes before the competition.


There were nearly 10 competitors in the Open Category. We had to present our game as the very first presentation in Open Category. 

So Finally we won the People's Award in SLIIT Code Fest 2012. It was a great experience where we programmed the game in just 1 day and still managed to win an award... 



Here's the award we got.. 


The Team.. From left to right... Mihiran, Me, Hiran and Guru.... 


Here's a promotional video prepared by Mihiran....



Special thanks to Manesha Gunathillake... our Mentor of the project... who motivated and guided us.... and organized everything.. 

Those memories will never be shaded...... great times at SLIIT..


Tharindu Edirisinghe
SLIIT 10'


Monday, September 24, 2012

Algorithm Simulator Mini Version with Source Code

Once year back when I was in the 2nd year, I programmed the Algorithm Simulator to demonstrate the three sorting algorithms : Insertion Sort, Selection Sort and Bubble Sort. I released the source code also but due to lack of time, the code was not well documented or commented so that I received so many comments from those who went through the code that it was too difficult to understand. I'm glad that many found the project useful and therefore I'm releasing a mini version of the simulator with less number of code lines so that it can be understood easily. Here are some screen shots of the application. Find the download link at the end of the post.





Click Here to Download the Visual Studio Project (48.21 KB)

-Tharindu Edirisinghe
-SLIIT 10'



Wednesday, September 12, 2012

Blend for Visual Studio 2012 - Not working ???

Recently I installed Microsoft Visual Studio 2012 which comes with the .NET framework 4.5. Unlike the previous versions in VS, the new one comes with Blend inbuilt. After the installation, VS 2012 worked perfectly but when I tried to run Blend for Visual Studio 2012, it gave me the following error message. 

I followed the link displayed in the message to install the Blend + SketchFlow Preview for Visual Studio 2012. 
Then I downloaded the preview from the Microsoft Expression website which was 102.3MB. 
I followed the installation steps as shown in the images below.




Even after installing the preview, Blend for Visual Studio 2012 gave the same error message. Instead of that, the newly installed Blend + SketchFlow Preview for Visual Studio 2012 worked without any issue.

The new features of Blend are yet to be tried out. If anybody already gave it a try, feel free to give your comments.

-Tharindu Edirisinghe
-SLIIT 10'


Thursday, April 19, 2012

How to Create a Basic Crystal Report using Windows Forms and C#

From this post, I will show you how to create a basic Crystal Report. You don't need to have previous knowledge in reporting. Just a little bit knowledge in C# and SQL would be enough.

In SQL Server, I'm creating a database named 'Company' and inside that I have a table named 'Employee'. An employee has an id, a name and a designation. Sample values are added into the Employee table.

Then in Microsoft Visual Studio, I'm creating a Windows Forms Application.

Then I need to add a data source to the project. Right click on the project in Solution Explorer. Select Add and Click on New Item.
Then in the dialog box, select 'Data' as the Category and from Template, select DataSet. The name for the new data set is given as EmployeeDataSet.xsd in this example. Then click Add.

Then the EmployeeDataSet.xsd file will be opened. If not open it from the Solution Explorer. In the Toolbox, under DataSet, click on the TableAdapter, drag it to the working area and drop it.
Then the Table Adapter Configuration Wizard will be opened.
Click on New Connection. Then give the database details appropriately. In this example, server name is localhost and the database is Company. Then test the connection.
Once the connection is successful, click OK.
Now the connection string is created. Click next in the Table Adapter Configuration Wizard.
In the next window, you can give a name for the connection string. For my convenience, I'll leave the default name. Then click Next.

In the next window, select 'Use SQL Statements' and click Next.
In the next window, you can specify the SQL query for the table adapter. I'll use the Query Builder to build the query.
In the Add Table window, select the tables you want for the query and click on Add. Then close the window. In this example I'm adding the Employee table.
\
Then select the columns needed for the query and click Execute Query to view the result. Then click OK.

Now the query is successfully built. Click Next.

Make the selections as shown in the following image and click Next.
 Now the table adapter is successfully configured. Click Finish.

Now you can see the configured table adapter in the working area.

Now we need to add a Crystal Report to the project. Right click on the project in the Solution Explorer and  select Add -> New Item. From the categories, select Reporting and from the Templates, select Crystal Report. The name given for the report in this example is EmployeeReport.rpt . Then click Add.
 Here I'm creating a Standard Report using the Reporting Wizard.
In the wizard, select the data table that you want in the report. Here I'm selecting the Employee table. Then click Next.
Then select the fields to be displayed in the report and click Next.

Next thing is Grouping. Here I don't want to group the displaying fields. So I'll click Next without making any selection.
Next thing is filtering fields. Here I don't need any filtering so I'll click Next.
Next thing is selecting a style for the report. I'll select Standard style and click Finish.
Now the report is created. You can drag the fields and customize the appearance. Add lines and images if you need. I'll just leave it as it is.
Now the designing is over. Now we need to view the report. Get the Windows Form (here Form1). In Tool box, under Reporting menu, click on the Crystal Report Viewer and drag it to the form and drop. 


Now we need to write little bit coding to display data on the report viewer. Go to the Form Load event and write the following code.

Now run the project and see the output report.




Feel free to put your comments here !

-Tharindu Edirisinghe
-SLIIT 10'