Thursday, January 29, 2009

JSF Session Parameters and Redirect

Putting values in the Request map is problematic issue.
JSF navigation has 2 modes:
1) Forward
2) Redirect

The forward solution is not good. Mostly because:
The Url is not updated on the browser, causing compability problems with 3rd service companies. No bookmarking available. No possibity to send URL to some by email and all sort of side effect problems.

The redirect solution is also problematic, since redirecting to a new page is a new request. This causes the data that is put in the request map to disappear.

Sun forum

Tuesday, January 20, 2009

JPQL case insensitive search

According to the JPQL spec the pattern value following the keyword LIKE must be a string literal or a string-valued input parameter. So I assume the expression lower(:username) is the problem the OpenJPA query compiler is complaining about. As a workaround you could try "lowering" the value for the username input parameter yourself before passing it to the setParameter call. Then the JPQL would look like:

SELECT u FROM User u WHERE lower(u.username) LIKE :username

Ref:

MarkMail

Sunday, January 4, 2009

Ubuntu Oracle XE setup

1-There is an apt-get repository up on oss.oracle.com for XE. Just add:

deb http://oss.oracle.com/debian unstable main non-free
to /etc/apt/sources.list and then:
# wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle 
-O- | sudo apt-key add -
# apt-get update
# apt-get install oracle-xe

'libaio' and 'bc' are in the repository, so dependencies will pull them in if the user doesn't have them. (Note: You will need to 'sudo' or have 'root' privileges to install XE.

****If you don't know the root password then you can do this like that:

sudo” means superuser do. “sudo” will prompt for “Password:”. Please specify user password

As you have noticed during the Ubuntu installation there was no question about the root password, as you might have been used to see during other Linux distribution installation process.Because of this your root accout is inactive.

If you want to enable root account (which is not recommended) enter the following command.

$sudo passwd root

This will prompt for a new root password and once you confirm it, you can start using the root account to login.


2- You must install libaio-dev package to continue and
"sudo aptitude install libaio-dev"
should do it. And you will have glibc already, and impossible to run without it.

3-As _root_ begin installing the latest available Oracle XE:
root@Ozzy:~$ su -
root@Ozzy:~# cd /home/ozer/Desktop
root@Ozzy:/home/ozer/Desktop# ls
DapperDevStatus02-Feb-2006.pdf oracle-xe_10.2.0.1-0.060128_i386.deb trash.desktop
root@Ozzy:/home/ozer/Desktop# dpkg -i oracle-xe_10.2.0.1-0.060128_i386.deb
Selecting previously deselected package oracle-xe.
(Reading database ... 58594 files and directories currently installed.)
Unpacking oracle-xe (from oracle-xe_10.2.0.1-0.060128_i386.deb) ...
This system does not meet the minimum requirements for swap space. Based on
the amount of physical memory available on the system, Oracle Database 10g
Express Edition requires 1006 MB of swap space. This system has 799 MB
of swap space. Configure more swap space on the system and retry the installation.
dpkg: error processing oracle-xe_10.2.0.1-0.060128_i386.deb (--install):
subprocess pre-installation script returned error exit status 1
Errors were encountered while processing:
oracle-xe_10.2.0.1-0.060128_i386.deb
root@Ozzy:/home/ozer/Desktop#

Ooops we have a problem here. We must increase the swap size of our ubuntu to the
requested amount of space:

How do I add more swap?

  • Usually, people associate swap with a swap partition, maybe because they've been proposed to create a swap partition on install. In fact any file can be used as a swapping device, be it a partition or a conventional file. If you're considering responsiveness, my advice: add more RAM. Swapping to a partition or a file won't change anything.
  • We will add more swap by adding a swap file.
  • Adding more swap is a four-step process :

    • a- Creating a file the size you want.
    • b- Formatting that file to create a swapping device.
    • c- Adding the swap to the running system.
    • d- Making the change permanent.
  • We will consider (as an example) a 512 Mb swap need.

  • a- Creating a file the size you want :

    • We will create a /mnt/512Mb.swap swap file.

      sudo dd if=/dev/zero of=/mnt/512Mb.swap bs=1M count=512
      • What is important here is count=512, which means we want our file to contain 512 blocks of bs=1M, which means block size = 1 Megabyte

      • Be careful *not* to do this dd of=/mnt/512Mb.swap bs=1M seek=512 count=0

        • Though the file grows to 512Mb immediately,it will have holes that makes it unusable.
  • b- Formatting that file to create a swapping device :

    sudo mkswap /mnt/512Mb.swap
  • c- Adding the swap to the running system :

    sudo swapon /mnt/512Mb.swap
    • You can see with "cat /proc/meminfo" that your additionnal swap is now available.

  • d- Making the change permanent :

    • edit your /etc/fstab:

      gksudo gedit /etc/fstab
    • and add this line at the end of the file:

      /mnt/512Mb.swap  none  swap  sw  0 0
    • save and reboot
4-After doing all this we can continue to install oracle-xe:

root@Ozzy:/home/ozer/Desktop# dpkg -i oracle-xe_10.2.0.1-0.060128_i386.deb
(Reading database ... 62016 files and directories currently installed.)
Unpacking oracle-xe (from oracle-xe_10.2.0.1-0.060128_i386.deb) ...
Setting up oracle-xe (10.2.0.1-0.060128) ...
Oracle Database 10g Express Edition is not configured. You must run
'/etc/init.d/oracle-xe configure' as the root user to configure the database.
Executing Post-install steps...
You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database.


5-After running the above code you will start to configure the database:

root@Ozzy:/home/ozer/Desktop# /etc/init.d/oracle-xe configure
Oracle Database 10g Express Edition Configuration
-------------------------------------------------

This will configure on-boot properties of Oracle Database XE. The following questions will determine whether the database should
be starting upon system boot, the ports it will use, and the passwords that
will be used for database accounts. Press to accept the defaults.
Ctrl-C will abort.
Specify the HTTP port that will be used for Oracle Application Express [8080]:

Specify a port that will be used for the database listener [1521]:

Specify a password to be used for database accounts. Note that the same
password will be used for SYS and SYSTEM. Oracle recommends the use of
different passwords for each database account. This can be done after
initial configuration:

Confirm the password: (* make sure you remember this password *)

Do you want Oracle Database 10g Express Edition to be started on boot (y/n) [y]: y

Starting Oracle Net Listener...Done
Configuring Database...Done
Starting Oracle Database 10g Express Edition Instance...Done
Installation Completed Successfully.
To access the Database Home Page go to "http://127.0.0.1:8080/apex"
root@Ozzy:/home/ozer/Desktop#