Posts

Showing posts from 2012

Website Visit Forecasting with Weka

Data mining is a technique which can used for identifying relationships between various large amounts of data set. I have done a research on Time Series Forecasting, there I done web visit forecasting with Weka tool. I think that kind of Research will help to plane to new releases, upgrades, etc. Another case is density of forecast visitors would be helpful to allocate or deallocate servers.

The aim of this research work was applying a suitable forecasting technique to predict web site visits. Thus, the results derived through forecasting will be assist web site owners in,

Predict total number of visitors within next WEEK time.Predict number of visitors on a given DAY (Sunday, Monday, etc) within next WEEK time.
In this research four of classifier functions are used. They are namely Gaussian Process, Multilayer Perceptron, Linear Regression and SMO Regression.Based on the evaluation results i finally  conclude that SMO regression and Linear Regression algorithms are better suited for …

Build Maven Multi Module Project and Run using one Command

When we have maven multi module project, there will be dependency between sub project. Therefor if you need to build all projects need tp navigate to parent directory and run the mvn clean install command.

If we have web based multi module project, currently most people doing is go to parent directory and build the all projects using mvn install or mvn clean install command, after that navigate to web project and start web container.

Ex: Projects are P1(parent project), Core and Web. When we building project go to P1 and build the all subprojects, after that go to web project and start jetty server using mvn jetty:run

But that approach wasting you time little bit and when we doing same thing all the time it will become boring  task to do(build parent and go to child folder and run the server)

For avoid this issue I am going to show how to run web project with out navigate to child project.

following command will help you to run specific project without moving to sub project folder.

mv…

Change Jetty Server Running Port

Jetty is one one of the best development server which I have ever used. It is easy to work with jetty server and its light weight

Here I am going to show how to change jetty server running port.  Jetty server default running port is 8080. 

Port with Maven: 

 Command line:          For starting jetty server we are using mvn jetty:run command. We can change the port jetty server running by passing run time argument to it.

mvn -Djetty.port=80 jetty:run


 Using pom.xml
                By changing jetty plugin system properties as below, you can change the jetty running port.
<plugin> <groupid>org.mortbay.jetty</groupid> <artifactid>maven-jetty-plugin</artifactid> <configuration> <stopport>9966</stopport> <stopkey>foo</stopkey> <systemproperties> <systemproperty> <name>jetty.port</name> <value>80</value> </systemproperty> </systemproperties> </configurati…

Maven add jar without install

I have some problem with adding external jar in to maven project without install it. If I install JAR file other people who working on same project, have to install same JAR. them I want to avoid that issue.

First need to place jar file inside lib folder. After that using following POM entry we can use it as dependency.

<dependency> <groupId>com.chandana</groupId> <artifactId>example</artifactId> <version>0.1</version> <scope>system</scope> <systemPath>${basedir}/lib/example.0.1.jar</systemPath> </dependency>

Ex: <dependency> <groupId>com.sun</groupId> <artifactId>tools</artifactId> <version>1.5.0</version> <scope>system</scope> <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath> </dependency>
 Here very important option is <scope>system</scope>. It's say dependency provide with system, no need …

Maven commands and hint

svn checkout without subfolders

svn co --depth immediates URL
maven without internet(Without downloading)

mvn -o install
mvn --offline install

Force the check of the latest dependency jars
mvn -U install
mvn --update-snapshots install

*** -U option to update your snapshots

Skip the tests

mvn install -DskipTests

also use the maven.test.skip property to skip compiling the tests

mvn install -Dmaven.test.skip=true

Remote Debug

mvnDebug test
mvnDebug install


To avoid OutOfMemoryError

To avoid OutOfMemoryError when running maven, set environment variable MAVEN_OPTS as below

MAVEN_OPTS=-Xmx1024m -XX:MaxPermSize=256m


If you have issue with Maven does not find JUnit test cases to run:
By default Maven runs tests class which names start with Test or end with Test or TestCase.Do not messed up the naming convention

Introduction to OSGi - 2 (OSGi Services)

There are so many OSGi tutorials, blogs, and samples. I am going to add another OSGi sample/tutorial with my OSGi leanings. Here is my previous article regarding OSGi(Introduction to OSGi).

An OSGi Service is a java object instance which is registered with OSGi framework with set of attributes. Services can be accessed via service registry(performed via the class BundleContext). BundleActivator is to be invoked on start and stop. When BundleActivator call start method we are going to register our service. After that any bundle can access that service.

Service Bundle:

In service bundle you need to export your service and need to register it via service registry. When we are exporting service we export interface package only. As usual that is to hide the implementation from the other bundles.

I have created a sample OSGi project called HelloServcie

MANIFEST.MF
Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: HelloService Bundle-SymbolicName: com.chandana.hello.HelloSer…