Tuesday, 22 December 2009

Apex 4.0 for Forms Developers

It was less than a week ago I woke up to a flurry in the Apex folder of my RSS feed and I knew something Apex related had been announced!

After reading Dimitri's comments regarding Apex 4.0's Tree View vs Component View, I had to learn more about this new view as it immediately made me think of all the Forms programmers out there learning Apex.

In addition to Oracle's Apex page dedicated to Forms developers, their Oracle Development Tools Statement of Direction states that instead of creating migration tools, they wish to create environments that expose similar concepts as Forms and Reports, giving to Forms and Reports developers the opportunity to become productive in a new, but familiar environment.

So as soon as I saw Apex 4.0's tree view, it made me think of the Oracle Forms object navigator.


Compared with the Forms object navigator, today's technology provides the Apex team with the ability to create a more dynamic environment. The browser environment, however, does also bring it's drawbacks.
Expanding and collapsing in Forms, while minor, did create time saving opportunities.

As Dimitri noted, the tree view does also limit the information you can see at once, such as conditions. I can foresee having to locate these via tool-tips may become frustrating.
On the plus side, the quick drag and drop feature will be handy, and the right mouse click is context sensitive


 I do agree with Dimitri in his comment that the tree view does provide an insight to the overall page process. This can assist Forms developers and those new to the Apex environment, but let's not forget the Page Events view.

Previous to Apex 4.0, this was one click away - however now it's three clicks and two pages away.
Utilities -> Additional Utilities -> Page Events

This Page Utilities option offers some new layouts that may turn out to be useful, plus a location to store links for some existing features.

The grid edit of pages is a nice way to modify those attributes, and navigate to the relevant pages - but does take time to navigate to. The page attributes also provides a potentially useful summary detailing counts of various page components.

There are also subtle changes around the place, one I do like is the runtime Developer Toolbar is now "frozen" to screen like a semi-transparent frame.



After a quick browse through the Application Migrations section, there are no obvious changes to the Forms to Apex conversion utility - including fixing some issues I uncovered while writing my presentation.

In an overall perspective, I think more screen real estate is unnecessarily used - particularly by the main application page. For those of us using laptops, screen height can be an issue. That being said, I do look forward to seeing how useful the various new dashboards can be.

As for the tree view, I'm undecided where I may spend most of my time. I think while it does illustrate the page processing very well, those familiar with Apex intricacies may stick with the existing screen showing more information is shown without interaction, and where double clicking is not necessary.

This is all without mentioning the extra coding grunt being provided out of the box. Keep a close eye on the Apex blogs for more information on these.

Friday, 18 December 2009

11g Documentation trick

One handy tip I learned at the conference wasn't at one of the seminars, but whilst having an amber ale with my esteemed colleague Connor McDonald.

Neither of us seem to be a fan of the expand/collapse feature in Oracle, nor the navigation bar. However it was Connor that took the time to find a simple edit to restore the look and feel to pre 11g levels.

Where your local version of the documentation is stored, simply rename this file
.\dcommon\js\doccd.js

And instead of the documentation looking like this on entry, requiring more clicks to do anything of use:


It will look like this, all ready to search for your keyword of interest:


The main page will retain it's little search area, although if you use that, it will search online - so you might as well utilise something a little more powerful and handy like Ubiquity.


I don't know what the folks at Oracle Documentation HQ think of this, but at least it's not tinkering unlawfully with the database.

Wednesday, 16 December 2009

JQuery Datepicker

Recent suggestions indicate that JQuery will be included as one of many new features in Apex 4.0, so why not start having a play with it now?

Take the example of the JQuery datepicker. The original date picker that comes with Apex reminds me of web applications from yesteryear, and it's welcoming to see a feature that feels integrated with the web page.



The documentation for these features are thorough and at first glance can seem a little overwhelming, so why not illustrate an example specifically for Apex? There are a few sets of instructions out there in the Apex blogging world, but this is what I found useful when I wanted to experiment with the features, plus a few thoughts of my own.

1) Download the bundle of components from jqueryui.com/download
Here you can select the theme your interested in - perhaps match it up with the theme you're using for your Apex application. You can also select what components are going to be included. If you want to keep your application light, deselect those you do not need, or you can prepare multiple copies and attached the relevant ones to the relevant pages in your application - you have a few options for this I'll mention shortly.

The download will also include an index.html to the development-bundle folder, allowing you to demonstrate with a local copy of the scripts.

2) Make the files visible to your workspace.
The following files are a must for the components to work
jquery-1.3.2.min.js -- this represents the functionality core to jquery, all components will need this script
jquery-ui-1.7.2.custom.min.js -- this will include any components you've checked in the build stage on the JQuery website
jquery-ui-1.7.2.custom.css -- this of course represents the theme you selected. Without it things will look a little strange.

If you're working with the embedded PL/SQL gateway, you will need to upload the files as Static Files or Images in Shared Components. By the looks of the CSS, JQuery doesn't seem to be built to easily adapt to this Apex setup, so you may have difficulties incorporating the images. If you wish to use JQuery, I'd suggest using Apache.

If you're working with Apache, they will need to reside somewhere in your /i/ folder. Note the images will need to be in a folder called ./images, relative to the location of the CSS file.
ie -
./apex/images/css/jquery-ui-1.7.2.custom.css
./apex/images/css/images/ui-icons_ef8c08_256x240.png

3) Include the scripts as part of your page
When referring to file locations, Apache will refer to #IMAGE_PREFIX#, and the embedded gateway to #WORKSPACE_IMAGES#
Further to this, it would be better practice to store your file location in a computed application that will return the relevant file location depending on your environment, for instance:
<script src="&F_FILE_LOCATION.jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="&F_FILE_LOCATION.jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script>
<link type="text/css" rel="stylesheet" href="&F_FILE_LOCATION.jquery-ui-1.7.2.custom.css" />
Some people choose to place this within the template, others like to include it in page zero where it may be conditionally included in various pages. This condition could be to include the JQuery scripts only on pages that utilise it. If you want to be really specific, you can include different scripts representing different components. You don't need to use the custom script you generated, you could refer to the specific .js files as required - check out the documentation for further tips.

4) Invoke the JQuery code
Within the page that will utilise the JQuery feature, you need to invoke the relevant function during page load. Again there are a few options here:
a) Include the following script in the source of the page
<script type="text/javascript">
  $(document).ready(function(){
    $(".datepicker").datepicker({
    showOn: "both",
    buttonImage: "#IMAGE_PREFIX#asfdcldr.gif",
    buttonImageOnly: true,
    showOn: 'button',
    dateFormat: 'dd-m-yy'
    });

  });
</script>
Edit - modified dateFormat to match documentation.

And apply to the item's HTML Form Element Attributes property:
class="datepicker"

b) Include the same code, but in the highlighted line 10, add referenced to your selected items:
$('#P1_MY_DATE').datepicker();

c) Or apply the date picker to all items in the application
<script type="text/javascript">
  $(function(){
  // Convert all Datepickers to a jQuery DatePicker
  // Remove the native Oracle Apex DatePicker and add JQuery one
    $("td.datepicker")
    .next("td")
    .remove()
    .end()
    .children("input[type!=hidden]")
    .datepicker(
    { dateFormat : 'dd-mon-yyyy'
    , showOn : 'button'
    , buttonImage: "#IMAGE_PREFIX#asfdcldr.gif"
    , buttonImageOnly : true
    });
  }); 
</script>

And voila! You'll have applied a JQuery component to your application. Why not start playing with other widgets?

Stay tuned for the implementation process come Apex 4.0

Monday, 14 December 2009

How Developers should ask for help

Back in October ZDNet Australia posted a brief video interview of Tom Kyte describing How developers should ask for help (linked by Eddie Awad). I thought I'd mention it now since I was talking to a few colleagues at the recent AUSOUG Conference and they don't recall seeing the video.

When I was first learning Oracle, I spent about 20 minutes every morning reading entries on AskTom and learned a lot! You also get a feel for someone's personality when you continuously read responses to questions posted by all varieties of people. Frankly, Tom's a witty fellow. I especially like his oft used analogy of comparing apples to toaster ovens.

I also empathise with some of his pain in responding to questions that simply don't provide enough information. I must say I particularly agree with Dan Wilson's reply in the comments section. Regardless of the forum to which you may be posting a question, it's so important to provide a context, frame of reference, ins and outs etc.

Put yourself in Tom's shoes - what information would you like to receive from someone asking you a question about a technological problem? Do you want to hear "Why doesn't this query work?" or would you like to be provided with a really simple test case that provides you the ability to tinker straight away?

I also liked Tom's explanation of why he doesn't respond with RTFM. Not only is it important for everyone to learn by doing, it's also important for people to learn how to effectively find the correct documentation themselves - which should be the first step to nutting out a problem before you even consider approaching anyone. I'm passionate about documentation, and technical queries on Oracle functionality spurred me into writing my presentation on documentation usage.

Another analogy I find is when my eldest child tries to tell me about something in a book he's reading. Unless he puts it in context for me, I'm not really going to understand why it's funny. Or perhaps when I ask my father how to do some handy work around the house. I might ask him specifically how to do something, but if I don't even give him the bigger picture, he may not know to explain the even easier solution using different tools I wasn't even aware of.

This concept applies true to so many fields and situations.

Friday, 11 December 2009

Interesting topics while I was gone

Not surprisingly, the world still ticks - even when I'm on holidays.

I've finally caught up with my RSS feeds - the work related ones anyway - and I've compiled a brief list of those that caught my eye in particular. When trying to catch up on three weeks of feeds, the best reads tend to stand out.

Comparing Oracle & MySQL - this may become more relevant as time goes on, and will certainly be useful every time my MySQL friend asks me Oracle questions.
Oracle XE 11g - while I'm not waiting for it, that would be a useful release, particularly for those who want to tinker and learn from home.
asktom.oracle.com/tkyte - I spotted the loss not long after Tom jumped domains, so it's good to see all his reference scripts made available again.
Multibyte characters - I encountered this issue recently, but not because I was coding for another language. I was importing data files that contained characters that I wasn't expecting, so I had to consider width as Alex described even though I was substringing a particular length.
Unwrapping PL/SQL - It's amazing how many people are curious about this.
Apex & Web 2.0 - There are some great demo applications linked through here.

And as I write this my replacement laptop power adapter arrived - let's hope it works. No more excuses for me!

Apex Application Alterations

Here is a tidbit I noticed that may be useful to someone.

Sometimes there comes a need to compare two applications to determine differences. Typically, this would be comparing an older version of the same application to see what has been changed (and try to determine why!)

Doing this via a text comparison of the export is tough. A simple compare of text files in TextPad gave me 5000 lines of differences for a copy of an application where I made one change! This would of course be due to the differences in IDs for all the objects. Perhaps an expert in text comparison tools may suggest an alternative there.

The Application Express builder provides a comparison tool for you. Once you have one of the applications selected, click on the Application Reports link in the Task List.

One set of application reports is "Cross Application"


There are two comparison reports, as opposed to the attribute listings:


Now this is an output of differences between my two applications, one was a copy where I made an attribute change of an item in a form.

The Show Details checkbox option does little to illustrate the difference Apex found, but the report can be a good starting point to debugging and locating a problem you may have.

In this case the Application Attribute difference is obvious - the application alias would have changed.
Page 7 relates to my change, so it seems to be highlighting some difference in the page itself, in addition to the item I modified. If the algorithm is using some form of checksum to make the comparison, this is not exceptional.
I didn't look into the page 35, where there is a blob displayed, nor the page templates.

If this is a task you may perform semi-regularly, they may be anomalies/expected behaviour you come to expect from the comparison and learn what is safer to ignore.

Monday, 30 November 2009

Review - Oracle Application Express Forms Converter



Recently in the blogosphere - not just Oracle related blogs – I’ve noticed an increasing number of book reviews. Normally I’ve found these reviews are by authorities as part of the regular marketing campaign. As with other industries, new forms of marketing evolve – in this case one that facilitates professionals in the field an opportunity to provide critique on new texts.

I was recently provided the opportunity to review a book discussing how to use Oracle’s tool to convert Forms applications to Application Express: Oracle Application Express Forms Converter by Douwe Pieter van den Bos. This book, published by Packt Publishing, is the first of its kind on this subject matter, and you may have seen the cover if you regularly visit Oracle based blogs – particular specialising in Apex. This opportunity is in part due to the fact I’m presenting on this very topic at this year’s AUSOUG conference series.

It’s a tough topic. Oracle Forms has a large presence throughout the world, but it’s ageing. Support is consistently being extended, however this support is predominantly there to keep it stable. Oracle is suggesting to customers to move towards new environments such as ADF and Application Express.

Converters between technologies have been around for a long time, and Oracle offers an Oracle Forms to Application Express conversion tool. There are many facets to a conversion between technologies, and the industry is typically aware that a tool will rarely be a silver bullet. There are such fundamental differences between technologies and human interaction and guidance is always required.

Accompanying documentation with the tool is regrettably lacking. While it describes the conversion process using the product, it doesn’t go into detail about what else needs to be done - so the situation is ripe for a book offering.

When reading books, fictional, non-fictional – and the subset of that being technical manuals, I always seem to be lucky in selecting the good ones. I rarely find myself reading a bad book, which is lucky since like movies, I don’t want to stop regardless of how bad it is – curiosity killed that cat.

Unfortunately, I feel compelled to give this book a less than enthusiastic review. To the author’s credit, it’s partially due to what I feel is not only a disappointing tool, but a difficult concept to actualise as software.

The book starts very well, dictating exactly what the book offers and provides no disillusion to the reader about what the conversion itself offers. David Peake’s foreword offers insight into how the tool came to be, and the author’s preface re-iterates how much work will be required to convert the application between the two disparate technologies.

Each chapter is just like the copybook for presenters. Say what you're going to say, say it, say what you've said. I like this, personally it reconfirms what you've learnt, and it makes it a little easier to find things in future. It reads very much like a blog or OTN article, which works well for me. I remember some texts from University being very dry as it just stated facts, where if the book almost forms a conversation between the author and reader, it makes concepts easier to learn and your attention is kept.

The book stated in the preface "because this book is written for developers and analysts who know both Forms and Apex." I think this is the perfect target audience as for this subject best value would be obtained by directing attention to developers who have a decent understanding of both products. Suggest to readers whose knowledge of Application Express is low to read an Application Express specific book such as Pro Oracle Application Express by John Scott and Scott Spendolini (so many Scotts!). As a reader of this book I really want to know the ins and outs of conversion – not just the tool itself but all considerations that need to be made since the tool will only handle a small percentage of the conversion.

For this topic I feel a fair and safe assumption would be, for example, a decent understanding of how to create an LOV in Apex. The author, however, spent time discussing some of these Application Express basics which detracted from the main topic of conversion. During my presentation I stated the assumption that the audience knew how to enhance Apex – this allowed me to concentrate on the issues that would be faced during the conversion and what components needed to be targeted.

On a positive note, it does make a presumption you've got decent knowledge about the sample application they're converting, which is fine if again you consider that you want to understand the process – not a description of the sample application which is really just a catalyst. There is always a concern that the sample application is tweaked and diluted to show the strengths of the tool. In a basic sample application I created during my experimentation, I found many more issues that needed to be considered.

After a strong start where we heard how difficult a conversion process can be, I felt the chapters were finishing too quickly. For instance Chapter 5 talked about “Getting your Logic Right” - where you can edit the queries used. I found this to be the buggiest part of the process and no mention of these problems were made.

At 10 pages, Chapter 6 on the actual conversion was thin. The author talked about how we can “edit the most important parts of the application”, yet he just seemed to describe aesthetics – even then to surface level detail. I found this process to be the source of the most frustrating elements of the conversion - item types weren’t carried across; ordering of items was indeterminate; and usage of UI defaults were necessary but not mentioned in the book. For a large application, the list of pages to be generated would create more confusion for the developer than to have just created all pages from scratch. My sample application caused generation errors, but why didn’t the author didn’t cover this possibility?

Chapter 7 is when we see the author question our knowledge of Apex, presuming we don’t know its standard features. The LOV example I found demonstrated the author deviated from the topic of conversion to that of educating about Apex, which is a shame because it was a good time to highlight the fact we were missing components from the conversion; describe how to properly address it; how long it may take to do so; and how we could use annotations to continue effective management of the conversion – probably the most useful feature of the conversion tool.

I think sometimes the author gets a little off topic, even though he promised not to earlier on when stating targeted audience. For example in his final chapter he talks about security and pulling multiple applications together, too far removed from the conversion process for my liking.

Documentation on Application Express is already pretty thin, especially when comparing against the comprehensive documentation found for the database. Don’t expect this to be the manual for converting your Oracle Forms applications to Application Express - it’s a wonderful starting point to understanding how to use the tool, but not great at mitigating likely issues of your conversion.

In the interest of fairness, other reviews of this book can be found on the following blogs:
Marc Sewtz
Roel Hartman
David Peake