Stuff I'm Up To

Technical Ramblings

Java Decompiler — November 6, 2018

Java Decompiler

Today I’ve been working on a problem where properties being loaded into our CRM system from a GIS DTF file are doing some strange updates. It appears that the vendor in their wisdom has decided to populate user defined fields that we already use!

The Loader is written in Java, I have a .jar file and can extract the .class files, but they’re all compiled.

A bit of searching reveals an online decompiler I can use: http://www.javadecompilers.com/jad

I started using it to decompile one .class file at a time and quickly became bored. So tried the whole .jar file. It happily decompiled the file and returned a single zip file containing the decompiled .class files as .javafiles.

Now I can scan the .java files to find out what other SQL calls they are making to fill other fields we might be using.

Advertisements
Opening another Window with electron-vue — October 9, 2018

Opening another Window with electron-vue

Having entered the world of Electron and mashing it together with Vue.js using electron-vue I needed to figure out how to open another window from Electron and still have vue active within it and better yet, still have the hot module reloading active in that new window whilst developing it.

It was whilst trawling the electron-vue github issue page that I came across a golden nugget of code that answered the very question for me.

https://github.com/SimulatedGREG/electron-vue/issues/401#issuecomment-330656658

Quoted:

First of all, you need to disable mode: 'history' in your vue-router, check in vue-router docs

Then do the following:

src/main/index.js example

ipc.on('showChart', function (e, data) {
  const modalPath = process.env.NODE_ENV === 'development'
    ? 'http://localhost:9080/#/showChart'
    : `file://${__dirname}/index.html#showChart`
  let win = new BrowserWindow({ width: 400, height: 320, webPreferences: {webSecurity: false} })
  win.on('close', function () { win = null })
  win.loadURL(modalPath)
})

In your router, use the exactly path to your url

src/renderer/router.js example

{
  path: '/showChart',
  name: 'showChart',
  component: require('your-router'),
},

 

When this isn’t this and becomes that — October 2, 2018

When this isn’t this and becomes that

I recently tried to assist a colleague with an issue in JavaScript involving an undefined variable within a Vue.js app.

Now I have encountered this issue several times and never really gotten to the crux of the matter other than I know it’s because the context of this changes, depending on where you are in your code.

It was during this tongue twisting exercise that he found a useful document that gives an outline more elegantly than I could phrase.

https://gist.github.com/JacobBennett/7b32b4914311c0ac0f28a1fdc411b9a7

Since arrow functions provide a lexical this value, the this inside our function() refers to the window instead of our Vue object which breaks our current implementation! When attempting to get this.item, we will actually be looking at window.item which is currently undefined.

electron-vue —
Adding Crucible to Jira — October 1, 2018

Adding Crucible to Jira

Continuing the Jira and Confluence journey into Crucible I faced a challenge of adding it beneath the same reverse proxy setup.

My aim was to end up with a single host with multiple URL’s for each feature eg.

https://jira.domain.local – for Jira Software

https://jira.domain.local/confluence – for Confluence

https://jira.domain.local/crucible – for Crucible

The documentation on how to achieve this was a little fragmented and whilst it made sense I failed to get things working first time round.

Continue reading

React and Webpack – Project Template — September 22, 2018

React and Webpack – Project Template

I’ve begun looking at building a project using React and followed some online sources to begin with. But then I fell into outdated material that related to babel. So I could only take many of the tutorials so far before having to update the construction to suit @babel/core v7.

It seems it’s very easy to install different versions of babel and it’s components and then discover things won’t compile. The error message I was getting:

Error: Plugin/Preset files are not allowed to export objects, only functions.

It doesn’t exactly make clear that what you have probably done is installed a preset  from an older version of babel and your babel core doesn’t like it.

Continue reading

JIRA, Confluence and Nginx — September 15, 2018

JIRA, Confluence and Nginx

With Atlassian Jira Software and Confluence installed onto the same server I thought I’d investigate setting things up so we don’t have to use the default TCP port type of access over HTTP. instead let’s setup a reverse proxy using HTTPS over TCP 443 that forwards to the TCP 8080 and 8090 ports.

The aim is to get Jira accessible as https://jira.domain.local and Confluence as https://jira.domain.local/confluence.

Continue reading

Verint Online Forms — August 30, 2018

Verint Online Forms

We’re new to this and trying to integrate a form solution with our Lagan CRM system. We have a corporately installed test and production system for forms, but it get frequent usage by many non-IT related staff, so I thought about deploying our own dev system.

The forms products are pretty much Jetty programs with a database requirement. Looking at the config files for the initial deployment package they are looking for either H2, Oracle or MSSQL. That means our only real dev option is H2.

Step 1 – Install the H2 database

Download the platform independent zip from http://www.h2database.com/html/main.html and extract it into a suitable location.

Make sure you have a $JAVA_HOME environment variable set, and ensure you have a Java JDK (not just a JRE) installed. On my Debian system I set it to the default java instance (which just happens to be Java 10):

$ export JAVA_HOME=/usr/lib/jvm/default-java

Then run the H2 program:

$ cd h2/bin
$ sh ./h2.sh

This fires up a browser session and gives you an icon in the tray if you’re running a windowed environment.

Step 2 – Install dforms

Extract the dfoms zip file.

Edit the config.sh file in dforms-x.x.x/bin as necessary. The only changes I made to this one was the jdbc user and password. I prefer not to use defaults.

Run the program:

$ cd dforms-x.x.x/bin
$ sh ./Run.sh

We then have a running dforms program listening on the default port 9081. You can use your browser to visit it at http://localhost:9081/auth/login and logon using the defaults Admin/Admin credentials.

Step 3 – Install dforms-leadapter

Extract the dfoms-leadapter-x.x.x zip file.

Edit the config.sh file in dforms-leadapter-x.x.x/bin as necessary. I made a few more changes to this one, again the jdbc user and password – it is a different database than the dforms one and there are two of them in this config. But also the flweb_lagan_uri and flweb_user and flweb_password to match our environment.

Run the program:

$ cd dforms-leadapter-x.x.x/bin
$ sh ./Run.sh

We then have a running dforms-leadapter program listening on the default port 9082. You can use your browser to visit it at http://localhost:9082/auth/login and logon using the defaults Admin/Admin credentials.

When is a Question Mark not a ? — August 29, 2018

When is a Question Mark not a ?

That’s a morning of smashing my face on the desk again. I deployed my dev program onto a production system and then started crying as it stopped working as it should.

It seemed that none of my query string parameters were making it through to the controller. I called up some debugging and dumped out my $request and $request->all() etc. and discovered that the parameters although shown in the browser dev window went AWOL between server and controller. On my dev environment it all acted as it should.

So there must be something different. PHP v7.2 on dev and v7.0 or production maybe? No, much simpler than that. None of the Laracasts and Laravel related Googling pulled up any particular clues. It wasn’t until I looked at Nginx and parameters not being passed to PHP that I got a hit.

https://serverfault.com/questions/685525/nginx-php-fpm-query-parameters-wont-be-passed-to-php

The answer was as simple as adding in the $is_args into my Nginx virtual server config.

location / {
  try_files %uri $uri/ /index.php$is_args$query_string;
}

Up until now I guess I’ve been using routing with the parameters as part of the URI. Now I’m using some query string parameters I need to put in the ?, which is the $is_args variable.

So why not a problem in dev? Because I’m not using Nginx, I just use artisan serve to debug my development program.

Postman is Awesome — August 21, 2018

Postman is Awesome

I’m in the process of testing and documenting my API’s and up until yesterday I’d only used postman to test my responses gave me something back. But it’s capable of so much more!

I can use it to generate the documentation for each call I make, publish it online and share it with colleagues.

But I can also use it to carry out unit tests on my API calls. Which is awesome.

Then I find I can use globals and environment variables to migrate my tests and documentation between development and production systems… which is even more awesome.

Continue reading

Postman Makes API Development Simple — August 20, 2018
Laravel and Lagan Web Services – SOAP API — August 17, 2018

Laravel and Lagan Web Services – SOAP API

SOAP is a dirty word to me. But I have a need to interact with our CRM system to import / extract data. My go to platform for most of my PHP work is Laravel. So I looked at interacting with Lagan CRM using SOAP calls from PHP.

I started off accessing the Lagan WSDL pages to see what the capabilities of the API are.

http://[laganserver:8080]/lagan/services/FL?WSDL
http://[laganserver:8080]/lagan/services/FLAuth?WSDL
http://[laganserver:8080]/lagan/schema/FLService.wsdl

Now I can see the self documenting API calls I can make. I just need to create the SOAP envelope to pass data to the service with the call I want to make.

Continue reading