Sunday, January 8, 2012

Connecting a phpMyAdmin DB to Eclipse

This is a small tutorial on how to connecting a phpMyAdmin database to Eclipse.
Things you need - Eclipse , mySQLConnectorJXAMPP

Step 1
Once you install XAMPP, Open the install folder. There you will find 'xampp-control.exe' . Open it configure it to the following setting. Apache and Mysql are initiated by their start buttons.



Go to your browser, type 'localhost' to the address bar. Then click phpMyAdmin on the left side bar.

In the phpMyAdmin page, you are able to create the database of what you want and the tables necessary.

For more help -
InstallingConfiguringDevelopingWithXAMPP

Step 2
Open Eclipse. Create a project in where you want to connect to the database. Right click the project file > Build Path > Add External Archives

From the selection window, select the 'mysql-connector-java-5.1.18-bin.jar' file in the mySQLConnectorJ folder. (You may have a different version of the jar file)

Step 3
The code below is a class I made in connecting to a database in XAMPP.

//THE_CODE

package database;
import java.sql.Connection;
import java.sql.DriverManager;

public final class Connect {
private Connection conn;
public Connect(){
conn = null;
try{
String userName = "root";
String password = "";
String url = "jdbc:mysql://localhost/shop";
Class.forName ("com.mysql.jdbc.Driver").newInstance ();
conn = DriverManager.getConnection(url, userName, password);
}
catch(Exception e){
System.out.println("Exception found");
}
}
public Connection getConnection(){
return conn;
}
public void closeConnection(){
try{
conn.close ();
}catch (Exception e) {
System.out.println ("Connection close error");
}
}
}


//DESCRIPTION
The code below is the main part in connecting to the database.


String userName = "root";
String password = "";
String url = "jdbc:mysql://localhost/shop";
Class.forName ("com.mysql.jdbc.Driver").newInstance ();
conn = DriverManager.getConnection(url, userName, password);

The Strings userName and password are the username and password for the database.
"shop" mentioned there is the name of the database.
To execute SQL statements, follow the tutorial link given below -
http://www.kitebird.com/articles/jdbc.html

*Remember to close the connection after using it. The closeConnection function will execute it.

Hope all this is clear for you. :D

GO_HOME ?

As I was in the informatics Olympiad training pool sometime back. I used to be addicted in solving problems. This post is one such problem I solved on the 5th of May 2011 when I was bored. The problem is where a maze is given and a path needs to be found from a given source and a destination. The code was developed in 'Dev C++' .

//THE_CODE!!!!!

#include<iostream>
using namespace std;

const int mapWidth =10;
const int mapHeight=10;
char map[mapHeight][mapWidth]={' '};
int startY ;
int startX ;
int height, width;
int pathSteps=0;
int steps=0;
int tempSteps=0;
 
void displayMap(){
     for(int i=0;i<height;i++){
            for(int k=0;k<width;k++){
                    cout << map[i][k] ;
            }      
            cout << endl;
    }  
}

bool maze(int y, int x){
     if(y<0 || x<0 || y>height-1 || x>width-1){
            return false;    
     }  
     if(map[y][x]=='*' || map[y][x]=='d' ){
            return false;                            
     }
     if(y==startY && x==startX){
            return false;                
     }
     if(map[y][x]=='h'){
            cout << "FOUND! " << endl;
            return true;                            
     }
   
     map[y][x]='d';
     steps++;
   
     if(maze(y, x+1)){
            return true;        
     }
     if(maze(y+1, x)){
            return true;        
     }
     if(maze(y, x-1)){
            return true;        
     }
     if(maze(y-1, x)){
            return true;        
     }
     steps--;
     return false;
}


int main(){
    cin >> width;
    cin >> height;
    for(int i=0;i<height;i++){
            for(int k=0;k<width;k++){
                    cin >> map[i][k] ;
                    if(map[i][k]=='s'){
                              startY=i;
                              startX=k;                          
                    }
            }      
    }
    //displayMap();
    maze(startY, startX+1);
    tempSteps = steps;
    maze(startY+1, startX);
    if(steps<tempSteps){
            tempSteps = steps;                  
    }
    maze(startY-1, startX);
    if(steps<tempSteps){
            tempSteps = steps;                  
    }
    maze(startY, startX-1);
    if(steps<tempSteps){
            tempSteps = steps;                  
    }
    if(steps==0){
            cout << "NO PATH TO HOME!" <<  endl;          
    }else{
          cout << "Steps = " << steps << endl;
    }
    system("PAUSE");
    return 0;
}

//THE_INPUT
"
10
10
**********
*s****xx**
*x**xxx***
*xxxx*x***
*x****x***
*x****xx**
***hxxx***
**********
**********
**********
"

's' is the source;
'h' is destination;
'*' are blocks which cannot go through;
'x' are independent paths;

*Enter the above without quotes

//THE_OUTPUT


The output for the following maze, the number of steps needed to reach from 's' to 'd' is 14.

//DESCRIPTION
The solution is made using recursion. Rather than using 'for' loops, I thought it would be interesting to find the solution using recursion. The maze function solves the maze using each possible path. This algorithm does not find the shortest path.



FLASHY ENUF_?

As my life is almost being online on the internet, most of the time is spent on Facebook and Youtube. Recently I hit an interesting social entertainment known as a "Flash Mob". Flash mobs is where a group of people gather unexpectedly in public places performing an entertainment act.  I also checked Wikipedia, they say that is it an "pointless act". But I beg to differ. It is one of the most COOLEST things I've seen on my life. After watching videos of flash mobs in youtube so much, I hope to join a flash job later on ;) . I also noticed the it is kind of embarrassing at the start. But later on it gets better and better. Some of my favorite flash mob videos are linked here..




much love <3

Saturday, January 7, 2012

QR Code

Recently I noticed there are these weird looking square images used in banners, advertisements in the internet and as well as on the road. So I did some research on it and was able to find out what it is. Its called a QR Code.

qrcode

QR code stands for quick response code. This was used by the Toyota company to track vehicles in the manufacturing process in 1994.

I believe it seems to be a quick way to send messages using a security facility.
The internet has websites in encoding and decoding the QR Code.

Encoder - http://qrcode.kaywa.com/

Decoder - http://zxing.org/w/decode.jspx

This may be useful some day.... ;=)

Vertigo Cinema

I am currently in a team of people creating frag movies names "Vertigo Cinema". You may be wondering what frag movies are. They are actually a movie made up of game-plays of a games. These movies are created using different softwares such as Sony Vegas, Fraps, VDub, etc.

This is frag movie of a Call of Duty 4 player named robbye.


A frag movie by me... :)

WHOSE_TAIL?

I know the television can bring many weird and bad ideas. This is one of them. Cocktails!!!. Cocktails are alcoholic mixed drinks usually containing more than one ingredient. I still haven't consumed any cocktail in my life yet. But for now, I must say that there are some really interesting cocktails out there in the world. I will share 2 of my favorite cocktails for now.

The Grasshopper...


The grasshopper is a sweet, mint-flavored drink.
The recipe -


  • 3/4 oz green creme de menthe
  • 3/4 oz white creme de cacao
  • 3/4 oz light cream

Tequila Sunrise..
The Tequila Sunrise is considered a long drink with the sweetness of orange.
The recipe - 
  • 4 oz orange juice
  • 2 oz tequila
  • 1/2 oz grenadine
  • orange slice for garnish
  • maraschino cherry for garnish


Dont think anything bad of this :P  . But sometimes in life, you just gotta enjoy whats out there.

Career Statement

I am a self motivated, honest, dynamic, creative and hard working undergraduate who is able to use my own initiative in successfully completing tasks. I also possess a proven track record of positively contributing to work as part of a team.

I seek a challenging position within the IT industry where I could learn from and contribute to serving the organization to the fullest of my abilities. I want to use my creativity, verbal and written communication skills, team working skills, interpersonal skills and practical intelligence.

Software engineering (SE) is the application of a systematic, disciplined, quantifiable approach to the development, operation, and maintenance of software, and the study of these approaches. That is, the application of engineering to software. Software Engineering involves the development of software in a well defined and schematic manner. It is a field, which undergoes rapid changes along with time and technology, in which newer opportunities are raised to propose innovative and creative ideas.

I am a person who is keen in challenges. The tasks of a Software Engineer are such that they tend to become more challenging with time and progress of a given project.

The field of computer science undergoes many changes with time. So in order to meet with these changes, changes in the various fields of businesses, changes of requirements of end-users, the potential Software Engineer must be a person with capability of imagination.

And this is a virtue that I have always possessed. I love to think different, work things out differently and look for new aspects of developing software, so that the current requirements of the filed would be met with. The tasks of a Software Engineer involves to a greater degree, high inter-personal skills, communication skills both written and oral. 

I am still an undergraduate, and the accomplishment is further ahead. The knowledge that I gained while being an undergraduate has taught on how to  explored and learned in this field of software development.

Assets
Education and Credentials
· Satisfactory completed Training course JAVA APPLICATION DEVELOPMENT conducted by Computing Services Centre, University of Colombo School of Computing (2008)
· Completed Level 6 of International Certificate of Competence in Information Technology, International Curriculum and Assessment Agency (UK), endorsed by University of Southampton(2002).
· Participated at the 19th National Schools’ Software Competition (NSSC) 2008 conducted by Computer Society of Sri Lanka(CSSL)
· IOI (International Olympiad in Informatics) training.
· Currently enrolling the 2nd year of my B.Eng Software Engineering degree.

Additional Skills – Badminton, basic knowledge on music, cyber gaming.

My Career Ambition and Environment 
My career ambition is to get promoted to the position of a Software Architect position in 7 years of time. So by joining into the firm as a Software Engineer related to mobile applications, I would gain the required knowledge and experience that is required to be a Software Architect. And the regular promotion scheme at most main software engineering companies are very much in line with my career progression. Most of the work places in the field of software engineering in Sri Lanka have supportive, flexible corporate culture, which is beneficial to the prospective employees. They cherish equality and always welcome new ideas. Most of the leading software engineering companies have well balanced work schedule and acknowledges hard work whist also concentrating on interpersonal relationships between the firm as well as its clients, so that the benefits would be long term. They also provide its employees with cutting edge technology, which not only exposes them to the latest technology but also enhances their productivity as well as innovation.

Strengths
· Quick learner and critical analysis.
· High sense of professionalism.
· Ability to effectively plan and manage tasks given.
· Proactive and ability to think outside the box to deliver on goals.
· Ability to effectively track and monitor key milestones/ deliverables.
· Analytical and systematic approach to problem solving.

Critique of an Interview


After my advanced level exam at school was over, My parents asked my whether I would like to join IIT for a software degree as I already had a scholarship earned by myself. So my parents told me that there will be an interview done by the dean of IIT prof. Alfred Perera. These are some facts I acquire about the sitting.


How I have prepared?
As I got to know about that there will be an interview, I had enough time to prepare myself. At that moment, I did not have a curriculum vitae. So I created one using my past certificates, positions I had in school and the extracurricular activities I’ve done. On the day of the interview I got myself well dressed and prepared. As I was able to come to IIT before the time of the interview I was confident enough to face the interview. I also took my CV and the application when going to the interview. I also studied what they might ask me, the background of the degree and the subject itself that I am going to study. These helped me a lot to bring up confidence but there was a slight nervousness because this was my 1st interview. But I was excited throughout the whole session. It is necessary to wear smart casual and should not wear any fancy items just to make appeal. I only took a pen and a file including my application and the CV and was there by time.


How to use the body language at its best?
At first, It is vital to make the first impression by using proper body language. Being pleasant and smiling is needed for this. We should not show any type of discomfort even though we are nervous. Being in a good posture is also essential. Eye contact also should be maintained to show that we are eager and interested to apply.


How to the Interview
When answering question at the interview it is not good to digress because verbal communication plays the foremost role in an interview. The success in answering the questions is to build up a good reputation at that moment and show that we are ready to move on. Showing the positive feelings to the interviewer builds up the reputation and the confidence that they have on us.


· What have you done regarding programming languages?
This question was pretty much easy for as I knew 2 programming languages by then. So I said that I know Java and C++ confidently. This is because during my school life I learnt C++ and Java for the Olympiad training. So I was confident enough that whatever the question they ask regarding  those languages I would reply them with good answers. I did not make any mistakes at this moment.


What are the field your interested in?
This was an interesting question. At this moment I knew that my interests will convince them to build up a foundation of what I am able to do. So I was precise on my answers. Hence I said game developing. I was not sure whether it will bring up a wrong impression on me as gaming is not considered as a talent but as an addiction in Sri Lanka. I also described some information on what I have done regarding that interest. I noticed that it is not necessary to go deep into this making the interviewer fed up of me. So I limited my information.


Who is the Sri Lankan boxer who lost his gold medal due to drugs?
This question kind of depressed me as I could not remember the name of the boxer. It was a tricky question. However I remember that the first name was Manju. But I did not knew the last name of that person. So I answered Manju. The interviewer agreed and told me that even within the university there are different types of people that may be addicted to drugs and that I should know to take the correct path. 


What I have learned
As to what I faced more attention should be done for body language and also on general knowledge. I also need to brush up on my communication skills as I did stuttered during the lecture. Facing this interview was very useful for me as this was my 1st interview faced. I have learnt how to take a part in an interview and how to prepare for an interview successfully to succeed in the interview.

Reflection on perception of IT ethics and legal issues


The word ethics may give different meaning to different people.

“Ethics has to do with what my feelings tell me is right or wrong?."
"Ethics has to do with my religious beliefs?."
"Being ethical is doing what the law requires?."
"Ethics consists of the standards of behavior our society accepts."

Ethics is concerned with what is right or wrong, good or bad, fair or unfair, responsible or irresponsible, obligatory or permissible, praiseworthy or blameworthy. We may wonder whether law and ethics are giving out the same meaning. But it is not. Ethics is a moral code of right and wrong that is generally acceptable by your community. Law is the codification of ethics as part of the government's responsibility to protect its citizens. Ethics are more like rules of conduct.

As for today, information technology plays a major role in the society. It has grown widely around the world. This has led to a doubt whether IT should also have its ethics and legislation. When it comes to IT ethics, stealing is still stealing, stalking is still stalking. We often ask whether the internet is uplifting ethical issues. “Computer ethics” is a branch of practical philosophy which deals with how computing professionals should make decisions regarding professional and social conduct.

As I am current enrolling on a BEng Software Engineering degree it is my responsibility to adhere to current IT ethics and its legislation. When in public I have to consider the due regard for public health, privacy, security and wellbeing of others and the environment. I should know how to conduct professional activities without discrimination on the grounds of nationality, colour, race, ethnic origin, religion, age or disability, or of any other condition or requirement. I must assist in promoting equal access to the benefits of IT and seek to promote the inclusion of all sectors in society wherever opportunities arise. Acting in public interest as such may be governed by legislation.

When in using my professional skills I should know only undertake to do work or provide a service that is only within my professional competence. In developing my professional knowledge, skills and competence on a continuing basis, I shall maintain awareness of technological developments, procedures, and standards that are related to my field. I must ensure that I have the knowledge and understanding of legislation and that I comply with it. In working with my profession I respect and value alternative viewpoints, and if it is needed to be criticized, I should give honest criticism. Avoiding injury to others, their property, reputation, or employment by false data or software should be noted. It is a well known fact that making any offer or acceptance of bribery.

When I am following my career I should carry out my responsibilities with due care in agreeing with the company’s or client’s requirements. Any situation that may give rise to a conflict of interest between you and your relevant authority should be avoided. When working with my colleagues I should take responsibility of mine and their work if they are working under my supervision. It is not accepted to hold back information on products, system and services. I should not advantage of the lack awareness or inexperience of others.
As for duty of my profession I should accept my personal duty to support the reputation of it and not take any action which could bring the profession to disgrace. I am to seek, in improving my professional standards through participation in their development.

With the improving technology at present the human kind also engage in crimes related to IT. Because of this reason, legal issues are brought down by different governments. I am currently aware of some of the legal acts brought down by governments such as…
Computer misuse act 1990
Data protection act 1998
Freedom and information act 2000

All of these acts are brought out to suppress piracy and hacking. When talking about piracy, many websites collect user data, from usernames and passwords to personal information such as addresses and phone numbers, without the explicit permission of users. Selling this information is widely considered unethical. I hereby consider that I have a good understanding about IT ethics and legal issues.


Reflection on Self-awareness

As I am currently enrolling on the 2nd year of my software engineering degree program, the module professional practice introduced the qualifications for a person to develop to carry out and face the field as a software engineer. This module helped me in identifying my skills, interests, weaknesses and professionalism. The module consisted of tutorials such as debates, self awareness sessions, presentations, writing job description.
The debate was done group wise. A group consisted of 4 people chosen randomly and was given a topic. We each divided our parts on the topic. But since there was no time for practice, we took more time than we were given. Because of this reason we were not able to deliver our speeches properly. From this tutorial I noticed that time management is necessary and that I need to built it up. Also practice before anything. This helped me on how to organize a delivering a speech as well as for presentations.
During the presentation tutorial, the module leader taught us some improvable facts that can be developed to give a better presentation. He especially told us on how to get the attention of the crowd and also the movements and posture. This was the first time I had a feed back on a presentation. These facts are really useful and I got to know that I should improve on those skills.
I believe that these tutorials were really effective for my future career and it specially made me aware of my strengths and weaknesses. 

Oppertunity awareness and the value of Networking


Networking is the process or practice of building up or maintaining informal relationships, especially with people whose friendship could bring advantages such as job or business opportunities. When it comes to working in an IT field, networking plays an important role. When finding a job regarding IT it’s not “What you know” that’s important, but it’s “Who you know”. Through networking links are created with people in an organized way while committing to do our part but expecting nothing in return. Networking has its advantages and disadvantages.

1. You can be afforded an opportunity not yet advertised therefore reducing the competition significantly.
2. A job may be specifically created for you based on an employer’s requirement.
3. Networking provides social contact and stimulation.
4. Openings are created for you to be opportunistic and flexible.
5. Networking is a two way process that can enable you to help others.
6. Networking is a proactive job search method.
7. Networking puts you in control, setting your own pace and course.

Opportunity awareness is the process of looking at oneself in order to assess aspects that are important to our skills, interest, values, knowledge, personality, goals, self assessment, professionalism, the environment that is required to find jobs, workshops, events etc. The information learned by participating in opportunity awareness activities can help identify careers of interest, learn how they can prepare for them, and help them match their interests, personality.

Networking has played a major role in the study of my software engineering degree. I’ve known many people related to software designing and engineering before I started my degree. They have been great useful in improving my programming skills and also in clearing doubts in solving problems. As I was in the training program for the informatics Olympiad, the trainers and the other students of it are still having contacts with me. Whenever I have a problem regarding programming, especially when it is difficulty connected with algorithm I contact them. They provide fine solution. This is one of the valuable connections I have in my network. While I am studying my degree I have joined many communities and forums such as ‘Android Developer’ and ‘CodeProject’. They have been of great useful for me as it allows me to solve my problems and also being able to help others in their problems. These forums have made a great deal of impact on my knowledge especially when working on assignments. Even for today, networking has become invaluable for me. I also have a blog at google and a linkedIn profile. This was suggested by the lecturer in charge of professional practice module. I’ve made many connections with other companies because of this. I believe they will become in handy when I go into the IT field after my degree.

Many opportunities have risen due to the value of networking. Since I had connections with the University of Colombo School of Computing I was notified that Computer Society of Sri Lanka is hosting its National School’s Software Competition at University of Colombo. I was awarded for the participation and was chosen for training to be in a selected group comprising 3 people for the South East Asia Regional Confederation International School’s Software Competition. Though I was not being able to get selected, this was one of the greatest opportunities I had in my life. Embarking on this, it created more connections with more people with same interests such as I have. This also allowed me to participate for the informatics Olympiad training, which is still useful even for my degree studies.

I believe more opportunities will come forth in the next years of my degree. It is because of networking that these opportunities have raised. Since they have been of useful for me, I am keeping an eye out to capture any opportunity that comes. I do agree that networking also does has its disadvantages. But since I am still a student I think it won’t affect me much. As I have made evidences in the above sections, I am aware of the opportunities and the value of networking.