Monday, August 4, 2014

Oracle Mobile Application Framework Hands-On Workshops

We are kicking off the US-based series of the Oracle Mobile Application Framework hands-on workshops that are going to cover the details of the platform and get you started with Oracle mobile development in a heartbeat. By the way, this is a FREE event!
These are one-day workshops where you will get technical insights into the new product enhancements, see live demos, and best of all, get hands-on experience with mobile app development. 
All you need to do is register for the workshop, pre-install/configure the development environment (MAF) on your laptop and you will be ready to go (don’t worry, we’ll send you detailed instructions on how to do this as well as contact information, should you need it). We also plan to set this up so that you can BYOD to test out your completed app (details will be provided in the invite).
Here are the links for the currently scheduled workshops so that you can register. If you don’t see your city listed be sure to send me an email letting me know where you would like to see a workshop added – we’re working to prioritize additional workshops now and your input will be valuable.
 Click the city of interest below. 


See you at the workshop!

Wednesday, May 14, 2014

Mobile Emulation on Google Chrome

If you want to see what your web page will look like on a mobile device and also do debugging during development on your desktop, here is a very useful resource for you.

Google Chrome allows you to emulate different mobile devices, screen resolutions, user agents and things like touch screen, geolocation and the accelerometer.

To enable Mobile Emulation on Google Chrome, open the Developer Tools, go to Settings and enable "Show 'Emulation' view in the console drawer".



Then, press 'Esc' to bring up the Developer Tools console drawer and finally select the Emulation tab. You'll find four sections: Device, Screen, User Agent and Sensors.


A quick test to understand this powerful feature can be done by simply navigating to www.google.com, select a device (i.e. Google Nexus 5) and then click Emulate. You'll be able to see that Google Chrome will show you the mobile optimized version of the Google website.


To go back to the original settings, just hit Reset and you'll see the regular Google Chrome rendering of the web page.
 
Have fun playing with the other features!
 
 

Tuesday, April 29, 2014

Mac OS X Boot, Sleep and Wake Time and Date

For several times I wondered what was the exact time my machine booted, woke up or slept. So, I did a little investigation to find out that's actually very simple to get those answers.

Using the Mac OS X Terminal, you can run the following commands:

 
- For System Boot Time, use: systcl -a | grep kern.boottime

You should get results similar to the picture below





- For System Sleep Time, use: sysctl -a | grep sleeptime

You should get results similar to the picture below  




- For System Wake Time, use: sysctl -a | grep waketime

You should get results similar to the picture below




I typically use the "uptime" command (just type uptime on the Mac OS X Terminal) to find out how long my machine has been powered on.

Lastly, you can get a short history of the machine boot using the "last reboot" command (just type last reboot on the Mac OS X Terminal) to get the last three boots of the system.


You can get the same information reviewing system log files but I think opening the terminal and typing a few commands easy enough to get the information you're looking for.

Friday, April 18, 2014

Debugging Oracle ADF Mobile Applications - Part I

I've been involved with the Oracle Mobile Application Framework (a.k.a. ADF Mobile) lately and one of the things developers typically ask me during my talks is how to debug mobile applications created with the Oracle framework.

To give you a little bit of context, the Oracle Mobile Application Framework does generate a hybrid app (native container + HTML/JavaScript) so standard debugging techniques apply here. The Oracle Mobile Application Framework has some other capabilities like running Java code on the device but that's a topic for another post.

So, there is more than one way for debugging Oracle-generated (read hybrid) applications depending on the platform your are own and the target device you are working on. I'll try to isolate specific use cases on different posts so you don't get distracted with irrelevant stuff.

The first one on the list is debugging Oracle Mobile Applications on iOS and Mac OS X.

The ingredients are:

- Oracle JDeveloper 11.1.2.4.0
- XCode 5.1 (for the Simulator)
- Apple Safari

The setup is pretty straightforward and here is what you have to do:

On the iOS Simulator (works on iOS +6.x), go to Settings > Safari > Advanced > and make sure Web Inspector is turned ON.

Open up the Safari web browser and enable the Develop features. To do that, go to Preferences > Advanced and check the Show Develop menu in the menu bar.


If you don't have an app deployed to the simulator yet, this is a good time to do so. Open up JDeveloper and deploy a simple application to the simulator (you can use the same approach with a real device but I'd rather start debugging on the simulator).

Once you have the app installed/deployed and running on your iOS simulator go to Safari and select the Develop menu.   

You should see something similar to the picture below where you select the iPhone Simulator and then the name of your application (in my case - MyWeatherChannel). The below HTML pages are part of your application and highlighting one of them in the Safari menu will also highlight them on the iOS simulator.


Selecting that highlighted page will bring Safari's Web Inspector up. Click on the first icon on the left (Resources) and that should show you the DOM for the page you selected.



At this point, you have many options but you may want to try enabling the Styles (click on the Styles button on the top menu) and make changes to the existing components on the page. That would give a good idea on what to look for when doing further debugging.

You can also manipulate the DOM to change the name or size of the labels and see how they are going to look like.


What is also very interesting are the Timelines (click on the Timelines button on the top menu) where you can see how long it takes to make a network request, to load different components of your application and the details of JavaScript calls.



The last thing I'd like to show you here is the option to enable the Console (click on the Console button on the top menu) and you can many other things like triggering commands or watching the console output. You can also reload the application by pressing Cmd + R.


In the test above, I just fired an alert command (alert("My Test Message");) from the console and saw the JavaScript alert on the simulator.

You can also change the current values (by also manipulating the DOM) in the app like the example below where the command: document.getElementById("ot3").innerHTML=72; changes the value of one the fields in the app.




Happy debugging!





Saturday, February 22, 2014

An Introduction to Oracle Mobile Suite

Here is a quick overview and introduction to the Oracle Mobile Suite. There are basically four areas that the Oracle Mobile Suite helps with your mobile strategy:
  • Development of multichannel applications with Oracle Mobile Application Framework
  • Data and services integration across the enterprise with Oracle SOA Suite
  • Uniform information security across all layers of enterprise and mobile applications with Oracle Identity Management
  • Deployment and management (cloud and on premise) of multichannel applications with Oracle Cloud Application Foundation
The video below shows the core capabilities of the Oracle Mobile Suite and how can you benefit of it.


Wednesday, February 5, 2014

Getting Started with HTML5 WebSocket on Oracle WebLogic 12c

The current release of Oracle WebLogic (12.1.2) added support to HTML5 WebSocket (RFC-6455) providing the bi-directional communication over a single TCP connection between clients and servers. Unlike the HTTP communication model, client and server can send and receive data independently from each other. 

The use of WebSocket is becoming very popular for highly interactive web applications that depend on time critical data delivery, requirements for true bi-directional data flow and higher throughput.
To initiate the WebSocket connection, the client sends a handshake request to the server. The connection is established if the handshake request passes validation, and the server accepts the request. When a WebSocket connection is established, a browser client can send data to a WebLogic Server instance while simultaneously receiving data from that server instance. 

The WebLogic server implementation has the following components:
  •  The WebSocket protocol implementation that handles connection upgrades and establishes and manages connections as well as exchanges with the client. The WebLogic server fully implements the WebSocket protocol using its existing threading and networking infrastructure.
  • The WebLogic WebSocket Java API, through the weblogic.websocket package, allows you to create WebSocket-based server side applications handling client connections, WebSocket messages, providing context information for a particular WebSocket connection and managing the request/response handshake. For additional information about the WebLogic WebSocket Java API interfaces and classes, visit the following resource: http://docs.oracle.com/middleware/1212/wls/WLPRG/websockets.htm#BABJEFFD
  • To declare a WebSocket endpoint you use the @WebSocket annotation that allow you to mark a class as a WebSocket listener that's ready to be exposed and handle events. The annotated class must implement the WebSocketListener interface or extend from the WebSocketAdapter class.
When you deploy the WebSocket-based application on WebLogic, you basically follow the same approach using the standard Java EE Web Application archives (WARs), either as standalone or WAR module. Either way, the WebLogic Application Server detects the @WebSocket annotation on the class and automatically establishes it as a WebSocket endpoint.

Here is a simple application that creates a WebSocket endpoint at the /echo/ location path, receives messages from the client and sends the same message back to the client.

import weblogic.websocket.WebSocketAdapter;
import weblogic.websocket.WebSocketConnection;
import weblogic.websocket.annotation.WebSocket;

@WebSocket(pathPatterns={"/echo/*"})
public class Echo extends WebSocketAdapter{

@Override
  public void onMessage(WebSocketConnection connection, String msg){
      try{
          connection.send(msg);
      }catch(IOException ioe){
          //Handle error condition
      }
  }

}

On the client side, you typically use the WebSocket JavaScript API that most of the web browsers already support.


There are many samples out there that you can use to test the implementation above. One quick way of doing that is to navigate to http://www.websocket.org/echo.html and then point the location field to your WebLogic server. If you follow the sample available on https://github.com/mjabali/HelloWorld_WebSocket then you'll end up with something like ws://localhost:7001/HelloWorld_WebSocket/echo/ for the WebSocket server application.

The sample client provided will be available at http://localhost:7001/HelloWorld_WebSocket/index.html after the WebLogic deployment. See the README.md file on GitHub for additional instructions.

Have fun!

Wednesday, October 30, 2013

Getting Started with Oracle WebLogic 12c Dynamic Clusters

One of the new features introduced on WebLogic 12c (12.1.2) is the ability to create and add new managed servers to a clustered environment dynamically. Dynamic Clusters make the task of creating additional servers for scaling out your environment really easy.
 You no longer have to configure managed servers individually but instead you configure a cluster with the number of servers you want and the server template or the domain default values. From there the system maps out managed servers with attributes inherited from the server template.

Dynamic clusters can absolutely be a building block for elasticity in the cloud environment.


To create a sample WebLogic Dynamic Cluster configuration, follow the steps below:

- Download and install Oracle WebLogic Server 12.1.2 at http://www.oracle.com/technetwork/middleware/fusion-middleware/downloads/index.html

- Create a new domain called mydomain. If you need the instructions on how to create a WebLogic domain, go to: http://docs.oracle.com/middleware/1212/wls/WLDCW/newdom.htm#i1097775

- Start WebLogic Admin Server by running $WLS_HOME/user_projects/domains/my_domain/startWebLogic.sh | .bat where WLS_HOME is the directory where you have installed WebLogic

- Navigate to WebLogic console at http://localhost:7001/console (default settings used here)

- Under the domain structure, click on Machines and configure a new Machine called myMachine and the default settings.

- Create the Dynamic Cluster. Click on Cluster under the Domain Structure menu



- Click on the New button and then select Dynamic Cluster

- Specify the name for your Dynamic Cluster (i.e. myDynamicCluster) and press Next


- Select the number of dynamic server you want to configure, select the server name prefix and the template to be used when creating new servers. Click Next


- For this simple local configuration, specify the Machine Binding to be using the machine you created (myMachine) previously. Click Next




- Select the listen port for the first server in the dynamic cluster and then the SSL lister port for the first server in the dynamic cluster. The subsequent servers will be assigned with an incremental port number. Click Next



- You will be presented with the summary of your New Dynamic Cluster configuration. Click Finish and it will be created for you.


- The Summary of Clusters screens should show you the recently created Dynamic Cluster.


- Click on myDynamicCluster and then go to the Control tab. 


Before you can start any of the dynamic cluster members, make sure you have started the Node Manager on your machine with the following command: $WLS_HOME/user_projects/domains/my_domain/bin/startNodeManager.sh | .bat

As soon as the Node Manager is started, then go back to the WebLogic Admin Console, then select one of the servers in the cluster and then click Start. As a result of that operation, you should see the selected server up and running.


- The next step here is to start the other servers configured in your cluster and as a bonus you can dynamically add new members to the dynamic cluster.


I hope you found this sample tutorial and stay tuned for more!