- java 22
- maven 4
- db 4
- mysql 4
- git 3
- solidity 3
- cypto 3
- jsp 2
- seam 2
- arduino 2
- linux 2
- docker 2
- poi 1
- excel 1
- macgyver 1
- mariadb 1
- vaadin 1
- jira 1
- swarm 1
- jboss 1
- 3D Printer 1
java
Java 11 Ubuntu setup Part 2
Quick addion of the things around Java 11 that is required to get your enviroment ready for development. See part one on the Java 11 installation first: Part 1
Java 11 Installation and Setup
Updated: 2020-10-09
Eclipse Run Swarm
This will just quickly show you how to run a Wildfly Swarm application in Eclipse and also allow you to easily run the debugger.
Singleton with arguments
Had a very unusual requirement where I needed to share singleton between projects that requires initialization arguments. These arguments are different based on what server it is started. In applications using CDI this was very easy but not all where using CDI and a lot of the projects where not under my control they where simply using the lib. Thread safty was also a concern and I wanted to avoid using synchronized. Here is the solution I came up with.
Into the Future Thread - Part 2
Continuing with execution flow of Futures and thread. See Part 1 if you have not. I would like to highlight when future.get() completes in different scenarios. Firstly I know it is not best practice to use Futures in this way but I think it is still important to understand how the internals work.
Into the Future Thread - Part 1
Just wanted to highlight what thread is used in regards to Java Futures in Java 8. The flow of execution. Basicly the differences between the normal and Async function in futures.
JIRA Docker quick setup
Just going to give a quick explination of how I got JIRA Software running quick for new company. Going to use Docker container for database postgres and another for Jira. We will then use nginx to serve the site and do the HTTPS with letsencrypt.
Dagger 2 Maven Config
Just a quick post on how to setup Dagger 2 with maven to compile without messing with eclipse settings. Just remember to include target/generated-sources to your class-path.
RuntimeException: wrong class format
I have a very old project still running on Jboss 6 AS, it has been on the TODO list to write but since it is of low importance, only used internally and it just works.
Hibernate fetching strategies
Fetching strategies are used to optimize the SQL generated by Hibernate. Using Object Relational Mapping (ORM) tools does have a overhead for the all the benefits it provides but this can be reduced by understanding it.
Jetty Embedded adding CORS Filter
How to add Cross-origin resource sharing (CORS) filter to a embedded Jetty server. Jetty comes with a CORS filter that is easy to use. Add the following to you maven:
Self-signed SSL with private maven repository
When running a private MAVEN repository via https with self-signed certificate in my case Archiva. You will run into a error when trying to upload/download artifacts.
MySQL/MariaDB data not available in second application
This is a interesting issue I found using Hibernate. You have 2 independent application both using the same database. What I found that if one application submits a value to the database the second application does not see the updated/new entry. If you use direct SQL on the database the changed/new entry is visible and the same is true if you use the JDBC directly without hibernate.
ThreadPoolExecutor gotcha with unbounded queue
Something I have now seen a few times in projects is people not being aware of how ThreadPoolExecutor works. When creating a ThreadPoolExecutor you have to arguments to set minPoolSize, maxPoolSize, keepAliveTime and workQueue. Now the gotcha is in when the ThreadPoolExecutor creates a new thread for execution especially when using unbounded size Queues. For example when looking at this ThreadPoolExecutor constructor:
NavSpark setting up Arduino IDE in 64-bit Linux
Received my new toy today a NavSpark-GL : Arduino Compatible Development Board with GPS/GLONASS!
Implementing Java Comparable
Implementing the Comparable interface in Java give the object a natural ordering, as in makes it Sortable. The comparable interface only has one method:
Guava LoadingCache invalidate call while loading?
I have a application that needs to pull data from the database do some calculations (This takes a second or two) then returns. I have been using Guava’s LoadingCache to do this. The problem came in when a user makes a change to the source data which in effect invalidates the calculation results. Easy solution just invalidate. But what happens if the data is modified during the calculation process. For example you have 2 threads, Thread 1 calls get on the loading cache then during the Loading process in Thread 1, Thread 2 calls invalidate since the underlying data has changed. Is the data invalidated or is the invalid/stale data stored in the cache?
Eclipse exporting WAR file give NPE
Received a NPE when I was exporting a WAR file in eclipse on a old project. Error below:
Official Eclipse support for Java 8
So far only IntelliJ 13.1 has support for Java 8 but now Eclipse also announced support for Java 8! Starting with I20140318-0830 all Luna (4.4) builds contain the Eclipse support for Java 8. There is also a feature patch available for Kepler SR2 (4.3.2). Source: https://dev.eclipse.org/mhonarc/lists/eclipse.org-committers/msg00948.html
Java 8 released here is how to install
Java 8 JDK final got released today so time install!
Hiding data on a Excel Spreadsheet using POI
I had a requirement where I needed to hide some meta data in Excel Spreadsheet. Instead of using hidden row/columns/cells I used Custom Properties. Custom properties is a map in the Spreadsheet file where you can store key/value data. I found this much safer than hiding the data on the sheets since users could delete/corrupt the data very easily.
JBoss and debug breakpoints
The problem
maven
Java 11 Ubuntu setup Part 2
Quick addion of the things around Java 11 that is required to get your enviroment ready for development. See part one on the Java 11 installation first: Part 1
Dagger 2 Maven Config
Just a quick post on how to setup Dagger 2 with maven to compile without messing with eclipse settings. Just remember to include target/generated-sources to your class-path.
Self-signed SSL with private maven repository
When running a private MAVEN repository via https with self-signed certificate in my case Archiva. You will run into a error when trying to upload/download artifacts.
Maven, Eclipse and Git what not to commit!
When using maven and git remember to add this to the .gitignore!
db
JOOQ MySQL/MariaDB and the duplicate column name
Hit a interesting issue today using MariaDB with JOOQ. I have a project that can be configured to use different underlying databases depending on client requirements and I use JOOQ to simplify this for me. One of the tables are structured as follow:
Enable SQL log in MySQL/MariaDB
When using a ORM like hibernate it is always a good idea to check what SQL is generated/executed. This is how you enable a log of the SQL executed on the MySQL/MariaDB server:
MySQL/MariaDB data not available in second application
This is a interesting issue I found using Hibernate. You have 2 independent application both using the same database. What I found that if one application submits a value to the database the second application does not see the updated/new entry. If you use direct SQL on the database the changed/new entry is visible and the same is true if you use the JDBC directly without hibernate.
Can not connect to MySQL/MariaDB running in Docker
If you are using docker to run MySQL/MariaDB and you are trying to connect to the database from the machine running the docker instance you could run into this error:
mysql
Hibernate fetching strategies
Fetching strategies are used to optimize the SQL generated by Hibernate. Using Object Relational Mapping (ORM) tools does have a overhead for the all the benefits it provides but this can be reduced by understanding it.
Enable SQL log in MySQL/MariaDB
When using a ORM like hibernate it is always a good idea to check what SQL is generated/executed. This is how you enable a log of the SQL executed on the MySQL/MariaDB server:
MySQL/MariaDB data not available in second application
This is a interesting issue I found using Hibernate. You have 2 independent application both using the same database. What I found that if one application submits a value to the database the second application does not see the updated/new entry. If you use direct SQL on the database the changed/new entry is visible and the same is true if you use the JDBC directly without hibernate.
Can not connect to MySQL/MariaDB running in Docker
If you are using docker to run MySQL/MariaDB and you are trying to connect to the database from the machine running the docker instance you could run into this error:
git
Ungit the ultimate tool for git
Ungit is the easiets way to use GIT. It is great tool that visiually represents your repository and completly removes the learning curve with GIT. It uses node.js and is available via npm.
Bluk update GIT master location
The server hosting the GIT repository has moved to an new domain name. Now is very painfull to update manually so here is quick command to find all the GIT config files and replace the old domain name with the new domain name.
Maven, Eclipse and Git what not to commit!
When using maven and git remember to add this to the .gitignore!
solidity
Deploy Solidity Contract
This tutorial will show you how to deploy a solidity contract to Ropsten (Test Net).
Truffle Expected Throw Test
When creating test cases to test your solidity code you will need to test conditions that causes throws. This will show you how to write those tests in javascript.
Solidity Truffle Quickstart
This quick and dirty tutorial will show you how to create Ethereum Smart Contract project using truffle framework.
cypto
Deploy Solidity Contract
This tutorial will show you how to deploy a solidity contract to Ropsten (Test Net).
Truffle Expected Throw Test
When creating test cases to test your solidity code you will need to test conditions that causes throws. This will show you how to write those tests in javascript.
Solidity Truffle Quickstart
This quick and dirty tutorial will show you how to create Ethereum Smart Contract project using truffle framework.
jsp
Seam parameter as date
When using Seam Gen to setup basic pages from the persistence objects where a primary key is a date or one of the keys in the combined primary key is a date you will run into this error: “value must be a date” This is due to the date converter not working properly when seam is parsing the page parameters. By default it just performs a toString causing the page parameter to be populated as follow:
Cannot create Seam component, scope is not active
The problem:
seam
Seam parameter as date
When using Seam Gen to setup basic pages from the persistence objects where a primary key is a date or one of the keys in the combined primary key is a date you will run into this error: “value must be a date” This is due to the date converter not working properly when seam is parsing the page parameters. By default it just performs a toString causing the page parameter to be populated as follow:
Cannot create Seam component, scope is not active
The problem:
arduino
NavSpark setting up Arduino IDE in 64-bit Linux
Received my new toy today a NavSpark-GL : Arduino Compatible Development Board with GPS/GLONASS!
5×5 LED Cube
The 5×5 LED cube project version 1.0 is working!
I am making use of 4 shift registers 74CH595N to control the 25 columns and 5 P2N2222A NPN Transistor to select a layer. Currently I am writing the cube state for a layer out every 7ms.
linux
Email alerts on login
This quick tutorial will show you how to get email alerts when any user logs into your Linux box.
NavSpark setting up Arduino IDE in 64-bit Linux
Received my new toy today a NavSpark-GL : Arduino Compatible Development Board with GPS/GLONASS!
docker
JIRA Docker quick setup
Just going to give a quick explination of how I got JIRA Software running quick for new company. Going to use Docker container for database postgres and another for Jira. We will then use nginx to serve the site and do the HTTPS with letsencrypt.
Can not connect to MySQL/MariaDB running in Docker
If you are using docker to run MySQL/MariaDB and you are trying to connect to the database from the machine running the docker instance you could run into this error:
poi
Hiding data on a Excel Spreadsheet using POI
I had a requirement where I needed to hide some meta data in Excel Spreadsheet. Instead of using hidden row/columns/cells I used Custom Properties. Custom properties is a map in the Spreadsheet file where you can store key/value data. I found this much safer than hiding the data on the sheets since users could delete/corrupt the data very easily.
excel
Hiding data on a Excel Spreadsheet using POI
I had a requirement where I needed to hide some meta data in Excel Spreadsheet. Instead of using hidden row/columns/cells I used Custom Properties. Custom properties is a map in the Spreadsheet file where you can store key/value data. I found this much safer than hiding the data on the sheets since users could delete/corrupt the data very easily.
macgyver
Fixing the mouse
I have been using a Evoluent VerticalMouse 4 now for just over a year and have really grow to like it up until a few weeks ago where it would only work when it felt like it. Fiddling around with the cable I realized there was a connection problem in the cable. After doing some searching it seems like a common problem.
mariadb
JOOQ MySQL/MariaDB and the duplicate column name
Hit a interesting issue today using MariaDB with JOOQ. I have a project that can be configured to use different underlying databases depending on client requirements and I use JOOQ to simplify this for me. One of the tables are structured as follow:
vaadin
Vaadin EntityManager-Per-Request pattern using Server Push
Hibernate is one reason you mite need to do the following since Hibernate does not like keeping entity manager alive for long.
jira
JIRA Docker quick setup
Just going to give a quick explination of how I got JIRA Software running quick for new company. Going to use Docker container for database postgres and another for Jira. We will then use nginx to serve the site and do the HTTPS with letsencrypt.
swarm
Eclipse Run Swarm
This will just quickly show you how to run a Wildfly Swarm application in Eclipse and also allow you to easily run the debugger.
jboss
Eclipse Run Swarm
This will just quickly show you how to run a Wildfly Swarm application in Eclipse and also allow you to easily run the debugger.