Friday, September 12, 2014

how to .xz files

  • J: use xz to uncompress archive -- notice: J is uppercase

tar xvfJ filename.tar.xz  

xz --decompress filename.gz

Thursday, September 11, 2014

how to install tomcat

PLATFORM
windows 7 family edition 64-bit
jdk 1.7.0
tomcat 7.0.26 (64-bit edition)


go to apache tomcat website and download tomcat 7.0

http://tomcat.apache.org/

download 64-bit Windows zip file as we try to install tomcat 7.0.26 on windows 7 64-bit system

unzip apache-tomcat-7.0.26-windows-x64.zip

this is how the folder looks like after unzipping

C:\Downloads\apache-tomcat-7.0.26-windows-x64\apache-tomcat-7.0.26\bin

If you click startup.bat file to start tomcat IT WILL NOT RUN

C:\Downloads\apache-tomcat-7.0.26-windows-x64\apache-tomcat-7.0.26\bin\startup.bat

To get tomcat running,first run command prompt

Then with cd command go to directory

cd C:\Downloads\apache-tomcat-7.0.26-windows-x64\apache-tomcat-7.0.26\bin

Run startup.bat in the command prompt

C:\Downloads\apache-tomcat-7.0.26-windows-x64\apache-tomcat-7.0.26\bin>startup.bat

Then type on firefox

http://localhost:8080


Server Status" and "Manager App" interfaces require manager-gui role and "Host Manager" requires admin-gui role.

add these lines and restart tomcat if it works.

C:\Downloads\apache-tomcat\conf \tomcat-users.xml


<role rolename="manager-gui,admin-gui"/>
<user username="tomcat" password="tomcat" roles="manager-gui,admin-gui"/>


configure tomcat port.
C:\Downloads\apache-tomcat\conf\server.xml

 <Connector port="5555" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

This file sets java_home manually and runs tomcat on the folder mentioned.
contents of "tomcat start.cmd" file.

@echo off
SET JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_31
SET CATALINA_HOME=C:\Downloads\apache-tomcat
C:\Downloads\apache-tomcat\bin\startup.bat

run "tomcat start.cmd" on folder
C:\Downloads\ciroot

test tomcat whether it runs
tomcat runs on http://localhost:8080/

how to spring-framework-3.1.0. and eclipse indigo


  • PLATFORM

*windows 7 family edition 64-bit

*download Java Platform, Standard Edition
Java SE 7u3
jdk-7u3-windows-i586.exe
www.oracle.com

*download Java EE 6 Development Kit Bundles without JDK
Java EE 6 SDK Update 4
java_ee_sdk-6u4-windows-ml.exe
www.oracle.com

*download tomcat 7.0.26 (32-bit edition)
apache-tomcat-7.0.26-windows-x86.zip
http://tomcat.apache.org

*download Eclipse IDE for Java EE Developers
eclipse indigo package 32 bit
eclipse-jee-indigo-SR2-win32.zip
http://www.eclipse.org

*download Spring Framework 3.1.0.RELEASE
spring-framework-3.1.0.RELEASE-with-docs.zip
http://www.springsource.org/download


Because of the problems linked to whether 64-bit or 32-bit software should be used,even though I use 64-bit I prefer 32-bit software so that I don't risk having compatibility issues

@there are two types of containers in spring: applicationcontext and beanfactory.
applicationcontext is used in this example

@ create a new project eg "tester"
Eclipse-New-Java Project

@righ click on file "tester"
java build path-libraries-add external jars

@add all files in "spring-framework-3.1.0.RELEASE\dist"
@add file "spring-framework-3.1.0.RELEASE\projects\spring-build\lib\ivy\commons-logging.jar"

@create a new package
com.edu4java.spring.tutorial3

@create new java class Hello.java

@create Main.java class that uses Hello.java

@create context.xml  by using this pdf file "spring-framework-3.1.0.RELEASE\docs\spring-framework-reference\pdf\spring-framework-reference.pdf"

References:
http://www.youtube.com/watch?v=ZwMwfGNrRtE&feature=related

how to spring aop with eclipse indigo

PLATFORM

*windows 7 family edition 64-bit
ps:Because of the problems linked to whether 64-bit or 32-bit software should be used,even though I use 64-bit I prefer 32-bit software so that I don't risk having compatibility issues


*download Java Platform, Standard Edition
Java SE 7u3
jdk-7u3-windows-i586.exe
www.oracle.com

*download Java EE 6 Development Kit Bundles without JDK
Java EE 6 SDK Update 4
java_ee_sdk-6u4-windows-ml.exe
www.oracle.com

*download Eclipse IDE for Java EE Developers
eclipse indigo package 32 bit
eclipse-jee-indigo-SR2-win32.zip
http://www.eclipse.org

*download Spring Framework 3.1.0.RELEASE
spring-framework-3.1.0.RELEASE-with-docs.zip
http://www.springsource.org/download

*download aspectj-1.6.12.jar
http://www.eclipse.org/aspectj/downloads.php

What is AspectJ?
AspectJ(tm) is a simple and practical extension to the Java(tm) programming language that adds to Java aspect-oriented programming (AOP) capabilities. AOP allows developers to reap the benefits of modularity for concerns that cut across the natural units of modularity. In object-oriented programs like Java, the natural unit of modularity is the class. In AspectJ, aspects modularize concerns that affect more than one class.


*download aopalliance.zip

The AOP Alliance project is a joint open-source project between several software engineering people who are interested in AOP and Java
AOP Alliance: http://aopalliance.sourceforge.net/


*download cglib-2.2.2.jar
cglib is a powerful, high performance and quality Code Generation Library, It is used to extend JAVA classes and implements interfaces at runtime.
CGILIB: http://cglib.sourceforge.net/


*download asm-3.3.1.jar (asm-4.0-bin.zip caused compatability problems and had to remove)

ASM is an all purpose Java bytecode manipulation and analysis framework. It can be used to modify existing classes or dynamically generate classes, directly in binary form
http://asm.ow2.org/

how to 32 bit vs 64 bit

  •  how to 32 bit vs 64 bit



x86_64 ==> 64-bit kernel
i686   ==> 32-bit kernel

on linux commands to find

cat /proc/cpuinfo

grep flags /proc/cpuinfo

tm(transparent mode) or rm(real mode) or lm(long mode)

rm ==> 16-bit processor
tm ==> 32-bit processor
lm ==> 64-bit processor

you can have a 64-bit CPU with a 32-bit kernel installed


getconf LONG_BIT
    32, if OS is 32 bit
    64, if OS is 64 bit

 grep "CONFIG_64" /lib/modules/*/build/.config




#include <stdio.h>

int main(void)
{
    printf("%d\n", __WORDSIZE);
    return 0;
}



$ ls -l /lib*/ld-linux*.so.2
/lib/ld-linux.so.2
/lib64/ld-linux-x86-64.so.2


lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit

http://stackoverflow.com/questions/246007/how-to-determine-whether-a-given-linux-is-32-bit-or-64-bit  

how to java enterprise application

there are 3 ways of implementing enterprise applications with java. This list can be updated or corrected.

1-licensed j2ee servers -weblogic,websphere,oracle application server

2-open source j2ee containers - jboss,glassfish,tomcat,openejb,activemq

3-spring framework + opensource servlet/jsp engine -tomcat,jetty,resin