Choosing the right UI-strategy.

The only way for any user to get to their data is a user interface. Nowadays we mostly use the GUI or “graphical user interface”. You can find all about how we got here on the internet. Just search for “history of the graphical user interface”.

Many years Microsoft’s Windows kind of dictated how a user interface looked and operated. It had limitations, but for most users is was sufficient, even perfect. The grey colors, input fields, selection lists, scroll bars and buttons; if you had seen it once you knew what to expect in other applications.

With the rise of the internet, browsers and the Hyper Text Markup Language (HTML), programmers got more possibilities. Techniques like CSS and Javascript enabled more-and-more possibilities – and still do. It looks like a never ending flow of creative graphical “inventions”. And although this might look like an exciting development, the side effect is less efficiency.

I am a programmer. I want to produce programs that offer the user with functionality it needs. Since the 90ies and until a few years ago, you could quite easily discuss how the GUI had to be. Since you had only limited options. Most of the time it did not take long to get to a well-designed interface.

Today the looks of an application becomes so important, that it is blocking my programming productivity. I am forced to spend much more time on the appearance and location of – for instance – a button. And if I ask more people what they think, many times I get “more+1” ideas…

The sky is the limit. What do you want: Which background color? Text color? Menu: Left? Right? Top? Bottom? Fixed to the page or to an area? Tabs? Buttons? Or links? Cards? Lists? Tree? Where? “Hamburger”? Slide-in/out? Fixed? Checkbox or Switch? How should the switch look? Icons? Which icon? Icon before/after text? Text labels left aligned? Right aligned? Floating maybe? Above the item or before the item? On which devices: desktop, tablet, smartphone? Responsive? Resize? Resize what? When? How? How does an inactive item differ from an active one? And ofcourse all this also has to be tested and verified… 😐

Although all these choices seem to make everything possible, we are often forced into a straight jacket where a page consists of 12 evenly spread columns whereas in Windows you can position each element on the pixel!

We should become more aware that there are differences in the purpose of applications and that this should have a major influence on the user interface. If the application has a commercial purpose, it should be attractive and entertaining. But administrative applications like for personnel, finance, planning or inventory, that don’t need to sell anything. It just needs to be efficient and doesn’t need all the mumbo-jumbo of today’s internet.

Attach SQL/Developer to an Oracle APEX session

I added three new files my GitHub PL/SQL repository.

  • Package GP in file hmo_pkg_gp.sql
    This contains a number of shortcuts and constants that I often use. Examples:

    • c_lf: is the line feed code
    • prt: is a wrapper for dbms_output.put_line
    • infinity: is the highest date for Oracle
    • f_trimws: to remove all leading and trailing whitespace from a string
       
  • package HMO_APEX_SESSION_UTL in file hmo_pkg_hmo_apex_session_utl.sql
    This contains functions to attach to an APEX session e.g. from SQL Developer.
    You can then easily refer to the session state values of that APEX session,
    for example when you are investigating the resultset of a SQL select copied
    from an APEX report that uses the V(‘xyz’) function.

     
  • the file TEST_hmo_apex_session_utl.sql contains examples of how to use the
    package HMO_APEX_SESSION_UTL

Use SAVEPOINT in a DML loop

Imagine the following situation: You must process a number of records (in a loop or cursor) with the necessary updates / inserts / deletes. But you want that if it goes well that for that record the changes are saved and if it goes wrong for a record that the updates are then reversed. (In short: keep updates that are successful and roll back updates that fail – or possibly give that wrong record an “error status” or notification).

You can find my solution at https://github.com/HermanMol/oracle_scripts/blob/master/rollback_savepoint_in_loop_exceptions.sql

Oracle SQL Developer: find methods in packages/functions/procedures

I work in a team with senior developers. We create awefull brilliant functionality 😉 but … where is it? Do you recognise this?

Well next query when you run it in Oracle SQL Developer it may help you as it did me:


select prc.owner
,prc.object_name
,prc.procedure_name
,prc.subprogram_id
,prc.object_type
,prc.object_id
,prc.overload
,prc.pipelined
,prc.deterministic
,prc.authid
,'SQLDEV:LINK:'
|| prc.owner
|| ':' || prc.object_type
|| ':' || prc.object_name
|| ':' || decode(prc.procedure_name, null, 1
,( select min(line) + 1 as line
from all_source
where regexp_like(text,'^\s*(procedure|function)\s+'||prc.procedure_name||'\W','im')
and owner = prc.owner
and name = prc.object_name
and type = prc.object_type
)
) -- line
||':'||0 -- column
||':'||prc.owner || '.' || prc.object_name || nullif('.' || prc.procedure_name,'.')
||':oracle.dbtools.raptor.controls.grid.DefaultDrillLink' as "Jump to it"
,prc.aggregate
,prc.impltypeowner
,prc.impltypename
,prc.parallel
,prc.interface
from all_procedures prc
where (:rx_Search is null
or regexp_like(prc.object_name || chr(30) || prc.procedure_name, :rx_Search,'i')
)
and owner in ('ALF','CRM','HWS','KCS','SRG')
order by owner
,prc.object_name
,prc.procedure_name nulls first
,prc.overload nulls first
/

Oracle formatted hex dump of a string

Recently I ran into the problem that some regexp_substr was not giving the result that I expected. It turned out that when I tested my code, the line-ending looked like Windows CRLF, but internally it was only and LF. When I copied the test string data from SQL Developer into my script, it was converted automatically and without notice. Grgrgrgr! So I was wondering how to be able to inspect the data that was subject of the regexp_substr. Searches lead me to RAWTOHEX(UTL_RAW.CAST_TO_RAW(yourstringhere)). But I did not like the looooong output. So I wrote my own function :-).

I finally was satisfied with the HEX_DUMP function that gave me this output of the first 300 characters of Lipsum (with some new lines added).

0001: 4c 6f 72 65 6d 20 69 70 73 75 6d 20 64 6f 6c 6f = Lorem ipsum dolo
0017: 72 20 73 69 74 20 61 6d 65 74 2c 20 63 6f 6e 73 = r sit amet, cons
0033: 65 63 74 65 74 75 72 20 61 64 69 70 69 73 63 69 = ectetur adipisci
0049: 6e 67 20 0a 65 6c 69 74 2e 20 56 69 76 61 6d 75 = ng ·elit. Vivamu
0065: 73 20 6d 6f 6c 65 73 74 69 65 20 64 69 61 6d 20 = s molestie diam
0081: 69 64 20 63 6f 6e 73 65 71 75 61 74 20 76 65 68 = id consequat veh
0097: 69 63 75 6c 61 2e 0a 4d 61 65 63 65 6e 61 73 20 = icula.·Maecenas
0113: 76 65 6e 65 6e 61 74 69 73 20 73 65 6d 20 76 69 = venenatis sem vi
0129: 74 61 65 20 73 65 6d 20 6c 75 63 74 75 73 2c 20 = tae sem luctus,
0145: 61 20 63 6f 6d 6d 6f 64 6f 0a 61 75 67 75 65 20 = a commodo·augue
0161: 6c 75 63 74 75 73 2e 20 56 69 76 61 6d 75 73 20 = luctus. Vivamus
0177: 74 65 6d 70 6f 72 20 62 6c 61 6e 64 69 74 20 6c = tempor blandit l
0193: 6f 72 65 6d 2c 20 61 63 0a 70 75 6c 76 69 6e 61 = orem, ac·pulvina
0209: 72 20 6c 65 63 74 75 73 20 74 65 6d 70 6f 72 20 = r lectus tempor
0225: 71 75 69 73 2e 20 53 75 73 70 65 6e 64 69 73 73 = quis. Suspendiss
0241: 65 20 64 75 69 0a 73 61 70 69 65 6e 2c 20 74 69 = e dui·sapien, ti
0257: 6e 63 69 64 75 6e 74 20 65 75 20 72 69 73 75 73 = ncidunt eu risus
0273: 20 69 64 2c 20 70 65 6c 6c 65 6e 74 65 73 71 75 =  id, pellentesqu
0289: 65 20 63 6f 6e 67 75 65 0a 73 65 64 2e 20<      = e congue·sed.

 

You can download the source from my_utl_hex.

Herman Mol is powered by WordPress.  Staypressed theme by Themocracy