Monday, August 31, 2015

Grant SYSDBA role to SYSTEM user on Oracle

SYSTEM user by default is not a dba, and this is an issue when you are trying to do Installations with  Oracle tools such as RCU.

Being the DBA just connect with sqlplus as sysdba

/home/omurillo$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Mon Aug 31 09:39:23 2015

Copyright (c) 1982, 2014, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> grant sysdba to system;
Grant succeeded.

And you are done.

Thursday, August 27, 2015

Make your web app look like an Stand Alone application on Mobile devices (Android, iOS)

Mobile devices have the availability to add a web page to home screen, and your web application can specify how to behave once this happens.

There is a simple configuration for Android and iOS that will make your app look as a Mobile Application.

For Android devices.
You need a manifest.json file that will contain the details of your application, here is an example:

{
  "name": "A|G Fitness",
  "short_name": "A|G",
  "icons": [{
        "src": "images/touch/icon-128x128.png",
        "sizes": "128x128",
        "type": "image/png"
      }, {
        "src": "images/touch/apple-touch-icon.png",
        "sizes": "152x152",
        "type": "image/png"
      }, {
        "src": "images/touch/ms-touch-icon-144x144-precomposed.png",
        "sizes": "144x144",
        "type": "image/png"
      }, {
        "src": "images/touch/chrome-touch-icon-192x192.png",
        "sizes": "192x192",
        "type": "image/png"
      }],
  "start_url": "/#!/",
  "display": "standalone"
}



Then on your web page you need to add some meta details inside your head as follows:
   <%-- Meta details to set add to home on Android Mobile devices as stand alone application --%>
   <meta name="theme-color" content="#4d4d4d">
   

This will tell the Android Device:

  • The name of the Application via short_name
  • The icon that will be used, based on device screen resolution
  • The start_url for the application to start
  • And at last to behave as stand alone application and not inside a browser.
  • theme-color that will be the status bar background color on your Android device.
  • Point your page to your manifest so it can be read by the Android device.


And that's it. You need to do anything afterwards, but is worth to mention that this functionality works on chrome browser, other browsers does not support this feature yet.
This is how you add it to your home Screen:
 
This is how looks like on home Screen:

And This is how it looks when it runs as Mobile Stand alone application.

 


For iOS Devices is a little bit different, but it can be accomplished, but instead of using manifest.json you need some metadata to make it works:

<%-- Meta details to set add to home on iOS Mobile devices as stand alone application --%>
   <meta name="apple-mobile-web-app-capable" content="yes">
   <meta name="apple-mobile-web-app-status-bar-style" content="black">
   <meta name="apple-mobile-web-app-title" content="A|G">
   
   

This will tell the iOS Device:

  • apple-mobile-web-app-capable will make it run as stand alone application
  • apple-mobile-web-app-status-bar-style will define the color of the status bar
  • apple-mobile-web-app-title is the title of the name of the application on home Screen
  • apple-touch-icon this is the icon that will be used on home screen
  • /ux/js/ux.main.links.js it is a script that will make all the links on your app stay on stand alone, this is needed to make the application stay as standalone, otherwise it will open new links on a tab, the code for this is on GitHub at https://gist.github.com/irae/1042167

As in Android Safari is the browser that support the add to home screen feature, this will not work on chrome since is not the native iOS browser.

Unfortunately I do not have an iOS device handy to show the screenshots as in Android, but believe it works the same, the only thing is that if you are running over https and your certificate is not trusted the icon will not be used, it will use an screenshot of the page instead.

Refer to https://developer.apple.com/library/ios/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html for ios related code
And for Android at https://developer.chrome.com/multidevice/android/installtohomescreen

Thursday, August 20, 2015

How To Change prefix on auto generated Ids (ATG Oracle Commerce)

ATG out of the box provide a mechanism to auto generate ids.

If you have been working with ATG you will know this by now, here are some examples of these Ids

Orders by default are created with prefix o, an order number is o4318732, shipping Groups are with prefix sg i.e. sg3251233.

This configuration can be changed easily updating das_id_generator table.

Let's say that we want to have an order prefix that starts with QAL, this is just matter of do the following update:

update das_id_generator set prefix = 'QAL' where id_space_name = 'order';

Now if we want to change the promotions prefix to be different we just need to do as follows:

update das_id_generator set prefix = 'p' where id_space_name = 'promotion';

This will do change it from promo to p.

As you can see id_space_name does match with the item descriptor type

Note: You will need to restart your server after the update since I do not know if there is a repository that can be used to invalidate the caches for these configurations.

So here are a sample of the records on das_id_generator_table, you can change any item descriptor prefix and suffix to make it work as your business needs, also it works with new item-descriptors, just need to create an entry on this table to make it work, SEED and BATCH_SIZE are used for IdGenerator component located at /atg/dynamo/service/IdGenerator/ oracle documentation is clear on how to use the columns and how to use the component these had not changed since a while so it applies to all versions as far as I have seen.