Tuesday, July 26, 2011

UPGRADING ATLASSIAN JIRA


This post describes the standard, recommended procedure for upgrading to JIRA 4.3.x from JIRA version 4.0.0 or later.
Atlassian's own web site describe the standards to upgrade Jira. The link given below shows how to upgrade Jira.
Link: http://confluence.atlassian.com/display/JIRA043/Upgrading+JIRA
Upgrading operation consists of a few basic steps. The steps are;
1. Backing Up
  • Back up your database:
    • Backup your external database and verify that your backup was created correctly.

  • Back up your JIRA Home directory:
    • In the WEB-INF/classes directory of your Jira installation directory, there is a jira-application.properties file, in the file, the location of home directory is available.

  • Back up your attachments directory if located outside your JIRA Home directory:
    • If your attachments directory is located outside of Jira home directory, it should be backed up.

  • Back up your JIRA Installation directory:
    • It is the directory that the Jira application files and libraries were extracted when Jira was installed.
2. Performing the Upgrade
  • Install the new version of JIRA:

    • Download Jira to install with the version that you want. And install Jira. Be aware of that install the new Jira version to a new location. Do not overwrite your existing Jira installation.

  • Migrate your existing JIRA configurations over to your new JIRA installation:
    • For each file that you have modified in your existing Jira installation, you need manually edit each equivalent in your new Jira version installation and re-apply your modification.

  • Connect your new JIRA to your existing database:
    • You should configure your new Jira version installation to connect your existing data base. Manually you can edit server.xml (in your new Jira version installation directory) to connect database. Also you can use Jira Configuration tool to configure your new Jira installation to connect your existing database.

  • Point your new JIRA to your existing JIRA Home directory:
    • Edit jira-application.properties (in new Jira installation directory) file. Find jira-home property and update the property to the path of your existing Jira home directory that you backed up in the steps above.
  • Start your new version of JIRA:

    • Shut down old Jira installation.

    • Start up new version of Jira.

    • Visit Jira in your web browser, log in by using user name and password from your old Jira installation. Without seeing the setup wizard, you should be able to log in.
To see detailed information for each step, visit the atlassian page that given on the top of the first page.
I hope to be useful.

Saturday, July 23, 2011

Java Send e-mail

In this post, by using JavaMail API, I will write a java program that sends an e-mail to the given e-mail address.
The JavaMail API provides a platform-independent and protocol-independent framework to build mail and messaging application.
Download the library and add it to your class path. Then start your development environment and use this code to send e-mail.


final String sender = “sender@gmail.com”;
final String password = “yourpassword”;
final String receiver = “receiver@gmail.com”;
Properties props = new Properties();
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.socketFactory.port", "465");
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.port", "465");
props.put("mail.debug", "true");
Session session = Session.getDefaultInstance(props,
new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(sender, password);
}
});
try {
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress(sender));
message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(receiver));
message.setSubject(subject);
message.setText(body);

Transport.send(message);
System.out.println("Email was Sent!!");
} catch (MessagingException e) {
throw new RuntimeException(e);
}


Change the values according to your accounts. For example change sender and receiver values.
I wish to be useful.

Saturday, July 2, 2011

Java Mysql Database Connection

This java program tries to connect to the named database installed on your local MySQL server.


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class JavaMysqlDatabaseConnection {

public static void main(String args[]) {

Connection connection = null;
public String databaseName = "yourDatabaseName";
public String userName = "yourUserName";
public String userPassword = "yourUserPassword";
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
connection = DriverManager.getConnection("jdbc:mysql://"+databaseName+"",
userName , userPassword);

if(!connection.isClosed()) {
System.out.println("Successfully connected to Database");
} else {
System.out.println("Not Connected to Database");
}
} catch(Exception e) {
System.err.println("Exception: " + e.getMessage());
} finally {
try {
if(connection != null)
connection.close();
} catch(SQLException e) {}
}
}
}


Step by Step get a Connection;

1. Open your development platform.
2. Craete a java class.
3. Copy this code to your class.
4. Change parameters according to your database, and get a connection.

In above example, "com.mysql.jdbc.Driver" is the name of the JDBC driver that you want to load.
I wish to be useful.

Saturday, June 18, 2011

THE DAILY SCRUM MEETING

What is the Daily Scrum Meeting?

A scrum is rugby play in which team members come together in a compact formation to move the ball down the field.

The daily scrum is the one of the three stages in Agile Planning.

  • Release Planning,
  • Sprint Planning,
  • Daily Planning.

This is the daily part. Everyday the team members gather around in a circle, generally around the Story/Task board and everyone, one at a time, answers three basic questions:

  • What tasks I worked on yesterday?
  • What tasks I plan to work on today?
  • What risks/obstacles stand in the way of my plan?

We must be aware of that the daily scrum is not used as a problem-solving or issue resolution meeting. Issues that are raised are taken offline and usually dealt with by the relevant sub-group immediately after the daily scrum.

It shouldn't take longer than 15 minutes.

Rules for Scrum Meetings:

  • Choose a scrum leader to enforce the rules during the sprint

  • Hold scrums every day in the same location and at the same time - preferably first thing in the morning

  • Each scrum should last only 15 to 30 minutes

  • Ask all participants the same three questions: What did you do since the last scrum? What are you going to do between now and the next scrum? Is anything in the way of you doing your work?

  • Address issues other than the three questions outside the scrum – this includes suggestions for a team member who's hit a roadblock

  • Managers are not allowed to speak

  • If a manager or colleague assigns unplanned work to a team member that will throw the team's schedule off track, the scrum leader has the power to excuse the person of the additional work. The work must either be fit into the next sprint or be assigned to someone who's not on the team.


Tuesday, May 17, 2011

Jsoup HTML Parser


There are so many open source java html parser. In this blog post just I will try to give some information about Jsoup. It is an open source Java HTML parser that I have been working on recently. Instead of Jsoup, you can use HTML parser, Jericho HTML parser or other parser libraries you want.

jsoup is a Java library for working with real-world HTML.

By using this library,

  • You can parse HTML from a URL, file, or string.
  • You can find and extract data, using DOM traversal or CSS selectors.
  • You can manipulate the HTML elements, attributes, and text.
  • You can clean user-submitted content against a safe white-list.

Getting Source Code.

Download the library and use it in your project. The current release version is 1.5.2.

Visit the example and start with jsoup to parse html.

If you use Maven to manage the dependencies in your Java project, you do not need to download; just place the following into your POM's section:

This post is an introduction to Jsoup. In other posts I will give some examples that I use in my real project. The examples will be about getting elements in html.

I wish to be useful.

Sunday, May 1, 2011

Java Primitive Data Types

In this part of my blog, I will try to give some information about java primitive data types, their range and default value of the types.

The Java programming language is statically-typed, which means that all variables must first be declared before they can be used. Before using any variable in your program, you must declare the variable with its type and name.

For example:

int data = 1;

This declaration tells your program that there is a field named “data”, holds numerical data, and has an initial value of "1".

Primitive data types and their range:

boolean :1 bit

range - May take on the values “true” and “false” only.

byte :1 byte

range - form -128 to 127

short :2 bytes

range – from -32,768 to 32,767

int :4 bytes

range – from -2,147,483,648 to 2,147,483,647

long :8 bytes

range – from -9,223,372,036,854,775,808

to 9,223,372,036,854,775,807

float :4 bytes

range – from 1.40129846432481707e-48

to 3.40282346638528860e+38

(positive or negative)

double :8 bytes

range – from 4.94065645841246544e-324d

to 1.79769313486231570e+308d

(positive or negative)

char :2 bytes, unsigned, unicode

range – from 0 to 65,535

String :a sequence of characters

We must know the range of the types to use them effectively in our programs. For example we have a counter, it starts with the value of 0 and it increases continuously. Initially for this counter as primitive type “int” will be sufficient. But in the future, the value of the counter will increase and it will be outside the range of int. so the program will not work correctly.

As developer if you do not assign a value to a variable you declare, it will be assigned will its default value.

Default values for the data types:

Data Type Default Value

byte :0

short :0

int :0

long :0L

float :0.0f

double :0.0d

char :’\u0000’

boolean :false

String :null

I wish to be useful.

Saturday, April 23, 2011

Java: For Loop

The “for loop” is a type of looping construct. This construct provides a compact way to iterate over a range of values. This loop works as “while loop construct” but it provides the initialization, condition and termination.

The general form (syntax) of the “for statement” can be expressed as follows:

for (initialization; termination; increment) {

statements;

//code_block_to_be_executed

}

The given example illustrates the syntax “for loop” for developing an application or a program.

initialization: The expression initialize the loop. It allows the variables to be initialized.

//it can be such as

int i = 0;

int j = 1;

termination (condition): This term of the for loop allows to check the certain condition. If the condition is true, the code block will be executed or the code block will be ignored.

//it can be such as

i < 10;

j <= 11;

increment: This term of the loop allows to increase the given variable. As programmers you can increment the value one by one, two by two or how you want.

//it can be such as

i++;

j++;

Generally the form of the “for loop” is illustrated above. Now I will give a code block and the output of the code. To be an example for the beginners it will be useful.

Code Block:

class ForLoop {

public static void main(String [] args) {

for (int i = 1; i< 4; i++) {

System.out.println(“Value of i is: ”, +i);

}

}

}

Output of the given code block will be:

Value of i is : 1

Value of i is : 2

Value of i is : 3

I hope it will be useful for programmers, beginners.