Wednesday, 29 December 2010

Basic Apex scripting - show/hide & labels

Sometimes the scripting requirements for an Oracle Apex page are fairly simple, yet determining the required modifications can be frustrating, particularly for a beginner in either Apex or HTML behaviours.

Recently I had the requirement of showing or hiding both the label and input item, depending on the selection within a select list.
So with this example, let's say my requirement is to hide the "Other Description" label and input item if "My select list" equals "- Select me -"
Otherwise, display the items and as an added bonus - set the label to the value of the selected list item.

First I need to modify the label so I have the ability to reference it in my JavaScript. So I edit my P1_OTHER_DESCRIPTION field and extend the HTML Table Cell Attributes in the Label section (not the Element section).
Here I added id="label_other"

Now I can define a script to do my work. It's highly likely this script will be used solely on this page so there's no real harm in adding it directly to the page attributes - unless you have a dedicated JavaScript file you add your scripting code.

So this would be added to the page footer text:
<script language="JavaScript" type="text/javascript">
<!--
function toggleOtherDesc(){
  $f_Hide_On_Value_Item('P1_MY_SELECTLIST',['P1_OTHER_DESCRIPTION','LABEL_OTHER'],'hide_desc');

  //I could also change my actual label, for instance to the value of my select list input item
  document.getElementById('LABEL_OTHER').innerText = $v('P1_MY_SELECTLIST'); 
}
toggleOtherDesc();
//-->
</script>
Some points to note here

  • $f_Hide_On_Value_Item is a pre-defined function you can call to hide a list of items based on the value of another. Its behaviour is documented online here. In this case I listed both the label I created an id for plus, the item name - surrounded by square brackets as to define an array.
  • 'hide_desc' is the value I've set in this case when the input description is '- Select me'
  • .innerText allows me to set the descriptive label, as long as I supply the id I defined for the label, not the item name you see in the Apex builder.
  • $v will return the value in the field, as it would be posted. This is also documented in the JavaScript API reference page.
  • The highlighted line 9 means the function will be called when you open the page, in this case after it's rendered. That way the fields will be shown/hidden depending on the set value in the select list.

Lastly, I can modify the P1_MY_SELECTLIST item to call the JavaScript each time the selection changes.
So I add onChange="javascript:toggleOtherDesc();" to the HTML Form Element Attributes in the Element section.

So the final product will change the label to the selected value in the select list, or hide the label and input field if '- Select me -' is chosen.
There you have it!

Thursday, 23 December 2010

Holiday season cometh, want to decorate your laptop?

It's almost a long weekend. Awesome!

Firstly, I'd like to offer a brief sentiment: some people around the world use this time to celebrate Christmas. I find it a somewhat uncomfortable time because I am one of few in my country, certainly in my circle of friends and family that do not. For those curious, recently someone else found almost the perfect words that fit my noggin. I guess I find solace in the fact that at least a third of the world's population don't celebrate it either.

However... for those of you that do, I have a great (albeit late) gift idea for you! They are called Laptop wraps, and here is a funky design example:


For those with small to large businesses, you may even consider it a great tax write-off while promoting your business. During this year's conference, we certainly had many people interested in having one designed to suit their brand. As I was going through the airport scanners recently, it even caught the favourable and approving eye of some of the security staff. Here is my laptop -


So if you want one (or many), my sister, Vicki, is in the process of populating her website full of various ideas along the same concept. It doesn't matter where in the world you live, you can order one of these; and/or ask her to help design one to suit your business or taste. So give it a visit: ArtWraps.com.au

They're pretty easy to apply, I used a ruler, some scissors, credit card, and a screen-cloth (which you can see in the photo)

I think you'll agree the final product looks a lot better than advertising for the company who built your chosen laptop. And for those consultants out there, what better way to promote your brand. I'm getting comments everywhere asking about it (and yes, sis, I'm letting them know about you ;-)

Maybe if you're a complete Oracle/Java fanboi, you could borrow a design from here ;-)
As a little extra plug, she has another website promoting her graphic design business, she's been doing all sorts of design activities and sign-writing for years - www.grovewesley.com

Anyway, I hope you all enjoy whatever it is you choose to do this time of year, and make sure you have a relaxing time doing it. Being around 35C here in the southern hemisphere, I won't be far from the beach or a pool.

Happy holidays!

Wednesday, 22 December 2010

Modifying Apex Tab behaviour

Today I was having a minor battle with tabs in Oracle Apex (3.2).

Sometimes you don't necessarily want it to submit the page when you click on a tab, so I was having a think about options to override the functionality.

I found an interesting discussion here on OTN, but I came up with something else involving On Demand processes. I'm still deciding whether it's an overkill for my situation, but I thought I'd post it as it may help someone else one day.

The solution involved :
  1. Current tab page template
  2. Script on page zero
  3. On-demand page process
My original "Current Tab" in my page template looked like this:
<td class="t9tabCurrent">
<a href="#TAB_LINK#" class="t9tabCurrent">#TAB_LABEL#</a>
#TAB_INLINE_EDIT#
</td>
I modified it to:
<td class="t9tabCurrent">
<a href=javascript:tabNav("#TAB_LINK#") class="t9tabCurrent">#TAB_LABEL#</a>
#TAB_INLINE_EDIT#
</td>

This calls a script I defined on page zero, passing through the original #TAB_LINK# code.
<script language="JavaScript">
<!--
function tabNav(p_orig)
{
  var get = new htmldb_Get(null,$v('pFlowId'),'APPLICATION_PROCESS=tab_target',$v('pFlowStepId'));
    get.addParam('x01',p_orig);
    vReturn = get.get();
    window.location = vReturn;
}
-->
</script>
The script will catch any click on the tab set. It takes the #TAB_LINK# substitution value and sends it to the on-demand process for processing. Then it re-directs the page to the resulting vReturn value.

My on demand process just encapsulates the code, so it's a call to a package I have defined. The g_x01 variable is the value I added in the AJAX call :
htp.p(my_pkg.tab_target(apex_application.g_x01));
This function definition simply replicates existing behaviour, but without the page submit.

FUNCTION tab_target
  (p_source  VARCHAR2)
  RETURN VARCHAR2 IS
-- Replicate tab functionality, but not as a submit
  lc_target  VARCHAR2(200);
  lc_delim   VARCHAR2(1) := q'[']';
  ln_session NUMBER := nv('SESSION');
  ln_app_id  NUMBER := nv('APP_ID');
  lc_debug   VARCHAR2(5) := v('DEBUG');
BEGIN
  SELECT 'f?p='||ln_app_id||':'||tab_page||':'||ln_session_id||'::'||lc_debug||':' -- essentially existing behaviour
  INTO  lc_target
  FROM  apex_application_tabs
  WHERE application_id = ln_app_id
  AND   tab_name = SUBSTR(p_source -- obtains T_HOME from -- javascript:doSubmit('T_HOME')
                         ,INSTR(p_source,lc_delim)+1
                         ,INSTR(p_source,lc_delim,1,2)-1-INSTR(p_source,lc_delim));

  RETURN lc_target;
END tab_target;
You could extend this to do whatever you like, depending on which tab has been pressed. I know in the past I've considered wanting to pass parameters on tab press...

Hopefully all the code is displayed ok, I'm having trouble finding an easy way to paste html examples into blogspot. I'm happy for any suggestions on that matter...

So, is anyone still working or reading blogs right now, or am I one of few? ;-)

Thursday, 2 December 2010

The bar has been raised

One day, I'd like to see something like this at an Oracle event.



Sure, it might be a little difficult if it's live, but I'm sure the technology will get there. Perhaps we'll see more of this type of thing once our broadband network gets up to scratch.

On a side note, look out for circles that do wild things - Japan in the 40s (medium red dot), China in the 50s (big red dot), Rwanda in the 90s (little blue dot), Middle East in the late 90s (green dots)... sense a trend?

Apparently Hans Rosling has some good TED talks, I might have to look those up.

Spotted at Pharyngula 

Tuesday, 30 November 2010

My thoughts on presenting

When it comes to presenting on Oracle topics, I am by no means a professional, nor would I consider myself an experienced presenter like Penny Cookson or Connor McDonald - in fact the delivery he mustered at this year's conference was outstanding.

I currently have seven presentations under my belt with 13 deliveries. I've experimented with a few different styles in an attempt to find what works best for me.

That being said, I'd like to offer a few words & discoveries to those newer at this to me, or even those considering submitting a presentation for your local event, without sounding like this.

#1 - nobody wants you to fail

Given the feedback and support I received as a new presenter, I immediately got the feeling that people wanted me to succeed.
As an attendee to many a presentation at conferences, branch meetings and other events - I'm sure I share the feeling amongst others that you will the person behind the lectern to succeed regardless of troubles faced.
As a volunteer at AUSOUG conferences, I've overheard conversations and witnessed feedback provided even when a demonstration blue screens at the critical moment - people are on your side.

We are all human, we want our fellow species to succeed in that position that many fear over death.

#2 - write a presentation

It sounds a little silly, but keep an eye out for an idea then start writing one. Do it from the top down - get yourself three main objectives, an agenda, a list of issues to cover, some slide headings... it flows. You don't have to commit yourself to a particular date - although that does help some people. However, once you have one in the bag, more ideas come from a variety of sources.
After years of looking procrastinating, now I've always got a handful of topic ideas that I'd love the time to investigate and write. If you're struggling to think of anything, look through past conference programs or have a look here - Tom Kyte started a discussion on it.
Stick with topics that interest you, because ultimately you will know these topics very well and that knowledge will enhance your career, either through product knowledge for your job or prospective clients witnessing your skills. Once again, I think Seth pretty much nails it.

Once you have it in the back of your mind, it's amazing where topic ideas come from.

#3 - be prepared

I'm not sure I can emphasize enough the importance of this one. I think Connor did the same when he was providing advice before my first session. I said above that people are ultimately there for the content - and if that isn't up to scratch, what do you have left? Your charm and charisma? We does that get car salesmen?

So what does it mean to be prepared? Ultimately, I think it means you must know your content. You must be able to rationalise a question and construct a response based on your understanding of the fundamentals, not just regurgitate a crammed fact. We all learnt from this mistake in high school. Sometimes with bleeding edge content you won't know information, or if the question borders the scope of your presentation. Then you just need the confidence to say "I don't know", then carry on further to say it would be good to investigate, or offer a way to potentially test the issue. That comes from understanding.

Preparation should also relate to any demonstrations you may have. Rule 1 - always have representations of your demo in slide form, you never know what's going to happen on the day. If you repeat the presentation one day, it will also be a nice reminder of how things were meant to happen. You can also use it to post your presentation on the net.

It's also a good idea to ensure your demonstrations are repeatable. Just like your polished production-level scripts, it's a good idea to have a test case that will clean itself up and be able to execute it more than once. People may like to see that example shown again. You don't want flaky demonstrations because it's difficult to think on the fly if something goes wrong.

Have a trial run at home. Present your slides to your wall/pet/partner/colleague - whatever works. Do it in front of a mirror to see your mannerisms and see if you move too much. Make sure you're speaking fluently, know what words you want to use. Make sure the slides flow and make sense together. Be consistent and make most of the clicking change the actual slides and limit internal events, you may forget they exist.

Connor gave me a rule of thumb and suggested you know the content of the next 2-3 slides. I noticed in Chris Muir's recent effort he had little grey text in the bottom corner to prompt what the next slide was about.

At the end of the day, the audience will know the difference between someone who has put the effort in and understands their content vs a fraud who is stumbling their way over plagiarised content.

#4 - simplify content

What do you want to see in a presentation? Nitty gritty detail that will one day serve as a reference item, or a bunch of ideas that you can use to add to your own repository of creativity?

I have been trying to limit the amount of code in my developer-based presentations. Nobody coming out of the seminar will remember code detail, but they'll remember the key ideas or words that they can look up during their own research that they will have to do regardless so they can apply it to their scenario.

My latest presentation was a bunch of simple concepts with perhaps the odd coding example that provides a starting point to a solution. It would be difficult to create and convey a bunch of case studies to attendees if you're trying to offer a decent amount of information without causing confusion.

Limit ideas/concepts per slide.

#5 - beware scope creep

After a while I noticed that 40 minutes to get your presentation out turns out to be a short amount of time. When I was in school I would think that even 20 minutes for a report felt like an eternity. I now need to ensure I stay focused on certain goals and not introduce too much semi-relevant information.

Phil Winstanley concisely covers some key tips in his 24 slides on good presenting. Slide 18 on structuring your presentation shows what I agree is key to avoiding scope creep.

- Key message
- Define the problem
- Benefits of solving the problem
- Proposed solution
- Reinforce key message
- Conclude and close

Information can be quite evenly shared over these points as well - it doesn't need to be all about the proposed solution. Everyone also needs to understand how to identify the problem and what the benefits would be if we tackled it.

Having a key message at the start helps put everything into perspective. Provide the big picture before attempting to describe the detail. Think about how you may wish this information presented to yourself. Sometimes it makes me feel better knowing that I've given the audience key objectives to keep pondering.

Think different. Your key message doesn't need to be displayed as an agenda slide.

#6 - get a hand-held presenter

This is the one I have, but companies like Logitech are always releasing snazzy new ones. Having a presenter will give you the flexibility to walk away from your laptop (or other device that does the job these days). I think the presenting style demonstrated by Dick Hardt was damaged by being chained to the laptop.
Beyond the obvious advantage of having a laser pointer, these devices allow you to step forward & back through the slides when you are ready. Mine also has a setting that allows me to set a timer, and it will vibrate five minutes before the end - a good cue for winding up.
Just limit the movement of the laser dot - just imagine what your pet would do with it zipping around the screen everywhere!

Having freedom to walk away from the laptop may help settle your nerves.

#7 - identify 2-4 people around the room to alternate your attention

I find that if my eyes focus on just a handful of people as I speak and wander about, I limit the amount of distractions I face and stop myself from getting dizzy. I also find these people a gauge on how the talk is going - whether I need to up the pace or concentrate on certain slides.
Don't make it a hard & fast rule that it will always be people sitting in the four corners - you won't always have people sitting in these locations and you kinda want to avoid the habitual sleeper. I also tend to avoid those of a particular authority as they can add undesired & unwarranted pressure.
I also don't agree with trying to imagine people naked - I'm sure that's just an old wive's tale. I prefer to think I'm just talking amongst friends.

This will ultimately limit your movements and allow people to focus more on what you have to show & say.

#8 - body language

Your body speaks a thousand words. It is often said that if aliens came to observe us, they would think the majority of our communication is non-auditory. I think this site explains my thoughts well. I let my enthusiasm for my topic (as nerdy as some people say it makes me) steer the ship when it comes to my movements, and that also seems to assist audience enjoyment and satisfaction - if I'm coming across happy, it's hard to ignore that contagion. Trouble is, with that I always forget to pause - I'm still learning the best time to throw pauses in. I've seen good presenters do it at the perfect moments, I'm still working on that skill.

Speak with the confidence that you believe what you're saying.

#9 - they are there for the content

At the end of the day, if your slides aren't projecting well; if you have an accent foreign to the majority; or your demo just isn't playing ball - people want quality verbal/visual content. If at least one of these succeeds, you've probably made your mark.

The rest will probably come with practice and experience.

**

No doubt over the months & years these thoughts will change and evolve into something else, but it's where I stand right now.

At the end of the day one may ask, why present? For starters, as an example, it helped provide me the opportunity to work for Penny in a job that suits me perfectly. You never know the opportunities it might present. You also gain thorough knowledge of your chosen topic - a skill that won't go astray in your day-to-day job. So there's two-three good examples straight off the bat.

I hope I've provided at least something to think about, so you can go away an adapt to your own style and scenario. No doubt some of the suggestions here may not fit the type of information you need to get across. For me they've worked for semi-technical Oracle developer information.

I'll leave this with another site I might start sinking my teeth into:
http://speakingaboutpresenting.com/

ScottWe

Ubuntu, here I come...

For many many years, I've promised myself I would learn a flavour of Linux. After suffering some more Windows pain yesterday, a few contacts suggested Ubuntu, which has been on my short-list for a while.

I have my old laptop which has been a bit of a trusty work-horse (except for the frequent blue-screens), so it's now dual-booting into Ubuntu 10.10 - in fact I'm writing this post via Ubuntu!

First impressions - wow. While I can see the learning curve will be a little steep at times, it seems that releases such as Ubuntu have reached a level of maturity that will hopefully see a larger uptake from professionals around the world - particularly (I suspect) from University students whose brain will be like a sponge.

I may liken it a little to all the benefits of the simplicity of an iPhone, with the flexibility of an Android - let's hope that stays true.

I'm in the process of attempting to install Oracle 11gR2 with the following instructions (thanks Pythian). I've come across my first of many hurdles...

In the meantime, I'm downloading the Debian package for OracleXE, see if that's a little easier for my baby teeth to bite into.

I've registered for the Ubuntu forums, and will always welcome further advice.

ScottWe

Monday, 29 November 2010

SAGE 2010 AUSOUG Conference presentations available

To all those that requested or are interested in our presentations from the AUSOUG conference, all five are now available on the SAGE website - click on the New! 2010 Presentations link.

As for all other presentations, the AUSOUG committee are in the process of chasing down those we did not obtain and with any luck, should be available on the AUSOUG website before the next conference.

You may even find some on the websites of the respective presenters. Big names such as Steven Feuerstein and Tom Kyte always have their's available on-line. However for presentations such as Guy Harrison's keynote & Connor McDonald's 350+ slide masterpiece - you're never going to get the same value reading it as being there - their delivery was impeccable.

Truth be told, the WA state committee has gathered fresh and keen members this year, and we are pushing hard to make dramatic improvements to the design and functionality of the site. During the AGM, it was mentioned that around March 2011 should see the fruition of this change.

On top of website changes, we have received good feedback from the conference this year and we have plenty of changes and improvements in mind for next year to make it more exciting. I look forward to how many of these improvements we can fit in, and 2012 should be even better!

One of these changes is to ensure we get better attendance for the AGM, since we would like to better serve and provide for our members. This means we will try to schedule it so it's not the same time the drinks & nibblies come out ;-)

If you have something to contribute, or a super idea to suggest - you don't even have to until then, contact the committee today.

This should be my last user group related post this year, back to normal Oracle blogging now. If I don't see you at the end of year function (8th Dec @ Rosemount Bowl), I may see you at our first event next year which will be a breakfast in February, if I'm not mistaken.

ScottWe