Tuesday, April 27, 2010

XE and Apex on a Slicehost

For a while I have considered getting a hosting service for my apex applications. The community have made a list of some of the providers. All of them charge depending on the amount of storage capacity that you need. They have a fairly high monthly rate compared to the amount of storage. For instance htmldb-hosting.com charges $32/month for 50MB and $140/month for 500MB.

Previously I have looked into just renting a server and installing a oracle express edition on it. In the past I have had some trouble with it, as the OS provided was not the easiest to install XE on. However, Slicehost have now upgraded their selection of OS and I give it another go.

I chose to get a 15GB storage, and 384MB of memory slice. It will cost me $25/month. In order to avoid any unplesant experienced a I added a backup for $7.5. When this is installed I'll be able to use up to 4GB of storage in Apex (limited by the XE edition), and I'll still have 5-10GB left on the server that I can use for other purposes.

Installation process.

Get a slicehost, chose Ubuntu 9.10 32-bit OS. Shortly after this is done you'll get an e-mail with the root password and the IP of your new server. You can log in using a web console on slicehost page or use ssh.

After logging in to the new server:
dd if=/dev/zero of=/mnt/swap.img bs=1M count=780
mkswap /mnt/swap.img
swapon /mnt/swap.img

vi /etc/fstab
add the following line
/mnt/swap.img none swap sw 0 0

vi /etc/apt/sources.list
add the following line:
deb http://oss.oracle.com/debian unstable main non-free
Run
wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle  -O-
| sudo apt-key add -
apt-get update
apt-get install oracle-xe
You now got a oracle user and a running XE database. If you need to upgrade apex you can use the following guide.

Monday, September 21, 2009

OWB 10.2.0.4 outer join PEBKAC fix

Looking at a join Mr. someone-else had made in a OWB mapping I found the following conditions:
a.column1 = (+) b.column1 AND
a.column2 = (+) b.column2
Noway this can work! However the mapping was running smoothly. OWB actually changes the place of the (+) to the correct location when generating the SQL so that the final statement looks like:
a.column1 = b.column1 (+) AND
a.column2 = b.column2 (+)
I was totally amazed by this.

Wednesday, August 5, 2009

OWB 10.2.0.4 joiner errors

Deleting a in-group in a joiner
If you have a joiner and for some reason has to delete one of the in groups OWB can corrupt the join conditions. After a delete the columns in the conditions have moved around or been substituted for other (apparently random) columns. If not corrected manually afterwards this will cause you trouble.

java.lang.ArrayIndexOutOfBoundsException: -1
When deploying a mapping you might get the following error
VLD-1141: Internal error during mapping generation.

java.lang.ArrayIndexOutOfBoundsException: -1
at oracle.wh.service.impl.mapping.component.JoinSqlDelegate.prepareOutputContext(JoinSqlDelegate.java:530)
at oracle.wh.service.impl.mapping.generation.WBMappingGenerator.generate(WBMappingGenerator.java:239)
at oracle.wh.service.impl.mapping.generation.PlSqlGenerationMediator.assembleSetBasedInternal(PlSqlGenerationMediator.java:2150)
at oracle.wh.service.impl.mapping.generation.PlSqlGenerationMediator.assembleSetBased(PlSqlGenerationMediator.java:2132)
at oracle.wh.service.impl.mapping.generation.PlSqlGenerationMediator.assemble(PlSqlGenerationMediator.java:554)
at oracle.wh.service.impl.mapping.generation.WBMappingGenerator.generate(WBMappingGenerator.java:807)
at oracle.wh.service.impl.mapping.generation.WBMappingGenerator.generate(WBMappingGenerator.java:334)
at oracle.wh.service.impl.mapping.generation.WBDeployableMappingGenerator.generate(WBDeployableMappingGenerator.java:104)
at oracle.wh.service.impl.generation.common.WBGenerationService.generateCode(WBGenerationService.java:433)
at oracle.wh.service.impl.generation.common.WBGenerationService.generateCode(WBGenerationService.java:311)
at oracle.wh.service.impl.generation.service.WhValidationGenerationTransaction.run(WhValidationGenerationTransaction.java:251)
This happens if you have a join condition referencing outgrp1. Why would you reference outgrp1 in a join statement, you wouldn't. However if your deleting one of the in-group, in particular the last in-group, Oracle might insert outgrp1 as part of the join condition. If you get this error start by looking through all your join conditions to see if Oracle have messed one up.

Monday, May 18, 2009

OracleXE and Apex 3.2 on Ubuntu 9.0.4

Introduction
I'm a huge fan of Apex. It is a very quick and good way to develope data driven applications. With it you can make extreamly affordable applications. Especially if it is compined with OracleXE and a free of charge Linux like Ubuntu. This is what I'm going to do in this short how-to. I'm going to install OracleXE (10g) on Ubuntu 9.0.4. Apex is bundled with OracleXE, so no installation is needed for that. How ever I'm going to upgrade the Apex installation from 2.1 to 3.2

Requirements
First of all you need 32bit os. Install Ubuntu 9.0.4, the desktop version. I had some problems in previous version of Ubuntu with the server release in regards to OracleXE, thats why I'm using the desktop version. Just make a default installation. I did mine on VmWare, running of my Windows XP gaming pc.

Then grab Oracle Database 10g Express Edition (Universal), Download oracle-xe-universal_10.2.0.1-1.0_i386.deb from oracle.com. For the uninitiated this is Oracles free database. You can use it with 1gb memory, 1CPU and 4gb of data for (almost) any purpose free of charge. The full lisence can be found her.

Get Apex 3.2 for oracle.com

Installing OracleXE
sudo aptitude install libaio1
sudo dpkg -i oracle-xe-universal_10.2.0.1-1.0_i386.deb
When running the above the installer might abort and say that you do not have enough SWAP. If it does run the following four lines. Where 700 is changed for the amount of SWAP you are missing.
sudo dd if=/dev/zero of=/SWAP.img bs=1M count=700
sudo losetup /dev/loop7 /SWAP.img
sudo mkswap /dev/loop7
sudo swapon /dev/loop7
Note that after the first reboot this SWAP image is no longer going to be used, which is fine. We only need it during the install. However, ff you want to keep it you either have to add it in fstab or run the following after each boot.
sudo swapon /dev/loop7
When then installer finishes it tells you to run the post install, do that:
sudo /etc/init.d/oracle-xe configure
It will ask you a bunch of question, if your unsure of the answer just hit enter and you'll get the default. Well you need to enter a password though.

http://127.0.0.1:8080/apex is usually the url for your new database. From this web interface you can manage some aspects of the database, but I'm a sqlplus fan. Note the 127.0.0.1 address is only valid from your computer. If you need to reach the database from a different computer substitute 127.0.0.1 for the ip or domain of your computer where OracleXE is running.

Note that the installer created a database with SID = XE for you. This might come as a surprise to some experienced DBA's as Oracle usually does not do this. You have to do it your self after the install.

Upgrading Apex 2.1 -> 3.2
Unzip the software you downloaded from Oracle.com
unzip apex_3.2.zip
sudo mv apex /usr/lib/oracle/xe/app/oracle/product/
sudo chown oracle:dba -R /usr/lib/oracle/xe/app/oracle/product/apex
The installer for the databse created a oracle user, so lets login with it and get sqlplus working:
sudo su - oracle
Set the path and oracle environment variables:
export PATH=$PATH:/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/
export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
export ORACLE_SID=XE
It's time to upgrade apex. When you installed OracleXE it came with a apex installation, but we want to have the newest, Apex 3.2.

This will take hand of the pre-install requirement:
cd /usr/lib/oracle/xe/app/oracle/product/apex
sqlplus / as sysdba
ALTER SYSTEM SET SHARED_POOL_SIZE='100M' SCOPE=spfile;
shutdown immediate
startup
@apexins SYSAUX SYSAUX TEMP /i/
The last line starts the update scripts. It will run for a while, so be patient.

Since we are running apex on OracleXE we have to do a couple of special steps, these are the ones below. Note that password should be substituted for what ever you want the admin password to be.
@apxchpwd
@apxldimg.sql /usr/lib/oracle/xe/app/oracle/product/
@apxxepwd.sql password
If you want your applications to be available from other computers run:
exec dbms_xdb.setListenerLocalAccess(l_access => FALSE);
There are a few more settings you might want to change, they can be found her.

The administration page for your apex can be found at: http://127.0.0.1:8080/apex/apex_admin

Username is admin, and password is the one you sett when runing @apxchpwd

The application interface that user are going to use when developing applications are at:
http://127.0.0.1:8080/apex/apex

When the application is done the final applications will be available at:
http://127.0.0.1:8080/apex/f?p=#APPNUMBER#
Where #APPNUMBER# is the number of the application, for instance 100, http://127.0.0.1:8080/apex/f?p=100


More documentation and lots of good information can be found at:

Saturday, February 7, 2009

Flickr

I got my self a Flickr account. I was told it was easy and fast to upload, and for just $24 a year I could store unlimited amount of images. This sounded great, just what I need. I need backup of all my images, it is probably around 100GB.

It's far from perfect, it needs more features like:
  • An upload agent that will retry upload when they fail.
  • An upload agent that remember where it was if it crashes or the computer goes down.
  • A system for removing, or better merging duplicate images. It should do a search if the image has the same image name and size it is probably the same image. It should show a list of all these for you to check and the merge tags, comments and set membership and finaly remove the duplicate. 
  • Better access controll. You should be able to have a list of all images visible for family, or public. And it should be able to grant access to individual people. 


Thursday, February 5, 2009

Downhill

When I was younger, half a lifetime ago, I used to go with my parents on Easter vacation. During these vacation we would always go downhill skiing. Next week I'll be going to Chamonix with my company to ski for five days. Naturaly I was a bit nervous about skiing for the first time in 15 years. So I went to the local resort to test my skills. To my delight it was like riding a bike....

I'm realy looking forward to the trip, I'm sure it will be awesome

A few images from Tryvann.

Tuesday, January 27, 2009

Cat

We got a cat. My girlfriend wanted a free-house cat that she could save. However after I started googeling cats I fell in love with the Maine Coon's so thats what we got. We made a blog for the cat with lots of images and stuff.