|
| Book review: Oracle Application Express 3.2 – The Essentials and More |
4 |
Christian Rokitta |
02-SEP-2010 23:46 |
Language : English Paperback : 644 pages [ 235mm x 191mm ] Release Date : June 2010 ISBN : 1847194524 ISBN 13 : 978-1-847194-52-7 Authors : Arie Geller, Matthew Lyon In June, just before the official release of APEX 4.0 and #APEX4 Twitter messages popping up on my desktop every minute, I noticed a tweet from one of the authors of this book saying something like: “...bad timing…just released our book APEX 3.2 – Essentials and More …”. Well, I agree. Just looking at the books title, you might really think: Bad Timing. But, you should never just judge a book by its cover (or Title, in this case). Just let´s forget about APEX 4.0 for a moment. This book covers almost all aspects you probably will encounter when developing with APEX. The authors start the book explaining the concepts of APEX and explaining the “APEX Angle” of related (or required) technologies like HTML, CSS, Javascript and AJAX. Once the basics are covered, Application development with APEX is explained in great detail. And by this, I mean: In great detail! No OTN Hands-On like tutorials (step-by-step-click-through-without-further-explanation). Instead, sparse code samples, no more then necessary screenshots and lots, lots, lots of explanations. That´s exactly what I like about this book. It´s not a tutorial and more then just a reference. The authors explain the essence of developing with APEX and beyond. The book concludes in a “Best Practice” Chapter which I think is an excellent subject to finish. Although the book covers almost all aspects, some aspects are covered just a bit too brief. The chapter about Themes an Templates, for example, is covering only the very basics and is not inviting to start creating a template or theme on your own. Extending APEX with JavaScript libraries like JQuery could have had more attention, as this is common practice nowadays. I like this book. It is a great companion for ever APEX developer. But what about the 3.2 / 4.0 bad-timing thing? Well, there are still lots of environments and applications based on APEX 3.2. It will take a while until all those have been upgraded. Apex 4.0 is a great step forward, but the basic principles are still the same as in 3.2. Almost all 3.2 techniques and functionality still is there. So this book will help you too when learning and developing in APEX 4.0. If you are aware of the new functionality and keep in mind that the screenshots and examples might look a bit different, this book is still a valid reference. Anyway, I don´t think you will find an APEX 4.0 book this extensive just yet.
|
|
| |
| Automatic Time Zone support in Application Express 4.0 |
4 |
Joel Kallman |
02-SEP-2010 13:43 |
A feature of Application Express 4.0 which hasn't received a lot of press but is useful for those building applications that span time zones is the Automatic Time Zone application attribute.
The Oracle database has this wonderfully rich data type called TIMESTAMP WITH LOCAL TIME ZONE. The elegance of this data type is that the value stored in this column will be displayed in the user's current database session time zone. Having written a PL/SQL package to do time zone conversion, it is a non-trival exercise to develop this type of functionality let alone maintain it. Wouldn't it be great if we could put this burden of maintaining constantly evolving time zone rules and daylight saving time dates on the database? Well, you get this for free with TIMESTAMP WITH LOCAL TIME ZONE.
So if all we need to do is set the database session time zone, then:
- How do we elegantly derive this for each end user of our application?
- How do we ensure that every page view and page submission in Application Express has its database session time zone set correctly for a particular user?
There were numerous suggestions in the past, of storing a user's preferred time zone as a preference and then authoring a PL/SQL block in the VPD attribute of an application like:
execute immediate 'alter session set time_zone =''' || :MY_USER_TIMEZONE || '''';
Not exactly obvious. And this still doesn't answer question #1 of how do we elegantly derive this. This is where the new Automatic Time Zone attribute is useful.
In the Application Builder, if you edit the Application Properties and navigate to the Globalization subtab, you should see something like:
By default, Automatic Time Zone will be set to 'No'. When set to 'Yes', this will now change the behavior of your application:
- At the beginning of an Application Express session (which happens at the beginning each time a user runs your application ), the time zone offset will be calculated from their Web browser client.
- This time zone offset information will be sent to Application Express and recorded in the APEX session information for that user.
- Then, each and every page view for the duration of their APEX session, the Application Express engine will read this value and set the database session time zone to this value.
All you have to do is employ data types which are time zone aware (like TIMESTAMP WITH LOCAL TIME ZONE; DATE is not time zone aware) and check a box in your application definition. It couldn't be simpler!
To demonstrate this, I created a simple application using the following DDL: create table tz_log( id number primary key, username varchar2(255) not null, tz varchar2(512) not null, created_ts timestamp not null );
create or replace trigger tz_log_trg1 before insert on tz_log for each row begin if :new.id is null then :new.id := to_number(sys_guid(),'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'); end if; -- :new.created_ts := localtimestamp; end;
Then, I just built an application with a SQL report on this table and added an on New Instance PL/SQL Process of:
insert into tz_log (username, tz) values(:APP_USER, apex_util.get_session_time_zone ); commit;
You can run this sample application here. Just keep in mind - it will require you to authenticate with your oracle.com credentials (the same credentials you use if you login to the OTN discussion forum) and it will record your visit in a log table, which others can view. Here's what it looks like - nothing fancy:
If you pay close attention, immediately after authentication, you'll see a URL like:
https://apex.oracle.com/pls/otn/f?p=27207:1:127976719236631&tz=-4:00
Obviously, your APEX session identifier and time zone value will be different than what I show above. But you'll see that there is a new parameter 'tz' to the 'f' procedure. And it is through this interface that you can create a URL to an APEX application and explicitly set the APEX session time zone to a different value. After you login, change the time zone value in the URL to something else (e.g., tz=0:00) and watch the values in the "Inserted into the Log Table (in your local time zone)" report column automatically adjust to that time zone. The underlying report definition didn't change - we're still simply selecting the TIMESTAMP WITH LOCAL TIME ZONE column out of the database, just now the database is automatically converting that value to display in the current session time zone.
|
|
|
| APEX Meetup @ OOW 2010 |
4 |
Dimitri Gielis |
02-SEP-2010 11:21 |
 It's an annual tradition, so also this year we'll organize an APEX Meetup at the 4th Street Bar & Deli on the Tuesday (7.30 PM) during Oracle Open World. Here you find some pictures of last year. As you can see, it's always fun with nice people, drinks and food. Every year we get more people during the meetup, so we started to get sponsors to help to pay for the bills ;-) Thanks so much to our sponsors of this year: - Oracle Technology Network (OTN) - Oracle Development Tools User Group (ODTUG) - APEX Development TeamIf you or your company wants to sponsor aswell, feel free to send me a mail or add a comment to this post. The current total to spend is $500 :-) See you soon!
|
|
|
| Calendar Inline Datepicker and Dynamic Actions |
4 |
Sathish Kumar |
02-SEP-2010 05:12 |
There is a way to technique to display google like Calendar in Apex where you select the start date and end date from the DatePicker and automatically the Calendar refreshes. Let me explain the step by step process of how to achieve this. 1. Create a Calendar with Partial Page Refresh and include Custom Calendar as well. 2. Create two jquery based datepicker items (for example P1_SD and P1_ED), both having date format YYYYMMDD. 3. Create Dynamic Action named refresh_calendar, should be having the following properties Event : Change Selection Type : Item Item : P1_SD Action Action : Execute Javascript Code Code : apex.widget.calendar.ajax_calendar('C','same',$v('P1_SD'),$v('P1_ED')); 4. Create another Dynamic Action duplicating Step 3, but for selection item P1_ED. 5. Delete "Monthly","Daily","Weekly". 6. Run the Page and Select Start Date using DatePicker, should be seeing the Calendar getting refreshed, trying selecting end date from the second Datepicker should be seeing the Calendar refresh automatically. 7. Click on next and previous to see difference of days between start date and end date getting skipped. 8. So a single view of calendar is used for Day,Week and Month. Click here for the Demonstration Application
|
|
|
| Die nächsten Tutorials warten bereits... |
4 |
Tobias Arnhold |
01-SEP-2010 22:38 |
In den nächsten Wochen und Monaten habe ich vor ein paar wirklich nützliche APEX Erweiterungen vorzustellen. In Form von Anleitungen und Beispielapplikationen soll jeder in die Lage versetzt werden, professionelle Anwendungen mit den neuesten Techniken zu entwickeln. Die folgenden Themen stehen derzeit auf meiner Agenda: - Tooltip Applikation: Viele Tooltip/Infobox Beispiele für APEX gibt es im Netz, nur keiner hat einen wirklichen Überblick darüber. Diese Applikation soll Abhilfe schaffen. Ein alter Post zeigt ein paar Möglichkeiten auf: All about Tooltips - jExpand Report: Eine geniale Reportlösung mit der es möglich ist, Reports mit vielen Spalten auch auf kleinen Raum unter zu bekommen! Eine Implementierung als APEX Template wird das Ziel sein. Beispiel mit Testdaten - JQuery Layouts: Ähnlich ExtJS ist es möglich bewegliche Seitenbereiche auch mit JQuery umzusetzen. Ein Ansatz der bisher kaum Gehör bei den APEX Entwicklern fand und endlich auch mit OpenSource Mitteln umgesetzt werden kann. http://fabrizioballiano.net/jquery-border-layout/ und http://layout.jquery-dev.net/ Bis dahin schaut doch mal in meine ExtJS Lösung rein: APEX-AT-WORK Developer Competition 2009 Edition Ich denke das sind Themen die viele APEX Entwickler interessieren könnten. Deswegen gebt doch einfach mal ein kurzes Feedback zu meinen Ideen.
|
|
|
| Leaving wordpress.com… update your bookmarks! |
4 |
João Oliveira |
01-SEP-2010 10:20 |
Hi Folks, Today I’m leaving wordpress.com as the base of my blog. I’ve moved to my own domain named beyondoracle.com. This change will provide me to use much more features of wordpress than the one provided in the wordpress.com service. I also updated the look of the new site to a cleaner simplistic design. So, [...]  ]]>
|
|
|
| Anonymous Pro |
4 |
Scott Spendolini |
31-AUG-2010 08:31 |
Anonymous Pro is a fixed-width font developed specifically for developers by Mark Simonson. Best of all - it's free under the Open Font License. From it's home page: "Characters that could be mistaken for one another (O, 0, I, l, 1, etc.) have distinct shapes to make them easier to tell apart in the context of source code." I installed it on my Mac and set SQL Developer's default font to it, and the text is a little crisper than Courier, my previous default. Anyone else have a favorite "coding" font?
|
|
|
| Authenticate database user against Active Directory - the poor man's version |
4 |
Ilmar Kerm |
28-AUG-2010 18:47 |
My use case for this: one big database, where applications have some shemas. But also, quite a lot of developers need access to the database, to see the production data and security requires each user to have his/her own personal account and of course also requires password expiration and complexity. Authenticating database users against organizations central Active Directory would be just perfect for this case.
Oracle offers this solution for Enterprise Edition, but its an extra cost option - Oracle Advanced Security. If these are not an option for you, then its also possible to achieve the same task, in its simplest form, using user profile password verification function and database logon trigger.
Basically, the procedure works as follows:
- Create a new profile for AD-authenticated users with password verification function.
- Assign this new profile to a database user.
- When the database user changes password, the password verification function will try to connect to AD with the user specified password, if AD authentication is successful, then the password is correct and can be changed and stored by Oracle.
- Every time the user connects to the database, after logon trigger will query AD for the user status: does the user still exist, is the user disabled or expired, when did the user last change password. If the user status is changed in AD, the trigger will lock or expire the database user accordingly.
The code
My solution consists of a PL/SQL package, that I create under my database administration account, named DBAUSER. The package will be called from password verification function and the logon trigger. The DBAUSER account needs network ACLs to permit it to connect to the AD server (11g+!) and the following system privileges:
GRANT create job TO dbauser;
GRANT alter user TO dbauser;
GRANT select ON sys.user$ TO dbauser;
Now the package:
Package
Package Body
NB! Look into the package body script! There are configuration parameters on top, that you MUST look over and change!
Now, create the password verification function under SYS schema, that will only call out the created package:
CREATE OR REPLACE FUNCTION sys.ad_profile_verify_function
(username varchar2, password varchar2, old_password varchar2)
RETURN boolean IS
BEGIN
RETURN DBAUSER.PROFILE_AD_AUTH.VERIFY_PASSWORD(username, password);
END;
/
Next, create a new profile setting the password verification function and also would be good to set parameter PASSWORD_LIFE_TIME to the same value AD has for password expiration. An example profile:
CREATE PROFILE ad_user LIMIT
SESSIONS_PER_USER 2
FAILED_LOGIN_ATTEMPTS 4
PASSWORD_LIFE_TIME 90
PASSWORD_VERIFY_FUNCTION ad_profile_verify_function;
And finally the logon trigger, that will fire the user verification function for all users having the ad_user profile. Modify it for your own needs before executing. The following procedure also needs SELECT privilege on SYS.DBA_USERS granted to SYSTEM.
GRANT execute ON dbauser.profile_ad_auth TO system;
CREATE OR REPLACE TRIGGER system.AD_USER_LOGON AFTER LOGON ON DATABASE
DECLARE
i NUMBER;
BEGIN
IF user NOT IN ('SYS','SYSTEM','APPUSER1','APPUSER2') THEN
-- Check if user belongs to a specific profile
SELECT count(*) INTO i
FROM sys.dba_users
WHERE username = user AND profile = 'AD_USER';
-- Execute verification procedure
IF i > 0 THEN
dbauser.profile_ad_auth.verify_user(user);
END IF;
END IF;
END;
/
To create a user that will be authenticated from AD, first create a regular user with a temporary password, then issue ALTER USER to set the profile. This is needed because if profile is set in CREATE USER command, then the initial password will also be validated with the verification function.
CREATE USER ilmar IDENTIFIED BY test123;
ALTER USER ilmar PROFILE ad_user PASSWORD EXPIRE;
NB! 10g passwords are not case sensitive, so subsequent logins will be allowed with passwords using the wrong case. In 11g, be sure to enable initialization parameter SEC_CASE_SENSITIVE_LOGON, to benefit from case sensitive passwords.
One big problem... SQL Developer still does not support changing passwords and user must change the password from SQLPlus. What do you think may be a good way around it? When the procedure detects, that AD password has changed, then execute ALTER USER to expire the password, but do not raise an exception? Then the user must remember to change the password using ALTER USER, but of course, it means allowing authentication with the old password once...
I have not yet used it in production, so all feedback is welcome! I've tested the code on 10.2 EE and 11.2 EE, should work on standard edition also.
Download all the code from here
|
|
|
| APEX Meetup @ OOW 2010 |
4 |
Roel Hartman |
27-AUG-2010 15:54 |
Just like last year and the year before that, there will be a (semi) official APEX Meetup during Oracle Open World 2010! And as the APEX Developers - just like every other human being - hang on to a good tradition, even the venue, the day and the time will be exactly the same as in previous years. So write in your agenda / add to your schedule: What : APEX Meetup When : Tuesday September 21, 7.30 PM - ??? Where : Fourth Street Bar & Deli (very close to Moscone) Another not-to-miss event...hope to see you all there!
|
|
| | |
|