Monday, October 08, 2007

My Project into Sakai


I am using Sakai Demo, change sakai-demo to tomcat directly. In deploy, just as before, put the .war file in to webapps under tomcat.
Follow the instruction in the doc, download sakai.bibliography example, put the weg/ file to maven/repository/, be sure to add a dependency in project.xml of the sakai-tool-filter-1.0.jar

My problem is:
My welcome page is a static page, rather than a redirect page. When it first shows the welcome page, it can't link to those jsp page under jsp/. Then after an hour test, I start to redirect this page to a page under jsp/. Now it is working well. After redirect to a jsp page, you still can link back to that static page, the interesting thing is, now this static page starts to work.

Refer to the sakai.bibliography example, I add a header to my page, and some format, which makes my pages looked very nice. You can have the whole page in the screen, instead scrolling the bar. The thing to control these format is under include.jsp file and a sakai.jsp related.

I should say Sakai is lack of documentation as what we usually do in our program development.

Wednesday, October 03, 2007

REFINE of My project, Touch Sakai

A pure Sakai Demo without my project
Running on my computer




The syntax has different views between IE and FireFox:

The view in FireFox


The view in IE




HSQLDB: start up:
java -classpath hsqldb-1.7.3.0.jar org.hsqldb.Server

Wednesday, September 26, 2007

Data Persisternt

After install MySQL:

sudo /etc/init.d/mysql stop

mysqladmin -u root password myPassword

mysql -u root -p

sudo /etc/init.d/mysql start

Current ID and PS
ID: root
PS: root

Unit Test, Add this to project.properties
maven.junit.fork=true

Reason:
http://forum.springframework.org/archive/index.php/t-23057.html

Finally, my Hibernate is working,

NB>the object ID value cant be set by programmer, it will specify by the application, which is hibernate or database.
Many legacy SQL data models use natural primary keys. A natural key is a key with
business meaning: an attribute or combination of attributes that is unique by virtue
of its business semantics. Examples of natural keys might be a U.S. Social Security
Number or Australian Tax File Number. Distinguishing natural keys is simple: If a
candidate key attribute has meaning outside the database context, it’s a natural
key, whether or not it’s automatically generated.
Experience has shown that natural keys almost always cause problems in the
long run. A good primary key must be unique, constant, and required (never null
or unknown). Very few entity attributes satisfy these requirements, and some that
do aren’t efficiently indexable by SQL databases. In addition, you should make
absolutely certain that a candidate key definition could never change throughout
he lifetime of the database before promoting it to a primary key. Changing the
definition of a primary key and all foreign keys that refer to it is a frustrating task.
For these reasons, we strongly recommend that new applications use synthetic
identifiers (also called surrogate keys). Surrogate keys have no business meaning—
they are unique values generated by the database or application. There are a num-
ber of well-known approaches to surrogate key generation.

from Hibernate in Action Page90 -Page91
Also, the ID should be int, short or long. Cant be String!!!!!!
Again, don't give value to ID.

I have tried some unit tests. I planned to do this by the end, but the code is too many to test, and debug, so the only wayto narrow your test and find the problem is pick up Unit Test. The Test-Record really helps.

Monday, September 17, 2007

Maven and Tomcat

Deploy to Tomcat using maven.xml file:

Two sources about deploy to Tomcat using Maven 1.0.2, basically, it follows the Ant structure: add these code to maven.xml
http://raibledesigns.com/rd/entry/running_cargo_from_maven
http://raibledesigns.com/rd/entry/maven_console_and_setting_properties


To deploy a web application to Tomcat, just copy the war file to /tomcat/webapps/
Once Tomcat starts up, it will automatically scan this folder, and generates a sub directory under this folder according to the .war file. You can use
tail -f /tomcat/logs/catalina.out
to check Tomcat's reaction to your deploy.
One thing is you don't have to keep on shutdown and start tomcat after your deploy. Tomcat keeps on scan webapps folder after it starts.

The other way is using Maven-Tomcat plugin, which is provided by 3rd party--codeczar.

About Java Bean:
property(in XML file) -------- setProperty(), getProperty() (Methods in Java Bean)
attributes name seems unrelated to property.

To install SVN in Eclipse:

Name: Subclipse 1.2.x (Eclipse 3.2+)
URL: http://subclipse.tigris.org/update_1.2.x

Name: Subclipse 1.0.x (Eclipse 3.0/3.1)
URL: http://subclipse.tigris.org/update_1.0.x

Thursday, September 13, 2007

Mevenide working fina!!!!!!!!!!!!!!!!y in Eclipse

1. Set my Mevenide in Preference:
Java Home point to /jre:


2. In Eclipse: Add one line below: based on your JDK version
(Window | Preferences | Java | Installed JREs | | Edit):

Default VM Arguments:

JDK 1.5 or 1.6

-Djavax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl

JDK 1.4 -

-Djavax.xml.parsers.SAXParserFactory=org.apache.crimson.jaxp.SAXParserFactoryImpl


Refer to: http://www.xmlblaster.org/FAQ.html#xml-parser


3. Copy /MAVEN_HOME/bin to /home/ji (my home address)

in order to let Mevenide find forehead.conf


A discussion here:

http://jira.codehaus.org/browse/MEVENIDE-231

After several days research, finally I got Mevenide run in my Eclipse, and understand that Mevenide 0.4.0 is a bugful plugin. Although I can run Maven in Eclipse, I wouldn't do this now. Also Mevenide 0.4.0 seems the lastest version of Mevenide supported Eclipse. It shifts to other IDEs. PS. this bug seem commonly exists under Linux platform, Maven 1.0.2 and Eclipse 3.1+

Wednesday, September 12, 2007

Ubuntu with BEA Workshop Studio 10.1

An introduction how to install BEA Workshop 10.1 (Unnecessary to follow it under Ubuntu 7)

http://workshopstudio.bea.com/install/install.html#nxtrialactivation


Address to download BEA Workshop Studio 10.1

http://workshopstudio.bea.com/downloadNitroX.do

The free license BEA Workshop™ for WebLogic 10.1 only supports BEA WebLogic Server, which is the main different from Workshop Studio ()

"BEA Workshop Studio has all the same
features as BEA Workshop for WebLogic, but adds
the capability to develop, debug, deploy to BEA and
non-BEA server targets like Apache Tomcat, IBM
Websphere, Caucho Resin, Mortbay Jetty and
Redhat JBoss (in addition to BEA WebLogic Server)."


After you download the Workshop.bin, just double click the icon. It just works without any configuration.
Register with email, and wait 5 minutes to get the reply, then try the trial version for 30 days

Simply speaking, BEA Workshop is Eclipse with many plugins, but I still have to install SVN and Mevenide, again, Mevenide doesn't work, but with another error this time












I download my project uploaded by Eclipse 3.3, and it works well in Eclipse 3.2 which supplied by Workshop.

Tuesday, September 11, 2007

Subclipse stays on one Workspace

I changes my workspace in Eclipse, then find out the SVN doesn't work. I go back to my previous workspace, copy /.metadata to current workspace, then it is working now.

cp -r .metadata/ /home/ji/projects/

or you can try remove the .metadata under your current workspace

rm -r .metadata/

Saturday, September 08, 2007

Add plugin for Maven in Ubuntu

If you put your Maven in under /opt or any other folder needed root to modify, you will need to be root to add a plugin for Maven in Ubuntu

####To start a root terminal:
gksudo gnome-terminal


export MAVEN_HOME=/opt/maven
export MAVEN_REPO=/home/ji/.maven/repository
export MAVEN_OPTS='-Xms256m -Xmx512m -XX:PermSize=64m -XX:MaxPermSize=128m'
export PATH=$PATH:$MAVEN_HOME/bin

maven plugin:download -DgroupId=maven-plugins -DartifactId=maven-axis-plugin -Dversion=0.7


####This creates a new Maven repository under /root, I don't know how to change it back to my normal user repository.

This is the server I use to download plugin:
http://mirrors.ibiblio.org/pub/mirrors/maven/maven-plugins/plugins/

Don't try to put a plugin straight to Maven plugin folder, it crashes Maven.

My Eclipse still doesn't work in using Maven plugin~~~!!! Is it possible my Maven too old for Eclipse 3.3.
Why don't we use higher version of Sakai, so that it can support Maven 2?
The answer to this is, till now the lastest version of Sakai only supports Maven 1.0.2 well.

Friday, September 07, 2007

Maven with Eclipse 3.3


Maven can not be used in Eclipse 3.3

Always Nullpointer Exception

Thursday, September 06, 2007

Using Maven

Setup SVN in Eclipse

Setup Maven 1.0.2
Add these lines below in a file called project.properties, so that your can run the genapp under a folder with this file in.

maven.xdoc.date = left
## maven.xdoc.version = ${pom.currentVersion}
custom.zipsource = true
maven.repo.remote=http://mirrors.ibiblio.org/pub/mirrors/maven/,http://source.sakaiproject.org/maven/

Refer to Massol, genapp is a plug-in to Maven, to check whether you have this plug-in, run
maven -g grep genapp
##Credit to San

Now I start to worry if the network doesn't work, what things can I do with Maven.

Ubuntu
To do copy and paste from window to window as root permission, run this:
sudo nautilus
##Credit to Hank

Maven POM description
http://maven.apache.org/maven-1.x/reference/maven-model/3.0.2/maven.html

Wednesday, August 29, 2007

Use Case

Background Introduction
Second hand textbook has potential market in every university. Although there are many big C2C online selling companies out there, like eBay, some students still prefer to buy locally, which saves the delivery expense and is easier to make a payment.

Description
A local bookstore can deploy a used book sell online website, which utilizes information communication technology and has the convenience provided by local trading. Buyer can check detail of each book on the website before he/she go to the store, and seller can leave a book in the bookstore with predefined price. Each transaction is through the bookstore. Buyer and seller do not have to make an appointment to meet any more.

Scope
This component is a part of an entire online selling system. It builds the entry and update function for bookstore staff, browsing function for buyer to find a correct book.
Online placing sell, order and updating function from buyer or seller are out of the boundary. Also, there is no search function for browser to search a particular book for sell.

Actors & Goals
Bookstore (Direct Actor): Keeps buyer and seller’s membership. Propagate itself, or generate some profit from transaction.
Buyer (Direct Actor): Easy to find a book and get the up-to-date information. Does transaction with less time constrain.
Seller: Get a platform with intense demand. No time constrain as no appointment.

Use Case
1. A seller hand a textbook to the bookstore located near university, and give a price to the book.
2. Bookstore staff takes picture and makes description of that book, classify it to a course. Then upload this sell onto the website. (MVC and write database)
3. Buyer browses the website, follow the course classification then check all those available books under one course, record a book he/she wants to buy. (MVC with database read)
4. Buyer goes to bookstore, ask for that particular book and pay. (Delete the record in database)
5. Seller is notified to collect money from bookstore.

Extend
 In book’s description, staff uses a multiple choice to mark a book’s current condition. (unbias)
 Bookstore staff can use barcode to identify a particular book.
 Seller can leave and update a description and price directly on the store website.
 Buyer can place an order directly online.

Potential Project Components to Integrate
(This part is not in my individual work, but can be handled by other team member)
 Bookstore can notify seller by email or SMS after book sold.
 A search engine should be built
 A auction function can be used.
 Integrate with library book DB, student account DB and study unit portal (sakai).

Actually the best actor of the bookstore is the library, which keeps a book database, customer (student) database. This also enhances the payment and trust. And the most important thing is that, unlike most second hand bookstores work on large margin or commission fee between buying and selling price, this service can be free to students.

Sunday, August 19, 2007

A Book related to our lab work - Spring in Action

CRAIG WALLS, RYAN BREIDENBACH, 2005, Spring in Action

It discusses what we are trying to do in lab in the following chapter. I find it useful when you get confused in doing the lab work.

Chapter 8 Building the web layer - Getting started with Spring MVC
This chapter covers
■ Mapping requests to Spring controllers
■ Transparently binding form parameters
■ Validating form submissions
■ Adding functionality with interceptors

Saturday, August 18, 2007

GCC

To setup the C environment in Ubuntu, so that you can compile C file
sudo apt-get install build-essential

Wednesday, August 15, 2007

Junit test failed in terminal

Use my Eclipse to run junit:
No problem:

Buildfile: /home/ji/projects/springapp/build.xml

build:
[javac] Compiling 1 source file to /home/ji/projects/springapp/war/WEB-INF/classes
clearData:
[echo] CLEAR DATA USING: org.hsqldb.jdbcDriver jdbc:hsqldb:db/test
[sql] Executing commands
[sql] 1 of 1 SQL statements executed successfully
loadData:
[echo] LOAD DATA USING: org.hsqldb.jdbcDriver jdbc:hsqldb:db/test
[sql] Executing commands
[sql] 5 of 5 SQL statements executed successfully
junit:
[junit] Running tests.TestProductManager
[junit] Testsuite: tests.TestProductManager
[junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 0.035 sec
[junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 0.035 sec
[junit] Running tests.TestProductManagerDaoJdbc
[junit] Testsuite: tests.TestProductManagerDaoJdbc
[junit] 2007-08-15 00:55:31,921 INFO [org.springframework.jdbc.datasource.DriverManagerDataSource] -
[junit] 2007-08-15 00:55:31,922 INFO [db.ProductManagerDaoJdbc] -
[junit] 2007-08-15 00:55:32,387 INFO [db.ProductManagerDaoJdbc] -
[junit] 2007-08-15 00:55:32,403 INFO [db.ProductManagerDaoJdbc] -
[junit] 2007-08-15 00:55:32,403 INFO [db.ProductManagerDaoJdbc] -
[junit] 2007-08-15 00:55:32,406 INFO [org.springframework.jdbc.datasource.DriverManagerDataSource] -
[junit] 2007-08-15 00:55:32,407 INFO [db.ProductManagerDaoJdbc] -
[junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 0.771 sec
[junit] Tests run: 2, Failures: 0, Errors: 0, Time elapsed: 0.771 sec
[junit] ------------- Standard Output ---------------
[junit] 2007-08-15 00:55:31,921 INFO [org.springframework.jdbc.datasource.DriverManagerDataSource] -
[junit] 2007-08-15 00:55:31,922 INFO [db.ProductManagerDaoJdbc] -
[junit] 2007-08-15 00:55:32,387 INFO [db.ProductManagerDaoJdbc] -
[junit] 2007-08-15 00:55:32,403 INFO [db.ProductManagerDaoJdbc] -
[junit] 2007-08-15 00:55:32,403 INFO [db.ProductManagerDaoJdbc] -
[junit] 2007-08-15 00:55:32,406 INFO [org.springframework.jdbc.datasource.DriverManagerDataSource] -
[junit] 2007-08-15 00:55:32,407 INFO [db.ProductManagerDaoJdbc] -
[junit] ------------- ---------------- ---------------
[junit] Running tests.TestSpringappController
[junit] Testsuite: tests.TestSpringappController
[junit] 2007-08-15 00:55:32,535 INFO [org.springframework.core.CollectionFactory] -
[junit] 2007-08-15 00:55:32,577 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] -
[junit] 2007-08-15 00:55:32,691 INFO [org.springframework.context.support.FileSystemXmlApplicationContext] -
[junit] 2007-08-15 00:55:32,709 INFO [org.springframework.context.support.FileSystemXmlApplicationContext] - <6 hashcode="6147782]">
[junit] 2007-08-15 00:55:32,719 INFO [org.springframework.context.support.FileSystemXmlApplicationContext] -
[junit] 2007-08-15 00:55:32,722 INFO [org.springframework.context.support.FileSystemXmlApplicationContext] -
[junit] 2007-08-15 00:55:32,725 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] -
[junit] 2007-08-15 00:55:32,802 INFO [web.SpringappController] -
[junit] 2007-08-15 00:55:32,803 INFO [web.SpringappController] -
[junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.376 sec
[junit] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 0.376 sec
[junit] ------------- Standard Output ---------------
[junit] 2007-08-15 00:55:32,535 INFO [org.springframework.core.CollectionFactory] -
[junit] 2007-08-15 00:55:32,577 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] -
[junit] 2007-08-15 00:55:32,691 INFO [org.springframework.context.support.FileSystemXmlApplicationContext] -
[junit] 2007-08-15 00:55:32,709 INFO [org.springframework.context.support.FileSystemXmlApplicationContext] - <6 hashcode="6147782]">
[junit] 2007-08-15 00:55:32,719 INFO [org.springframework.context.support.FileSystemXmlApplicationContext] -
[junit] 2007-08-15 00:55:32,722 INFO [org.springframework.context.support.FileSystemXmlApplicationContext] -
[junit] 2007-08-15 00:55:32,725 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] -
[junit] 2007-08-15 00:55:32,802 INFO [web.SpringappController] -
[junit] 2007-08-15 00:55:32,803 INFO [web.SpringappController] -
[junit] ------------- ---------------- ---------------
BUILD SUCCESSFUL
Total time: 3 seconds




When I use the terminal command:
ant junit
Error comes out:


Buildfile: build.xml

build:
[javac] Compiling 1 source file to /home/ji/projects/springapp/war/WEB-INF/classes

clearData:
[echo] CLEAR DATA USING: org.hsqldb.jdbcDriver jdbc:hsqldb:db/test
[sql] Executing commands
[sql] 1 of 1 SQL statements executed successfully

loadData:
[echo] LOAD DATA USING: org.hsqldb.jdbcDriver jdbc:hsqldb:db/test
[sql] Executing commands
[sql] 5 of 5 SQL statements executed successfully

junit:

BUILD FAILED
/home/ji/projects/springapp/build.xml:175: java.lang.NoClassDefFoundError: org/apache/tools/ant/types/ResourceCollection



I think the reasons can be they use different junit.jar files, or my Ant did not configure well. Anyway, the springapp website runs without any problem. I install
Apache Ant version 1.6.5 compiled on July 5 2006

Saturday, August 11, 2007

Stop working

http://weg.ee.usyd.edu.au/courses/ebus5003/
This afternoon, I try the course website, but it doesn't work. I can't do the lab without this~~~~!!!!!

Another problem is that I have copied Spring file from lab computer. When I extract it in my desktop at home, it comes out an error. I really need the junit.jar from Spring to continue.

Maybe Saturday is not the right day to work.

Friday, August 03, 2007

Here is a brand new chapter

I install Ubuntu 7.04 on my desktop at home to do this lab. Since I used up all the quota in accessing internet, I downloaded all the software in lab and planned to install them into my Ubuntu just like what we usually do in MS Windows that straight forward. But I am wrong.

Many software in Ubuntu is self-managed by the system. It can automatically download online and install it on a click. But if you'd got a pack on hand to install, it seems not that straight forward.
First, in Ubuntu, you can't use RPM pack used normally in Fedora or some other popular Linux systems. In installation, you just uncompress the pack you downloaded online, and put it somewhere in the system. The hard thing is to specify the environment value. Here is what I added to
~/.bashrc

export JAVA_HOME=/usr/lib/j2sdk1.5-sun
export CLASSPATH=/usr/lib/j2sdk1.5-sun/lib
export PATH=$PATH:/usr/lib/j2sdk1.5-sun/bin
export CATALINA_HOME=/opt/tomcat

There are some reminders when using the lab computer

bash
source /eelabs/ebus5003/profile

In my account, I always have to type these in my terminal to start and work. No idea!!!!

fs listquota
check your disk space

proxy:
http://www.eelab.usyd.edu.au/proxy.pac
In Firefox


build.properties and build.xml should be under the same folder




In step10, make sure to specify where you want to put the log file. In my case, it is like this:

log4j.appender.logfile.File=/opt/tomcat/logs/springapp.log

If you make it wrong, you can't find the file, and nothing indicates it was going wrong!!!!!!!!


Until now, luckily, part1 is finished. I encounter Linux, Ant and Spring. I believe they are good tools once you can set them up.

Tuesday, July 10, 2007

4 yrs old laptop System












CPU-Z 1.40.5 report file




Processor(s)





















Number of processors1
Number of cores1 per processor
Number of threads1 (max 1) per processor
NameIntel Pentium M
Code NameBanias
SpecificationIntel(R) Pentium(R) M processor 1500MHz
PackageSocket 479 mPGA
Family/Model/Stepping6.9.5
Extended Family/Model6.9
Brand ID22
Core SteppingB1
Technology0.13 um
Core Speed595.4 MHz
Multiplier x Bus speed6.0 x 99.2 MHz
Rated Bus speed396.9 MHz
Stock frequency1500 MHz
Instruction setsMMX, SSE, SSE2
L1 Data cache32 KBytes, 8-way set associative, 64-byte line size
L1 Instruction cache32 KBytes, 8-way set associative, 64-byte line size
L2 cache1024 KBytes, 8-way set associative, 64-byte line size


Chipset & Memory














NorthbridgeIntel i855GM rev. A3
SouthbridgeIntel 82801DB (ICH4-M) rev. 03
Graphic InterfaceAGP
AGP Revision2.0
AGP Transfer Rate4x
AGP Side Band Addressingsupported, enabled
Memory TypeDDR
Memory Size512 MBytes
Memory Frequency132.3 MHz (3:4)
CAS# Latency (tCL)2.5 clocks
RAS# to CAS# (tRDC)3 clocks
RAS# Precharge (tRP)3 clocks
Cycle Time (tRAS)6 clocks


System







System ManufacturerSony Corporation
System NamePCG-Z1RCP(CN)
System S/N28144570-7102300
BIOS VendorPhoenix Technologies LTD
BIOS VersionR0061G0
BIOS Date05/02/2003


Memory SPD



Software



Windows VersionMicrosoft Windows XP Professional Service Pack 2 (Build 2600)
DirectX Version9.0c

New System Profile

















CPU-Z 1.40.5 report file




Processor(s)




















Number of processors1
Number of cores1 per processor
Number of threads1 (max 1) per processor
NameIntel Celeron 347
Code NameCedar Mill
SpecificationIntel(R) Celeron(R) D CPU 3.06GHz
PackageSocket 775 LGA
Family/Model/SteppingF.6.4
Extended Family/ModelF.6
Core SteppingC1
Technology65 nm
Core Speed3077.7 MHz
Multiplier x Bus speed23.0 x 133.8 MHz
Rated Bus speed535.2 MHz
Stock frequency3066 MHz
Instruction setsMMX, SSE, SSE2, SSE3, EM64T
L1 Data cache16 KBytes, 8-way set associative, 64-byte line size
Trace cache12 Kuops, 8-way set associative
L2 cache512 KBytes, 8-way set associative, 64-byte line size


Chipset & Memory














NorthbridgeIntel i945G/GZ rev. A2
SouthbridgeIntel 82801GB (ICH7) rev. 01
Graphic InterfacePCI-Express
PCI-E Link Widthx16
PCI-E Max Link Widthx16
Memory TypeDDR2
Memory Size1024 MBytes
Memory Frequency267.6 MHz (1:2)
CAS# Latency (tCL)4.0 clocks
RAS# to CAS# (tRDC)4 clocks
RAS# Precharge (tRP)4 clocks
Cycle Time (tRAS)12 clocks
Bank Cycle Time (tRC)16 clocks


System









System Manufacturerstem manufacturer
System NameSystem Product Name
System S/NSystem Serial Number
Mainboard VendorASUSTeK Computer INC.
Mainboard ModelP5LD2-SE
BIOS VendorAmerican Megatrends Inc.
BIOS Version1104
BIOS Date06/14/2007


Memory SPD



Module 1DDR2, PC2-5300 (333 MHz), 512 MBytes, Hyundai Electronics
Module 2DDR2, PC2-5300 (333 MHz), 512 MBytes, Hyundai Electronics
Software
Windows VersionMicrosoft Windows XP Professional Service Pack 2 (Build 2600)
DirectX Version9.0c

Thursday, August 17, 2006

JAVA

How to change the compiler's language in runtime environment?

http://developers.sun.com/dev/gadc/faq/java/files/cjkv.html#1.1

Here is the solution, simply change the Regional Setting control panel. It works

Tuesday, June 13, 2006

Organizational Learning

A useful link, about double loop learning