Wednesday 30 January 2013

Dynamic Action hidden False actions

I thought I'd share what's quite literally a hidden problem I experienced in 4.1.1 involving dynamic actions.

The project used hundreds of dynamic actions, and often I would copy them between pages.

Something to watch out for, however, is the cleaning up APEX does with dynamic actions in it's own builder. I've notice in the past the meta-data I saw in dictionary views contained stale information, hidden after no longer being needed when adjusting some other attribute - like condition types.

By looking at the stock debug, I noticed that a good portion of my page render time was for dynamic action plug-ins. One of these was for the notification plug-in supplied by Oracle (gritter). Over time the number of notifications on the Global Page Zero had grown - but in my case could be consolidated using &ITEM. substitution syntax to define the title & message.

But there were still more instance of the gritter notification in the rendered page sauce than was expected, so I looked a little harder...

In regard to dynamic actions, beware the non-condition - in past I must have copied this from another action; removed the event "when" condition; the false action region was hidden from the developer, but and a false action remained - causing unnecessary rendering of a plug-in, hence performance issue. What a paragraph, hope that made sense!

All I saw when editing the item were the True actions.
True actions for DA with no JavaScript "when" event condition
By changing the when condition to "equal to", I was able to see the previously hidden False action.
screenshot actually from 4.2
Sure enough - there it is
A hidden False action, displayed when condition restored
So I had a few false actions to remove that would never fire.

You can find such cases yourself with the following SQL - I used this query to check for other issues.
select * 
from   apex_application_page_da d
-- no when condition present
where when_condition is null 
--and dynamic_action_name = ''
and application_id = 104
and page_id = 0
and exists  -- a false condition
  (select null 
   from apex_application_page_da_acts a
   where a.dynamic_action_id = d.dynamic_action_id
   and dynamic_action_event_result = 'False')
/

I saved about .05 seconds each plug-in render, so notifications in page zero added up over time. I saved about third of a second in my clean up of these alone. Plus I was finding other minor performance gains - they all add up!

Scott

Tuesday 29 January 2013

Learning Oracle APEX? Try these books

If you're a reasonably confident Oracle developer and want to learn Oracle Application Express via books - I would recommend the following:

Start:

Pro APEX 4 - I read the original and I trust the updated would be even better. Start strong and solid.

Detail:

Expert APEX - compendium of great topics written by multiple authors, for a good cause.

Refine:

APEX Best Practices - Brilliant book to help make sure you properly apply what you've learnt above.

Future:

APEX Mobile - to be released this year, if you want to keep working in Oracle web development this decade, you'll need to read this. It's been brilliant so far.

Update August 2016
Time have changed, APEX 5 provides big improvements in development productivity and style, and the Universal Theme changes things, too. Look here for the best list of APEX books
apex.oracle.com/books 

For added bonus, here is one on APEX Security - on my to read list but the chapters look spot on.

Some of these I've reviewed already, plus others that are available.

If you want to keep up-to-date with what people are doing around the world, or pick up tips and tricks - subscribe your preferred blog reader to apexblogs.info - an aggregation of Oracle APEX blogs

For those perhaps not so confident, or would like to see things being done instead of reading them - I'll be publishing something early this year - stay tuned!

Scott

Thursday 24 January 2013

What if Google went bust?

Ever consider that? What would you lose?

During life we put a spectrum of trust in different areas, depending on our own risk assessment. We originally entrusted our tribe members to help protect the community. Now, we might give a dollar to a little boy to fetch us something, and we might not get it back. Who cares? it's a buck.
We trust out mortgage to the banks because they have a proven history of money management.

So what about your data? I trust Google with a lot of my content. In fact, not really content, but information. Dates, numbers, links, hints, prompts, memories...
It's hard to back up because it's a network of information. A lattice that Google so elegantly lets you search.

We occasionally joke about our reliance on these modern devices when an old fashioned diary will do - but what happens when you lose that? I was listening to an interesting podcast recently from our public broadcaster ABC, a program called "All in the mind". A recent discussion on memory suggested we've been using these aids in various forms to help us remember from computers to paper to papyrus to cavern walls - so what's the matter with using this tool aiming for a device harmoniously engineered for bio & robotics. Well, maybe I added some thoughts in the description - but a program well worth a listen.
http://www.abc.net.au/radionational/programs/allinthemind/new-document/4420956


On a slight tangent (ba-dum), searching is an interesting topic itself - what if all information humanity knows about the universe was in a cube the size of a dice? Search facilitation would have to be impeccable. Search companies are never going to die (altavista? well, companies that aren't a verb in the Oxford English Dictionary)

If Google went bust, I'd be in the doo doo.

So what about your personal finance software? What if that went bust? or your hard disk died? laptop stolen? fire?
How much information would you lose? How easy is to backup? Copy the export to a disk, thumbdrive, cloud service, cd - somewhere off-site.

And know how to get it back.

Risk vs benefit vs simplicity.

I have what I feel is a very strong password - that's all you need, right? Remember the TV show "Weakest Link", think about that with your security. Cars used to be hot-wired, now they can't so criminals steal keys out of houses.

Heck, what happens when our cars start integrating via bluetooth with more intelligence to other aspects of your life? Smartphone applications getting more advanced and integrated than Google's My Tracks or Angry Birds.

People are being asked to put passwords everywhere now right? People using simpler passwords and not caring about that added security because it's too hard an unnecessary - who would be interested in me, right?

Shit happens and sometimes it gets up your nostrils. People might start to take notice - sites are providing shared authentication through a number of accounts - google, facebook, twitter - so the closer we get to one-size-fits-all authentication, we can perhaps think about just having one good, strong, but easy to remember password.

So, passwords is too strong for a super duper force of networked computers to hack? well try basic social engineering.

I think everyone should read the story of Mat Honan, a man who's heavily invested digital life was destroyed with a simple phone call.
http://www.wired.com/gadgetlab/2012/08/apple-amazon-mat-honan-hacking/all/

He lost all his information, and tells the horrible story of someone gaining access to a single point of his online identity, then trail blazed from there - just by someone pretending to be him on a phone, getting a password reset. All because they liked his 3 letter twitter handle.

I've had this rambling drafted for a while, and now I encounter the perfect concept to take away from this - Google has now announced a war on the password.
http://www.wired.com/wiredenterprise/2013/01/google-password/

I've always had interests in various security aspects of computer science, and I think this will be an interesting part of the journey. I wonder which science fiction writers ended up being right in helping us imagine the future we encounter?

When will we close a year of technology and comment on the general disappearance of the common password, gone like the day of the 3.5" disk that fits perfectly in your starched shirt chest pocket?

Wednesday 23 January 2013

Which pages are locked in APEX?

Would you some SQL to tell you which pages are locked?

As far as I could tell, there is no data dictionary view that this information.

So I found this using the all_tab_columns view
SELECT 
  id
 ,flow_id
 ,object_id
 ,locked_by
 ,locked_on
 ,lock_comment
 ,security_group_id
FROM apex_040200.wwv_flow_lock_page
WHERE 1=1
--AND   flow_id   = :APP_ID 
--AND   object_id = :APP_PAGE_ID
/
I used it to add a region (bound to a build option) that displayed a notification in the sidebar to other developers that the page was locked and under construction/change/development.

Scott.

ps - can you find the joke on this post?

Thursday 17 January 2013

Thursday Thought: Helicopters, batteries & squid

First of all, this photograph was difficult to take.

Second of all, this is one of the most fun inventions ever.

And I have a greater respect for helicopter pilots. I found an even better backdrop, but this little thing is highly sensitive to wind.

The question I'd like to ask is - when are scientists going to make even moderate gains in battery efficiency? This thing last less than 20 minutes per USB charge.

Update 2013-1-24
I have some data points - only 3, but better than a guess.
MI:SS

08:44 - in garage, wind affected,  charged previous day, left to drain?
16:13 - inside home, occasional breaze, longer flight times, recent charge, flying lights on - did I write down total, not lap time?
07:30 - inside home, occasional breaze, longer flight times, recent charge, flying lights off

04:47 - inside home, light breeze, mostly flying, charged previous day, left to drain? 
07:26 - inside home, light breeze, mostly flying, just charged

I've gathered no data as yet on charge times.
I want a bigger copter ;-)


Imagine what scaling down battery size, the way microcomputers and hard disks have paved a path to miniature. After healthcare, of course, think about what you might like to do?

Think exploratory devices - for caves you could use perhaps like the ones I just saw in Prometheus, but as quadcopters? Clever people are already using these to map rooms and find things, good steps towards disaster relief efforts.

But my number one would be the oceans.

Who shall I quote talking about how much we know about astronomy and cosmology, compared to the dark, inhabitable depths of the world's ocean. 95% of ocean ready to be explored - the other, final frontier.

All this seeded by the announcement of footage of a giant squid airing recently on NHK - I can't wait to see that footage on Discovery.

Impressive as this is, finding a kraken would be the one cryptid I'd like come true!

Who knows what other discoveries could be made by an autonomous, sensor laden, self propelling robot with the capacity to last for days?


Wednesday 16 January 2013

Using SQL to view APEX session state

There are times (mobile development, multi-browser development, most Fridays) when checking out what's in session state isn't as easy as clicking a button in the developer toolbar.

One option is to utilise provided data dictionary views and a supplied API.
select item_name, component_comment
      ,apex_util.get_session_state(item_name) session_value
from  apex_application_page_items
where application_id = :APP_ID
and   page_id        = :APP_PAGE_ID
Update - this query locates values for Page Items, you can also use apex_application_items to view Application Item values. I used both in my debug page (thanks, Marko)

You could include this as a link to a popup from the navigation bar, or a region on a global page (page zero) that is conditionally displayed using a build option.

You can also interrogate session state using SQL in your favourite IDE, but there's a catch.

If you have access to objects in the APEX owner, you can run a query like this to view session state detail:
select s.remote_addr
      ,d.flow_id app_id
      ,i.display_sequence seq
      ,d.item_name, d.item_value_vc2 item_value
      ,d.item_filter
      ,d.session_state_status
      ,d.is_encrypted
      ,s.cookie the_user
      ,s.security_group_id
      ,d.flow_instance
      --,d.* 
from apex_040200.wwv_flow_data d
    ,apex_040200.wwv_flow_sessions$ s
    ,apex_application_page_db_items i
where d.flow_instance = s.id
and   i.item_id(+)    = d.item_id
--and   s.security_group_id = 100001 -- workspace group ID 
--and   item_name is not null
and   flow_instance   = 4359890239697682 -- session ID
and   flow_id < 4000 -- ignore dev builder et al
order by flow_id, i.display_sequence, d.item_name
In my local laptop I have this query handy in SQL Developer, replacing the session ID in the highlighted line to whatever is shown in my browser's address bar. If you aren't talking about your local laptop, and have a good relationship with your DBA, perhaps this could be turned into a view
CREATE VIEW apex_040200.apex_session_state AS...

Then grant SELECT on the new view to your schema owners, and create a synonym. Note, if any item is set to encrypted, you still won't be able to read the item value. This view was also particular to 4.2, it was previously d.item_value -- _vc2

At the end of the day, there is more than one way to check out session state.

Scott

ps - on a related note, here is another way to check out the alert log
Exposing the Oracle Alert Log to SQL - Neil Chandler

Monday 14 January 2013

Review: Agile Oracle Application Express

Agile development is a term I've been familiar with for a while, and when you pair it up with a technology such as APEX - it makes for an interesting book.

I was a technical reviewer for Agile Oracle Application Express, written by Patrick Cimolini and Karen Cannell. This means the team at apress sent me chapters of the book as they were written, so I could provide any comments regarding code, or the understanding thereof.

If you're interested in how APEX projects might come together using Agile techniques - this is the book for you. If you don't really know what "agile" is all about, but use the Oracle APEX product - this is a book for you.

This was some time ago, memory has faded, and my comments may be out of date as some of these were garnered & paraphrased from my TR comments.

Chapter 1, Agile Software Development

I found this a great summary of what agile is all about

Chapter 2, Agile and APEX

Sometimes I found the links a little tenuous, but as the book went on I could see more detail on how the bigger picture joins together. It also seemed very pro-APEX, why not, but I like seeing authors provide a genuine perspective sometimes. Not be quite so "selly"

Chapter 3, Oracle APEX vs enhanced APEX

The first half got a little boring as it essentially lists APEX features at at 4.1, but tell you what - if you aren't aware of why APEX has in it's toolkit, you will be now.
Then it got onto how APEX can be enhanced, and how this relates to Agile. The further the book went, the stronger this was affirmed.

Chapter 4, Supporting Technologies.

This is where the book reminds you it's not all about APEX, but then goes into awesome detail on those features and how they fit into the Agile model. A heap of information in this chapter.

Chapter 5, Project Management

This took me back to university days, learning about project models and "software engineering". It got a little too textbook for my liking.

Chapter 6, Team Development

This module was added to APEX 4 and according to David Peake it was initially built internally for the APEX development team.
This chapter is a must when talking about agile, and goes into good detail with regard to gathering Feedback and distributing it across environments.

Chapter 7, Rules and Guidelines

This is an important chapter regarding agile development considerations with APEX and is full of quality. Agile still needs structure.

Chapter 8, Documentation

I'm a big fan of good documentation, and suggesting ideas on how to best utilise it. I enjoyed reading this chapter, but in hindsight I think Instrumentation needs to be included here.

Chapter 9, Quality Assurance

Something I'm sure every project can improve on. I think if every project took advantage of the 6 ideas portrayed here, software around the world would be further on the way to awesome.

Summary

It's refreshing to read an APEX book that isn't super technical and full of code, yet still be a good guide on how to run projects that use rapid development tools such as APEX. I recommend the read.

Other reviews can be found here.

Scott

Thursday 10 January 2013

Thursday Thought: YouTube video statistics

Ever watch a YouTube video and check out the statistics to see how it ended up on your screen?

I did this recently with an amazing video taken on a scary looking bridge in Norway (Slartibartfast would be happy)
Mobile is on the brain, so what initially struck me was the amount of views reported by a mobile device vs something like Facebook.

Looking further, what really got the graph moving was when it was first embedded in yahoo web mail. I interpret this as when it really started to spread between family & friends and traveled through the regions of Norway, Poland & Canada.

Despite the younger generation, social media, and views of some - email still has a long way to go before dying. Ever tried to set up any form of account for kids? Everything needs an e-mail address!

And don't underestimate where mobile is going. It hit Zynga fast, crippling a company that had it all.






Wednesday 9 January 2013

APEX 4.2 User Interface Detection

The User Interfaces that have been added to APEX 4.2 have a few properties to help define what URL should be resolved - hence whether you see a page designed for a mobile or desktop.

After testing these to determine behaviours as the values change, I find it would make an easier flow chart to follow.

User Interface Properties
If Auto Detect is off, it will render the default UI
If Auto Detect is on, and hardware matches UI, this will override default.

Should auto detect fail, or no default are specified when auto detect is off for both interfaces, APEX will display the following page.
Page seen when no default and auto detect is off
This page was also displayed when auto detect was on for both UIs on a Samsung tablet, so probably best to define at least on default.

Order of the list is defined by UI Sequence - which is the only display this property seems to affect - nothing within the builder.

This screenshot captures the default appearance, but you can override the stylesheet used by using the User Interface Detection CSS File URLs property, under application properties.

ADMIN 01 - User Interface Selection

Please select a user interface from the list below:
Media queries are also accetable
[media="only screen and (max-device-width: 480px)"]/mycss/smartphone.css
So those with good CSS kung fu could really make that a page professional looking entry point, should your application require it. Of course, you could build your own page using the dictionary view  APEX_APPL_USER_INTERFACES, and make it look however you want declaratively.

And of course, the page that initially opens will be the relevant home page URL for the user interface used, and the relevant login page should authentication be required.

The exact mechanics behind the detection is not known - David Peake wasn't sure off the top if his head when I asked him about it in Melbourne. If anyone knows, I'd be interested.
What he did suggest, however, is that Tablets will be available as a User Interface option in a future APEX release. I predict perhaps SmartTVs will also be a future option.

Scott

Friday 4 January 2013

Friday fun - UV Security Pens

That headline almost doesn't make sense - where's the connection, right?

I bought some UV pens so I can write identifying information on personal products.

Turns out there is another use
My Friday night plans have just changed

Thursday 3 January 2013

APEX 4.2 new feature - Show Grid

It's easy to get caught up in the razzle dazzle of advertised new features, but I love discovering new features that aren't blatantly obvious - where you just stumble across them while exploring. In APEX there will always be a few that aren't even mentioned in the release notes.

Today I noticed in the developer toolbar a new option - "Show Grid" / "Hide Grid"
New Developer Toolbar Feature
If I had a dollar for the amount of times I've used the browser debug options to show the border around tables while attempting to place components...

As stated in the relevant documentation - About the Developer Toolbar
Show Grid displays how regions and page items are positioned on a page if a grid layout is used.
No doubt this little ditty will become extremely useful with responsive web design. Stay tuned, I'll be posting better examples as time goes on.

Thank you APEX development team.

Scott

2012 Blog Review

Last year I reviewed the outcomes of my blog, so I've decided to make it an annual event.

I tried hard this year to become a regular blogger, despite many things getting in the way. The key is certainly setting time aside and writing a bunch at the same time, scheduling them for later. This only takes me so far, since I have many ideas labelled in my e-mail, yet only a dozen or so currently in the schedule.

I've certainly found it rewarding. Blogging about Oracle has opened up a number of opportunities for me. It's also a useful way to affirm knowledge, and be a great reference for the future. I'm sure a number of hits are from me looking up information I know exists!

A telling metric is a comparison to last year - thank you to all my readers, old & new!
It seems late December is a quiet time...
According to Google Analytics, these are the top viewed pages for 2012

  1. APEX 4.2 Wish List - It seems a lot of people wanted a say in this, bring on APEX5
  2. Wrong number or types of arguments - a common error, perhaps?
  3. Modifying your APEX login page - simple post, but popular concept.
  4. APEX Tutorial - Form & Report sharing same page - another "grassroots" post
  5. Automating APEX backups from DB - I'm glad this one's popular
Notably, #3 & #4 were written in second half of 2011, and #5 was from February 2010.

Most visits were from (what I interpret to be) Google search, then direct. About the same from feedburner & apexblogs.info, and a fast growing number from Twitter - but a mere dent compared to Google search.
Notably, Bing is down the list - below ODTUG!

Again, the US constitutes most of my readers, with India becoming a new player. UK & Germany now rank above Australian visits, which is a pleasing sign to me that it's useful to others and not just friends of friends in my home country.

Browsers: Firefox, Chrome, IE respectively

Three times as many mobile devices as the year before, but still only a fraction. iPad by far most popular, followed closely by iPhone.

Search terms were interesting, and may help drive what I write about in 2013. I've tried to be more aware of SEO issues when constructing the posts and preparing meta-data. "oracle pivot" was most popular; searches involving upcoming versions always a mainstay; "pls-306" explains my 2nd most popular page; "apex tutorial" is what caught my eye; "paul verevis" from those searching for details of our fallen friend; "oracle apex performance" is down the list, something I'd like to see more frequent, along with "apex security"
Finally, I can see what would be mainly me: "site:grassroots-oracle.com some keywords"

Responsive Web Design
At some point we should also see APEX5, but potentially before that I might suggest another release that allows for a third user interface, allowing for design that suits the three major screen sizes shown above. 3-4", 7-10", and desktops - mobile, tablet, desktop.

So in 2013, keep an eye out for many little APEX tips; continued commentary in Thursday Thought; continued Oracle Community announcements; and my prediction - plenty of posts regarding APEX mobile and Responsive Web Design.
Should I find the time to mitigate ongoing frustrations, I will also increase the frequency of the Ubuntu tag. I also see a presentation coming out of this.

Scott