Monday, July 29, 2013

Where have all the buttons gone?

Oracle's Apex product Apex.oracle.com allows a web page developer to place buttons in pre-defined locations within an Apex page region.  As a developer, one is faced with a pull-down menu displaying about a dozen choices. I haven't used Apex enough to easily pick the right location the first time.  I usually pick something that looks right, display the page, and take another try or two to get it right.

I need a cheat-sheet showing the button descriptions with the buttons sitting in the right places.  So, I created an almost-empty Apex region and added a button at every possible pre-defined location.  Each button has a label derived from the pull-down menu, so a quick glance shows the button descriptions and where it physically goes in the region.

If you visit the buttons page, you can see the predefined locations in a region and buttons placed among the Apex items. There are three regions on this page:  one region with all the buttons right-aligned, one region with all the buttons left-aligned, and the last region with buttons and data items intermingled.

Saturday, July 20, 2013

Who are you?

I develop and maintain web pages for our organization's internal use.  Some of our work uses an internally developed web framework, some of it is native HTML, and some of it uses Oracle's APEX framework.  All of it is delivered using Oracle 11g and Apache.

When we develop for internal use, we don't give much thought to the user's browser.  The browser must be a recent version of IE or Firefox, maybe Chrome, or maybe Safari.  And that's it.  No tablets.  No phones. No obsolete or obscure browsers.

Recently we took on a project developing pages for external use.  Now, I'm thinking about browsers.  What's out there? How many are there?  What HTML version do they support?  So, before I deliver content, the question is "who are you?"

Why do I care?  Well, new browsers support HTML5.  And if we properly develop and deliver HTML5, we should be safe with just about any current, commonly-used browser.  Floating divs are great advantage over table-based layouts.  Table-based layout is static; divs can float up to the next row if the browser is wide enough, or float under an element if the browser window is narrow.  And we don't need to worry whether it's a phone or narrow window on a desktop:  400px wide is 400px wide.

But, we do have some worries:  Older browsers.  Unusual browsers. Buggy browers.  In our internal environment, if a browser renders a page badly, we ask the user to use one of our approved browsers.  Delivering external content is another matter.  Users expect, rightly or wrongly, content to be delivered to them in a usable form.

So, there are two decisions to be made.  The business decision is whether to attempt to support any browser out there, or display a "Please upgrade to a modern browser" message.  The technical decision is identify to what browser we're delivering content and proceed based on the business decision.  It's the latter problem that interests me and that I'll address in this post.

We're running on an Oracle 11g database, so we'll use the OWA_UTIL package to help us identify the browsers.  OWA_UTIL has a couple of procedures that are useful to us.   The GET_CGI_ENV function will return the value of any variable in the CGI environment.  There are lots of variables in the CGI environment, and the PRINT_CGI_ENV procedure will print all them for us.   Visit the demo page and see who you are.

You're back!  That was a lot of strings.  So, how to interpret those browser strings?  There are several websites that provide lots of information.  UserAgentString.com has a description of the browser identication string for what must certainly be the entire universe of known browsers.  Also, www.zytrax.com/tech/web/browser_ids.html has a list of ids and tips on how to parse the id strings using regular expressions. 

Thursday, July 18, 2013

Lost Learnings, an Introduction

Lost Learnings

Lost Learnings is a blog about things we learn and forget.  We learn, we learn some more, we learn still more, and then we start losing the things we don't use everyday.  Some of it we never do forget -- like how to ride a bike, for example.  But much of it is "going, going, gone" as the ballpark announcer shouts while a long fly ball goes over the outfield fence.

Remember all that set notation we had to learn back in grade school?  Maybe it seemed silly at the time, learning something that  was obscure and didn't have any purpose.  Now, SQL is the language of the database, and it's all about sets.  

Some of the things we learned we'll never need again.  In my career, I learned to program computers in about a dozen languages using half-dozen operating systems.   I'll probably never write a program in FOCAL, or PAL8, or MANTIS again.  And I doubt I'll ever see another Univac mainframe or DEC mini-computer. 

But some of that old stuff was fun.  IBM's PL/I language was my favorite language, and much of what I learned about PL/I is still applicable in REXX and SAS programming today.  I still have a working Heathkit H-8, the computer equivalent of a Ford Model T.  The H-8 was a fun machine, and I learned a lot about computing building it, studying the logic diagrams, and learning to program in 8080/8085 assembler.  

Perhaps the moral here is that much of we learn is foundational.  Remembering sets from grade school helps with SQL programming.  Learning PL/I helped me program in REXX or SAS.  Learning 8080/8085 assembler helped me program IBM PC assembler and IBM 370 assembler.

Much of what we've forgotten is useful and applicable now.  Some of the algorithms I coded in COBOL at another job would still be useful today.  Things like SQL travel pretty well from one vendor's database (IBM DB2) to another (Oracle 11g).  And there's a lot of odd things that I learned along the way, often doing research for things that didn't get implemented, sometimes learning how to solve a problem for its own sake. 

So, in this blog I'll talk about problems and ideas and solutions now, before they, like the long fly ball, are going, going, gone.