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 (168.250.1.174)' 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:
%ORACLE_HOME%\app\oracle\product\11.2.0\server\network\ADMIN\listener.ora
%ORACLE_HOME%\app\oracle\product\11.2.0\server\network\ADMIN\tnsnames.ora
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

Highlights:

  • 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:

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

Specific topics:
Background:

    9 May 2016

    JPA: Composite Primary Key with Foreign Keys



     
    Entity for the ProductSales Table:
    package com.example.model;
    
    import javax.persistence.*;
    
    @Entity
    @IdClass(ProductSalesPK.class)
    public class ProductSales {
    
     @Column(name = "QUANTITY")
     private int quantity_sold;
    
     @Id
     @ManyToOne
     @JoinColumn(name = "sales_id")
     private Sales sales;
    
     @Id
     @ManyToOne
     @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;
     }
    
     @Override
     public int hashCode() {
      int hash = 5;
      hash = 83 * hash + this.sales;
      hash = 83 * hash + Objects.hashCode(this.product);
      return hash;
     }
    
     @Override
     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;
     } 
     
    }