Wednesday, November 3, 2010

Getting started with Eclipse Subversive

Getting started:
http://www.eclipse.org/subversive/documentation/gettingStarted.php

Installation:
http://www.eclipse.org/subversive/documentation/gettingStarted/aboutSubversive/install.php

Sample Installation: (Eclipse Helios)

Install Subversive Plugin using Eclipse update site
1) Help -> Install New Software...
2) In the "Work with" dropdown, select the update site of your eclipse version, e.g Kepler. The available software sites will be listed/displayed.
3) In the list, select Collaboration -> Subversive features then install. At the least, you only need the Subversive SVN Team Provider.

Install Subversive Plugin using SVN update site
1) Help -> Install New Software...
2) In the "Work with" dropdown, select the update site of SVN. If it is not available click "Available Software Sites". On the window that opens, select subversion update locaion. If location is not found, add it. SVN will now appear on the "Work with" dropdown. Select it.
Sample
Name: Subversive
Location: http://download.eclipse.org/technology/subversive/0.7/update-site/
3) In the list, select Subversive features then install.

Install Subversive SVN Connectors
1) Restart Eclipse
2) After restart you'll see connectors discovery dialog.
3) Install Subversive Connectors without registering connectors update site manually.

http://community.polarion.com/projects/subversive/download/eclipse/2.0/helios-site/ -

Update:
If the SVN Connectors are not downloaded,
1. make sure you are using a fresh workspace to launch Subversive Connector Discovery upon restart
2. get the latest release from:
http://www.polarion.com/products/svn/subversive/download.php?utm_source=eclipse.org&utm_medium=link&utm_campaign=subversive
Latest Release – Recommended
Help (free book):
http://svnbook.red-bean.com/

Sources:
http://www.eclipse.org/subversive

What is Subversion

Subversion® is an open-source version control system. Subversion® allows developers to share there projects on the repositories, where they are stored afterwards. Repository is much similar to a file server, except the fact, that it not only stores the copy of the file system, but its previous states and changing history. Subversion® access its repositories using network, so it provides a probability for a person to work over some shared files and watch for every possible changes made by other developers.

Subversion® home:
http://subversion.apache.org/
http://subversion.tigris.org/ - old home

Trunk, Branches and Tags
Trunk is a main (head) line of development. That's where you share your project and do initial commit. Branches are the additional lines of development. Used when branching for different versions from one initial is needed or when each developer has his own development line and plan. Tags are a kind of specific labels for a set of files each with its own revision number. Used to track the important events if project's life cycle.

Apache Subversion - provides an API for Subversion developers and package maintainers to build Subversion from source code

Binary packages - packages from volunteers built on top of Apache Subversion
- some of the available packages are here: http://subversion.apache.org/packages.html
- Example: Slik SVN

SVNKit
SVNKit is a pure Java toolkit - it implements all Subversion features and provides APIs to work with Subversion working copies, access and manipulate Subversion repositories - everything within your Java application.

Sources:
http://subversion.apache.org/
http://subversion.tigris.org/
http://www.eclipse.org/subversive
http://svnkit.com/index.html

Wednesday, October 20, 2010

Web Server, Web Container & Application Server

A Web Server is a server capable of receiving HTTP requests, interpreting them, processing the corresponding HTTP Responses and sending them to the appropriate clients (Web Browsers).
Example: Apache Web Server

A Web Container, also called Servlet container or Servlet engine, is a J2EE compliant implementation which provides an environment for the Servlets and JSPs to run. Putting it differently we can say that a Web Container is combination of a Servlet Engine and a JSP Engine. If an HTTP Request refers to a Web Component (typically a Servlet or a JSP) then the request is forwarded to the Web Container and the result of the request is sent back to Web Server, which uses that result to prepare the HTTP Response for the particular HTTP Request.
Example: Tomcat is a typical Web Container. A typical setup would be to have Apache HTTP Server as the Web Server and Tomcat as the Web Container.
Illustration: Servlet Container = Web Server + Servlets/JSPs (dynamic response generation)

An Application Server is a complete server, which provides an environment for running the business components (EJBs, ADF BCs, etc.) in addition to providing the capabilities of a Web Container as well as of a Web Server.
Example: Bea WebLogic, IBM WebSphere, Oracle Application Server, etc.
Illustration: Application Server = Web Server + Servlets/JSPs + Business component (EJB)

Source:
- copied from http://geekexplains.blogspot.com/2008/06/web-server-web-container-application.html
http://www.ecomputercoach.com/index.php/component/content/article/68-servers/72-web-server-vs-servlet-container-vs-application-server.html

Sunday, September 12, 2010

JSP / JSTL / EL

JSP
JavaServer Pages (JSP) - is the standard presentation-layer technology for the J2EE platform.

JSP scripting elements:
  • expressions
    - form: <%= javaExpression %>
    - ex: date = <%= new java.util.Date() %>
    - xml syntax: <jsp:expression>javaExpression</jsp:expression>
  • scriptlets
    - form: <% code %>
    - xml syntax: <jsp:scriplet>code</jsp:scriplet>
  • declarations
    - form: <!% code %>
    - xml syntax: <jsp:declaration>code</jsp:declaration>
Comments
  • JSP Comment - <%-- JSP Comment --%>
  • HTML Comment - <!-- HTML Comment -->
Predefined vars: request, response, session, out, application, config, pageContext and page

JSTL

JSP Standard Tag Library (JSTL) - is a collection of standard custom tag libraries that implement basic functionality common to a wide range of server-side Java applications.

EL
Expression Language (EL) - is a simplified form for JSP expression
- syntax: ${elExpression}

Source:
http://www.ibm.com/developerworks/java/library/j-jstl0211.html
http://download.oracle.com/docs/cd/E17802_01/j2ee/j2ee/1.4/docs/tutorial-update2/doc/index.html

Thursday, September 9, 2010

Line Wrap for excel cells

DO:
In report manager,
exporter.setParameter(JExcelApiExporterParameter.IS_COLLAPSE_ROW_SPAN, Boolean.TRUE);

In xml,
textField isStretchWithOverflow="true" // on long data input cells
reportElement stretchType="RelativeToTallestObject"

API: http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/export/JRXlsAbstractExporterParameter.html

Wednesday, June 9, 2010

Initialization of list/map in one line

List
ArrayList places = new ArrayList(Arrays.asList("Buenos Aires", "Córdoba", "La Plata"));

ArrayList list = new ArrayList() {{
add("A");
add("B");
add("C");
}}

link

Map
Map m = new HashMap() {
{
put(".jpg", "image/jpeg");
put(".jpeg", "image/jpeg");
}
};

Sunday, April 11, 2010

Java Concurrency/Threads

Process vs Thread
Process - is a running program that runs independently from other processes. It has its own address space and cannot directly access resources of other processes. Each process can have one or more threads.

Thread - is sometimes called lightweight process. Both processes and threads provide an execution environment, but creating a new thread requires fewer resources than creating a new process. Threads share the process's resources, including memory and open files.

2 ways to define a Thread:
  1. implement Runnable interface
    - more general, can have many superclass
    - starting: (new Thread(new HelloRunnable())).start();
  2. extend Thread class (Thread class itself implements Runnable)
    - simpler but limited
    - starting: (new HelloThread()).start();

Thread methods:
  • public void run() - the only method coming from Runnable
  • public void start() - calls the run() method, can only be called once
  • public static void sleep(long millis)/(long millis, int nanos) throws InterruptedException - suspend execution for a specified period
    - time is not guaranteed
    - can be interrupted
  • public void interrupt() - indicates that thread should stop
  • public static boolean interrupted() - interrupted status is cleared
  • public boolean isInterrupted() - has no effect on interrupted status
  • public final void stop()/suspend()/resume() - deprecated

ObjectThread
notify
notifyAll
wait
sleep
yield


Source: http://java.sun.com/docs/books/tutorial/essential/index.html
http://www.vogella.de/articles/JavaConcurrency/article.html