Transposing Records into One Field
As they say in Exist, There’s always a better way.
What I Did…
performed a loop for each record in my collection to retrieve another collection using a particular Id in the record
and placing the retrieved collection to be part of the record.The Effect…
my screen populates very slowThe Solution…
from backend, transpose those collection being retrieved to be just one field so you need not to loop in your code- thanks to ken and cata
Eclipse: build-error but seems everything is set properly
Been using Eclipse for two years now.
So I have this project with a modular setup where all model class is in one folder while the webapp is in another folder.
Okay, so i did check everything. It seems everything is set properly.
My project do get build in maven, all build path and variables are set properly.
So how did I solve my error? ALL I needed to do was to PROJECT >> CLEAN.
–thanks VENZ

Debugging in Eclipse, calling shell scripts
Background:
i’m using Ubuntu, my Eclipse was installed via apt-get
i have Oracle installed under ‘oracle’ profile
i run and debug my program through EclipseIssue:
attempt to run sqlldr which is called from the webapp results to an error/sqlldr exit code 3.Solution:
run the webapp externally, don’t use Eclipse when running the webapp(since it was installed via apt-get and uses different permissions/ownership)
or have a manual installation of Eclipse and place it in your profile’s home folder if you want to use Eclipse for running your webapp.
Installing Oracle 10g in Ubuntu 7.10 (Gutsy Gibbon)
This doc isn’t yet perfect, but it would help.
1. Requirements
Your linux swap is set to 2GB
You have the Oracle 10g RC2 installer for Linux2. Setting Ubuntu
2.1 Install required libraries
Open the Synaptic Package Manager (click System –> Administration)
Click on Settings –> Repositories
Click all the checkbox(main, universe, restricted, multiverse) found in the “Ubuntu Software” Tab
Click the Close button
Click the Reload button
Close the Synaptic Package ManagerOpen a terminal
sudo apt-get install gcc make binutils libmotif3 lesstif2 rpm libaio1 zip build-essential rpm lesstif2-dev alien -y2.2 Users/groups Oracle’s creation
sudo userdel nobody
sudo groupadd oinstall
sudo groupadd dba
sudo groupadd nobody
sudo useradd -g oinstall -G dba -p passwd -d /home/oracle -m oracle -s /bin/bash
sudo useradd -g nobody nobody
sudo passwd oracle2.3 Deceive Installer that you are using RedHat
sudo ln -s /usr/bin/awk /bin/awk
sudo ln -s /usr/bin/rpm /bin/rpm
sudo ln -s /usr/bin/basename /bin/basename
sudo ln -s /etc /etc/rc.d
sudo touch /etc/redhat-release
sudo chmod 666 /etc/redhat-release
sudo echo “Red Hat Linux release 3.0 (drupal)” > /etc/redhat-releasesudo mkdir -p /u01/app/oracle
sudo mkdir -p /u02/oradatasudo mkdir /data/oracle -p
sudo mkdir /data/oracle/10g2.3.1 mode & ownership modification
sudo chown -R oracle:oinstall /u01 /u02
sudo chmod -R 775 /u01 /u02sudo chown -R oracle:oinstall /data/oracle
sudo chmod -R 775 /data/oracle2.4 Configurations
2.4.1 Configuring Kernel Parameters
Oracle instances consume memory and CPU resources on servers, and Ubuntu doesn’t come configured to allow the quantity of resources to be consumed that we’ll end up needing. To fix that, we therefore have to specify a set of new Kernerl Parameters which the operating system should use. That’s easily done by editing one file, like so:
sudo gedit /etc/sysctl.conf
You can substitute in the name of your preferred text editor instead of gedit if you like, but whatever editor you use, you now need to add these lines to the end of that file:
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000Don’t make any typing mistakes (it’s best to cut-and-paste from the above, really) and make sure you leave a blank line after the last line of the file (otherwise, the last setting tends not to get read and implemented at all). Normally, the sysctl.conf file is only read at each machine startup, so you’d have to reboot the server to implement the changes, but you can force the server to re-read the file without need for a reboot by now issuing the command:
sudo /sbin/sysctl -p
2.4.2 Security Limits
Finally, we need to set some new security limits for the system, too. Do that by issuing this command:
sudo gedit /etc/security/limits.conf
..and then appending to the end of that file these new values:
* soft nproc 2047
* hard nproc 16384
* soft nofile 1024
* hard nofile 655362.4.3 Setting Up Environment
sudo mkdir /home/oracle
sudo chown oracle:oinstall /home/oracle -R
sudo gedit /home/oracle/.bashrcORACLE_HOME=/data/oracle/10g/
ORACLE_SID=orcl
ORATAB=/etc/oratab
ORACLE_HOME_LISTNER=$ORACLE_BASE
ORACLE_BASE=$ORACLE_HOMEexport ORACLE_BASE ORACLE_SID ORATAB ORACLE_HOME ORACLE_HOME_LISTNER
PATH=${PATH}:$ORACLE_HOME/bin
Make sure to leave a blank line after the last of those lines.
3. Installing Oracle
3.1 preparing the installer
copy the oracle installer to /home/oracle
sudo chown oracle:oinstall /home/oracle/*.zip
sudo chmod 775 /home/oracle/*.zip3.2 running the installer
logout of ubuntu
login back as oracleopen a console
unzip the file
cd /home/oracle/database./runInstaller -ignoreprereq
3.3 Editing Oratab
You should log out as the oracle user, and log yourself back on as yourself (that is, the user you created during the Ubuntu install). That’s a full logout and logon, not merely the use of the su command to become another account, by the way.
Once you’ve done that, you should edit the contents of the /etc/oratab file in the text editor of your choice. You’ll have to have root privileges to edit a file in the /etc directory, of course, and that means it will be necessary to issue a command such as:
sudo gedit /etc/oratab
You’ll find at the moment that the file contains this one line (apart from all the commented-out ones, that is):
orcl:/oracle/10g:N
4. Starting the listener and the database
su - oracle
Password: enter your sudo password
[oracle] $ lsnrctl startLSNRCTL for Linux: Version 10.2.0.1.0 - Production on 19-JAN-2006 13:55:02
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Starting /u01/app/oracle/oracle/product/10.2.0/db_1//bin/tnslsnr: please wait…
TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /u01/app/oracle/oracle/product/10.2.0/db_1/network/admi n/listener.ora
Log messages written to /u01/app/oracle/oracle/product/10.2.0/db_1/network/log/l istener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(P ORT=1521)))Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
————————
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 19-JAN-2006 13:55:04
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/oracle/product/10.2.0/db_1/network/adm in/listener.ora
Listener Log File /u01/app/oracle/oracle/product/10.2.0/db_1/network/log /listener.log
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
Services Summary…
Service “PLSExtProc” has 1 instance(s).
Instance “PLSExtProc”, status UNKNOWN, has 1 handler(s) for this service…
The command completed successfully[oracle] $ sqlplus connect as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jan 19 13:55:21 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Enter password: enter the DB password
Connected to an idle instance.SQL> startup
ORACLE instance started.Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 92276304 bytes
Database Buffers 188743680 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.
SQL> exit—-
Credits:
Much of the content of this document came from dizwell’s site and few of the steps were updated for the Ubuntu 7.10 compatibility. And thanks to those other sites that makes our life easier. (http://www.zjant.com/index.php/date/2007/04/ , http://www.supinfo-projects.com/en/2006/oracle%5Fon%5Fubuntu/3/)
Set Encoding in Eclipse
Problem was, when i check out our project, all ‘»’ characters were being replaced with ‘�’.
I didn’t knew this was happening until Ken told me.Ken figured out that it was an encoding issue.
I was using Eclipse 3.2 and Ken was using 3.3.
So when i went to my Eclipse Edit menu –> Set Encoding.
My eclipse default was UTF-8.So I went to see what was Ken’s and it was ‘ISO-8859-1′ encoding
Oh well, need to restore those characters…
Dual Boot Issues: Reinstalled Windows
My windows did get a virus. Did try to remove it, a system restore, but none worked. Last resort… REINSTALL
After re-installation I needed my GRUB(the that lets you choose your operating system when booting) back.
1. Boot Ubuntu Live CD
2. open a terminal, if your in GUI mode
3. run#sudo grub
4. find your grub in preparation for the root command executefind /boot/grub/stage1
5. executeroot (<device,partition>), if step 4 returns (hd0, 5) you doroot (hd0, 5)
6. executesetup (<device>), following step 5 it would besetup (hd0)
7. execute quit, then reboot.I did find some help through google. But Venz Hua has better document and I’m placing it here.

Eclipse/maven-jetty plugin: Couldn’t restart my listener
related to my blog: Eclipse: running your project via mvn jetty:run and debugging it
So there i was using my eclipse, running the external tool for debugging.
I recompiled my source code and needed to re-run the debugger.
But when I restarted the listener(part of external tool) it wouldn’t start.
My guess was on the port. So I asked nap…checked it with
lsof -i :4000it returned the process running using it.
i guess eclipse was unable to kill that process, when i restarted my listener.
after knowing the PID i then killed it and started my external tool.thanks nap.
Finding Memory Leaks
As Jon Bentley said, “Make it work before you make it work fast.”
I got this line in the JMP user guide. By the way, JMP stands for Java Memory Profiler.
Oh yeah, we’re now looking for possible memory leaks.I also found out that JMP can be installed in Gutsy Gibbon using apt-get.
After installing, I tried running it with MAVEN.
added the -Xrunjmp:<your options> in the MAVEN_OPTS, it worked.There are three things you can profile with this tool:
- Profiling objects to find memory leaks and find causes for heavy memory usage
- Profiling methods to find out where your program spends time
- Inspect threads to find out why your program is blocked
Java to DWR - decrease the file size of your javascript
It was until yesterday i realized I was doing something wrong with regards to JAVA-DWR interfacing as pointed out by Cata.
Backgrounder: in dwr.xml we define the classes(services) we use, which generates javasript which we will call facades and these can be imported in our javascript files.
My practice: In my js file, i simply import those facades i need, even though i only use one method in one of the services.
Issue: when importing a facade to your js files it will include everything even those methods you don’t use, thus increasing the size of your js file.Proposed solution: create another class composed of only those methods used in your front-end. So that it will lessen the file size of your javascript generated by the DWR.
Eclipse: running your project via mvn jetty:run and debugging it
As part of my preparation for my new assignment, since I’ve been using Eclipse, I do really need this set to my IDE…
Step 1
Go to the Run/External Tools/External Tools …” menu item on the “Run” menu bar. Select “Program” and click the “New” button. On the “Main” tab, fill in the “Location:” as the full path to your “mvn” executable. For the “Working Directory:” select the workspace that matches your webapp. For “Arguments:” add jetty6:run.
Move to the “Environment” tab and click the “New” button to add a new variable named MAVEN_OPTS with the value:
-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=y
If you supply suspend=n instead of suspend=y you can start immediately without running the debugger and launch the debugger at anytime you really wish to debug.
Step 2
Then, pull up the “Run/Debug/Debug …” menu item and select “Remote Java Application” and click the “New” button. Fill in the dialog by selecting your webapp project for the “Project:” field, and ensure you are using the same port number as you specified in the address= property above.
Now all you need to do is to Run/External Tools and select the name of the maven tool setup you created in step 1 to start the plugin and then Run/Debug and select the name of the debug setup you setup in step2.
Some Notes:
If your project has a modular structure, you need to set the “Working Directory” on the parent folder and use jetty:run-exploded for the argument field.
Generally, your guide in configuring Step 1 would be how you run your project via command console.
Make sure that you have ran your project in command console just to verify that “mvn jetty:run” or “mvn jetty:run-exploded” is working.
Credits: http://simile.mit.edu/wiki/How_to_debug_mvn_jetty:run_in_Eclipse

