5 December 2016

Amazon Go: shops without checkout

Amazon Go is Amazon's new concept of a brick and mortar shop.
Here's the manual:

  1. walk in
  2. pick your stuff
  3. walk out

26 November 2016

IntelliJ IDEA 2016.3 released

Some highlights in the 2016.3 IntelliJ IDEA release:

  • When looking at source code the editor now adds hints that show all parameter names in method calls for literals and null being passed in.
  • The debugger now allows you to examine the heap
  • The Resource Bundle editor now shows you which properties are unused in the project. Handy if you have tons of properties!
  • Refactoring to ES6 constructs (let, class...)

16 November 2016

Android phones made in China come with spyware

China made android phones have been found to contain spyware that sends your data to the Chinese government.
The malware is part of pre-installed apps made by Shanghai Adups Technolog, supplying software to ZTE and Huawei. It was found on the low budget phones made by these companies for the USA BLU phone brand.

9 November 2016

Oracle and ANSI SQL

ISO SQL is a rather weak standard.
First you can not get it unless you pay for it, which is not a good thing if you want your standard to be succesful. You can find draft versions of the latest SQL 2011 on the web however.
Second there is no official independent compliance verification.

Appendix B of the Oracle Database SQL language reference gives a detailed overview of Oracle standard compliance.

In oracle you can set the FLAGGER variable, to verify whether your command complies with the standard. It only checks compliance with the ISO SQL/92 standard though:

Finally, here's a neat overview of compatibility of SQL statements for the most popular databases.

22 September 2016

Excel: sort text as a date

You'd think that setting the format of an excel cell to date is sufficient to have excel treat it as such, but alas that's not the case.
The easiest way to do this (better than the microsoft support tips) is on superuser: abuse data>text to columns, to let excel parse and store as a date.

21 August 2016

Umlet: hide toolbox pane

You can resize the right pane containing the Umlet toolbox, but the minimum width will still take up some space. This is annoying when you want to view diagrams side by side, by firing another instance of the program.
There is a hidden feature to help you out here: doulble clicking the border separating the toolpane from the canvas hides the pane entirely. Double clicking the right canvas border again, makes the toolbox sidebar reappear.

18 August 2016

Cygwin ssh: Could not create directory '/home/myuser/.ssh'.

When first running ssh from cygwin 2.5.2, the .ssh directory to store trusted host keys could not be created.
ssh still works OK, but each time it prompts you to accept the host you are connecting to:

Could not create directory '/home/myuser/.ssh'.
The authenticity of host 'myserver (' can't be established.
ECDSA key fingerprint is SHA256:eSpqYAq2c7k843RfqpbpvK9F118XsKCArBdBheRN8c0.
Are you sure you want to continue connecting (yes/no)?
Reason is that ssh does not find your home directory. Easiest solution is to point it to your windows home directory. To do this, add this line to your_cygwin_install_dir\etc\nsswitch.conf file:

db_home: /%H

16 August 2016

Oracle Virtual box extensions install fails with VERR_ACCESS_DENIED due to McAfee

Installing Virtual Box 5.1.2 extensions on windows 10 failed with this error:

VBoxExtPackHelperApp.exe: error: Failed to rename the temporary directory to the final one: VERR_ACCESS_DENIED ('D:\Program Files\Oracle\VirtualBox\ExtensionPacks\Oracle_VM_VirtualBox_Extension_Pack-_-inst-4288' -> 'D:\Program Files\Oracle\VirtualBox\ExtensionPacks\Oracle_VM_VirtualBox_Extension_Pack')
After seeing several people on the net pointing to the antivirus, I disabled the McAfee real time virus scanning that came for 1 year with my Dell PC:
  1. Right click System Tray McAffee LiveSafeIcon
  2. Change Settings > Real Time Scanning
  3. Turn off
    1. Leave In 15 minutes
Then I reran the extensions installer and all went well.

12 August 2016

Oracle SQLDeveloper connection fails / TNS listener not starting

I had a problem today connecting to my Oracle express database from SQL Developer on Windows 10 with the error: The network adapter could not establish the connection.
Connection did work from SQL*PLUS (Run SQL Command line).
The OracleXETNSListener service was stopped in my services and restarting it did not work.
Turns out the problem was that I changed my computer name yesterday and the service does not use localhost, but the computername.
To solve this I changed the hostname in these files:
Stopped/started the database and everything's fine.

Saw these alternate solutions (did not test):
solution 1: Add the old hostname to C:\Windows\System32\drivers\etc\hosts
solution 2:

SQL> alter system set LOCAL_LISTENER='(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))' scope=both;
SQL> alter system register;

4 August 2016

SAP Hybris 6.1 released


  • Customer lists in assisted service module
    • Pick-Up In-Store Customers:
    • Current In-Store Customers:
    • My Recent Customer Session
  • B2C Accelerator: Save multiple carts for later 
  • Backoffice Solr search supported 
  • YAAS cloud: SAP hybris customer profiling
    • google analytics like events
    • order, account, session, product... events
    • API for mining the collected data

10 May 2016

JPA links (updated)

Reference implementation.

Official documentation:

Providers often have good JPA documentation as well. Might include extensions (and JDO stuff) though:

Specific topics:

    9 May 2016

    JPA: Composite Primary Key with Foreign Keys

    Entity for the ProductSales Table:
    package com.example.model;
    import javax.persistence.*;
    public class ProductSales {
     @Column(name = "QUANTITY")
     private int quantity_sold;
     @JoinColumn(name = "sales_id")
     private Sales sales;
     @JoinColumn(name = "product_id")
     private Product product;
     public ProductSales() {
     public ProductSales(Sales sales, Product product, int quantity_sold) {
      this.sales = sales;
      this.product = product;
      this.quantity_sold = quantity_sold;
     public Product getProduct() {
      return product;
     public Sales getSales() {
      return sales;
     public void setProduct(Product product) {
      this.product = product;
     public void setSales(Sales sales) {
      this.sales = sales;
     public int getQuantity_sold() {
      return quantity_sold;
     public void setQuantity_sold(int quantity_sold) {
      this.quantity_sold = quantity_sold;
    ProductSalesPK Id class:

    package com.example.model;
    import java.util.Objects;
    public class ProductSalesPK {
        private int sales;
        private String product;
     public ProductSalesPK(int sales_id, String product_id) {
      this.sales = sales_id;
      this.product = product_id;
     public int hashCode() {
      int hash = 5;
      hash = 83 * hash + this.sales;
      hash = 83 * hash + Objects.hashCode(this.product);
      return hash;
     public boolean equals(Object obj) {
      if (obj == null) {
       return false;
      if (getClass() != obj.getClass()) {
       return false;
      final ProductSalesPK other = (ProductSalesPK) obj;
      if (this.sales != other.sales) {
       return false;
      if (!Objects.equals(this.product, other.product)) {
       return false;
      return true;

    5 May 2016

    Callable ManagedTaskListener

      class Japavapa implements Callable, ManagedTask, ManagedTaskListener {
        String word;
        LocalTime submit;
        public Japavapa(String word) {
          this.word = word;
        public String toString() {
          return ":P " + word;
        public String call() throws Exception {
          Random rand = new Random();
          Matcher match = Pattern.compile("([AEIOUYaeiouy]+)").matcher(word);
          return match.find() ? match.replaceAll(match.group(1) + "p" + match.group(1)) : word;
        public ManagedTaskListener getManagedTaskListener() {
          return this;
        public Map<String, String> getExecutionProperties() {
          return null;
        public void taskSubmitted(Future<?> future, ManagedExecutorService executor, Object task) {
          submit = LocalTime.now();
          logger.info("SUBMIT " + task
            + " AT " + submit 
            + " ON " + executor);
        public void taskAborted(Future<?> future, ManagedExecutorService executor, Object task, Throwable exception) {
          logger.info("ABORTED " + task
            + " AFTER " + Duration.between(submit, LocalTime.now()).toMillis()
            + "ms ON " + Thread.currentThread().getName());
        public void taskDone(Future<?> future, ManagedExecutorService executor, Object task, Throwable exception) {
          logger.info("DONE " + task
            + " AFTER " + Duration.between(submit, LocalTime.now()).toMillis() + "ms");
        public void taskStarting(Future<?> future, ManagedExecutorService executor, Object task) {
          logger.info("STARTING " + task
            + " AFTER " + Duration.between(submit, LocalTime.now()).toMillis()
            + "ms ON " + Thread.currentThread().getName());

    30 April 2016

    Java SE version history (updated)

    Version Name JSR Release Major new features
    9 2016 JSR 294: modular JDK (Jigsaw)
    8 337 3/2014 JSR 335: lambda expressions
    Collections Stream Framework
    JSR 310: Date and Time API
    Compact profiles
    JSR 308: annotations outside declarations (on usage)
    7 Dolphin 336 7/2011 language (project coin): switch on strings, multi catch, try with autoclosing resources, empty generics (diamond operator), binary literal, underscores in numbers NIO.2 file handling
    Fork/Join concurrency
    JAX-WS 2.2 (SOAP 1.2, WS-I 2.0, metro 2.0)
    Detailed overview
    6 Mustang 270 12/2006 JSR 223: scripting language support
    JSR 224: JAX-WS2.0 (metro 1.x)
    JSR 221: JDBC 4 (driver autoloading))
    Perfomance enhancements in synchronisation and garbage collection
    5 Tiger 176 9/2004 language (JSR 201): Enumerations, autoboxing, enhanced for loop, static import, vararg
    JSR 175: Annotations
    JSR 14: Generics
    RMI automatic stub generation
    1.4 Merlin 59 2/2002 language: assert
    regular expressions
    JSR 51: NIO
    JSR 47: java.util.logging
    JSR 54: JDBC 3 (metadata API, autogenerated keys, transaction savepoints, multiple || resultsets/statement)
    security and cryptography
    1.3 Kestrel 5/2000 HotSpot JVM
    RMI/CORBA support
    1.2 Playground 12/1998 Collections
    JIT compiler
    Browser plugin
    JDBC 2.1 (datasources, distributed transactions, connection pooling,RowSet, ResultSet backscrolling and updating )
    1.1 2/1997 AWT events reorganisation
    inner classes
    1.0 1/1996
    Here's an overview of Java EE versions

    27 April 2016

    NetBeans hints (edit)

    Your first NetBeans project
    1. On the start page click the Learn & Discover tab
    2. Under Demo's and Tutorials select Java SE applications
    3. Start the Java Quick Start Tutorial 
    NetBeans 7.4 Developer Guide
    If you're searching how to do someting in netbeans just type it in the ... search box, it will not only search in your project,  but also in the online help.
    Keyboard shortcuts
    • view, search & change shortcuts: tools => options => keymap
      • You can set the keymap to a profile from another IDE (Eclipse, IntelliJ...) here as well.
    • help => keyboard shortcuts card. The pdf that is shown, lives in
    • Some additional useful shortcuts:
      • Go to
        • to definition: CTRL click
          • to implementation: CTRL ALT click
      • Edit
        • Code completion
          • autocomplete popup (+ javadoc): CTRL SPACE
          • javadoc inline popup: CTRL SHIFT SPACE
            • ALT F1 to see in browse
            • Netbeans bundles plenty of javadoc you can browse supplied javadoc for your project libraries from help>Javadoc references
          • complete to recently typed word: CTRL k
        • Add semicolon at end of line:  CTRL ;
        • Add new line below + go there: SHIFT ENTER
      • View
        • fold/unfold code: CTRL –/+
        • members/herarchy of current selection: CTRL/ALT SHIFT F12
        • zoom: ALT + mousewheel up/down 
        • editor only: CTRL SHIFT ENTER (>= 7.4)
    Running code
    • After you ran a program, and corrected some errors Rerun using the >> buttons.

    • The lighter double arrows below allow you to rerun with different parameters. You can change the arguments you run with in the Ant properties window.
    • Similar options are available for (individual) tests.
      • You can also launch an individual test by  positioning the cursor in the method and selecting "Run focused test" from the right click menu. 

    Netbeans comes with plenty of sample projects for you to explore

    HTTP Monitor

    The server side monitor is enabled by default for Tomcat and can be enabled in the properties of GlassFish. You may have to undeploy/redeploy your webapp for the monitor to show up.
    When the server receives an HTTP request, NetBeans will show a window with all request details. It extracts all parameters and stuff for you, but does not show the raw bodies of POST requests. It does not show responses either.
    There is also a client monitor. If you use the internal browser (or the NetBeans Chrome plugin) you can use Window > Web > Network Monitor (NetBeans >= 7.4). It does not show all client side traffic but is targeted at in-page initiated traffic (AJAX, websockets) and failed requests.

    19 April 2016

    Java EE Patterns (edit)

    • Numbers on the arrows indicate a possible call sequence in a request. (thanks for the hint Nishant) 
    • patterns
      • Front Controller: initial point of contact for handling all related requests. The Front Controller centralizes control logic that might otherwise be duplicated, and manages the key request handling activities.
      • Transfer Object: carries multiple data elements across a tier
      • Transfer Object Assembler:  builds an application model as a composite Transfer Object. The Transfer Object Assembler aggregates multiple Transfer Objects from various business components and services, and returns it to the client. 
      • Persistent Domain Object: Rich domain object, ie. having rich behavior/bus.logic and persistent 
      • Web Service Broker: exposes and brokers one or more services using XML and web protocols.
        • The Web Service Broker can be generalised to a Protocol Broker.
      •  Service Facade: encapsulates business-tier components and exposes a coarse-grained service to remote clients. Clients access a Service Fa├žade instead of accessing business components directly. 
      •  Service: Fine-grained, reusable logic in an EJB with local access only, product of decomposition
      • Data Access Object: abstracts and encapsulates all access to the persistent store. The Data Access Object manages the connection with the data source to obtain and store data. 
      • Asynchronous Resource Integrator: Invocation of a Service from a Message-Driven Bean (invoked by a messaging system via JMS)
      • Payload extractor: factor out the (reusable) type checking and error handling for a MDB message into a reusable interceptor; poison messages moved by the interceptor to a “dead letter queue” via a stateless EJB using the JMS API
      •  Resource Binder: put a custom resource into JNDI using a @Singleton with @Startup and the JNDI API (Context.(re)bind()).

    17 April 2016

    Dozer DTO assembler (edit)

    Dozer is a nice little object mapper. It moves data from one object to another.

    Dozer can be used as a generic Data Transfer Object assembler. You specify your mappings in an XML file. By default it copies data to properties with the same names, unless you add specific field mappings.

    Next you call dozer in your code to move your data:
    public Kloon getDto (Original o) {
      return dozerMapper.map(o, Kloon.class);
    Dozer can reverse map from class-b to class-a as well. There is an annotation based mapping mechanism which works well for simple cases.

    10 March 2016

    SoapUI XPath assert needs namespaces

    If you are testing XML documents without namesapces, and you assert them with XPath expressions without namespaces, your XPath expressions (e.g. '//my-stuff') will not match.

    An easy trick to make this work, is to add  '*:' (wildcard) namespace in front of your elements (e.g. '*://my-stuff')

    SoapUI C:\WINDOWS\system32\config\systemprofile\soapui-settings.xml (Access is denied)

    I installed SoapUI open source 5.2.1 on windows10 from the (default) windows 64 bit installer.

    This installation considers C:\WINDOWS\system32\config\systemprofile as the home directory and insists on keeping his config there. Probably because it asks system administrators priviliges while installing and then derives the home directory from the system administor settings. When running SoapUI as your humble self afterwards and try to change any preferences you get

    java.io.FileNotFoundException: C:\WINDOWS\system32\config\systemprofile\soapui-settings.xml (Access is denied)
     Uninstall and reinstall from the zip installer (from alternate platforms downloads). That one works from your user home directory as it should.

    23 February 2016

    Webservices Practice 5.1 alternative

    To use the Glassfish JAXB RI instead of the default Eclipse MOXy implementation in Weblogic 12.1.1 add this to the beginning of your %DOMAIN_HOME%\bin\setDomainEnv.cmd. %MW_HOME% is set to the installation location of WebLogic.

    set PRE_CLASSPATH=%MW_HOME%\modules\databinding.override_1.0.0.0.jar%PRE_CLASSPATH%

    On Weblogic 12.2.1 you should use WL_HOME (=%MW_HOME%\wlserver) instead of MW_HOME.

    21 February 2016

    Link Blogger to Google Drive

    Blogger supports including images from Picassa, but when you include an image as a share link from Google drive, this seems to work initially, but the converted link does not work anymore after a while. So, you end up, saving your images twice in google storage.
    Here's a post on converting a Google Drive link for usage with Blogger.

    20 February 2016

    Webservices Excercises Module 13: JAX-WS only

     Exercise 13-1

    1. Generate SSL artefacts
      • Edit certgen.bat (do not double click). Adapt the paths at the top of the file to reflect the correct paths on your machine.
        • The individual steps that are executed by the script are explained in Practice A-2
      • Run the script from the command line
    2. Configure WebLogic for WS-Security
      • Edit sslconfig.bat (do not double click). Adapt the paths at the top of the file to reflect the correct paths on your machine.
      • Edit sslconfig.py.  Adapt the paths at the top of the file to reflect the correct paths on your machine.
        • The script uses the WebLogic Scripting Tool (WLST). The  same procedure using the administration Console is explained in Practice A-3. 
      • If WebLogic is not running, start it.
      • run sslconfig.bat from the command line 
      • The script stops WebLogic. Start it again afterwards.
      • Connect to the WebLogic Admin Console over SSL, using URL https://localhost:7002/console
        • The browser warns you because it does not know the certificate authority
          •  Verify the certificate
          • Approve the connection
    3. Open theCardDecksWS project
    4. If you did not enable JAX-WS HTTP dumping in Excercise 5-7, do it now.
    5. Add a new library to NetBeans using Tools> Ant Libraries
      • Create a new library
        • Name: WebLogic Web Services API
        • Type:  Server Libraries
      • Press Add JAR/Folder, browse to the WebLogic folder and add modules/ws.api_2.0.0.0.jar
      • Click OK   
    6. Add the "WebLogic Web Services API" library to the CardDecksWS project
    7. View the policy file you will use
      • Expand Libraries> Oracle WebLogic Server> weblogic.jar> weblogic.wsee.policy.runtime
      • Double click Wssp1.2-2007-Wss1.1-UsernameToken-Plain-X509-Basic256.xml 
      • Examine the file
      • Close the file
    8. Open ejbs.CardDeckSessionBean.java
    9. Annotate the class with @Policy to 
      • use the policy you have just viewed 
      • add it to the WSDL
    10. Using the @Policies and   @Policy annotation on every method indicate that
      • webservice calls should be signed
      • webservice calls should be encrypted
      •  this should be added to the WSDL
    11. Correct any errors and save
    12. View the WSDL at http://localhost:7001/CardDeckSessionBean/CardDeckSessionBeanService?wsdl
      •  Notice the wsp1_2:Policy elements that have been added
    13. Open the GenericCardGameWS project in NetBeans
    14. Open games.CardGameService
    15. After the creation of the port in the createCardGame method, add code to use WS-Security, as shown in slides 13-17 to 13-19
    16. Refresh the JAX-WS artefacts and cached WSDL
      • In the Web Service References Node, right click the CardDeckSessionBeanService and choose Refresh
      • Select the checkbox to also replace the WSDL
      • Click Yes
    17. Correct any errors and save
      •  Clear the WebLogic Server Output window (right click>clear)
    18. Open the Weblogic Test Client at http://localhost:7001/wls_utc
    19. Enter WSDL http://localhost:7001/GenericCardGameWS/CardGameService?wsdl
      • Create a cardGame with 1 deck and 2 jokers
      • Inspect the SOAP messages
        • View the Oracle WebLogic Server output window in NetBeans
        • Compare the calls to Try to see the difference between the calls to 
          • CardGameService
          • CardDeckSessionBeanService

     Exercise 13-2

    1. Check the time between the first and last message in a call in the previous exercise
    2. In the CardGameService class, modify the usage of the CarDeckSessionBeanService. Apply the same kind of optimisations on the service as in step 2 in the activity guide.
    3. Apply the same kind of optimisations on the CarDeckSessionBean port as in step 3 in the activity guide
    4. Correct errors and save. 
    5. Check the time again between the calls when creating a card game.

    19 February 2016

    WebLogic 12.1.2 zip install: terminalio to read the password securely is not found

    My WebLogic 12.1.2 install from the zip distribution aborted after asking for the domain admin user with the error message:

    Native Library(terminalio) to read the password securely from commandline is not found
    It appears that this is a different symptom of the same error I had working with Weblogic 12.1.1: the native libraries delivered with WebLogic are not in the PATH. My system is a 64 bit windows system, so i need to add the libraries for this platform to avoid this error.
    I added one line to %WL_HOME%\wlserver\server\bin\setWLSEnv.cmd
    set WL_HOME=C:\wl12120
    @REM added the next line
    set PATH=%WL_HOME%\server\native\win\x64;%PATH%
    If you do this, the installation and the configuration of a default domain run smoothly. As explained in my previous post, after the domain creation, also add this line to the domain envionment setup file %domain_dir\bin\setDomainEnv.cmd. If you don't you'll get warnings about Weblogic reverting to less efficient file reading libraries etc.

    13 February 2016

    Oracle SQL info

    • Oracle 11g SQL reference
    • SQL developer keboard shortcuts
      •  Tools>preferences>shortcut keys
      • CTRL+SHIFT+D: copy current line down
    • Changing the password
      •  change it in the database
    alter user user_name identified by "new_password" replace "old_password"

    8 February 2016

    Java Web Services resources (edit)

    Java EE component versions overview (edit)

    The table below lists the components in latest versions of the Java Enterprise Edition.

    • I put the most important changes in red.
    • Components with a (version number) between brackets are  proposed for removal in a future release.
      • JAX-WS is intended to replace JAX-RPC
    • An x indicates a technology is removed from the specification
      • JSR's are shown as hyperlinked numbers.
      • SE indicates that an API was moved to the standard edition 
        • eventually followed with the version number
        • Java SE version history is in a separate post
      • Web technologies are in a separate post
      • EJB history is in a separate post
      • I added some application servers at the bottom of the table. 
      J2EE 1.4

      Java EE5

      Java EE6

      Java EE7

      Java EE8
      Java SE59 1.4176 5270 6336 7337 8
      EJB153 2.1220 3.0318 3.1345 3.2
      EE Management77 1.0

      JMS 914 1.1

      343 2.0368 2.1
      JTA 9071.01.1
      JavaMail 9191.
      Connector (JCA)112 1.51.5322 1.61.7
      Java Activation Framework (JAF) 9251.01.1SE:1.1.1
      Web Services 1091.11.21.3
      Web Services Metadata 181
      JAX-RPC 1011.1
      JAX-WS (SOAP) 2241.02.0SE (2.1)SE (2.2)
      JAX-RS (REST)

      311 1.1
      Jersey 1.1.5
      339 2.0370 2.1
      JAXB 222
      JSON-P  353 1.03741.1
      JSON-B 367
      JAXR (UDDI Registry)1.0
      SOAP w attachments (SAAJ) 671.21.3SE
      StAX 173
      container authorisation (JACC) 1151.
      container authentication (JASPIC) 196

      Security 375

      Common annotations 250
      Java Persistence (JPA)
      1.0317 2.0338 2.12.2
      Bean Validation

      303 1.0349 1.1
      Managed Beans

      CDI for Java EE

      299 1.0346 1.1365 2.0
      DI for Java 330

      Concurrency utilities 236

      State management 350

      Batch  352

      JCache 107

      Sun JSAS89.1
      Glassfish23 (12/2009)4 (5/2013)
      JBoss / WildFly457 (7/2011)8 (2/2014)
      IBM Websphere678 (6/2011)-
      Oracle Weblogic91012.1.1
      12.2.1 (11/2015)
      Apache Geronimo123 (7/2012)-
      • J2EE 1.3(2001) introduced
        • Message Driven  Beans
        • Local interfaces
      • Profiles are a subset of the spec.
        • Java EE Web profile (only profile currently defined)
          • contents
            • java SE
            • web technologies,
            •  JTA, common annotations, JPA, validation, managed beans, interceptors, CDI, DI
            • EJB Lite
              • Stateless, Stateful, and Singleton session beans
                • asynchronous session beans (EJB 3.2)
              • only local EJB interfaces or no interfaces
              • interceptors
              • security
              • transactions
              • non persistent timer only (EJB 3.2)
              • No Message Driven beans and remote invocation.
            • JAX-RS (Java EE7)
          • implemented by
            • Resin 4
            • Apache TomEE