Tuesday, October 23, 2012

Responsive Design in Oracle APEX - not just APEX 4.2

One of the hottest topics in web design in 2012 has been Responsive Design - the ability for a web page to dynamically re-size to fit on a desktop, tablet or mobile phone.

The reason it is such a hot topic is simple; there is no such thing as a standard screen size any more. You can't even pick a common denominator such as 1000 pixels wide and say "that will cover most computers, from laptops up to the massive dual screen desktop you told your boss you couldn't be without".

Sometime in the near future mobile devices will out-number desktops. According to which source you read it's somewhere between 2014 and 2016. Which means you should start factoring it into your applications today.

I'm really excited that APEX 4.2 supports declarative responsive design, but it may be a while before I get to  use it. In the mean time, there's no reason why you can't build it into your applications in older APEX versions today. It just requires a little more thought and ingenuity.

That's part of what I'm presenting on at the AUSOUG 2020 Foresight Conference in Perth next week.

Here's a couple of screenshots from a very simple responsive application written in APEX 4.0.

And here's the same page on a mobile phone

What's that charming expression about "eating your own dog food".

Thursday, May 31, 2012

Loading images into Oracle XDB

There are a number of different ways to load images (and other filetypes) into Oracle XDB. You can use FTP, WebDAV or PL/SQL.

For APEX installations using the Embedded PL/SQL Gateway (EPG) images are loaded onto the server, and then loaded into XDB using PL/SQL script apxldimg.sql. With a couple of minor edits to change destination folders, the apxldimg.sql script can be re-purposed for your own applications.

The script creates a database directory, and then reads a XML file (default is imagelist.xml) to identify the directories to create and files to upload.

To generate your own imagelist file, you can use the following Windows batch script from a command window directing the output to a filename.

   imagelist.bat > imagelist.xml

@echo off
@REM *****************************************************************
@REM * File:    imagelist.bat
@REM * Author:  Mark Lancaster May 2012
@REM * Purpose: For APEX applications using the Embedded PL/SQL Gateway.
@REM             Generate XML list of directories and files suitable
@REM             for loading into Oracle XDB.
@REM             Refer APEX file "apxldimg.sql" for example usage.
@REM             Direct output to a file e.g.  imagelist.xml
@REM *****************************************************************

setlocal enabledelayedexpansion

echo ^<upload^>
echo     ^<directories^>

REM list directories with relative path

for /F "tokens=*" %%c in ('dir /ad /b /s') do (
  set abspath=%%~fc
  call set "relpath=%%abspath:%cd%\=%%"
  set relpath=!relpath:\=/!
  echo         ^<directory^>!relpath!^<^/directory^>

echo     ^<^/directories^>
echo     ^<files^>

REM list files with relative path and leading slash

for /F "tokens=*" %%c in ('dir /a-d /ogn /b /s') do (
  set abspath=%%~fc
  call set "relpath=%%abspath:%cd%\=%%"
  set relpath=!relpath:\=/!
  echo         ^<file^>^/!relpath!^<^/file^>

echo     ^<^/files^>
echo ^<^/upload^>