Converting RTF to PDF in an Oracle Database

OraMonkey | Jul 3, 2009 07:47 -0600
There are a number of commercial products out there which converts RTF to PDF, but there is also a free alternative called Ted. Actually, calling this a converter is a gross understatement, it is a fully fledged RTF editor which also can convert RTF to PDF.

I will describe how to install Ted, and how to use it with RTF-documents stored in the database. This combined with generating dynamic RTF-documents can give a rich document solution for your Oracle Apex applications.

This is a Linux/Unix specific solution. So if you are stuck with some other operating system, go do something about it ;-)

Downloading and Installing Ted
Ted runs on Unix/Linux, and you can download the software here. Ted is released under GNU Public License, and restrictions may apply.

The easiest way of installing Ted is to use RPM package file.
  • Download RPM package file to /tmp
  • Install RPM-package as user root (or system user with sufficient privileges)
    rpm -ivh .rpm
If you get an error stating that packages are missing, do not despair, simply download and install the package indicated (or get it from your installation CD). The installation is pretty much the same as described in the bullets above.

Preparing os for RTF conversion
Download Ted the rtf2pdf.sh script which converts rtf-files to pdf-files.
  • Create an os-directory:
    mkdir /u01/app/ted
  • Copy the Ted conversion script to the directory
    cp /u01/stage/ted/rtf2pdf.sh /u01/app/ted/.
  • Grant execute privileges on the script
    chmod +x rtf2pdf.sh
I have done the above operations with user oracle of group oinstall, and in this demonstration user oracle will be used to execute os-operations. This is probably not the best production solution, but will serve for my demonstration purposes.

Creating directory in the Oracle database
Defining a directory in Oracle is quite easy:
  • Connect as user SYS
  • Create directory:
    create directory RTF2PDF as '/u01/app/ted';
  • Grant privileges to RTF2PFDF
    grant all on directory RTF2PDF to <schema_user>
How to execute os-commands from the Oracle database
There are basicly three alternatives; dbms_scheduler, Java and C. The three alternatives and use of dbms_scheduler is described by Steven Feuerstein here. He also has a good description of the Java and C approaches.

dbms_scheduler is the superior alternative to me, it's easy to use, and as opposed to Java, is compatible with Oracle XE (even though there are some issues with this release). The only beef with dbms_scheduler are the implicit commits, I have not investigated when or why any further as I have barely scratched the surface of dbms_scheduler. I'll get around to it some rainy day.

What actually made me revisit dbms_scheduler was this recent blog post by Tobias Arnold, following feeds like orna.info and apexblogs.info has proven invaluable for a monkey like me :-)

Dr. Tim Hall has an excellent site called oracle-base.com with loads of examples and articles on the Oracle database. My dbms_scheduler code and setup is based on his article Scheduler Enhancements in Oracle Database 11g Release 1.

Preparing for use of dbms_scheduler
Before your schema user can take advantage of dbms_scheduler and execute host commands, there are a few steps that must be done:
  • Connect as user sys
  • Grant create job to schema user:
    grant create job to <schema_user>;
  • Grant the ability to execute host commands/external jobs to schema user:
    grant create external job to <schema_user>
  • Create credential (this is new in 11g, and saves a lot of work):
begin
-- basic credential.
dbms_scheduler.create_credential(
credential_name => 'LOCALORACLE',
username => '',
password => '');
end;
  • Grant credential to schema user:
    grant execute on LOCALORACLE to <schema_user>
The os-user specified must have execution privileges on rtf2pdf.sh, and r+w on the directory where the script resides for this example.

PL/SQL code to invoke conversion
I have written a sample package for converting a rtf-document to a pdf-document. Sadly, I can't use Oracle's hosted environment on apex.oracle.com to showcase the functionality. I do not have the privileges to perform the required steps described above, and rightly so. Feel free to download and test it yourself. I have uploaded the package to my sample application at apex.oracle.com, you can download the sample code here.

The code is for demonstration purposes only, so my usual disclaimer apply: I take no responsibility what so ever for what might happen when you use it and there is no warranty of any kind expressed or implied. Phew... I still hope for world domination when you compile the package though ;-)

The package contains procedures/functions for file handling and invoking rtf2pdf.sh, but can easily be adapted for a more generic use.

Converting RTF to PDF
Lets say you have a table called RTF_DOCUMENTS that looks like this:
create table rtf_document
(
rtf_document_id number not null,
file_name varchar2 (255) not null,
rtf_file clob,
pdf_file blob,
constraint rtf_document_pk primary key (rtf_document_id)
);

And you want to create a procedure to convert the contents of column RTF_FILE to a pdf-document in column PDF_DOCUMENT, you can use the following procedure:
create or replace procedure convert_rtf_doc (
p_rtf_document_id in rtf_document.rtf_document_id%type
, p_dir_name in varchar2 default 'RTF2PDF'
) is
cursor c_doc
is
select rtdo.rtf_document_id
, rtdo.file_name
, rtdo.rtf_file
, rtdo.pdf_file
from rtf_document rtdo
where rtdo.rtf_document_id = p_rtf_document_id;
l_pdf_file blob;
begin
for r_doc in c_doc
loop
l_pdf_file := rtf2pdf.rtf2pdf(p_rtf_file_name => r_doc.file_name
,p_rtf_file => r_doc.rtf_file
,p_dir_name => p_dir_name);
update rtf_document rtdo
set rtdo.pdf_file = l_pdf_file
where rtdo.rtf_document_id = p_rtf_document_id;
end loop;
end;
/

Beware of the implicit commit by dbms_scheduler! A select for update in c_doc cursor would result in "fetch out of sequence"-error.

Alternatives to Ted
There are always alternatives, this is not different. There are some Open Source projects out there, and this guy (that's sexist, but I still assume cfSearching is a he) has done some research on the topic. His angle was different from mine though, and he went the ooxml-way, which is not a stupid idea.

Open Office could be an alternative, and has a more active community surrounding it. The CLI surrounding the OO-libraries in server mode will probably do the job.

In conclusion
In all honesty, I have not yet investigated to which extent the rendering of pdf-files is correct based on the more complex elements of rtf. This, of course, I should have done first. For me the journey is the most fun when (as in this case) there are no expectations attached to the end solution.

Tightening the PL/SQl-code referenced here for production goes without saying!

Mac OSX Software I like

Dimitri Gielis | Jul 3, 2009 02:06 -0600
Sometimes I get the question which Mac OSX software I use. So here's a list of programs I've installed. Some I use often others less often. If you use other nice software, feel free to add!

Standard Mac Software:
  • Address Book
  • AppleScript
  • Automator
  • Calculator
  • Dashboard
  • Dictionary
  • Expose
  • Font Book
  • Image Capture
  • TextEdit
  • Unison
  • Utilities
  • Spaces
  • iCal
  • iSync
  • Stickies
  • Server - because we also have Mac OSX Server

Office:
  • iWork
  • iLife

Internet Applications:
  • Adium - chat
  • iChat - chat
  • Colloquy - irc (not used that much)
  • Cyberduck - ftp client
  • DynDNS Updater - link a hostname to an ip
  • Dropbox - online storage
  • Firefox with different plugins (YSlow, LiveHTTPHeaders, Firebug, ColorPicker, ...)
  • Safari - standard browser on OSX
  • GoToMeeting - to do remote support and meetings
  • SSH Tunnel Manager - ssh
  • Meerkat - ssh
  • Cisco VPNClient - vpn
  • Viscosity - vpn
  • Skype
  • Mail
  • Twitterrific - twitter reader
  • Reader Notifier - get rss updates
  • Yuuguu - connect to others
  • Transmission - download files

Graphical Software:
  • Adobe Acrobat 8 Professional
  • Adobe Dreamweaver CS3
  • Adobe Flash CS3
  • Adobe Illustrator CS3
  • Adobe InDesign CS3
  • Adobe Photoshop CS3
  • PDFpenPro - edit pdf
  • Paintbrush
  • OmniGraffle Professional 5 - make schemes
  • iWeb - make websites

Games:
  • Chess
  • Quinn - tetris like
  • MasterMind - dashboard plugin

Entertainment:
  • DVD Player
  • DivX Converter
  • DivX Player
  • EyeTV - makes it able to watch tv on my mac
  • Flip4Mac - be able to play wmv
  • GarageBand - audio
  • Front Row - menu to all entertainment
  • iDVD
  • iMovie
  • iPhoto
  • iTunes
  • ScreenFlow - record video
  • Photo Booth
  • VLC - play video
  • QuickTime Broadcaster
  • QuickTime Player
  • VisualHub - convert video (not updated anymore)
  • Spotify - play any song (only works when I'm in the UK)
  • BookSmart - online creation of you photo albums
  • WorldRadio widget - listen to radio as dashboard app

Local/External storage:
  • ExpanDrive - Mount drives even through ftp etc
  • Macfusion - extend to other filesystems
  • SuperDuper! - backup your Mac

Phone:
  • Missing Sync for Windows Mobile - I've an HTC and not an iPhone, so need extra software to sync agenda, contacts etc
  • TomTom HOME - on my phone I have also GPS and navigation software

Oracle related:
  • Oracle SQL DataModeler - SQL Modeler
  • Power*Architect - SQL Modeler
  • SQLEditor - SQL Modeler
  • SQLDeveloper - my day to day tool to talk to the Oracle database
  • Versions - SubVersion client
  • VMware Fusion - to get access to my remote machines

Project Management:
  • Merlin - allows to estimate the work and breakdown in pieces
  • Mindjet MindManager - read MindMaps
  • OmniFocus - to do list which is able to sync as well

Text Editor:
  • SubEthaEdit - allows to work on a text with more persons, real time editing
  • TextMate - favorite text editor

OSX Tools:
  • OmniDazzle - mouse focus and effects
  • Quicksilver - lunch commands fast
  • StuffIt Expander - zip like
  • 1Password - store passwords in a secure way
  • Wallet - store passwords in a secure way
  • World Clock Deluxe - to keep an eye when my clients get awake
  • iBank - trying that, MS Money type app
  • Caffeine - let your Mac never go in sleep mode
  • Time Machine - automated backups
  • iStat Pro widget - shows a lot of information about your Mac (ip, temperature etc)
  • AccuWeather widget
  • SysTran translation widget
  • Currency converter widget

For the people who want to work faster, here's a good list of shortcuts for OSX.

SQL Modeler for Mac OSX (Part 2)

Dimitri Gielis | Jul 2, 2009 23:03 -0600
Louis-Guillaume Carrier-Bédard commented on my previous post about SQL Modeler for Mac OSX, that I had to check out a tool called Power*Architect.

So I thought to give it a go. The steps to get it running:
  • Go to the SQL Power website and download Power*Architect
  • As most OSX applications you install by dragging the application in your Applications folder
  • So now I wanted to get an ERD of some tables, so you run Power*Architect and select from which Data Source you want to capture.
  • I had to download the Oracle 10g JDBC driver first (apparently 11g is not yet foreseen in Power*Architect)
  • In the User Preferences you can tell where the driver can be found
  • Next I dragged-dropped from the interface the tables I wanted to the right hand side, but the tables where not nicely ordered
  • Luckily there is a button "Automatic Layout" which I pushed and that gave me the below result


As far as I've tested Power*Architect, it looks very promising. It's definitely a tool I will try a bit more in the future.

SQL Modeler for Mac OSX

Dimitri Gielis | Jul 2, 2009 13:39 -0600
On the first of July Oracle's SQL Developer Data Modeler got a production release. You have the choice between a full version and a Viewer only version.

I installed the full version on my Mac to see how it is like. These are the steps I followed to get it working on my MacBook Pro:
  1. Download the zip file from OTN
  2. Unzip the file in my Applications folder
  3. You'll see a folder called "datamodeler"
  4. I ran a Terminal session to call this command: sh datamodeler.sh
  5. The first time SQL Developer Data Modeler asks you to enter the full pathname of a J2SE installation. For me the path is:
    /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
  6. Next SQL Developer Data Modeler opens and you are good to go
  7. I tried to generate a relational and logical datamodel and it worked great (see below screenshot of the DG Tournament schema


As expected Oracle didn't make the tool for free. I hoped differently, but apparently Larry decided against it. The latest Oracle pricelist shows under the Tools section the price of SQL Developer Data Modeler. The first year you pay USD 3,000 + USD 660 (support and upgrade), from the second year onwards it's 660, but that gives you the right to install all updates. I definitely think the product can justify the price, but maybe not for everybody or in every project as you might not want to use all the features.

One of the most important parts for me is viewing the ERD in a graphical way. I tend to use the ERD to explain clients how we see the application. Or if we come in when the application already exist, to quickly know what is going on behind the scenes. Till now I used SQLEditor of MalcolmHardie Solutions. It allows me to connect to a database and get the ERD for a schema or certain tables. It can do a lot more like adding tables, columns etc and you can see the sql statements in different formats. Below is a screenshot of the same schema as the picture before.


Most of the time I have to rearrange the tables so it's more logic and more understandable. Personally I think Oracle SQL Developer Data Modeler looks a bit better and it has more features and I had to not rearrange that much as with SQLEditor. But then I guess that explains the difference in price ;-) SQLEditor costs $79.

I still have a lot to learn of the functionalities of Oracle SQL Developer Data Modeler, but what I saw at the conferences and what I could do so far, I definitely think it's worth for you to give it a try.

APEX 3.2 Oracle Forms to APEX conversion in Oracle Scene

The new issue of Oracle Scene (the official UKOUG Magazine) out. I am very proud that one of the articles is written by ... me! It is even on the cover page!
For all the folks out there who don't have a subscription, you can read my article here.
Let me know what you think of it!

APEX FLoating Developer Toolbar

During the APEX 4.0 session at last ODTUG a question was raised: "Can we have a floating developer toolbar" (the thing at the bottom of the page with a.o. the 'Home' and 'Debug' link). There is no need to wait for APEX 4.0 to get that (if it will be implemented as a new feature), you can have it NOW!
If you put the next piece of code in an HTML Region in Page 0 (or in your Template, whatever you like), the toolbar gets sticked to the bottom of your browser like glue...


I guess it only works for FireFox, but that doesn't matter, because that's the tool we're all using anyway, aren't we? Oh, yeah, and you need jQuery...

Oracle SQL Developer Data Modeler available - but not for free….

Almost covered by yesterdays FMW 11g stampede, the production version of SQL Developer Data Modeler is available on OTN.
As expected (see this and this last years blog entry) this is not a free tool like SQL Developer or JDeveloper. It is a for-cost option of SQL Developer, and requires a separate license. And what are the license costs (as of yesterdays Pricing List): $3000 + $660 per year per Named User.
It looks really good. The functionality is about the same as the modeling part of good old Oracle Designer (it can even import the definitions from a Designer Repository). The full Internet Developer Suite costs $5800 + support per user. But then you get the all Designer functionality + Oracle Forms + Oracle Reports...
Is it worth the $3000? I don't have an opinion on that yet, do you?

Getting started with ExtJS Grids in APEX

Tobias Arnhold | Jul 1, 2009 23:07 -0600
I fumbled a bit around with ExtJS Grids and found a fantastic forum link where Ben really well described how to build an Ext Grid inside an APEX report template.

oracle apex and extjs grid table

OTNs APEX Developer Competition 2009

Anthony Rayner | Jul 1, 2009 04:12 -0600
Are you the...

  ...travelling type?  Fancy winning a free ticket for Oracle OpenWorld in San Francisco (October 11 - 15) to meet with like minded APEX enthusiasts and learn more about APEX and other Oracle technology?


Or maybe more the...

  ...bragging type?  How would the words 'Oracle Application Express Developer Competition Winner 2009' look on your CV? It does have a certain ring to it, don't you think?


Or even the...

  ...academic type?   What about the prospect of furthering your understanding of APEX by paging through your winning copy of 'Pro Oracle Application Express'?


Whatever your reasons, enter the OTN 'Oracle Application Express Developer Competition 2009' by submitting an APEX application that stands out from the crowd and you could be in with the opportunity of winning one of these great prizes or accolades!

For more information, including submission guidelines, all important judging criteria and registration details, please visit the OTN page and David Peake's related post. Entries close 24 August, 2009.

Good luck!

The buzz around APEX 4.0

During last weeks ODTUG Mike Hichwa presented APEX 4.0. This seemed to be the best attended session (apart from the 'real' keynotes) with over 200 attendees, so a lot of people wanted to know where their favorite development environment is heading!
Mike demoed some really cool new stuff - I will discuss these later on - and skipped (even more) nice features, with Declarative Tabular Forms, AJAX Client-Side Validations and Improved Error Handling make the top 3 of most interesting ones. See the pic of the slide for a complete list.

Websheets
There has been more blogging about Websheets last year, even with movies. But every time you see it live, it is amazing. Just copy data from a CSV, paste it into the APEX Builder and you're done! No Tables, Triggers, Primary Keys, etc needed: everything is automatically managed in APEX$xxx tables. You can update the data in line (like a Tabular Form), you can do mass update, create an LOV on the fly and add columns. You can also add Attachments, Notes and Tags to a record. The history is automagically kept, so auditing is out-of-the-box. You can define the properties of a column, move columns up or down, define column groups and even validations: all at runtime! So the (already thin) line between the Builder and the Runtime version of an application will get more vague.
But even Websheets will have its limitations: The Page Flow is limited and also the control over the Look & Feel is less exhaustive as with 'normal' APEX Pages: No use of Themes and Templates (more or less similar with the Interactive Reports).

Dynamic Actions
With Dynamic Actions you can Enable/Disable and Show/Hide Items dependent on the values of other Items. Things you nowadays need to code in (one line) of Javascript, will be declarative. That means not only less manual code, but - more important - easier maintenance, because these declarations will be stored in the APEX Repository and thus be available through APEX Dictionary Views.

Charts
In APEX 4.0 all charts will use the - much better looking - AnyCharts 5.1 version. Not quite clear if also the new chart types (like Gantts) can be declaratively created.

REST Web Services
In APEX 4.0 you also the use of REST Webservices is declarative. There was a short - but impressive - demo how to use Yahoo Maps within APEX.

Plug-Ins
Another main new feature are the Plug-Ins (previously called 'Custom Item Types'). You can compare these Plug-Ins to Widgets or - in the good old Oracle Forms environment - Pluggable Java Components (PJCs). Just register it within the Repository and you can use it wherever you like. The idea is that there should be a central 'Plug-In Registry' where every APEX Developer can register his Plug-In and make it available for download (free or for a fee). Oracle has no plans of managing / checking / controlling that registry due to legal restrictions (although just referencing source files didn't help Napster or The Pirate Bay ;-) ). The demo showed just registering / uploading a sql file containing the Plug-In (an Amazon style star rating) and the absurd easy way to use that Plug-In in a Form. Soon Patrick will be blogging about the technical details.

Improved Application Builder
Also the APEX Application Builder itself is revamped. The navigation is more intuitive, Interactive Reports are used all over the place and there is a general 'Search' function. That'll make developing with APEX even more productive...

Improved Interactive Reports
And even the, already fantastic, Interactive Reports got a make-over, with added functionality, like e-mail notification, compound filter expression (so you can use brackets and OR's in a filter) and - one long lasting request - shared saved reports!

Release Date??
As I can see for the search terms that hit my blog, "APEX 4.0 Release Date" is a very hot topic. Of course the Oracle APEX posse didn't gave a fixed date. And if they did, there is always the 'safe harbor'/disclaimer page as the first slide of the presentation. But in one of the presentations a 'date' was mentioned: End of 2009! So I will set my expectation to 2010Q1...

Stress & Load Testing Web Applications using Apache jMeter

Chris Muir has posted an excellent blog on how to use Apache jMeter for stress and load testing APEX and ADF applications. Check it out: http://one-size-doesnt-fit-all.blogspot.com/2009/06/stress-load-testing-web-applications.html.

ODTUG in the rearview mirror

Still recovering from a light jet lag, it is time to look back at another excellent ODTUG event. Although I planned to blog about it on a daily basis, the social/networking activities prevented that... (a.k.a. "I rather drink a beer with some friends and have a good chat, that write another blog post"). So here's a (rather) long wrap up of this fantastic event!

Sunday June 21: APEX Symposium
The symposium, with around 200 attendees, started at 8:00 AM (attending ODTUG is really hard work!). The day started with a sort of keynote by Joel Kallman, followed by 6 presentations of real world APEX applications and was finished off with a Panel discussion. Some highlights of the day:
Joel did an excellent presentation called Application Express: Ahead of the Curve. He explained that APEX is still ahead of it's time and therefore will still gain (even) more interest in the market. Especially because of the high speed development, you can create all kinds of applications with a good ROI (but of course you knew that already...).
Olivier Dupont showed that at Brussels Airport APEX is used for securing the entrance to all parts of the area (a real mission critical example!), even using no (real) browser and no mouse.
Cognera utilizes APEX for their billing solution in the utilities market in Canada (using BPO and SaaS constructions). Martin D'Souza even showed they embedded APEX into an Access application!
On behalf of PAETEC, Dennis Vanill presented their APEX enterprise application using an own framework to intercept the standard APEX rendering in order to minimize the number of common objects.
Jan Navratil showed that the National College for School Leadership uses APEX to support over 200,000 school leaders in the UK.
At Cornerstone Brands APEX is successfully used in their call center to handle thousands of orders daily by hundreds of users. So even a data entry environment APEX is suitable as Paul Davidson showed. Using the new APEX application the call center reduced the time per call and so increased the number of calls per agent substantially.

All examples showed APEX is suitable for mission critical enterprise applications with large numbers of users, even in a data entry environment!

The last general session of the day was a keynote by Steve Miranda. He demo'ed a (small) part of the new Fusion Apps. The UI looked very web 2.0, impressive functionality and animations. Although I wondered if all this visual force is still impressive - and useful - if you use such an application on a daily basis...

Monday June 22
Doug Gault kicked off the APEX part of the day with Performance Tuning APEX Applications. Performance is all about the User Experience. Some free tips: Separate UI (APEX) from Logic (SQL); move anonymous PL/SQL into the DB; use binds; instrument your code; gather statistics (for both application and APEX schema). For monitoring performance you can use the APEX Reports (especially the By Weigthed Page Performance); set the debug mode on; show the #TIMIMG# substitution variable in the region footer; use Firebug and/or set &P_TRACE=YES in the URL.
Next, mister APEX Security himself, Scott Spadafore, covered the APEX Security Essentials. All about the risks of hacking and the APEX answers thereto: session state protection, session timeout, VPD etc.
The last session of the day was more or less the general APEX keynote: APEX 4.0 by Mike Hichwa. For a very interested and curious crowd of over 200 people, Mike showed a lot of cool new features. More details about that in a next post.
In the evening we had the usual APEX meetup in one of Monterey's many restaurants. The meetup is getting bigger and bigger. This time there were more than 30 people!

Tuesday June 23
Another (beautiful) day packed with interesting APEX sessions. Bharat had the honor of keeping everyone's interest (after yesterdays meetup). He easily attracted attention by showing what you can do using DHTMLX Tree's and Grid. Very web 2.0 like pages with no resemblance of the standard APEX Themes at all!
Later that day Tim St. Hilaire dived into the wonderful world of jQuery and Yahoo UI. He showed how you can solve Wait Processing, Pop Up Dialog Boxes and Autocomplete functionality using these Javascript frameworks. Looking at the LOC needed for implementing this functionality jQuery will be my personal preference!
Next John Scott showed what you can do to increase the scalability of APEX. Using caching, minifying javascript, adding expiry info, gzip files etc you can dramatically reduce the number of round trips and the size of the data transfer.
Then it was my turn to present about How to integrate Forms and APEX. It went rather well, although I finished somewhat early. For myself I noted some accents to improve the presentation for OOW!
The last session of the day was done by Brian Spendolini. He demoed how to use Oracle Application Express on the iPhone. He showed how to overcome the size and navigation limitations of the iPhone and how to create real native iPhone APEX apps. Very cool stuff...
That evening I was invited for the Oracle ACE dinner in the other conference hotel at the beach. Nice food and good company. As always we ended up at Knuckles...

Wednesday June 24
The (for me) final day of the conference started off with Dietmar Aust's Generating complex Excel reports with APEX and jXLS. Maybe as a last resort I would come up with this solution, but it is not my tool of choice, because you have to learn another specific "jXLS language" and some Java stuff for the communication with the engine.
Next Joel Kallman showed how to Effectively Manage an Application Express instance using the Oracle Database Resource Manager. With live demo's on oracle.apex.com he explained how to use the different resource settings in order to improve the overall performance. With 7,000,000 page views a week, apex.oracle.com has only around 5 (real) active sessions at any moment. Should I say more on scalability?
After that, two sessions about managing the development of larger and multiple applications. In the first, Scott Spendolini explained the use of multiple Applications (one master application to subscribe to, one login application, one template application with all the subscriptions as a starter app and one for access control) can simplify, unify and speed up your development effort. In the other session Raj Mattamal raced - in his own special way ;-) - through the problems you might encounter when working with a larger team on an APEX application. Version control, page locking, page exports and - again - splitting up an application into different sub-apps where discussed.
In between these two, Francis Mignault talked about How to Build a multi-tenant SAAS application with Oracle Application Express. Very impressive to see how they managed to support such a different style of UI for their customers, while it still is one application in the end. Using VPD, customer specific style sheets and customer specific information it seemed like we were looking at totally different apps!

Thursday to Sunday June 25 - 28
While suffering from an information overload I decided to skip the last three sessions on Thursday morning and drove to Yosemite. After a very nice drive over the Californian roads (sometimes very long and straight, just like in the movies) I arrived in Yosemite. First I went to see the really, really big sequoias. Then I drove all the way up to Glacier Point. From there you have a stunning view on the amazing wonderful environment. Another long and winding road later I ended up in Yosemite Valley where I had reserved a cabin on forehand. Lots of squirrels, chipmunks and raccoons, but no bears... The next day I headed up to Mirror Lake, and took a quick look at the Yosemite Falls. Alas I had too little time to make a big hike all the way to the top, because I had to turn in my car at the end of the day. Another fine drive to (even visited La Grange) San Francisco - driving over the Bay Bridge is really special! Early next morning to the airport to catch my 7:35 flight to Atlanta. In Atlanta my 2 hours transfer time was extended to five hours before I could get on the long second leg to Amsterdam. Back home Sunday around noon....


Thanks to Crystal and her team and all the ODTUG volunteers it was another great ODTUG conference. Hope to see you all in October at OOW or at the next ODTUG event (in Boston? Atlantic City? Orlando?).

Abstract for Oracle Open World accepted!

To my suprise I received an e-mail from the Oracle Open World Content Team that my abstract "It's Great to Integrate: Combining Oracle Forms and Oracle Application Express" has been accepted - even though it is still "in the Mix", open for voting (currently 65 votes at the 9th position).
Maybe a 'spy' attended my session at ODTUG?
Nevertheless, I proudly accepted the invitation and hope to see you all at the next Oracle event in San Francisco!

It was meant to be …

Well after an exceedingly great ODTUG Kaleidoscope conference that hopefully surpassed everyones expectations, it was time to head home. I didn't actually want to head directly home as my best mate from high school was over from Australia for a short visit with his wife, and was in San Francisco over the weekend before heading to Las Vegas, New York, LA and then back home.

I rang up our travel people and asked how much it would cost to change my ticket so I could have a night in San Francisco and on hearing it would cost $1,000 decided I would have to try my luck at the airport or fly to meet him in Las Vegas or New York.

Well I jumped on my scheduled flight from Monterrey to San Francisco on Friday morning (after checking they couldn't help me) and landed in SFO with only 45 minutes before my Chicago flight was due to take off. I thought I had no chance but decided to stand in line to ask the people at the counter. As I was standing there I watched the United message boards and saw they had 58 people on stand-by which gave me a chance.

I was sixth in line and then the second United person at the counter asked if anyone wanted to volunteer to take a later flight. I leaped to the counter and asked if I could be bounced to Saturday. The United representative was ecstatic I didn't want to get on a later flight that day as they were all full. He offered me a 2:00 pm flight, which was great but my mate was flying out at 4:00 pm to Las Vegas so I asked for a later flight. He then asked if I would mind going via Vegas which was perfect as I could fly to Vegas with my mate and then fly on to Chicago. Just to top off being bounced off a flight when you really wanted to be and placed on the perfect flight(s) he then proceeded to give me a voucher for a free return airfare.

Couldn't get any better one would think as I got to spend time with my mate and his wife, and rather than paying money was given a free ticket. But wait there's more - On getting the perfect bounce I jumped on the BART to downtown SF and called a good friend who lives in the city. This friend doesn't have a car and is always very busy at work, but I caught him at a bit of a lull on the work front. What's more he was baby sitting a car for a friend of his due to the issues with parking downtown SF. So not only was I able to meet up with two good mates at once but had a very knowledgeable local tour guide (with car no less) to show us all places we wouldn't have otherwise seen.

Ok at the risk of sounding like one of those TV Commercials ("If you buy within the next 10 minutes you will also get ...") Wait there's still more - As we were driving through Little Italy my Aussie friends said they had heard about this Italian restaurant (don't ask me the name I've forgotten, but it begins with 'T'). SF friend then proceeds to say that it is his favorite Italian restaurant so we decide we will eat there. Now this place is so popular that people stand outside for over 1 hour waiting for their table, unless you have a seasoned local who knows the inside track to reserving a table at a restaurant that doesn't take reservations. So we went and had cocktails for an hour and then walked back and sat down within minutes. Brilliant food, great company - what more could you ask for.

We then topped the night off with a "few" drinks at a place called "Gold Dust" (or something like that very near Union Square) where these three guys would play almost any song imaginable for a dollar. Even caught up with a couple of fellow Aussies from QANTAS in the bar. We stayed till closing - tortuous night - and then very wearily went out to the airport on Saturday to continue our travels.

A special thank-you to my friend in SF for making it such a memorable time for my Aussie friends and I - we all had an absolute blast.

All I can say is -- It was SO meant to be ...

Safe and happy travels to all :)

ODTUG2009 - Excel Generation With jXLS Templates

daust_de | Jun 25, 2009 14:53 -0600
On wednesday morning (08:00 am, really early) I have been presenting at ODTUG Kaleidoskope 2009 in Monterey / California.
The presentation was about "Generating complex Excel reports with APEX and jXLS".

There I first covered your basic choices when it comes to exporting data to Microsoft Excel.
Then I showed how to integrate the open source library jXLS into your APEX applications in order to generate complex Excel sheets using a templating approach.

In more general terms this was a showcase on how to integrate any kind of open source java library into you Oracle applications.

Since I have just loaded java classes into the database and made them available via a pl/sql wrapper, you can use them in any language accessing the Oracle database and calling the interface via pl/sql.

Thus, you can leverage this in applications using Forms, Reports, APEX, PHP, Java, ... You name it.

You can download the presentation slides here.

If anybody is interested, I will put up an example on how to integrate a java framework into your APEX application.

Are you interested?

Regards,
~Dietmar.

ODTUG2009 - PDF Printing

daust_de | Jun 25, 2009 09:12 -0600
On Tuesday I have been presenting on ODTUG Kaleidoskope 2009 in Monterey / California. The presentation was about "PDF Printing with APEX - A cost free alternative". There I have shown and detailed the integration of the open source Java reporting engine "JasperReports" into Oracle Application Express for PDF and RTF printing.

For designing the reports you can easily use the graphical design tool "iReport Designer". It will generate the report definition file for you.

The combination of JasperReports and iReport Designer is a real good alternative to the very expensive reporting solution using the BI-Publisher.

You can download the presentation slides from here.

I will make this integration available for free! Right now I have very many things on my list to do, but I will make it available in the future.

If you are interested in such an integration, please drop me a note at: dietmar.aust@opal-consulting.de.

Regards,
~Dietmar.

ExtJS trees with JSON data source in APEX

Tobias Arnhold | Jun 25, 2009 02:23 -0600
I worked a bit around with ExtJS trees and their implementation into APEX using JSON data sources. For me it's just a start sooner or later there will come more examples about it.

I made a new test page so feel free to try it: ExtJS tree examples

ExtJS navigation tree

Tobias Arnhold | Jun 25, 2009 02:23 -0600
Hi folks,

I added an ExtJS navigation tree to my example application. To get the JSON data out of the database I created a small package which is dynamically creating this data string on every page load.

Take a look at the updated source code: AAW - ExtJS navigation tree

I got some request about the application installation file (application source code). So I decided to publish it to everybody how asks for it via email: tobias-arnhold@hotmail.de
I would use the same procedure as Denes does. You get an developer account and can download the current version yourself.

PS, feedback is always welcome! :D

ExtJS theme switcher for APEX

Tobias Arnhold | Jun 25, 2009 02:23 -0600
I integrated an ExtJS theme switcher in my example app.
How to?
ExtJS theme switcher for APEX (includes example + description)

I fixed a bug when you accessed a page (!= 1) the APEX tree area was empty.
I just changed the startup script to an application process.

DBMS_SCHEDULER examples

Tobias Arnhold | Jun 25, 2009 02:19 -0600
May be interesting to some of you which haven't had the time testing and working with the DBMS_SCHEDULER. I collected some examples to show what is possible with that amazing tool.

DBMS_SCHEDULER is an internal Oracle package (since Version 10g) which provides database driven jobs.
It's divided into 3 parts:
  • Time schedule part - dbms_scheduler.create_schedule
  • Program declaration part - dbms_scheduler.create_program
  • Job (conflation) part -dbms_scheduler.create_job
Examples of the dbms_scheduler.create_schedule part:

begin
-- daily from Monday to Sunday at 22:00 (10:00 p.m.)
dbms_scheduler.create_schedule
(schedule_name => 'INTERVAL_DAILY_2200',
start_date=> trunc(sysdate)+18/24, -- start today 18:00 (06:00 p.m.)
repeat_interval=> 'FREQ=DAILY; BYDAY=MON,TUE,WED,THU,FRI,SAT,SUN; BYHOUR=22;',
comments=>'Runtime: Every day (Mon-Sun) at 22:00 o'clock');

-- run every 5 minute, every day
dbms_scheduler.create_schedule(
schedule_name => 'INTERVAL_EVERY_5_MINUTES',
start_date => trunc(sysdate)+18/24,
repeat_interval => 'freq=MINUTELY;interval=5',
comments => 'Runtime: Every day all 5 minutes');

-- run every minute, every day
dbms_scheduler.create_schedule(
schedule_name => 'INTERVAL_EVERY_MINUTE',
start_date => trunc(sysdate)+18/24,
repeat_interval => 'freq=MINUTELY;interval=1',
comments => 'Runtime: Every day every minute');

-- run every Sunday at 18:00 (06:00 p.m.)
dbms_scheduler.create_schedule
(schedule_name => 'INTERVAL_EVERY_SUN_1800',
start_date=> trunc(sysdate)+18/24,
repeat_interval=> 'FREQ=DAILY; BYDAY=SUN; BYHOUR=18;',
comments=>'Runtime: Run at 6pm every Sunday');
end;

Example of the dbms_scheduler.create_program part:

begin
-- Call a procedure of a database package
dbms_scheduler.create_program
(program_name=> 'PROG_COLLECT_SESS_DATA',
program_type=> 'STORED_PROCEDURE',
program_action=> 'pkg_collect_data.prc_session_data',
enabled=>true,
comments=>'Procedure to collect session information'
);
end;

Example of the dbms_scheduler.create_job part:

begin
-- Connect both dbms_scheduler parts by creating the final job
dbms_scheduler.create_job
(job_name => 'JOB_COLLECT_SESS_DATA',
program_name=> 'PROG_COLLECT_SESS_DATA',
schedule_name=>'INTERVAL_EVERY_5_MINUTES',
enabled=>true,
auto_drop=>false,
comments=>'Job to collect data about session values every 5 minutes');
end;

Examples to change dbms_scheduler settings:

begin
-- change start time
DBMS_SCHEDULER.SET_ATTRIBUTE(
name => 'INTERVAL_EVERY_5_MINUTES',
attribute => 'start_date',
value => to_date('22.06.2009 12:15','dd.mm.yyyy hh24:mi')
);

-- change repeat interval
DBMS_SCHEDULER.SET_ATTRIBUTE(
name => 'INTERVAL_EVERY_MINUTE',
attribute => 'repeat_interval',
value => 'freq=MINUTELY;interval=2'
);
end;

Example to run job immediate:

begin
dbms_scheduler.run_job('JOB_COLLECT_SESS_DATA',TRUE);
end;

Select job status:

-- All jobs
select * from user_scheduler_jobs;

-- Get information to my job
select * from user_scheduler_job_log where job_name='JOB_COLLECT_SESS_DATA';


Further information about the DBMS_SCHEDULER:
http://psoug.org/reference/OLD/dbms_scheduler.html
Oracle documentation about the DBMS_SCHEDULER

These scripts are tested in an Oracle XE environment (10.2.0.1).
I will extend this post whenever I need new scripts.