Pages

Thursday, 29 May 2014

Enhancing APEX "no data found" message

Truth be told, the default "no data found" message for APEX reports is pretty boring.

Out of the box

Even the default wording irritates me just a little bit every time I see one amidst a page I thought was looking pretty snazzy.


There are two things I've done recently to make it look a little better.

1) Surround it with a nice soft coloured box.

Something with a little pop

This is pretty simple, just add the following CSS to your page (Edit page properties -> Inline CSS) or application's .css file. Tweak it to your heart's content - just no blinking text, please.

span.nodatafound {
  font-size:120% !important;
  border: 1px solid #FC0;
  background: #FFC;
  color: #384F34;
  display: block;
  font-weight: bold;
  margin: 2px auto 14px;
  padding: 15px !important;
  text-align: left;
}

2) Customise the output

Speaking of cats (if you clicked through the reference), there are probably a few ways to skin this one.

If you create a dynamic action the fires after refresh of your report region, you can execute this JavaScript

var ndf;
switch($v('P4_REPORT_SEARCH').length)
{
case 1:
  ndf="One character and you found no records?!";break;
case 2:
  ndf="Make sure there is no type";break;
default:
  ndf="No employees by this name, sorry.";
}

$('span.nodatafound').text(ndf);

And that's it!

See a demonstration on this sample search page.
Note it refreshes the report on key release.
Try type letters not found in the emp table.

Wednesday, 21 May 2014

Applying the APEX 4.2.3 patch

My experience patching Oracle APEX v4.2.1 to 4.2.3 on my Windows 7 laptop.

Background

Personally my main driver for this is to experience the updated themes and templates. I'd also like to explore the packaged applications and see if any of the dynamic PL/SQL regions have been converted to templates.

I already had 4.2.1 installed and before the patch was available to me I thought I'd try running scripts on the full download of 4.2.3

It turns out if you attempt the apxpatch.sql script you get
ORA-39702: database not open for UPGRADE or DOWNGRADE

If you run the apxins.sql
Error: This version of Application Express is already installed (APEX_040200).

So you kinda need to use the patch. If I had more time and a virtual machine ready I would see if it were possible to revert to 4.1, then upgrade.

Process

First I closed my APEX Listener stand-alone console, preventing myself from playing with APEX in the meantime.

I'm still running on Oracle 11g XE, so I run the non-CDB option (referring to 12c container databases)
This means I unzip the patch p17347169_423_Generic.zip to my c:\apex4.2.3 folder.

I then open a cmd window, change directory to that folder and run SQL*Plus as SYSDBA, then run the patch script.
cd \apex4.2.3
sqlplus sys as sysdba
@apxpatch.sql


While that was running I need to manage the images folder. For me I decided this meant copying custom content from c:\apex4.2\images to my new c:\apex4.2.3 folder.
This was a /sage folder that houses my training supplementary files
I also decided it was time to create a /scott folder to store my nick-nacks I play with, instead of dumping that in the root /images folder.
I didn't have anything under /themes I needed to transfer.

This means I modify my start_listener.bat file that launches APEX Listener stand-alone to
cd c:\apex_listener2.0.1\
java -jar apex.war standalone --apex-images \apex4.2.3\images


The next thing I did was open a browser tab to see what the latest APEX Listener version was - and if there's anything that would compel me to upgrade.

After all that, the patch script finished in 28 minutes (on my laptop), and I was ready to restart my listener and log in.

I initially had a blank page with a bunch of resource GET errors - but then I realised I had a typo in the path of my start listener batch file.

At runtime, there is a difference in the developer toolbar - can't we just leave these things alone? ;-)
Difference spotted between 4.2.1 and 4.2.3
Bring on APEX5.

Friday, 16 May 2014

Millions of big androids

This latest analysis on the population of mobile device technology got me thinking more about the typical sized screen you might encounter as a global web developer.
So it's looking at 2014 Quarter 1 shipment of nearly 280 million smartphones. 81% are now android, only 16% related to Apple - that next iPhone better be a seller!

The telling statement for me was regarding a third of those shipped:
Smartphones with 5″ and larger screens grew 369 percent, substantially faster than the overall market
I've been working on an APEX project for delivery on an Apple Air - building for a table sized interface has been fascinating. I can only imagine how different a functional APEX application for a 5" screen would need to be.

Wednesday, 14 May 2014

APEX 4.2 Application builder icon size

A common bug-bear for me is the large distance on web pages between the browser toolbar and the start of any real content on the page.

I remember providing feedback during a tryapexnow beta release on the issue

Gimme content without scrolling!
I can't expect too much - while news websites are frequent offenders for this, newpapers have also been doing it for years.
Pravda 1912
Today I (re?)discovered how to make these buttons smaller - by accident, while clicking between windows.
This was on 4.2.0.00.27.

It rings a vague bell...
Some developers may prefer it. Some developers just do this
Samsung physical monitor rotation
I've finally go the opportunity to try it - I've always preferred height to width.
It's great for APEX and my text editor, but there is still software that works better in landscape - Balsamiq for instance.

Wednesday, 7 May 2014

The web we want

I'm not a huge user of Firefox anymore. My exodus from IE brought me to Firefox, but then Chrome came along and I've been happy ever since.

That's quite analogous to my mobile telephone experience - starting with Nokia, big jump to first generation iPhone, now happy with Android.

I still use Firefox, but only so I can have a separate browser with an independent development builder session for Oracle APEX development. The FireFTP extension was pretty good, too. It doesn't render our tablet application very well, though - has trouble with some JavaScript libraries.

Anyway, I upgraded today and the Firefox team is asking the world what kind of web we want. It has a short, clever video using young children asking us to think know about the internet of things we make for our future generations, then asks us we want from our web from a choice of seven options :
  • Creates opportunity
  • Safeguards privacy
  • Inspires learning
  • Is available to all
  • Puts me in control
  • Promotes freedom
Personally, I chose "Inspires learning" because I feel that grassroots education is very important and these other aspects will be borne from an educated young.

The most interesting part was looking at the world map showing the percentages distributed by continent. I think it highlights the geo-politcal boundaries we currently face, relevant to each region.
The continents that value learning 
I think the learning map shows the people who want it the most probably don't have the best access to quality education.

Check it out, look at the maps for the other options and have a think about what is important to you.

ps - I'd also like a web with bigger "refresh" buttons, just like Chrome.

Tuesday, 6 May 2014

APEX 101: Cascading Select Lists & Dynamic Actions

This post was inspired by a question on the OTN APEX forum, which contains requests for two fairly common scenarios:
1) A select list dependent on another select list
2) A report the updates based on the selections.

The original post submitted the page after each select change - APEX 4.x makes this unnecessaary thanks to cascading select lists.
And the report can also be refreshed without submitting the page thanks to Dynamic Actions.

So a solution can be formed declaratively without submitting the page, we just need logical SQL to go with it.

Open the sample page, modify the Dept list and see how Emp list changes.
Change the employee to see Dynamic action refresh report based on selection.

The final result doesn't have many components.
Page rendering properties
The P25_DEPT LOV definition is simply
select dname, deptno from dept
The P25_EMP item has a 'Cascading LOV Parent Item' of "P25_DEPT", and LOV which ensures employees are shown even with no dept selected.
select ename, empno from emp where deptno = :P25_DEPT or :P25_DEPT is null
I've enabled display of null values in both select lists.

My report SQL is
select empno, ename, job
from emp
where job = (select job from emp where empno = :P25_EMP)
or :P25_EMP is null
with 'Page Items to Submit' as "P25_EMP", and I've ensured 'Enable Partial Page Refresh' report attribute is Yes.

The dynamic action fires on Change of P25_EMP, and refreshes the report region.

Simple, effective use of declarative APEX features - so you can spend more time on stuff like jQuery ;-)

Saturday, 3 May 2014

Europa Report

Today I watched Europa Report - a movie that plays the same sport as Gravity, but seemed to go straight through to the keeper since I only heard about it while listening to a science podcast - which I think was StarTalk Radio hosted by the charismatic Neil deGrasse Tyson - of recent Cosmos fame.

Anyway - bloody brilliant movie. If you liked Gravity, you'll like this. And it does a fairly good job with the science, only a few minor issues if you really want to get picky. I'm often happy to ignore a few to help the plot along, though there was a horrible faux pas regarding 'absolute zero'.

A small cast includes Sharlto Copley of District 9 fame, who almost succeeds in hiding his thick south african accent. I love this critic's response:
"Claustrophobic and stylish, Europa Report is a slow-burning thriller that puts the science back into science fiction."
I recommend this review by Britney Schmidt - a planery scientist advising actual planned missions to Europa. Though I'd suggest only reading it once you've seen the movie - it's a movie worth not knowing much about before you see it, but soaking up some background detail after the fact.

The cinematography cleverly combines some real photos from NASA/JPL catalogues, including this iconic shot of Europa from the aptly named Galileo spacecraft.
Look familiar?

I find it gorgeously reminiscent of the Apollo 11 descent of the LEM.
Kudos 'merica

I won't include my favourite perspective/scene as not to spoil anything, but ever since I was a young space enthusiast I've dreamed of seeing Jupiter up close.

Keep looking up.

Friday, 2 May 2014

Thursday Thought: Are web clients getting thick?

I stumbled across this great post from a non-Oracle specific developer, and I thought I'd mention it here because it's worth a read.

http://zderadicka.eu/web-clients-are-getting-thick/

I've re-posted my comment here because they were thoughts rattling in my brain that I was going to rabble on about one day.
I've been thinking the same thing recently in regard to requests for Oracle APEX pages to not rely on connection to the database in order to operate for a time - using HTML5 storage in the meantime, then synchronising once connection is established. 
Essentially native mobile app behaviour in a web/hybrid application. 
I've also noticed issues in performance during my general mobile usage, particularly when it comes to web surfing. If you visit a news site in desktop format with your smartphone (particularly earlier models) it takes a while to render, yet open the same pages on your laptop using the phone as a data tether (to facilitate same download speed) - I've noticed rendering is much faster. 
The front end will also have to do rendering work, and browsers have been competing against each other for rendering speed for ages, but yes - they're getting thick again.

Is this the circle of life?