Skip to main content

Setting the starting point for KScope2011: Get XFILES running...

As a preparation for a joint presentation with Marco Gralike for ODTUG Kaleidoscope 2011, I tried to (re)install the not-yet-so-famous XFILES Application. That application was the result of the collaboration of Mark Drake (Sr Product Manager XMLDB) and Carl Backstrom. They did a presentation about it during OOW2008. The idea behind the presentation/application was leveraging the power of XML-DB with an APEX UI. Due to Carl's tragic car accident, the application never reached a final stage. Marco already did a sequel about XFILES on his blog. You can also find a download link to the latest version of the application there.
But back to the installation....I used the OTN Developer Days VM as a start and patched it with the latest APEX patch (4.0.1). There is a sort of how-to included in the XFILES download, but that isn't flawless (yet). But after executing all the steps I fired up the application and got this:


So all my images where missing. Inspecting the code learned that the images had a path of /XFILES/APEX/lib/icons/, so not pointing to images included in the application itself (as Application or Workspace Images) but to a directory on the filesystem....that wasn't there.  If I entered http:/localhost/XFILES I did get the directory listing. And drilling down I could see the images. After some investigation it turned out that localhost was using the standard port 80, which was used by the (standard installed - or done by the XFILES installation ??) Embedded PL/SQL Gateway (EPG). And I was using the Apex Listener (with Apache/Tomcat) on port 8888. So the APEX Listener was looking for the XFILES directory on it's root (/home/oracle/apache-tomcat-6.0.20/webapps/ROOT). So in order to get the images in my application I could just extract them from the XDB Repository and copy them onto the filesystem. But that would have been too easy ;-). I though it would be more fun if I could create a mapping from the right location on the filesystem into the right location in the XDB Repository! But as I am not a *nix wizard - nor a XML-DB guru -, I couldn't quite figure out how to do that - even after some Googling around . So I send out a "help Tweet". But it is hard to explain a situation in just 140 characters...
Nevertheless I got a lot of replies (thanks Learco, Iloon, Jacco, Peter, etc). But Marco acted as my mainstay and Skyped me. And just like Marco is, he dived in deep and came up with a solution! And wrote a long post about it...
But in short there are only two additional steps necessary:
1. Create the XFILES directory on the webserver :
/home/oracle/apache-tomcat-6.0.20/webapps/ROOT/XFILES
2. As su, mount the XFILES Folder in the XDB Repository to that directory:
mount -t  davfs  http://localhost:80/XFILES /home/oracle/apache-tomcat-6.0.20/webapps/ROOT/XFILES

And the result is:


The funny thing about this solution is, that I - as a user - can replace one of the images with my own one and it will immediately show up in the application itself:


Now I first have to solve a performance problem, because the app is deadly slow... Maybe just because of this solution? Don't know yet, will have to find out!
After that the next step is to make it a full blown APEX 4.0-style application, before moving on...

Comments

Roel said…
I am already convinced that the "map Unix directory to XDB folder" doesn't speed up performance... If I replace the mounted directory with a real one, the response time increases dramatically...

Popular posts from this blog

Filtering in the APEX Interactive Grid

Remember Oracle Forms? One of the nice features of Forms was the use of GLOBAL items. More or less comparable to Application Items in APEX. These GLOBALS where often used to pre-query data. For example you queried Employee 200 in Form A, then opened Form B and on opening that Form the Employee field is filled with that (GLOBAL) value of 200 and the query was executed. So without additional keys strokes or entering data, when switching to another Form a user would immediately see the data in the same context. And they loved that. In APEX you can create a similar experience using Application Items (or an Item on the Global Page) for Classic Reports (by setting a Default Value to a Search Item) and Interactive Reports (using the  APEX_IR.ADD_FILTER  procedure). But what about the Interactive Grid? There is no APEX_IG package ... so the first thing we have to figure out is how can we set a filter programmatically? Start with creating an Interactive Grid based upon the good old Employ

apex_application.g_f0x array processing in Oracle 12

If you created your own "updatable reports" or your custom version of tabular forms in Oracle Application Express, you'll end up with a query that looks similar to this one: then you disable the " Escape special characters " property and the result is an updatable multirecord form. That was easy, right? But now we need to process the changes in the Ename column when the form is submitted, but only if the checkbox is checked. All the columns are submitted as separated arrays, named apex_application.g_f0x - where the "x" is the value of the "p_idx" parameter you specified in the apex_item calls. So we have apex_application.g_f01, g_f02 and g_f03. But then you discover APEX has the oddity that the "checkbox" array only contains values for the checked rows. Thus if you just check "Jones", the length of g_f02 is 1 and it contains only the empno of Jones - while the other two arrays will contain all (14) rows. So for

Stop using validations for checking constraints !

 If you run your APEX application - like a Form based on the EMP table - and test if you can change the value of Department to something else then the standard values of 10, 20, 30 or 40, you'll get a nice error message like this: But it isn't really nice, is it? So what do a lot of developers do? They create a validation (just) in order to show a nicer, better worded, error message like "This is not a valid department".  And what you then just did is writing code twice : Once in the database as a (foreign key) check constraint and once as a sql statement in your validation. And we all know : writing code twice is usually not a good idea - and executing the same query twice is not enhancing your performance! So how can we transform that ugly error message into something nice? By combining two APEX features: the Error Handling Function and the Text Messages! Start with copying the example of an Error Handling Function from the APEX documentation. Create this function