Marc Sewtz

Subscribe to Marc Sewtz feed
Oracle Application Express and Oracle's Database Cloud ServiceMarc Sewtzhttp://www.blogger.com/profile/07323603133640801038noreply@blogger.comBlogger62125
Updated: 5 hours 2 min ago

Getting Started with Mobile in APEX - Part 1

Fri, 2011-11-11 13:59
With jQuery Mobile moving closer to production, I finally started working on my paper documenting how to develop mobile applications with APEX 4.1 We've put a lot of changes into APEX 4.1 that make the integration of frameworks like jQuery Mobile easier. Full mobile support, with mobile templates and components that are optimized for mobile devices, is currently planned for APEX 4.2. But that doesn't mean that you couldn't start building mobile apps with APEX today. It'll just be a bit more manual work for now. So while working on the paper, I've figured I'll start blogging about this as well, taking you step by step through the process of enabling mobile development in APEX 4.1, integrating the jQuery Mobile library and building your first mobile app.

So let's get started. The first thing you'll need to do is set a system preference in APEX that enables mobile development, to do this, logon as SYS and run the following:

exec apex_040100.wwv_flow_platform.set_preference('MOBILE_DEVELOPMENT_ENABLED','Y') ;
Don't worry, this will have no effect on any of your existing applications. What this system preference does is that in a number of places in APEX, you'll now see a select list that lets you choose between a "Desktop" and "Mobile" mode. The most important place where that's relevant is when editing a page template, i.e. you can now define that page template to be a mobile page template or a full-size / desktop page template. Once we have jQuery Mobile fully integrated, currently targeted for APEX 4.2, this will trigger the inclusion of the jQuery Mobile library, and the omission of some JavaScript and CSS references that are not needed for mobile. For the time being though, all this is doing is that it makes APEX render form elements on your mobile pages without a table grid. This gives you better control over the HTML generated by APEX, which allows the generation of HTML code that follows to jQuery Mobile syntax. Having a mobile page template in your current theme also triggers the mobile option in the create page wizards. So you can choose to build a mobile page, which hides page types from the wizard that don't yet work well on mobile, like e.g. Flash charts. And as you step through the wizard, the wizard will pick up your default mobile templates, instead of the standard templates, but only if you have actually set your mobile defaults for your theme.

Next you'll need to install or reference the jQuery Mobile libraries. These libraries are not yet bundled into APEX because jQuery Mobile is not yet production software. However you can download the libraries directly from jquerymobile.com or even easier, reference the CDN-hosted libraries in your page template. To reference the CDN, simply include the following in your page template:
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0rc2/jquery.mobile-1.0rc2.min.css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0rc2/jquery.mobile-1.0rc2.min.js"></script>

If you prefer downloading and installing jQuery Mobile in your APEX instance, go to this URL and download the ZIP File from there:

http://jquerymobile.com/download/

Then extract the contents of this ZIP file and load them into your APEX images directory. When using the APEX Listener or Apache/mod_plsql, you can simply copy the files to the images directory. When using the Embedded Gateway, you will need to connect to your database via WebDAV or FTP and upload the files into XML DB. To follow the folder structure that APEX uses for other jQuery libraries, make sure to copy the files to a folder you create as \i\libraries\jquery-mobile\1.0rc2\ (that's assuming your downloading the Release Candidate 2 of jQuery Mobile). The JS and CSS files should be copied directly in this folder, the images directory one below. Once installed, you can include the following in your page template:
<link rel="stylesheet" href="#IMAGE_PREFIX#libraries/jquery-mobile/1.0rc2/jquery.mobile-1.0rc2.min.css" />
<script src="#IMAGE_PREFIX#libraries/jquery/1.6.1/jquery-1.6.1.js""></script>
<script src="#IMAGE_PREFIX#libraries/jquery-mobile/1.0rc2/jquery.mobile-1.0rc2.min.js"></script>

And then you're ready to get started with Mobile development. To create a minimalist mobile page template, use the following code samples:

Header:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>#TITLE#</title>
#HEAD#
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0rc2/jquery.mobile-1.0rc2.min.css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0rc2/jquery.mobile-1.0rc2.min.js"></script>
</head>
<body #ONLOAD#>
#FORM_OPEN#
Body:
<div data-role="page" id="#TITLE#">

<div data-role="header" data-theme="b" data-position="fixed">
<h1>#TITLE#</h1>
</div>

<div data-role="content">
#BOX_BODY#
</div>

<div data-role="footer" class="ui-bar" data-position="fixed">
#REGION_POSITION_08#
</div>

</div>

Footer:
#FORM_CLOSE#  
</body>
</html>
After that, create a new page, choosing the newly created mobile template, and include e.g. a HTML region with some static text, like "Hello World". Then open that page in your mobile device. You should see something like this:

You can download this sample app here (this is an updated version, in my previous version I used an application alias that caused the app to not work if it was installed more than once on an instance like apex.oracle.com), just import into your own workspace and run:

Please note that this demo references the CDN, if you want to reference your locally installed jQuery Mobile files, please modify your page template as outlined above.

This concludes my first "Getting Started with Mobile" blog post. Next time I'll cover the jQuery Mobile syntax and how you would go about structuring your mobile APEX pages.


Oracle Database Cloud Service

Thu, 2011-11-10 15:56
Learn all about Oracle's Database Cloud Service at my upcoming presentations in New York and Birmingham, UK. Announced at Oracle Open World 2011, the Oracle Public Cloud is a set of integrated services that provide access to Oracle Fusion Applications, Oracle Fusion Middleware, and the Oracle Database. The focus of my sessions will be on the Database Cloud Service, which includes Oracle Application Express, access to the Oracle Database using RESTful Web Services and a set of business productive application, which are based on Oracle Application Express and can be installed with just a few clicks.

UKOUG, Birmingham, UK, 12/06/2011

Oracle APEX 4.0 Cookbook

Tue, 2011-03-01 16:39
Thanks to some recent train travel, I had a chance to catch up on some reading, and so I looked at the recently published Oracle APEX 4.0 Cookbook by Michel van Zoest and Marcel van der Plas. It's great to see more and more APEX books coming out, and of course there are already several excellent ones out there. This new one I found quite interesting due to the way it's been structured. The authors basically have chapters covering the main areas of interest, i.e. creating basic applications, themes, websheets, web serivces, APIs, etc. And then within each chapter, they have smaller sections that lay out, step by step, how to go about e.g. creating a form, creating a report, creating a theme, etc, all broken down into very manageable pieces. And in each section, they tell you what you need to get started, then walk you through the steps, and then provide some background info on how it all works. So I think this is the kind of book an APEX developer might put on his desk (or e-reader) to quickly look up specific features while they are developing their applications. I think this book provides a great value to both experienced APEX developers and developers who just recently got started. It's not necessarily targeted towards complete beginners though, i.e. it's not so much an introduction into APEX as the authors pretty quickly get into more advanced features, like APIs, AJAX, JavaScript, etc. So for anyone looking for an APEX book they can use to quickly look up certain features, and how to use them, this book is doing an excellent job.

8th Annual NYC Metro Oracle Users Group Day

Tue, 2010-12-07 10:14
If you're in the NYC metro area tomorrow, come join me at the 8th Annual NYC Metro Oracle Users Group Day. The day kicks off with Andy Mendelsohn's keynote on Oracle 11g. Andy Mendelsohn is Oracle's Senior Vice President of Database Server Technologies, and our team, the Oracle Application Express group, is part of that organization.

And a little bit later, at 11:45am I'm on with my presentation about the architecture and configuration options of Oracle Application Express. I'm planing to dig a little bit deeper than usual into how APEX actually works, and walk you through the different setup options with the APEX Listener, Embedded PL/SQL gateway etc and review the install and update process. I presented several different APEX topics at a number of recent NYOUG meetings, and in addition to questions about these feature, I also always get a lot of architecture and configuration related questions, so I thought this time, I''ll dedicate my whole session to this.

You can find more information about the event here:

http://www.oracle.com/dm/11q1field/60403_8th_annual_metro_users_group_day_ny.html

culture shock ;-)

Fri, 2010-11-19 15:11
This week's DOAG 2010 conference in Nuremberg finally gave me an opportunity again to visit Germany after not having been there in a few years, and to present to a very engaged local APEX community in my native tongue. I think the conference was a great success and I was excited to see how many APEX sessions were scheduled this week - and it seems all the APEX sessions drew large audiences. I think Patrick Wolfs's and my sessions had about a hundred participants, close to capacity of the rooms. And Carsten Czarski had managed to hook us up with an additional session in the Demo Kino, so I ended up speaking for about three hours straight on Tuesday. I had a few customers come up to my podium after my presentations, thanking me for the information on APEX 4 and my demos and after they had seen on the schedule that I'm from New York, congratulating me on my excellent German skills. Of course they were less impressed, after I revealed to them that I had actually grown up in Germany.

I also really enjoyed the DOAG party Wednesday night. I was having dinner with Todd Trichler, Kuassi Mensah and Tom Kyte. The event organizers had setup a great buffet, live music and very neatly arranged tables. And each table had very attentive waitresses, who took good care of us. A few minutes into the dinner Bryn Llewellyn stopped by, and someone in my group suggested we could move a little and Bryn could pull over a chair from a neighboring table - which he promptly did. You should have seen the look on the face of one of our waitresses, she appeared to be in complete shock and disbelieve that someone would dare break the order of the tables and chairs. And just as I was making a joke to Todd, explaining some of the cultural differences, Steven Feuerstein stopped by, grabbed a chair from a neighboring table as well and unfortunately for him, took a chair from the VIP table were Oracle Germany's top management was having dinner. That of course was too much for the poor waitress, who promptly moved the chair back into it's proper position. Thankfully one of the DOAG officials became aware of the situation and personally setup a chair, plates and silverware for Steven on our table and we got to enjoy the rest of our dinner. Here's a photo taken by Markus Eisele (http://blog.eisele.net/):



Pages