Tuesday, June 17, 2014

APIs Frameworks and Tools

Alphabetical

JRuby

Play (Google) / SBT (Scala Build Tool - Typesafe)

C:\_dev\_play>play new test2
       _
 _ __ | | __ _ _  _
| '_ \| |/ _' | || |
|  __/|_|\____|\__ /
|_|            |__/

play 2.2.3 built with Scala 2.10.3 (running Java 1.7.0_51), http://www.playframework.com

The new application will be created in C:\_dev\_play\test2

What is the application name? [test2]
> redirect

Which template do you want to use for this new application?

  1             - Create a simple Scala application
  2             - Create a simple Java application

> 1
OK, application redirect is created.

Have fun!

C:\_dev\_play>cd test2

C:\_dev\_play\test2>dir
 Volume in drive C is OS
 Volume Serial Number is 4E12-1E48

 Directory of C:\_dev\_play\test2

29/05/2014  16:26    <DIR>          .
29/05/2014  16:26    <DIR>          ..
29/05/2014  16:25               141 .gitignore
24/07/2014  16:28    <DIR>          app
24/07/2014  16:28               140 build.sbt
24/07/2014  16:28    <DIR>          conf
24/07/2014  16:28    <DIR>          project
24/07/2014  16:28    <DIR>          public
29/05/2014  16:25               147 README
24/07/2014  16:28    <DIR>          test
               3 File(s)            428 bytes
               7 Dir(s)   3,725,914,112 bytes free

C:\_dev\_play\test2>play
Getting org.scala-sbt sbt 0.13.0 ...
:: retrieving :: org.scala-sbt#boot-app
        confs: [default]
        43 artifacts copied, 0 already retrieved (12440kB/185ms)
[info] Loading project definition from C:\_dev\_play\test2\project
[info] Set current project to redirect (in build file:/C:/_dev/_play/test2/)
       _
 _ __ | | __ _ _  _
| '_ \| |/ _' | || |
|  __/|_|\____|\__ /
|_|            |__/

play 2.2.3 built with Scala 2.10.3 (running Java 1.7.0_51), http://www.playframework.com

> Type "help play" or "license" for more information.
> Type "exit" or use Ctrl+D to leave this console.

[redirect] $ help play
Welcome to Play 2.2.3!

These commands are available:
-----------------------------
classpath                  Display the project classpath.
clean                      Clean all generated files.
compile                    Compile the current application.
console                    Launch the interactive Scala console (use :quit to exit).
dependencies               Display the dependencies summary.
dist                       Construct standalone application package.
exit                       Exit the console.
h2-browser                 Launch the H2 Web browser.
license                    Display licensing informations.
package                    Package your application as a JAR.
play-version               Display the Play version.
publish                    Publish your application in a remote repository.
publish-local              Publish your application in the local repository.
reload                     Reload the current application build file.
run <port>                 Run the current application in DEV mode.
test                       Run Junit tests and/or Specs from the command line
eclipse                    generate eclipse project file
idea                       generate Intellij IDEA project file
sh <command to run>        execute a shell command
start <port>               Start the current application in another JVM in PROD mode.
update                     Update application dependencies.

Type `help` to get the standard sbt help.

[redirect] $ publish
[info] Packaging C:\_dev\_play\test2\target\scala-2.10\redirect_2.10-1.0-SNAPSHOT-sources.jar ...
[info] Updating {file:/C:/_dev/_play/test2/}test2...
[info] Done packaging.
[info] Wrote C:\_dev\_play\test2\target\scala-2.10\redirect_2.10-1.0-SNAPSHOT.pom
[info] Resolving org.scala-lang#scala-library;2.10.3 ...
  [info] Resolving com.typesafe.play#play-jdbc_2.10;2.2.3 ...
  [info] Resolving com.typesafe.play#play_2.10;2.2.3 ...
  [info] Resolving com.typesafe.play#sbt-link;2.2.3 ...
  [info] Resolving org.javassist#javassist;3.18.0-GA ...
  [info] Resolving com.typesafe.play#play-exceptions;2.2.3 ...
  [info] Resolving com.typesafe.play#templates_2.10;2.2.3 ...
  [info] Resolving com.github.scala-incubator.io#scala-io-file_2.10;0.4.2 ...
  [info] Resolving com.github.scala-incubator.io#scala-io-core_2.10;0.4.2 ...
  [info] Resolving com.jsuereth#scala-arm_2.10;1.3 ...
  [info] Resolving com.typesafe.play#play-iteratees_2.10;2.2.3 ...
  [info] Resolving org.scala-stm#scala-stm_2.10;0.7 ...
  [info] Resolving com.typesafe#config;1.0.2 ...
  [info] Resolving com.typesafe.play#play-json_2.10;2.2.3 ...
  [info] Resolving com.typesafe.play#play-functional_2.10;2.2.3 ...
  [info] Resolving com.typesafe.play#play-datacommons_2.10;2.2.3 ...
  [info] Resolving joda-time#joda-time;2.2 ...
  [info] Resolving org.joda#joda-convert;1.3.1 ...
  [info] Resolving com.fasterxml.jackson.core#jackson-annotations;2.2.2 ...
  [info] Resolving com.fasterxml.jackson.core#jackson-core;2.2.2 ...
  [info] Resolving com.fasterxml.jackson.core#jackson-databind;2.2.2 ...
  [info] Resolving org.scala-lang#scala-reflect;2.10.3 ...
  [info] Resolving io.netty#netty;3.7.1.Final ...
  [info] Resolving com.typesafe.netty#netty-http-pipelining;1.1.2 ...
  [info] Resolving org.slf4j#slf4j-api;1.7.5 ...
  [info] Resolving org.slf4j#jul-to-slf4j;1.7.5 ...
  [info] Resolving org.slf4j#jcl-over-slf4j;1.7.5 ...
  [info] Resolving ch.qos.logback#logback-core;1.0.13 ...
  [info] Resolving ch.qos.logback#logback-classic;1.0.13 ...
  [info] Resolving com.typesafe.akka#akka-actor_2.10;2.2.0 ...
  [info] Resolving com.typesafe.akka#akka-slf4j_2.10;2.2.0 ...
  [info] Resolving org.apache.commons#commons-lang3;3.1 ...
  [info] Resolving com.ning#async-http-client;1.7.18 ...
  [info] Resolving oauth.signpost#signpost-core;1.2.1.2 ...
  [info] Resolving commons-codec#commons-codec;1.3 ...
  [info] Resolving oauth.signpost#signpost-commonshttp4;1.2.1.2 ...
  [info] Resolving org.apache.httpcomponents#httpcore;4.0.1 ...
  [info] Resolving org.apache.httpcomponents#httpclient;4.0.1 ...
  [info] Resolving commons-logging#commons-logging;1.1.1 ...
  [info] Resolving xerces#xercesImpl;2.11.0 ...
  [info] Resolving xml-apis#xml-apis;1.4.01 ...
  [info] Resolving javax.transaction#jta;1.1 ...
  [info] Resolving com.jolbox#bonecp;0.8.0.RELEASE ...
  [info] Resolving com.google.guava#guava;14.0.1 ...
  [info] Resolving com.h2database#h2;1.3.172 ...
  [info] Resolving tyrex#tyrex;1.0.1 ...
  [info] Resolving com.typesafe.play#anorm_2.10;2.2.3 ...
  [info] Resolving com.typesafe.play#play-cache_2.10;2.2.3 ...
  [info] Resolving net.sf.ehcache#ehcache-core;2.6.6 ...
  [info] Resolving com.typesafe.play#play-test_2.10;2.2.3 ...
  [info] Resolving junit#junit;4.11 ...
  [info] Resolving org.hamcrest#hamcrest-core;1.3 ...
  [info] Resolving org.specs2#specs2_2.10;2.1.1 ...
  [info] Resolving org.scalaz#scalaz-core_2.10;7.0.2 ...
  [info] Resolving org.scalaz#scalaz-concurrent_2.10;7.0.2 ...
  [info] Resolving org.scalaz#scalaz-effect_2.10;7.0.2 ...
  [info] Resolving com.novocode#junit-interface;0.10 ...
  [info] Resolving org.scala-tools.testing#test-interface;0.5 ...
  [info] Resolving com.google.code.findbugs#jsr305;2.0.1 ...
  [info] Resolving org.fluentlenium#fluentlenium-festassert;0.8.0 ...
  [info] Resolving org.fluentlenium#fluentlenium-core;0.8.0 ...
  [info] Resolving org.seleniumhq.selenium#selenium-java;2.32.0 ...
  [info] Resolving org.seleniumhq.selenium#selenium-android-driver;2.32.0 ...
  [info] Resolving org.seleniumhq.selenium#selenium-remote-driver;2.32.0 ...
  [info] Resolving cglib#cglib-nodep;2.1_3 ...
  [info] Resolving org.json#json;20080701 ...
  [info] Resolving org.seleniumhq.selenium#selenium-api;2.32.0 ...
  [info] Resolving org.apache.httpcomponents#httpclient;4.2.1 ...
  [info] Resolving org.apache.httpcomponents#httpcore;4.2.1 ...
  [info] Resolving commons-codec#commons-codec;1.6 ...
  [info] Resolving org.apache.commons#commons-exec;1.1 ...
  [info] Resolving net.java.dev.jna#jna;3.4.0 ...
  [info] Resolving net.java.dev.jna#platform;3.4.0 ...
  [info] Resolving org.seleniumhq.selenium#selenium-chrome-driver;2.32.0 ...
  [info] Resolving org.seleniumhq.selenium#selenium-htmlunit-driver;2.32.0 ...
  [info] Resolving net.sourceforge.htmlunit#htmlunit;2.12 ...
  [info] Resolving xalan#xalan;2.7.1 ...
  [info] Resolving xalan#serializer;2.7.1 ...
  [info] Resolving commons-collections#commons-collections;3.2.1 ...
  [info] Resolving org.apache.httpcomponents#httpmime;4.2.3 ...
  [info] Resolving net.sourceforge.htmlunit#htmlunit-core-js;2.12 ...
  [info] Resolving net.sourceforge.nekohtml#nekohtml;1.9.18 ...
  [info] Resolving net.sourceforge.cssparser#cssparser;0.9.9 ...
  [info] Resolving org.w3c.css#sac;1.3 ...
  [info] Resolving commons-io#commons-io;2.2 ...
  [info] Resolving org.eclipse.jetty#jetty-websocket;8.1.9.v20130131 ...
  [info] Resolving org.eclipse.jetty#jetty-util;8.1.9.v20130131 ...
  [info] Resolving org.eclipse.jetty#jetty-io;8.1.9.v20130131 ...
  [info] Resolving org.eclipse.jetty#jetty-http;8.1.9.v20130131 ...
  [info] Resolving org.seleniumhq.selenium#selenium-firefox-driver;2.32.0 ...
  [info] Resolving org.seleniumhq.selenium#selenium-ie-driver;2.32.0 ...
  [info] Resolving org.seleniumhq.selenium#selenium-iphone-driver;2.32.0 ...
  [info] Resolving org.seleniumhq.selenium#selenium-safari-driver;2.32.0 ...
  [info] Resolving org.webbitserver#webbit;0.4.14 ...
  [info] Resolving org.seleniumhq.selenium#selenium-support;2.32.0 ...
  [info] Resolving org.easytesting#fest-assert;1.4 ...
  [info] Resolving org.easytesting#fest-util;1.1.6 ...
  [info] Resolving com.typesafe.play#play-docs_2.10;2.2.3 ...
  [info] Resolving com.typesafe.play#play-doc_2.10;1.0.3 ...
  [info] Resolving org.pegdown#pegdown;1.4.0 ...
  [info] Resolving org.parboiled#parboiled-java;1.1.5 ...
  [info] Resolving org.parboiled#parboiled-core;1.1.5 ...
  [info] Resolving org.ow2.asm#asm;4.1 ...
  [info] Resolving org.ow2.asm#asm-tree;4.1 ...
  [info] Resolving org.ow2.asm#asm-analysis;4.1 ...
  [info] Resolving org.ow2.asm#asm-util;4.1 ...
  [info] Resolving commons-io#commons-io;2.4 ...
  [info] Resolving org.scala-lang#scala-compiler;2.10.3 ...
  [info] Resolving org.scala-lang#jline;2.10.3 ...
  [info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] :: delivering :: redirect#redirect_2.10;1.0-SNAPSHOT :: 1.0-SNAPSHOT :: integration :: Thu Jul 24 16:29:08 EDT 2014
[info]  delivering ivy file to C:\_dev\_play\test2\target\scala-2.10\ivy-1.0-SNAPSHOT.xml
[info] Compiling 5 Scala sources and 1 Java source to C:\_dev\_play\test2\target\scala-2.10\classes...
[info] Main Scala API documentation to C:\_dev\_play\test2\target\scala-2.10\api...
[info] 'compiler-interface' not yet compiled for Scala 2.10.3. Compiling...
[info]   Compilation completed in 8.149 s
model contains 17 documentable templates
[info] Main Scala API documentation successful.
[info] Packaging C:\_dev\_play\test2\target\scala-2.10\redirect_2.10-1.0-SNAPSHOT-javadoc.jar ...
[info] Done packaging.
[info] Packaging C:\_dev\_play\test2\target\scala-2.10\redirect_2.10-1.0-SNAPSHOT.jar ...
[info] Done packaging.
[trace] Stack trace suppressed: run last *:publishConfiguration for the full output.
[error] (*:publishConfiguration) Repository for publishing is not specified.
[error] Total time: 16 s, completed 24-Jul-2014 4:29:21 PM


[redirect] $ start 9001

(Starting server. Type Ctrl+D to exit logs, the server will remain in background)

Play server process ID is 8440
[info] play - Application started (Prod)
[info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9001


http://127.0.0.1:9001/
Your new application is ready.

Categorized

Javascript / CSS


Java EE 7


Java EE 6


Java EE 5


jBPM


Sunday, June 15, 2014

Upgrading to WebLogic 12c (12.1.2 or 12.1.3) from 10.3.5 or 10.3.6

    If you are upgrading from an older 11g 10.3.5 or 10.3.6 version of WebLogic Server to the latest 12.1.2 (EE6) or 12.1.3 (EE6 + partial EE7) version - the following references may be of assistance.

Setup

You can run 2 WebLogic domains simultaneously by running them on different ports.  Put one of the domains on admin port 7001 and the 2nd on admin port 17001, managed server ports 7101/7201 and nodemanager port 5556.


Create a (non-TX with properties: "Supports Global Transactions" global TX with one-phase commit) datasource to (for example postgreSQL) to be used by JMS called "MWJMSds".
Create a JDBC persistent store for each migratable server - but you will only be able to use datasources that are completely non-transactional.  Turn off the checkbox on the DS to see it in the dropdown of the persistent store create page.
The following table should be created "MW1WLStore" using a MW1 and MW2 prefix but we get.


one or more registered update listeners reported activation problems. The following failures occurred: -- The following failures occurred: -- javax.naming.NameNotFoundException: While trying to lookup 'jms.MWJDBCDerbyDS2' didn't find subcontext 'jms'. Resolved ''; remaining name 'jms/MWJDBCDerbyDS2' weblogic.management.DeploymentException: javax.naming.NameNotFoundException: While trying to lookup 'jms.MWJDBCDerbyDS2' didn't find subcontext 'jms'. Resolved ''; remaining name 'jms/MWJDBCDerbyDS2'

Make sure you target the managed server - not the admin server

JDBCStore
MW_ManagedServer_1 (migratable)

Create JMS servers and target the persistent store and managed server target


JDBCStore-0
MW_ManagedServer_1 (migratable)
MW_ManagedServer_1


Create a JMS Module
Create a subdeployment - target only the 2 JMS servers
Create a JMS distributed queue - use advanced targeting and select the subdeployment.
Go back into the JMS queue | SubDeployment and notice that the subdeployment is reset to "none" - this seems to be a new bug in WebLogic 12.1.2.0 - if you resave this page you will reset the subdeployment and target


Uniform Distributed Queue
jms/DistributedQueue-1
subdeployment
JMSServer-1, JMSServer-2



If I deselect one of the JMS servers in the subdeployment setup page - then the subdeployment reappears on the subdeployment dropdown of the distributed queue.
Other possible workarounds like changing the target of the subdeployment to the cluster (which inherits the JMS server(s)) does not work.

There are many features not available in default targeting - therefore we need to get multi-server subdeployment working.
http://docs.oracle.com/middleware/1212/wls/JMSAD/dynamic_messaging.htm#CHDHFDEI

weblogic_timers table:
Verify that the datasource is set on the cluster | configuration | scheduling page

See
https://community.oracle.com/thread/2502444

Architecture

The server consists of a cluster where each physical node has a nodemanager, 2 managed servers and 2 JMS servers.

Design Issues

DI 1: JMS Server failover via Migratable Target

DI 2: Time for all managed servers and DB must be synchronized


Verification Test Plan:

JMS

Uniform Distributed Queues:
The documentation for 12.1.2 states that default targeting should be deferred in favour of advanced targeting involving subdeployments.
http://docs.oracle.com/middleware/1212/wls/JMSAD/best_practice.htm#CACFGECE
However there is an issue where the subdeployment that targets more than one JMS server is not selectable as a target for UDQ's.

Targeting the cluster instead of a subdeployment is very limited in functionality - therefore we need to get multi-server subdeployment working.
http://docs.oracle.com/middleware/1212/wls/JMSAD/dynamic_messaging.htm#CHDHFDEI

Cluster | Configuration | Singleton Services

JPA 2.0

Although JPA 2.0 has been available since the 15 Jan 2010 release of WebLogic 10.3.4 - upgrading from JPA 1.0 may experience the following issues.

Issues:

Listen Address Unspecified:
The following warning means that multiple IP's are configured for the cluster
<Jun 15, 2014 8:10:48 PM EDT> <Warning> <Cluster> <BEA-003121> <Unicast cluster may not function correctly as the listen address of server MW_ManagedServer_1 is not specified.> 

References:

http://docs.oracle.com/middleware/1212/wls/NOTES/index.html
http://docs.oracle.com/middleware/1212/wls/JMSPG/index.html
http://middlewaresnippets.blogspot.ca/2013/11/jms-migration-in-weblogic-server-12c.html

Thursday, March 27, 2014

Apple MacBook Pro is the key to living the developer dream - have your iOS, your Android and Java EE

      My MacBook Pro is awesome.   On a single machine I am able to develop Java EE applications, write Android apps and of course evolve iOS mobile applications.   The high end machine is a fusion of what a developer needs.
1) Unix based OS
2) iOS development
3) Java EE development
4) Android development
5) Screen Sharing replaces RDP
6) Vmware Fusion 6 allows for running licensed versions of Windows 7 and an unlimited number of OSX 10.9 VM's
7) When installing iOS 8 beta on an iphone 5s or ipod touch 5th - you will need to cycle the device in member central as well as remove old provisioning profiles in XCode 6 | Devices - re-add them and then reconnect the device.  You will then be able to run new "Swift" coded apps from XCode 6

1) Make sure to turn off native mode for WebLogic 12c node manager on the mac
NativeVersionEnabled=false
http://cerebro.com.au/2013/02/25/nodemanager-on-mac-osx/
2) for Insufficient disk space error
use the flag -Dspace.detection=false
http://docs.oracle.com/cd/E21764_01/doc.1111/e14775/weblogic_server_issues.htm#CIHIHFCB

Friday, March 21, 2014

Using postgreSQL with WebLogic 12c and EclipseLink 2.4 or Hibernate 4.2

This article describes how to get the postgreSQL 9.3 database running on WebLogic 12.1.2 using EclipseLink 2.4 or Hibernate 4.2 as the JPA persistence provider

Tutorial assumes EclipseLink 2.4.2.v20130514-5956486 running on WebLogic 12.1.2.1 on OSX 10.9 using postgreSQL 9.3 the postgreSQL
JDBC driver jar does not come with WebLogic http://docs.oracle.com/cd/E15051_01/wls/docs103/jdbc_admin/third_party_drivers.html
modify the class http://docs.oracle.com/cd/E15051_01/wls/docs103/admin_ref/weblogicServer.html#ModifyingClasspaht
Download the latest postgreSQL 9.3 JDBC 4.1 jar from
http://jdbc.postgresql.org/download.htmlpostgresql-9.3-1101.jdbc41.jar
Install postgreSQL 9.3 on the mac
Create a database by running Applications/PostgreSQL 9.3/pgAdmin III

Create a datasource in the WebLogic console

JAVA SE RESOURCE_LOCAL persistence.xml
org.eclipse.persistence.jpa.PersistenceProvider

results
[EL Info]: 2014-03-19 18:03:22.718--ServerSession(1898536649)--Thread(Thread[main,5,main])--EclipseLink, version: Eclipse Persistence Services - 2.4.2.v20130514-5956486 [EL Config]: connection: 2014-03-19 18:03:22.722--ServerSession(1898536649)--Connection(223623898)--Thread(Thread[main,5,main])--connecting(DatabaseLogin( platform=>PostgreSQLPlatform user name=> "postgres" datasource URL=> "jdbc:postgresql://localhost:5432/obrienlabs"

JAVA EE JTA Container Managed persistence.xml
org.eclipse.persistence.jpa.PersistenceProvider

results
[EL Config]: connection: 2014-03-19 19:50:20.599--ServerSession(1214490893)--Connection(1145000203)--Thread(Thread[[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads])--connecting(DatabaseLogin( platform=>PostgreSQLPlatform user name=> "" connector=>JNDIConnector datasource name=>null )) [EL Config]: connection: 2014-03-19 19:50:20.599--ServerSession(1214490893)--Connection(417451054)--Thread(Thread[[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads])--Connected: jdbc:postgresql://127.0.0.1:5432/obrienlabs User: postgres Database: PostgreSQL Version: 9.3.3 Driver: PostgreSQL Native Driver Version: PostgreSQL 9.3 JDBC4.1 (build 1101) [EL Finest]: sequencing: 2014-03-19 19:50:20.599--ServerSession(1214490893)--Thread(Thread[[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads])--sequencing connected, state is Preallocation_Transaction_NoAccessor_State

Hibernate 4.2.12 on WebLogic 12.1.2.0

Hibernate 4.3 will not run as a container managed persistence context on WebLogic 12.1.2.0 because only the JPA 2.0 version of the EntityManager proxy is supported (12.1.3.0 should support JPA 2.1).  Therefore using Hibernate 4.2 is recommended for 12c.

persistence.xml












<property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.WeblogicJtaPlatform"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>   


Running any JPA provider that supports the 2.0 spec

Notes:
1) For polymorphic inheritance - the workaround annotation @ForceDescriminator is definitely your friend


Friday, February 21, 2014

All In CPU Performance Benchmarks

Java on

Macbook Pro 15 (8 core 2.6 GHz i7-4960) 16G RAM | OS 7.0.4 | Java 1.7.0_51 64-bit

38166 ms for Collatz  split: 16
38740 ms for Collatz  split: 32
37234 ms for Collatz  split: 64
35005 ms for Collatz  split: 128
34437 ms for Collatz  split: 256
32271 ms for Collatz  split: 512
31803 ms for Collatz  split: 1024
31707 ms for Collatz  split: 2048
31085 ms for Collatz  split: 4096
31469 ms for Collatz  split: 8192
32078 ms for Collatz  split: 16384
33302 ms for Collatz  split: 32768
32765 ms for Collatz  split: 65536
31821 ms for Collatz  split: 131072
31513 ms for Collatz  split: 262144
32498 ms for Collatz  split: 524288
33560 ms for Collatz  split: 1048576
36520 ms for Collatz  split: 2097152
34296 ms for Collatz  split: 4194304
34482 ms for Collatz  split: 8388608
40003 ms for Collatz  split: 16777216

61681 ms for Collatz  split: 33554432

Asus


Monday, September 23, 2013

Bluetooth 4 LE Mobile Rest client on iOS 7/Android 4 with abackendJAX-RS JPA 2 Java cloud service on Oracle WebLogic 12c

Bluetooth 4 LE Mobile Rest client on iOS 7/Android 4.3 with a backend JAX-RS JPA 2 Java cloud service on Oracle WebLogic 12c

The following post details my ongoing work in getting a mobile client [iOS 7 enabled iPhone 4s] to upload external biometric data from a Bluetooth 4.0 LE device such as the MIO watch or the Wahoo chest strap to a cloud based [Oracle WebLogic 12c] service.  I will also upload all available device data such as acceleration, rotation, gravity, light, humidity, temperature, magnetic fields, longitude/latitude, heading and altitude.

JAX-RS Testing

Here is a nearly ready for Apple submission - iPhone 5 based prototype that reads from two heart rate monitors simultaneously.  The data is uploaded real time to my Oracle Cloud data center where the two rates are correlated and used to eliminate heart rate spikes specific to a single device - for redundancy




BOM (Bill of Materials): 

- A Bluetooth 4.0 LE/Smart compatible device like the Apple iPhone 4s, 5 or 5c or the iPad mini 2nd gen
   or an Android 4.3+ device like the Samsung Galaxy S4 or Google Nexus 5
   or a BlackBerry 10 device like the Q10 or Z10
- a biometric device that emits low power Bluetooth 4.0 data like the Kickstarter LED pulse watch - MIO Alpha or more reliable wahoo chest strap which conforms to the Bluetooth Heart Rate Profile
- a cloud based data center service like Oracle WebLogic 12c or Cloudbees or even GAE that includes both a Java EE (preferably JPA 2 based backend with integrated Database like Oracle Database 11g.
- a local development version of Oracle WebLogic 12 with integrated OEPE Eclipse Kepler Java EE IDE
http://www.oracle.com/technetwork/middleware/weblogic/downloads/wls-main-097127.html
oepe-12.1.2.1-kepler-installer-win32.exe


Features

F1: Device independence or coverage (Android 4.3+ or Android 4.2.2 (Samsung), Blackberry 10, iOS 7 and optionally PhoneGap3/Webkit
F2: Sensor capture (device local) of positional, magnetic, acceleration, gravitational, rotational, light, pressure, humidity, sound data
F3: Sensor capture (device remote) of Bluetooth 4 LE (Smart) biometric data
F3.1: Multiple remote BT 4.0 capture (IE: Mio Alpha watch + Wahoo chest)
F4: Sensor display (device local and remote web monitoring)
F5: Sensor persistence (device local and online/offline remote data center)

Requirements

R1: Mobile sensor data capture
R2: Mobile data upload to data center
R3: Mobile data viewing
R4: Realtime local device based data analysis
R5: Realtime web based data analysis
R6: Mobile based data storage/caching
R7: Volumetrics: Time and Space performance analysis (best,average,worst)
R8: Resiliency: handle network timeout, unavailability through caching and concurrency
R9:

Architecture

Front end clients


Back end as a service (BaaS)


Development

We will be using the Core Bluetooth API introduced in iOS5 but targeting iOS7 just released in Sept 2013.
We will also be using Android 4.2.2 with the proprietary Samsung BLE API until I get get Android 4.3 on it containing generic BLE support.

Design Issues


DI1:  Handling network outages

DI2: Database for Backend
We will be using postgreSQL as the database backend.




Experimental Results

UUID, characteristics and data for the MIO Alpha bluetooth watch.

2013-09-26 21:48:54.395 Biometric[289:60b] CoreBluetooth[WARNING] <CBCentralManager: 0x16e994f0> is disabling duplicate filtering, but is using the default queue (main thread) for delegate events
2013-09-26 21:48:54.795 Biometric[289:60b] Connecting to peripheral <CBPeripheral: 0x16db2580 identifier = 398D853C-FE6D-A669-0E72-4A19D103CF0D, Name = "MIO GLOBAL", state = disconnected>
2013-09-26 21:48:55.501 Biometric[289:60b] Service found with UUID: Unknown (<6c721826 5bf14f64 9170381c 08ec57ee>)
2013-09-26 21:48:55.503 Biometric[289:60b] Service found with UUID: Device Information
2013-09-26 21:48:55.508 Biometric[289:60b] Service found with UUID: Unknown (<180d>)
2013-09-26 21:48:55.515 Biometric[289:60b] Discovered characteristic <CBCharacteristic: 0x16dc8020> UUID: Unknown (<6c722a0a 5bf14f64 9170381c 08ec57ee>)
2013-09-26 21:48:55.520 Biometric[289:60b] Discovered characteristic <CBCharacteristic: 0x16dd0850> UUID: Unknown (<6c722a0b 5bf14f64 9170381c 08ec57ee>)
2013-09-26 21:48:55.524 Biometric[289:60b] Discovered characteristic <CBCharacteristic: 0x16dc0460> UUID: Serial Number String
2013-09-26 21:48:55.527 Biometric[289:60b] Discovered characteristic <CBCharacteristic: 0x16ddb060> UUID: Manufacturer Name String
2013-09-26 21:48:55.530 Biometric[289:60b] Discovered characteristic <CBCharacteristic: 0x16dd23f0> UUID: System ID
2013-09-26 21:48:55.533 Biometric[289:60b] Discovered characteristic <CBCharacteristic: 0x16dd0df0> UUID: Firmware Revision String
2013-09-26 21:48:55.536 Biometric[289:60b] Discovered characteristic <CBCharacteristic: 0x16dca2b0> UUID: Hardware Revision String
2013-09-26 21:48:55.539 Biometric[289:60b] Discovered characteristic <CBCharacteristic: 0x16dd1280> UUID: Model Number String
2013-09-26 21:48:55.543 Biometric[289:60b] Discovered characteristic <CBCharacteristic: 0x16db5300> UUID: Software Revision String
2013-09-26 21:48:55.547 Biometric[289:60b] Discovered characteristic <CBCharacteristic: 0x16ea3f70> UUID: Unknown (<2a37>)
2013-09-26 21:48:55.551 Biometric[289:60b] Discovered characteristic <CBCharacteristic: 0x16ea3c70> UUID: Unknown (<2a38>)
2013-09-26 21:48:55.557 Biometric[289:60b] size: 4 value:<04030201>
2013-09-26 21:48:55.617 Biometric[289:60b] size: 4 value:<00000002> 
2013-09-26 21:48:55.677 Biometric[289:60b] size: 8 value:<30303030 46333344> 0000F33D
2013-09-26 21:48:55.737 Biometric[289:60b] size: 10 value:<4d494f20 474c4f42 414c> MIO GLOBAL
2013-09-26 21:48:55.797 Biometric[289:60b] size: 10 value:<3df30000 d86433d9 c9e9> (null)
2013-09-26 21:48:55.857 Biometric[289:60b] size: 5 value:<30322e30 33> 02.03
2013-09-26 21:48:55.917 Biometric[289:60b] size: 5 value:<30333233 38> 03238
2013-09-26 21:48:55.977 Biometric[289:60b] size: 10 value:<414c5048 41203533 5000> ALPHA 53P
2013-09-26 21:48:56.037 Biometric[289:60b] size: 8 value:<30312e30 392e3035> 01.09.05
2013-09-26 21:48:56.097 Biometric[289:60b] size: 4 value:<10367204> 6r

2013-09-26 21:48:56.157 Biometric[289:60b] size: 1 value:<02> 

Found the heart rate characteristic via the BLE specification site
https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.heart_rate_measurement.xml
It turns out the rate is encoded in the 2A37 characteristic


After fixing my callback I now see the embedded heart rate value in 2A37

2013-10-01 15:42:42.929 Biometric[536:60b] size: 4 value:<104b3303> K3 75
2013-10-01 15:42:43.926 Biometric[536:60b] size: 4 value:<104c2803> L( 76
2013-10-01 15:42:44.924 Biometric[536:60b] size: 4 value:<104d1e03> M 77
2013-10-01 15:42:45.921 Biometric[536:60b] size: 6 value:<104d1e03 1e03> M 77
2013-10-01 15:42:46.919 Biometric[536:60b] size: 4 value:<104d1e03> M 77
2013-10-01 15:42:47.916 Biometric[536:60b] size: 4 value:<104d1e03> M 77
2013-10-01 15:42:48.913 Biometric[536:60b] size: 6 value:<104d1e03 1e03> M 77
2013-10-01 15:42:49.911 Biometric[536:60b] size: 4 value:<104c2803> L( 76
2013-10-01 15:42:50.909 Biometric[536:60b] size: 4 value:<104c2803> L( 76

Setup

Android 4.2.2/4.3 on Samsung Galaxy S4 - deprecated

2014 Jan (use Android 4.4 on a Google Nexus instead)
Start with the blog entry below to enable your phone for development
http://stackoverflow.com/questions/16256048/eclipse-android-sdk-cannot-see-new-samsung-galaxy-s4-device-via-a-usb-connection
http://www.samsung.com/us/support/owners/product/SGH-I747MBBATT
You don't need KIES
http://www.samsung.com/in/support/usefulsoftware/KIES/JSP
http://www.androidcentral.com/how-get-developer-settings-galaxy-s4

study the API for Samsung BLE until Android 4.3 is enabled in Feb 2014 with standardized LE 4.0
http://developer.samsung.com/ble

References 

1) iOS6 Programming: Pushing the Limits, Rob Napier and Mugunth Kumar 2013, CH14: REST for the Weary, p.243
2) Bluetooth Smart Devices Technology website
3) https://developer.bluetooth.org/Pages/default.aspx
4) http://weblog.invasivecode.com/post/39707371281/core-bluetooth-for-ios-6-core-bluetooth-was
5) http://oleb.net/blog/2013/04/starting-bluetooth-low-energy-development-ios/
6) http://adcdownload.apple.com//wwdc_2012/wwdc_2012_session_pdfs/session_705__advanced_core_bluetooth.pdf
7)
Pro JPA 2.1 2nd edition by Mike Keith and Merrick Schincariol available at Apress, Amazon or partially at Google Books.

log

20131026: IOS 7 upload of heart rate via NSURLConnection

The IOS class NSURLConnection works about the same as the Java/Android HttpUrlConnection class and if easy to use.  I hardcoded the url and appended the heart rate from the 2a37 characteristic to test.

- (void) httpPushToDataCenter { NSMutableString *url = [[NSMutableString alloc ]init ]; [url appendString: cloudURLString]; [url appendString: @"&u=201310272&pr=ios"]; [url appendString: @"&hr="]; NSString *rateString = [NSString stringWithFormat:@"%hu", self.heartRate]; [url appendString: rateString]; NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString: url ] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0]; NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
I see the following on the Oracle data center
select IDENT_ID,TSSTOP,HEART from GPS_RECORD where userid=201310272

IDENT_IDTSSTOPHEART
1630901138280629409571
1630951138280629531971
1631001138280629633671
1631051138280629734271
1631101138280629831872
1631151138280629930771
1631201138280630031071
1631251138280630132571
1631301138280630287371
1631351138280630387172

20131027: Hiding the iOS keyboard for textviews

Apple has a bit of an issue surrounding closing the popup keyboard (Android gives you a done key).  It is the responsibility of the app to close the keyboard somehow - usually by clicking on empty app real estate or by assigning an action to another view.  Here I use the read-only text field for the heart rate to close any open keyboard.

- (IBAction)rateDown:(id)sender { [[self view] endEditing:YES]; }


20131029: Connecting to a WAHOO chest heart rate monitor

This HR monitor works well in an office/gym environment but it cuts out periodically in the field when rollerblading (unlike the MIO Alpha wrist HR monitor) - especially in temperatures down to +3 deg C.

However, my iOS 7 app picks up the monitor no problem - the issue now is I need to track both HR monitors simultaneously to get a better overall number.

2013-10-30 12:37:55.760 Biometric[806:60b] Setup
2013-10-30 12:37:55.798 Biometric[806:60b] Connecting to peripheral <CBPeripheral: 0x15557710 identifier = 4A90672B-EC3A-BEC2-5833-AD5A559DEE87, Name = "Wahoo HRM v2.1", state = disconnected>
2013-10-30 12:37:59.064 Biometric[806:60b] Connected to peripheral <CBPeripheral: 0x15557710 identifier = 4A90672B-EC3A-BEC2-5833-AD5A559DEE87, Name = "Wahoo HRM v2.1", state = connected>
2013-10-30 12:37:59.367 Biometric[806:60b] Service found with UUID: Device Information
2013-10-30 12:37:59.370 Biometric[806:60b] Service found with UUID: Unknown (<180d>)
2013-10-30 12:37:59.373 Biometric[806:60b] Service found with UUID: Battery
2013-10-30 12:37:59.375 Biometric[806:60b] Discovered characteristic <CBCharacteristic: 0x156531b0> UUID: Serial Number String
2013-10-30 12:37:59.377 Biometric[806:60b] Discovered characteristic <CBCharacteristic: 0x15647ce0> UUID: Manufacturer Name String
2013-10-30 12:37:59.378 Biometric[806:60b] Discovered characteristic <CBCharacteristic: 0x15647eb0> UUID: System ID
2013-10-30 12:37:59.380 Biometric[806:60b] Discovered characteristic <CBCharacteristic: 0x15652800> UUID: Firmware Revision String
2013-10-30 12:37:59.381 Biometric[806:60b] Discovered characteristic <CBCharacteristic: 0x156528c0> UUID: Hardware Revision String
2013-10-30 12:37:59.384 Biometric[806:60b] Discovered characteristic <CBCharacteristic: 0x15630ae0> UUID: Unknown (<2a37>)
2013-10-30 12:37:59.386 Biometric[806:60b] Discovered characteristic <CBCharacteristic: 0x15645240> UUID: Unknown (<2a38>)
2013-10-30 12:37:59.388 Biometric[806:60b] Discovered characteristic <CBCharacteristic: 0x15652ec0> UUID: Battery Level
2013-10-30 12:37:59.390 Biometric[806:60b] Discovered characteristic <CBCharacteristic: 0x15652150> UUID: Unknown (<2a1b>)
2013-10-30 12:37:59.392 Biometric[806:60b] Discovered characteristic <CBCharacteristic: 0x15652910> UUID: Unknown (<2a1a>)
2013-10-30 12:37:59.427 Biometric[806:60b] size: 6 value:<14439f03 9f03> C 67
2013-10-30 12:37:59.428 Biometric[806:60b] Sending: https://obrienscience-obrienlabs.*r?action=setGps&u=20131027&pr=ios&hr=67
2013-10-30 12:37:59.540 Biometric[806:60b] Notification began on <CBCharacteristic: 0x15630ae0>
2013-10-30 12:37:59.607 Biometric[806:60b] size: 6 value:<14439f03 9f03> C 67
2013-10-30 12:37:59.608 Biometric[806:60b] Sending: https://obrienscience-obrienlabs.*r?action=setGps&u=20131027&pr=ios&hr=67
2013-10-30 12:38:00.447 Biometric[806:60b] size: 16 value:<1442a403 a403a303 a3038b03 7c037603> B¤¤££|v 66

20131102: issues with Oracle WebLogic 12c response time on sub-second inserts using EclipseLink 2.3
I need to optimize the insert code as currently if I run 2 clients - an iOS7 app uploading heart rate data and an Android 4.2.2 app uploading everything else (all 27 data points) - both running every second - I get some network timeouts.
I also need to implement device side caching in period where the response time is reduced.
Here is an illustration of a field test while I was rolerblading - you will see some period where the Bluetooth 4 connection dropped to the Mio or Wahoo heart rate monitor.

I store and retrieve all my heart rate and other biometric data from the oracle cloud instance.
Reference rollerblade peak intervals
10 min exercise on treadmill - day 1


I had a major issue at 22 min after not running for 4 days - a 20 BPM spike from 158 to 178 and had to stop after 2 min.  I took the Mavik ACE inhibitor pill a bit earlier at 1800 - which was 2.5 hours before the run - when the full effects of the blood pressure lowering medication to kick in.  Later 30 min after the end of the run my BP was very low at 115/84/76 where it normally would be 145/105/80 before I started taking the ACE inhibitor 4 weeks ago. at 2330 I had a slight tight feeling around my heart.



In 7 seconds I went from 153 to 173 - a 20 BPM change around 22 min

1385084885943 1.002 149 151
1385084886944 1.001 151 151
1385084887904 0.96 153 152
1385084888959 1.055 156 153
1385084889914 0.955 156 153
1385084890893 0.979 156 157
1385084891867 0.974 165 160
1385084892920 1.053 172 160
1385084893928 1.008 174 168
1385084894903 0.975 174 171
1385084895941 1.038 174 171
1385084896903 0.962 174 173
1385084897928 1.025 176 174
1385084898938 1.01 178 175
1385084899897 0.959 178 176
1385084900919 1.022 178 176
1385084901924 1.005 176 176
Ms since 1970,diff, polar HR, mio HR

Connecting to two Heart Rate monitors for redundancy

The MIO Alpha watch has spikes of up to 200% where it will go from 80 BPM to 160 and return within a couple seconds.  These spikes can be filtered out in software.  There are also smaller spikes of 15-20 BPM that last up to 20 seconds that are hard to determine if they are due to the MIO HR watch itself or the wearer (an extra heartbeat confuses the multiplexed LED sensor?) - to workaround this my HR monitor/upload app can connect to two devices simultaneously - the heart rate values are both sent to the data center.
Here for example I am connected to the MIO Alpha Heart Rate watch and the Wahoo 2.1 Heart Rate chest strap.

Enabling the iOS Magnetometer in Xcode 5

You need to add "magnetometer" to the required device capabilities list in the plist file.

Adding CoreGraphics to an iOS UIView

Using color coded buttons with the current sensor value is good for a static snapshot but some historical context is required.  You add graphics capability under the standard views by subclassing UIView and assigning this subclass to your ViewController.  You must override the following callback.

- (void)drawRect:(CGRect)rect {
  CGContextRef g = UIGraphicsGetCurrentContext();
}

Adding Core Data persistence in iOS 7


Results
2014-05-25 00:24:28.809 Biometric[269:60b] <Device: 0x1780b9860> (entity: Device; id: 0xd000000000040000 <x-coredata://F02B5272-245D-4A76-94D9-3EB8EB92CD64/Device/p1> ; data: {
    id = iphone5;

})

20131129: Google Bluetooth 4.0 BLE API support in 4.3

Samsung pushed the Android 4.3- API18 update yesterday to the Galaxy S4 - therefore I can use standard Bluetooth 4.0 LE Heart Rate Profile spec code.  Since I got a Google Nexus 5 phone with Android 4.4 API19 - I now have 2 phones with spec BLE.



TODO

webservice
rest service
configurable length queue for http requests - each with a success/fail callback
option for local persistence
queue if fed by default from local persistence
refactor for key/value pair for each data point


local ui:


web ui:

Saturday, June 1, 2013

Java Cloud Providers - Review

Purpose:

I need a PaaS cloud/hosting provider for my Java EE applications so they can run as thin client applications and also as BaaS providers for mobile applications.

Google Appspot and GAE

This service is based on the DataNucleus JPA API - which runs fine

Oracle Cloud

Oracle's service is a straight PaaS offering that runs your database as a multitenant partition.  The difference is that you can be walked through the use and installation of the paid service in person.

The Java and DB instances are priced separately at a minimum combined cost of $533/month or $6400/year.
https://java-trialanzh.java.us1.oraclecloudapps.com
https://obrienscience-obrienlabs.java.us1.oraclecloudapps.com/
http://www.obrienlabs.org/opendata/FrontController?action=image

https://cloud.oracle.com/mycloud/f?p=service:database_pricing:0:::::
Database S5 $175 / Month
1 Schema Oracle Database 11g Release 2
5 GB Oracle Database Storage
30 GB Data Transfer

https://cloud.oracle.com/mycloud/f?p=service:java_pricing:0:::::
Java S1 $249 / Month
1 Oracle WebLogic Server 12.1.1+
1.5 GB RAM for Java Heap
5 GB File Storage
50 GB Data Transfer


Eclipse Integration
Get the OEPE from oracle that includes Eclipse Kepler, the OEPE plugins and WebLogic Server.
http://www.oracle.com/technetwork/developer-tools/eclipse/overview/index.html

Issues:


EMF injection requires static/dynamic weaving (the example entity is statically weaved)
http://static.springsource.org/spring/docs/3.0.0.RC3/reference/html/ch13s05.html
http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Advanced_JPA_Development/Performance/Weaving/Dynamic_Weaving
http://www.oracle.com/technetwork/articles/java/jsf-2-cloud-part1-1562825.html

Questions: Oracle Cloud using WebLogic 12.1.1.0 and JPA 2.0
https://forums.oracle.com/forums/thread.jspa?messageID=11052991#11052991|Thread: Database access from Oracle Java Cloud Service application
https://forums.oracle.com/forums/message.jspa?messageID=11052937#11052937|Thread: Related Annotations
https://forums.oracle.com/forums/message.jspa?messageID=11052868#11052868|Thread: EJB 3.1 Timer @Singleton does not start on Oracle Cloud - works locally

20130608: Oracle cloud running fine except for the Java EE container managed proxy issues.
20130608: Redeploy application (#40) job get stuck for 3 days now - there is no way for the user of the Oracle Java cloud instance to stop the misbehaving server job - rendering the cloud instance effectively offline.
20130614: solved by SR - job reset after 7 days was an anomaly - it would be good to have a watchdog process or an option to kill a long running process in the future.




Administration
https://database-trialanzh.db.us1.oraclecloudapps.com/apex/f?p=4500:1001:14650370459182::NO:::
Logs:
http://docs.oracle.com/cloud/123/developer_services/CSJSU/java-admin.htm#CACBHCGJ

Procedures:

Download WebLogic 12c via OEPE or Netbeans 7.3 to test your applications locally.
Update Netbeans to be cloud aware.
https://netbeans.org/kb/docs/web/oracle-cloud.html#install-plugin

You will need the matching source of the excellent JPA provider (EclipseLink) that ships with WebLogic Cloud
http://www.eclipse.org/eclipselink/releases/2.3.0.php
http://wiki.eclipse.org/EclipseLink/Examples/JPA/Composite

Get the version of EclipseLink by doing something that causes an exception and viewing the stacktrace
Currently as of 20131204 the version of EclipseLink - the default JPA provider in Oracle Cloud 12c is SVN rev# 10243 version 2.3.1 from 20111018

Caused by: Exception [EclipseLink-8034] (Eclipse Persistence Services - 2.3.1.v20111018-r10243): org.eclipse.persistence.exceptions.JPQLException


Cloudbees 


get git - http://git-scm.com/download/win
generating keys
https://help.github.com/articles/generating-ssh-keys
https://grandcentral.cloudbees.com/#CB_clickstart=https://raw.github.com/CloudBees-community/jboss-db-example/master/clickstart.json
http://opendatalink.obrienlabs.cloudbees.net/index.jsf
https://forge.cloudbees.com/a/obrienlabs/repositories/opendatalink

Jelastic


OpenShift (RedHat)


Cloud Foundry (VMWare)


AppFog


Amazon AWS / EC2 / Elastic Beanstalk


Your own router

Rogers allows a DMZ but Bell does not.  The performance of the upstream connection is too slow though.
local


Total Pageviews

Followers