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