<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Your Site's RSS Feed]]></title><description><![CDATA[Robs programming blog.]]></description><link>https://rjgallac.github.io</link><generator>GatsbyJS</generator><lastBuildDate>Tue, 05 May 2026 18:39:54 GMT</lastBuildDate><item><title><![CDATA[Test Apache Age]]></title><description><![CDATA[a docker compose file to get you start with apache age in postgres and a viewer]]></description><link>https://rjgallac.github.io/apache_age/</link><guid isPermaLink="false">https://rjgallac.github.io/apache_age/</guid><pubDate>Mon, 04 May 2026 00:00:06 GMT</pubDate><content:encoded>&lt;p&gt;a docker compose file to get you start with apache age in postgres and a viewer&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;version: &apos;3.7&apos;

services:
  age:
    container_name: age-db
    image: apache/age
    restart: always
    environment:
      POSTGRES_USER: age
      POSTGRES_PASSWORD: age
      POSTGRES_DB: age
    ports:
      - &quot;5432:5432&quot;
    networks:
      - age-network

  age-viewer:
    container_name: age-viewer
    image: skaiworldwide/agviewer
    depends_on:
      - age
    ports:
      - &quot;3000:3000&quot;
    networks:
      - age-network

networks:
  age-network:
    driver: bridge   &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Nextjs - basic setup and]]></title><description><![CDATA[install nest JS Cli create new project goto localhost:3000 create a module create a controller create a service VALIDATORS ORM]]></description><link>https://rjgallac.github.io/nextjs/</link><guid isPermaLink="false">https://rjgallac.github.io/nextjs/</guid><pubDate>Fri, 08 Nov 2024 00:00:01 GMT</pubDate><content:encoded>&lt;p&gt;install nest JS Cli&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;npm install -g @nestjs/cli&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;create new project&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;nest new nestjs-task-management&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;npm run start:dev&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;goto localhost:3000&lt;/p&gt;
&lt;p&gt;create a module&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;nest g module tasks&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;create a controller&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;nest g controller tasks&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;create a service&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;nest g service tasks&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;VALIDATORS&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;npm i class-validator class-transformer&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;ORM&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;npm i typeorm @nestjs/typorm pg&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Git diff patch]]></title><description><![CDATA[Today wanted to get a diff of the current branch ignoring diffs on the target branch and create a backup patch. git diff TARGETBRANCH…]]></description><link>https://rjgallac.github.io/gitdiffpatch/</link><guid isPermaLink="false">https://rjgallac.github.io/gitdiffpatch/</guid><pubDate>Wed, 18 Dec 2019 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Today wanted to get a diff of the current branch ignoring diffs on the target branch and create a backup patch.&lt;/p&gt;
&lt;p&gt;git diff TARGETBRANCH…CURRENTBRANCH &gt; FILE.patch&lt;/p&gt;
&lt;p&gt;this seemed to work. replace TARGET BRANCH with the branch that has the commits you want to ignore.  Replace CURRENTBRANCH with the branch you have the commits you want to backup and the FILE will be what you want to name the patch&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Gitlab Runner Docker Hub Push]]></title><description><![CDATA[To push to your docker hub registry. first change the gitlab-runner password. generate a token on docker hub Account Setings> New Access…]]></description><link>https://rjgallac.github.io/GitlabRunnerDockerHubPush/</link><guid isPermaLink="false">https://rjgallac.github.io/GitlabRunnerDockerHubPush/</guid><pubDate>Fri, 29 Nov 2019 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;To push to your docker hub registry. first change the gitlab-runner password.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;sudo su
passwd gitlab-runner
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;generate a token on docker hub Account Setings&gt; New Access Token.&lt;/p&gt;
&lt;p&gt;Login as the gitlab-runner user&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;su gitlab-runner&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;and following the instruction docker hub e.g&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;docker login --username rjgallac&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;then enter the password token you generated on git hub&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Undo Git Merge]]></title><description><![CDATA[If you’re in the middle of a merge If you’ve finished and want to undo]]></description><link>https://rjgallac.github.io/UndoMerge/</link><guid isPermaLink="false">https://rjgallac.github.io/UndoMerge/</guid><pubDate>Tue, 26 Nov 2019 00:01:00 GMT</pubDate><content:encoded>&lt;p&gt;If you’re in the middle of a merge&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;git merge --abort&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If you’ve finished and want to undo&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;git reset --hard &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Git diff two branches]]></title><description><![CDATA[This is an invaluable tool to quickly check before you merge two branches]]></description><link>https://rjgallac.github.io/GitDiffBranches/</link><guid isPermaLink="false">https://rjgallac.github.io/GitDiffBranches/</guid><pubDate>Tue, 26 Nov 2019 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;This is an invaluable tool to quickly check before you merge two branches&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;git diff branch1   branch2&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Local gitlab and Runners]]></title><description><![CDATA[In an attempt to learn gitlab and how to use runners I thought I would try and setup the environments on my laptop so I could experiment. To…]]></description><link>https://rjgallac.github.io/LocalGitlab/</link><guid isPermaLink="false">https://rjgallac.github.io/LocalGitlab/</guid><pubDate>Sat, 23 Nov 2019 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;In an attempt to learn gitlab and how to use runners I thought I would try and setup the environments on my laptop so I could experiment.&lt;/p&gt;
&lt;p&gt;To set up a local gitlab is quite simple(you’ll need docker install docker). Open a command prompt and enter the following&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;sudo docker run --detach \
  --hostname gitlab.example.com \
  --publish 443:443 --publish 80:80 --publish 22:22 \
  --name gitlab \
  --restart always \
  --volume /srv/gitlab/config:/etc/gitlab \
  --volume /srv/gitlab/logs:/var/log/gitlab \
  --volume /srv/gitlab/data:/var/opt/gitlab \
  gitlab/gitlab-ce:latest&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Make sure you add gitlab.example.com to your host file so you can browse to &lt;a href=&quot;http://gitlab.example.com/&quot;&gt;http://gitlab.example.com/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You’ll then need to create a runner locally. Enter the following on the command prompt.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;sudo gitlab-runner register&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You’ll be asked a series of questions. You’ll get your token from gitlab&gt; admin&gt; runners.&lt;/p&gt;
&lt;p&gt;I created a shell runner and a docker runner.&lt;/p&gt;
&lt;p&gt;The last question will ask you to give it a name.  This will be how you reference it from your gitlab-ci.yml file.&lt;/p&gt;
&lt;p&gt;Another thing I had to do was configure the gitlab toml file.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;sudo nano /etc/gitlab-runner/config.toml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;to get docker runners working I had to add extra host to the runners.docker section.  Also note I up’d the conncurrent to 3 which was previously 1.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;concurrent = 3
check_interval = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = &quot;rob-Inspiron-5520&quot;
  url = &quot;http://gitlab.example.com/&quot;
  token = &quot;sY6dhj9QssARP8UWv4Q5&quot;
  executor = &quot;shell&quot;
  [runners.custom_build_dir]
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]

[[runners]]
  name = &quot;rob-Inspiron-5520&quot;
  url = &quot;http://gitlab.example.com/&quot;
  token = &quot;vqpBor_Psc_zRCQ3arbY&quot;
  executor = &quot;docker&quot;
  [runners.custom_build_dir]
  [runners.docker]
    tls_verify = false
    image = &quot;node:13.1.0-alpine3.10&quot;
    privileged = false
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = [&quot;/cache&quot;]
    shm_size = 0
    extra_hosts = [&quot;gitlab.example.com:192.168.0.19&quot;]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I created three very simple projects to experiment with running concurrently.&lt;/p&gt;
&lt;p&gt;Two were simple shell scripts that slept for a numbers of seconds and the third was a node project to exercise the&lt;/p&gt;
&lt;p&gt;The simple ones looks like this&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;stages:
  - testshell

testshell:
  stage: testshell
  script:
    - whoami
    - sleep 30
  tags: [robshell]&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The node ones like this&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;stages:
  - testshell
  - test
cache:
  paths:
    - node_modules/

testshell:
  stage: testshell
  script:
    - whoami
    - sleep 3
  tags: [robshell]

testing:
  image: node:13.1.0-alpine3.10
  stage: test
  script: 
    - whoami
    - npm i
    - npm test
  tags: [robsdocker]&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Docker Volume Permissions]]></title><description><![CDATA[I’ve struggled recently with outputing results in a docker container.  The files get root permissions and gitlab fails to clean up.  I found…]]></description><link>https://rjgallac.github.io/DockerVolumePermissions/</link><guid isPermaLink="false">https://rjgallac.github.io/DockerVolumePermissions/</guid><pubDate>Fri, 22 Nov 2019 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;I’ve struggled recently with outputing results in a docker container.  The files get root permissions and gitlab fails to clean up.  I found this little trick to give the files the user if of the current user.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;-u `id -u` &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;e.g&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;docker run --rm -u `id -u` -v  `pwd`/data/:/var/data:z -w=&quot;/var/app&quot; --net=host dockerimage:5  commandToRun&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;anything saved to the /va/data folder inside folder will get the owner of whoever ran it.  The group stays as root.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Watch Server Script]]></title><description><![CDATA[A little script to ping/poll a server until it up before launching into the next stage of the pipeline build.]]></description><link>https://rjgallac.github.io/WatchServerScript/</link><guid isPermaLink="false">https://rjgallac.github.io/WatchServerScript/</guid><pubDate>Thu, 21 Nov 2019 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;A little script to ping/poll a server until it up before launching into the next stage of the pipeline build.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;#!/bin/bash
while ! (wget https://REPLACE_SERVER_NAME/ --no-check-certificate -q -O /dev/null)
do
        echo &quot;sleeping&quot;;
        sleep 2;
done&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Locale dates in javascript]]></title><description><![CDATA[Seemed to spend a long time on this. Trying to display UTC date from backend in locale time ---- Using plain old javascript ---- Using…]]></description><link>https://rjgallac.github.io/locale_dates_javascript/</link><guid isPermaLink="false">https://rjgallac.github.io/locale_dates_javascript/</guid><pubDate>Wed, 06 Nov 2019 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Seemed to spend a long time on this. Trying to display UTC date from backend in locale time&lt;/p&gt;
&lt;p&gt;---- Using plain old javascript&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;newdate= new Date(&quot;2019-01-20T19:58:01&quot;);
document.write(newdate)
document.write(new Date(Date.UTC(newdate.getYear(), newdate.getMonth(), newdate.getDate(), newdate.getHours(), newdate.getMinutes(), newdate.getSeconds())))&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;---- Using momentjs&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;const momentUTC = &quot;2019-01-20T18:18:01&quot;;
document.write(&quot;LOCAL: &quot; + moment.utc(momentUTC).local().format(&quot;YYYY-MM-DD HH:mm:ss&quot;))
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Blog moved]]></title><description><![CDATA[Took the decision to move my wordpress blog to gatsby. Was as simple as running. Reasons included hopefully saving on hosting fees.  I’m…]]></description><link>https://rjgallac.github.io/blog_moved/</link><guid isPermaLink="false">https://rjgallac.github.io/blog_moved/</guid><pubDate>Thu, 17 Oct 2019 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Took the decision to move my wordpress blog to gatsby.&lt;/p&gt;
&lt;p&gt;Was as simple as running.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;  gatsby new my-blog https://github.com/gatsbyjs/gatsby-starter-blog&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Reasons included hopefully saving on hosting fees.  I’m using netlify as a free host for now but as its a static site now it can site anywhere i.e github pages..
I should be able to update it via github GUI. Hopefully it’ll be more secure i.e. no database involved, no wordpress involved.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Jest toHaveBeenCalledWith in order multiple times]]></title><description><![CDATA[Spent some time looking for a way to confirm that my service was called multiple time in the corrcet order. Tried doing a expect over…]]></description><link>https://rjgallac.github.io/jest_have_been_called/</link><guid isPermaLink="false">https://rjgallac.github.io/jest_have_been_called/</guid><pubDate>Thu, 19 Sep 2019 00:00:06 GMT</pubDate><content:encoded>&lt;p&gt;Spent some time looking for a way to confirm that my service was called multiple time in the corrcet order. Tried doing a expect over multlpe lines like so.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    expect(asdf).toHaveBeenCalledWith(1);
    expect(asdf).toHaveBeenCalledWith(1);&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;but this did not work&lt;/p&gt;
&lt;p&gt;however this did work&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    const spy = spyOn(myService, “myMethod”);
    expect(spy.mock.calls).toEqual([[result1], [result2]]);&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Angular observable service unit testing]]></title><description><![CDATA[Struggled today to write a unit test for an observable. The old jasmine (done) =>{done()} wasn’t doing it for me tried various other methods…]]></description><link>https://rjgallac.github.io/angular_observable_unit_testing/</link><guid isPermaLink="false">https://rjgallac.github.io/angular_observable_unit_testing/</guid><pubDate>Wed, 18 Sep 2019 00:00:06 GMT</pubDate><content:encoded>&lt;p&gt;Struggled today to write a unit test for an observable. The old jasmine (done) =&gt;{done()} wasn’t doing it for me tried various other methods around the web and nothing worked… hoever this combination did work for me.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    import { TestBed, tick, fakeAsync, flush } from &quot;@angular/core/testing&quot;;
    import { ToDoService } from &quot;./todo.service&quot;;

    ......

    it(&quot;test todo service&quot;, fakeAsync(() =&gt; {
        const toDo = {&quot;name&quot;:&quot;test};
        toDoService.addToDo(toDo);
        tick(10000);
        toDoService.todos.subscribe(data =&gt; {
        expect(data.length).toBe(1);
        });
        flush();
    }));&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The important parts are the fakeAsync, tick(1000) and flush();&lt;/p&gt;</content:encoded></item><item><title><![CDATA[java reduce]]></title><description><![CDATA[A quick way of taking an array of objects and reducing it to a list of string and the count of accurances i.e. a group by.]]></description><link>https://rjgallac.github.io/java_reduce/</link><guid isPermaLink="false">https://rjgallac.github.io/java_reduce/</guid><pubDate>Tue, 02 Jul 2019 00:00:06 GMT</pubDate><content:encoded>&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    tasks.stream().map(t -&gt; t.getName()).collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;A quick way of taking an array of objects and reducing it to a list of string and the count of accurances i.e. a group by.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[flowable – a new bpm]]></title><description><![CDATA[Seems like a nice port of activiti https://www.flowable.org/documentation.html. I have tried it and of the little examples I’ve created it…]]></description><link>https://rjgallac.github.io/flowable/</link><guid isPermaLink="false">https://rjgallac.github.io/flowable/</guid><pubDate>Tue, 02 Jul 2019 00:00:05 GMT</pubDate><content:encoded>&lt;p&gt;Seems like a nice port of activiti &lt;a href=&quot;https://www.flowable.org/documentation.html&quot;&gt;https://www.flowable.org/documentation.html&lt;/a&gt;. I have tried it and of the little examples I’ve created it seems a little easier than activiti. A nice little addition is to start up an entire stack which includes a great little modeler&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    docker run --name flowable -p 8080:8080 flowable/all-in-one&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Custom fields missing from wordpress]]></title><description><![CDATA[click on the three dots, then options]]></description><link>https://rjgallac.github.io/wordpress_custom_fields/</link><guid isPermaLink="false">https://rjgallac.github.io/wordpress_custom_fields/</guid><pubDate>Wed, 26 Jun 2019 00:00:05 GMT</pubDate><content:encoded>&lt;p&gt;click on the three dots, then options&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Oh My Zsh -installing on ubuntu]]></title><description><![CDATA[This is a great command line improvement for me for linux especially if you’re using git as it’ll show you quite clearly which branch you’re…]]></description><link>https://rjgallac.github.io/zsh/</link><guid isPermaLink="false">https://rjgallac.github.io/zsh/</guid><pubDate>Thu, 06 Jun 2019 00:00:05 GMT</pubDate><content:encoded>&lt;p&gt;This is a great command line improvement for me for linux especially if you’re using git as it’ll show you quite clearly which branch you’re on.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    apt install zsh
    chsh -s /bin/zsh root
    wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh
    cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
    source ~/.zshrc
    nano ~/.zshrc&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;on git bash you may needs to install powerfonts and change some git bash settings to UTF-8 if you are not seeing the icons and a bit of gibberish but it should work if you’re in x-win. If you run this it’ll tell you something up with your fonts and character encoding.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    echo &quot;\ue0b0 \u00b1 \ue0a0 \u27a6 \u2718 \u26a1 \u2699&quot;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Youll probably have to do something like the following to fix&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/powerline/fonts&quot;&gt;https://github.com/powerline/fonts&lt;/a&gt;
./install&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Git – throw away all local commits and reset back to origin]]></title><link>https://rjgallac.github.io/git_reset_to_origin/</link><guid isPermaLink="false">https://rjgallac.github.io/git_reset_to_origin/</guid><pubDate>Wed, 05 Jun 2019 00:00:05 GMT</pubDate><content:encoded>&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    git reset --hard origin/branch-name&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Virtualbox]]></title><description><![CDATA[My current style of working is use my IDE in windows and connect to docker containers running in virtual box(As I’ve not had much joy with…]]></description><link>https://rjgallac.github.io/Virtualbox/</link><guid isPermaLink="false">https://rjgallac.github.io/Virtualbox/</guid><pubDate>Wed, 05 Jun 2019 00:00:04 GMT</pubDate><content:encoded>&lt;p&gt;My current style of working is use my IDE in windows and connect to docker containers running in virtual box(As I’ve not had much joy with docker in windows). To control the virtual box I’ll ssh into it so I can see what the docker containers are doing etc.To start a vm in headless mode run the following from windows command line&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    vboxmanage startvm  &quot;ubuntu dev&quot; --type headless&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;this will start up the virtual box machine. I can then ssh into it from windows and do docker-compose up. Use tmux to give you more windows in one terminal. This way the only window open is potentially your IDE and a bash shell.&lt;/p&gt;
&lt;p&gt;You could get an even cleaner desktop by running the terminal from your idea but tmux in a small terminal window in your IDE isn’t a great experience.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[docker host ip]]></title><description><![CDATA[to get the host machine ip in a docker file which can then be used with your docker container or in docker compose]]></description><link>https://rjgallac.github.io/docker host ip/</link><guid isPermaLink="false">https://rjgallac.github.io/docker host ip/</guid><pubDate>Tue, 04 Jun 2019 00:00:04 GMT</pubDate><content:encoded>&lt;p&gt;to get the host machine ip in a docker file&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    DOCKER_HOST=$(ip -4 addr show docker0 | grep -Po &apos;inet \K[\d.]+&apos;)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;which can then be used with your docker container or in docker compose&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    --add-host=frontendapp:${DOCKER_HOST} &lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[git stash]]></title><description><![CDATA[stash commands]]></description><link>https://rjgallac.github.io/git stash/</link><guid isPermaLink="false">https://rjgallac.github.io/git stash/</guid><pubDate>Tue, 04 Jun 2019 00:00:03 GMT</pubDate><content:encoded>&lt;p&gt;stash commands&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    git stash list
    git stash pop 0
    git stash show 0
    git stash show -p 0&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[git file history]]></title><description><![CDATA[to view the changes to a file git log -p]]></description><link>https://rjgallac.github.io/git_file_history/</link><guid isPermaLink="false">https://rjgallac.github.io/git_file_history/</guid><pubDate>Tue, 04 Jun 2019 00:00:02 GMT</pubDate><content:encoded>&lt;p&gt;to view the changes to a file&lt;/p&gt;
&lt;p&gt;git log -p &lt;filename&gt;&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Angular karma test and selecting DOM elements for testing]]></title><description><![CDATA[using css selectors you can interrogate the DOM. or]]></description><link>https://rjgallac.github.io/Angular_karm_ test_and_selecting_DOM_elements/</link><guid isPermaLink="false">https://rjgallac.github.io/Angular_karm_ test_and_selecting_DOM_elements/</guid><pubDate>Fri, 24 May 2019 00:00:02 GMT</pubDate><content:encoded>&lt;p&gt;using css selectors you can interrogate the DOM.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;  const liElements = fixture.nativeElement.querySelectorAll(&quot;.delete-product&quot;);
  expect(liElements.length).toBe(0);&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;or&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;  const addProduct = fixture.nativeElement.querySelector(&quot;#add-product&quot;);
  expect(addProduct).toBeTruthy();&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Angular Karma test]]></title><description><![CDATA[How to test and mock services in karma and spy on service using jasmine]]></description><link>https://rjgallac.github.io/Angular_Karma_test/</link><guid isPermaLink="false">https://rjgallac.github.io/Angular_Karma_test/</guid><pubDate>Fri, 24 May 2019 00:00:01 GMT</pubDate><content:encoded>&lt;p&gt;How to test and mock services in karma and spy on service using jasmine&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;import { TestBed, async, ComponentFixture } from &apos;@angular/core/testing&apos;;
import { AppComponent } from &apos;./app.component&apos;;
import {TestService} from &apos;./test.service&apos;;
import { DebugElement } from &apos;@angular/core&apos;;


describe(&apos;AppComponent&apos;, () =&gt; {
  let testService: TestService;
  let fixture: ComponentFixture&amp;lt;AppComponent&gt;;
  let debugElement: DebugElement;

  beforeEach(async(() =&gt; {
    TestBed.configureTestingModule({
      declarations: [
        AppComponent
      ],
    }).compileComponents();
    fixture = TestBed.createComponent(AppComponent);
    debugElement = fixture.debugElement;
    testService = debugElement.injector.get(TestService);

  }));



  it(&apos;should render title in a h1 tag&apos;, () =&gt; {
    const fixture = TestBed.createComponent(AppComponent);
    fixture.detectChanges();
    const compiled = fixture.debugElement.nativeElement;
    expect(compiled.querySelector(&apos;h1&apos;).textContent).toContain(&apos;Welcome to angest!&apos;);
    expect(compiled.querySelector(&apos;h3&apos;).textContent).toContain(&apos;hi&apos;);
  });

  it(&apos;should rend&apos;, () =&gt; {
    spyOn(testService, &apos;getHi&apos;).and.returnValue(&quot;hi ho&quot;);
    const fixture = TestBed.createComponent(AppComponent);
    fixture.detectChanges();
    const compiled = fixture.debugElement.nativeElement;
    expect(compiled.querySelector(&apos;h3&apos;).textContent).toContain(&apos;hi ho&apos;);
  });


});&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[time taken in javascript]]></title><link>https://rjgallac.github.io/time_taken_in_javascript/</link><guid isPermaLink="false">https://rjgallac.github.io/time_taken_in_javascript/</guid><pubDate>Thu, 23 May 2019 00:00:01 GMT</pubDate><content:encoded>&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    const start = performance.now();
    const end = performance.now();
    this.searchTimeTakenInSeconds = ((end - start) / 1000).toFixed(2);&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Delete a local branch from git]]></title><description><![CDATA[This will delete a branch locally This should be safe and will warn you if it hasnt been merged. Use uppercase -D
to force delete]]></description><link>https://rjgallac.github.io/Delete_a_local_branch_from_git/</link><guid isPermaLink="false">https://rjgallac.github.io/Delete_a_local_branch_from_git/</guid><pubDate>Tue, 21 May 2019 00:00:01 GMT</pubDate><content:encoded>&lt;p&gt;This will delete a branch locally&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    git branch -d the_local_branch&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This should be safe and will warn you if it hasnt been merged. Use uppercase -D
to force delete&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Check is a branch is already merged into master]]></title><description><![CDATA[To list all branches already merged to list all branches not merged into master]]></description><link>https://rjgallac.github.io/Check_is_a_branch_is_already_merged_into_master/</link><guid isPermaLink="false">https://rjgallac.github.io/Check_is_a_branch_is_already_merged_into_master/</guid><pubDate>Tue, 21 May 2019 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;To list all branches already merged&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    git branch --merged master&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;to list all branches not merged into master&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    git branch --no-merged&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[mocha and freecodecamp test]]></title><description><![CDATA[On the final module. Not a lot of instruction on how to run the test but you should be able to run them by]]></description><link>https://rjgallac.github.io/mocha_and_freecodecamp_test/</link><guid isPermaLink="false">https://rjgallac.github.io/mocha_and_freecodecamp_test/</guid><pubDate>Wed, 15 May 2019 00:00:01 GMT</pubDate><content:encoded>&lt;p&gt;On the final module. Not a lot of instruction on how to run the test but you should be able to run them by&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    ./node_modules/.bin/mocha --ui tdd ./tests/1_unit-tests.js&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Turn a cold observable into a shared hot in Angular 6]]></title><description><![CDATA[Rather than have multiple backend calls a cold http service call can be turned into a hot shared multiplex service using the following]]></description><link>https://rjgallac.github.io/cold_observable_into_a_shared_hot_in_Angular_6/</link><guid isPermaLink="false">https://rjgallac.github.io/cold_observable_into_a_shared_hot_in_Angular_6/</guid><pubDate>Tue, 14 May 2019 00:00:01 GMT</pubDate><content:encoded>&lt;p&gt;Rather than have multiple backend calls a cold http service call can be turned into a hot shared multiplex service using the following&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    public doGetSharedProductsService() {
        return this.ProductService.getProducts().pipe(share());
    }&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Git pull another branch without switching]]></title><description><![CDATA[Something I’ve been doing for a long time is stashing a change, swicthing to the develop branch, pulling , switching back to my feature…]]></description><link>https://rjgallac.github.io/Git_pull_another_branch_without_switching/</link><guid isPermaLink="false">https://rjgallac.github.io/Git_pull_another_branch_without_switching/</guid><pubDate>Tue, 14 May 2019 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Something I’ve been doing for a long time is stashing a change, swicthing to the develop branch, pulling , switching back to my feature branch, unstashing and then merging. No need to switch, you can just pull in develop without switching.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    git pull origin develop:develop&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Git undo]]></title><description><![CDATA[This will undo the last commit leaving the files you committed in your local workspace]]></description><link>https://rjgallac.github.io/Git undo/</link><guid isPermaLink="false">https://rjgallac.github.io/Git undo/</guid><pubDate>Sun, 12 May 2019 00:00:00 GMT</pubDate><content:encoded>&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    git reset –soft HEAD~1&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This will undo the last commit leaving the files you committed in your local workspace&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    git reset --soft HEAD~1&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Levenshtein Distance]]></title><description><![CDATA[Needed for a recent code wars. See https://en.wikipedia.org/wiki/Levenshtein_distance for explanation. The java code]]></description><link>https://rjgallac.github.io/Levenshtein_Distance/</link><guid isPermaLink="false">https://rjgallac.github.io/Levenshtein_Distance/</guid><pubDate>Fri, 08 Mar 2019 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Needed for a recent code wars.&lt;/p&gt;
&lt;p&gt;See &lt;a href=&quot;https://en.wikipedia.org/wiki/Levenshtein_distance&quot;&gt;https://en.wikipedia.org/wiki/Levenshtein_distance&lt;/a&gt; for explanation.&lt;/p&gt;
&lt;p&gt;The java code&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;public class LevenshteinDistance {

    public int calc(String s1, int s1_length, String s2, int s2_length) {
        int cost;

        if(s1_length == 0) return s2_length;
        if(s2_length == 0) return s1_length;

        if(s1.charAt(s1_length-1) == s2.charAt(s2_length-1)){
            cost = 0;
        } else {
            cost = 1;
        }
        return min(
                calc(s1, s1_length-1, s2, s2_length) +1,
                min(
                calc(s1, s1_length, s2, s2_length -1) +1,
                calc(s1, s1_length-1, s2, s2_length -1) + cost)

        );
    }
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;@Test
public void test(){
    String s1 = &quot;saturday&quot;;
    String s2 = &quot;sunday&quot;;
    LevenshteinDistance levenshteinDistance = new LevenshteinDistance();
    int calc = levenshteinDistance.calc(s1, s1.length(), s2, s2.length());
    System.out.println(calc);
    assertEquals(3, calc);
}

@Test
public void test2(){
    String s1 = &quot;test&quot;;
    String s2 = &quot;test2&quot;;
    LevenshteinDistance levenshteinDistance = new LevenshteinDistance();
    int calc = levenshteinDistance.calc(s1, s1.length(), s2, s2.length());
    assertEquals(1, calc);
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[PHP + Composer]]></title><description><![CDATA[then]]></description><link>https://rjgallac.github.io/PHP_Composer/</link><guid isPermaLink="false">https://rjgallac.github.io/PHP_Composer/</guid><pubDate>Fri, 14 Dec 2018 00:00:01 GMT</pubDate><content:encoded>&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    curl -sS https://getcomposer.org/installer | sudo php — –install-dir=/usr/local/bin –filename=composer&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;then&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    composer install&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Reset WordPress pass]]></title><description><![CDATA[update wp_users set user_pass = “5f4dcc3b5aa765d61d8327deb882cf99” where user_login = “username_here”;]]></description><link>https://rjgallac.github.io/Reset_WordPress_pass/</link><guid isPermaLink="false">https://rjgallac.github.io/Reset_WordPress_pass/</guid><pubDate>Fri, 14 Dec 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;update wp_users set user_pass = “5f4dcc3b5aa765d61d8327deb882cf99” where user_login = “username_here”;&lt;/p&gt;</content:encoded></item><item><title><![CDATA[linux – cpu and memory usage]]></title><description><![CDATA[I was looking to see how much ram and cpu a process was using.  Running a war on a tomcat instance on my hosting was using over a constant…]]></description><link>https://rjgallac.github.io/linux_cpu_and_memory_usage/</link><guid isPermaLink="false">https://rjgallac.github.io/linux_cpu_and_memory_usage/</guid><pubDate>Fri, 01 Jun 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;I was looking to see how much ram and cpu a process was using.  Running a war on a tomcat instance on my hosting was using over a constant 80%.&lt;/p&gt;
&lt;p&gt;After looking into a new micro framework micronaut I looked at the ps command and htop but counldn’t isolate the process usage. However the following helped me easily watch the usage.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    watch ps -p [PID] -o %cpu,%mem,cmd&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[installing micronaut]]></title><description><![CDATA[Then trying to install micronaut and spending a lot of time trying to work out why I can’t build it I stumble upon sdkman and then]]></description><link>https://rjgallac.github.io/installing_micronaut/</link><guid isPermaLink="false">https://rjgallac.github.io/installing_micronaut/</guid><pubDate>Thu, 31 May 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Then trying to install micronaut and spending a lot of time trying to work out why I can’t build it I stumble upon sdkman&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    curl -s &quot;https://get.sdkman.io&quot; | bash&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;and then&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    sdk install micronaut&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Keycloak]]></title><description><![CDATA[I’ve been recommended keycloak as a single sign on solution.  Thought I would have a look into it this weekend.  Found a simple tutorial…]]></description><link>https://rjgallac.github.io/Keycloak/</link><guid isPermaLink="false">https://rjgallac.github.io/Keycloak/</guid><pubDate>Sun, 20 May 2018 00:00:02 GMT</pubDate><content:encoded>&lt;p&gt;I’ve been recommended keycloak as a single sign on solution.  Thought I would have a look into it this weekend.  Found a simple tutorial here for implementing it in Spring boot first of all using freemarker and locking down the the tomcat container using keycloak and then using spring security.  I should have stopped there.&lt;/p&gt;
&lt;p&gt;I then tried to freestyle and use javascript to connect to the rest endpoints and I was met with my old friend CORS and access-control-allow-origin error on the front end. I spent about 30 mins getting keycloak working and as soon as I seen the CORS error I knew I was in for a very long night. About five hours later messing about with CORS in keycloak and spring boot and the front end I realise I was trying to use the same client for locking down both the front end and the backend. I release I can make another client for the ReST backend and set its access type to bearer only.  And I would have another client thats access type is public for the angular front end.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[nexus and gradle caching dependencies]]></title><description><![CDATA[Spent some time wrestling with gradle and a SNAPSHOT dependency. I would push a jar to nexus and try to pull it but it was still using the…]]></description><link>https://rjgallac.github.io/nexus_and_gradle_caching_dependencies/</link><guid isPermaLink="false">https://rjgallac.github.io/nexus_and_gradle_caching_dependencies/</guid><pubDate>Fri, 04 May 2018 00:00:02 GMT</pubDate><content:encoded>&lt;p&gt;Spent some time wrestling with gradle and a SNAPSHOT dependency. I would push a jar to nexus and try to pull it but it was still using the old dependency.&lt;/p&gt;
&lt;p&gt;Every attempt to update index etc in nexus wouldn’t work. I tried going into .gradle/caches/modules/files and deleting all the file for my repo however even that wouldn’t work.&lt;/p&gt;
&lt;p&gt;I couldn’t get this to work for me thinking maybe gradle had something to do with it.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;configurations.all {
    resolutionStrategy {
        cacheDynamicVersionsFor 0, &apos;seconds&apos;
        cacheChangingModulesFor 0, &apos;seconds&apos;
    }&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;What did work in the end was that I noticied there was a .gradle/caches/modules/metadata folder.  When I deleted my repo from here and refreshed my dependencies it worked.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Fetch API – ajax call without libraries]]></title><description><![CDATA[Putting this here as it took me a while to track it down. https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API e.g or a post]]></description><link>https://rjgallac.github.io/Fetch_API_ajax_call_without_libraries/</link><guid isPermaLink="false">https://rjgallac.github.io/Fetch_API_ajax_call_without_libraries/</guid><pubDate>Fri, 04 May 2018 00:00:01 GMT</pubDate><content:encoded>&lt;p&gt;Putting this here as it took me a while to track it down.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API&quot;&gt;https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;e.g&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;getAll () {
    console.log(&quot;GET ALL&quot;)
    return fetch(&apos;http://127.0.0.1:8084/customer/&apos;, {
        method: &apos;get&apos;,
        headers: {
          &apos;Accept&apos;: &apos;application/json&apos;,
          &apos;Content-Type&apos;: &apos;application/json&apos;
        }
      }).then(function(response) {
        return response.json();
      }).then(function(data) {
        return data;
      });
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;or a post&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;addCustomer(customer){
  fetch(&apos;http://127.0.0.1:8084/customer/&apos;, {
    method: &apos;post&apos;,
    headers: {
      &apos;Accept&apos;: &apos;application/json&apos;,
      &apos;Content-Type&apos;: &apos;application/json&apos;
    },
    body: JSON.stringify(customer)
  }).then(function(response) {
    return response.json();
  }).then(function(data) {
  });
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Thoughtworks tech radar and impostor syndrome]]></title><description><![CDATA[One site I regularly visit is tech radar to see if there are any new advances in programming that I should be looking at.  Usually a lot of…]]></description><link>https://rjgallac.github.io/Thoughtworks_tech_radar_and_impostor_syndrome/</link><guid isPermaLink="false">https://rjgallac.github.io/Thoughtworks_tech_radar_and_impostor_syndrome/</guid><pubDate>Sun, 15 Apr 2018 00:00:01 GMT</pubDate><content:encoded>&lt;p&gt;One site I regularly visit is tech radar to see if there are any new advances in programming that I should be looking at.  Usually a lot of it is over my head but sometimes I’ll come across something that I will look into further and sometimes even being aware of these terms has proved useful. I recommend you visit every now and then &lt;a href=&quot;https://www.thoughtworks.com&quot;&gt;https://www.thoughtworks.com&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;A lot of the time it can bring out my impostor syndrome and I think I’m missing out on a lot of good nice tech because I just don’t have the time to keep up.  I do my best in my own time to research and improve myself but I see things move into the archive section of the radar that completely slipped by me. Wish I had more time to try out some of these but I already feel like I am sacrificing a lot of family time just to do what I already do.&lt;/p&gt;
&lt;p&gt;I consider myself a fullstack developer and although my work has mostly revolved around Java/Spring and angular I feel that I’m spread so thin that I know nothing and I am inferior to all of my peers. I know you can’t know everything and people have their own strengths, I know it can be exciting to live in a rapidly changing environment but I wish things would slow down for 5 minutes and not have a new framework released that I don’t have time to learn.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Versioning jars]]></title><description><![CDATA[After struggling for a long time trying to get snapshots and release into their respective places in nexus I thought I’d share my experience…]]></description><link>https://rjgallac.github.io/versioning_jars/</link><guid isPermaLink="false">https://rjgallac.github.io/versioning_jars/</guid><pubDate>Sun, 15 Apr 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;After struggling for a long time trying to get snapshots and release into their respective places in nexus I thought I’d share my experience. I’m working on a small test for bundling a client API with a server.  This seemed like an ideal time to improve my knowledge of nexus.&lt;/p&gt;
&lt;p&gt;The client API contains the shared code such as DTOs that the ReST server and calling clients will use.  The idea is that you could pass a JAR that contains the DTOs and the client and a user could simply Autowire in the client and call your service by invoking&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;productClient.getOne(1L);&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I started off creating using a local repo using the maven plugin in gradle.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;apply plugin: &apos;maven&apos;
uploadArchives {
    repositories {
        flatDir {
           dirs &apos;../repos&apos;
        }
    }
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This works well, in the gradle tasks you should have a task called jar which when called creates the JAR and a task called uploadArchives which will put it in your local repo.  You can then reference the JARs from your other projects like so&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt; compile files(&apos;../repos/productapi-0.1.0.jar&apos;)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This works great when working on your own.  I can see a benefit of this when wanting to make changes locally without having to push to git before you can test with the server locally and risk breaking changes.&lt;/p&gt;
&lt;p&gt;I then decided to create a local docker instance of nexus and start pushing to that. The maven plugin had me covered just by changing the flatdir to the following.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;mavenDeployer {
    repository(url: &apos;http://localhost:8081/nexus/content/repositories/snapshots&apos;) {
        authentication(userName: &quot;admin&quot;, password: &quot;admin123&quot;)
    }
    pom.version = project.version
    pom.artifactId = project.artifactId
    pom.groupId = project.groupId
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;I wanted to also improve my understanding of versioning which has always been a bit of a mystery to me.  At this point I was happily pushing snapshots but what about releases and whats the difference anyway. I always thought SNAPSHOTS went something like 0.0.1-SNAPSHOT 0.0.2-SNAPSHOT 0.0.3-SNAPSHOT and then when you were happy you’d release i.e. 0.0.4-RELEASE.  Turns out, not so.  It looks like it goes 0.0.1-SNAPSHOT and you can have lots of iterations of this until your happy at which point when you release you have a 0.0.1-RELEASE. An automated process will then create a 0.0.2-SNAPSHOT for you.&lt;/p&gt;
&lt;p&gt;So it was at this point I decided to look in nexus and work out how the hell I get a release file into the release part of nexus. By using a second plugin called maven release &lt;a href=&quot;https://github.com/researchgate/gradle-release&quot;&gt;https://github.com/researchgate/gradle-release&lt;/a&gt;&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;plugins {
    id &apos;net.researchgate.release&apos; version &apos;2.6.0&apos;
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This gives you a nice little release task which when run you’ll see create a new JAR with the SNAPSHOT portion in the filename, updates the version in your gradle.properties and increments the version number. But it wasnt pushing the release build to nexus, I could see it locally but not in nexus.  A lot of googling later I stumbled upon this snippet&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt; repository(url: &quot;http://localhost:8081/nexus/content/repositories/${project.version.endsWith(&apos;-SNAPSHOT&apos;) ? &apos;snapshots&apos; : &apos;releases&apos;}&quot;) {&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;which looked very hacky to me and I couldn’t get to work.&lt;/p&gt;
&lt;p&gt;however much googling later I stumbled upon this&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;uploadArchives {
    repositories {
        mavenDeployer {
            snapshotRepository(url: &apos;http://localhost:8081/nexus/content/repositories/snapshots&apos;) {
                authentication(userName: &quot;admin&quot;, password: &quot;admin123&quot;)
            }
            repository(url: &apos;http://localhost:8081/nexus/content/repositories/releases&apos;) {
                authentication(userName: &quot;admin&quot;, password: &quot;admin123&quot;)
            }
            pom.version = project.version
            pom.artifactId = project.artifactId
            pom.groupId = project.groupId
        }
    }
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;which looked and felt better however still didn’t work.  It still wasn’t pushing to release. Lots of googling later I was still none the wiser until I took a break and realised that the release plugin was unaware of the maven upload plugin and I should be plugging the uploader into the release plugin.  My thinking was it was doing this&lt;/p&gt;
&lt;p&gt;CREATE RELEASE -&gt; CREATE SNAPSHOT -&gt; UPLOAD&lt;/p&gt;
&lt;p&gt;when I wanted&lt;/p&gt;
&lt;p&gt;CREATE RELEASE -&gt; UPLOAD -&gt; CREATE SNAPSHOT&lt;/p&gt;
&lt;p&gt;so I tried&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;afterReleaseBuild.dependsOn uploadArchives&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;and it worked.  Funny how one line makes a difference.&lt;/p&gt;
&lt;p&gt;I then decided to get Jenkins involved and to let jenkins build the api and push to nexus. I did spend some time looking at the jenkins nexus plugin but I felt that that would be tying myself to installing plugins and I wanted as much as possible to live in my code(pipeline as code) and let gradle do the heavy lifting.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Code visualization]]></title><description><![CDATA[On my quest to find something to visualise java code I found these useful tools for intellij http://findtheflow.io https://plugins.jetbrains…]]></description><link>https://rjgallac.github.io/Code_visualization/</link><guid isPermaLink="false">https://rjgallac.github.io/Code_visualization/</guid><pubDate>Fri, 06 Apr 2018 00:00:03 GMT</pubDate><content:encoded>&lt;p&gt;On my quest to find something to visualise java code I found these useful tools for intellij&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://findtheflow.io&quot;&gt;http://findtheflow.io&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://plugins.jetbrains.com/plugin/7324-code-iris&quot;&gt;https://plugins.jetbrains.com/plugin/7324-code-iris&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/Vanco/SequencePlugin&quot;&gt;https://github.com/Vanco/SequencePlugin&lt;/a&gt;&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Intellij updates]]></title><description><![CDATA[I frequently find myself with a duff shortcut on my desktop when I update intellij on ubuntu. Edit this /.local/share/applications/jetbrains…]]></description><link>https://rjgallac.github.io/Intellij_updates/</link><guid isPermaLink="false">https://rjgallac.github.io/Intellij_updates/</guid><pubDate>Fri, 06 Apr 2018 00:00:02 GMT</pubDate><content:encoded>&lt;p&gt;I frequently find myself with a duff shortcut on my desktop when I update intellij on ubuntu.&lt;/p&gt;
&lt;p&gt;Edit this /.local/share/applications/jetbrains-idea-ce.desktop&lt;/p&gt;
&lt;p&gt;and update to the location of the latest update&lt;/p&gt;</content:encoded></item><item><title><![CDATA[enter non running docker]]></title><description><![CDATA[add this command to set off an infinite loop giving you time to bash into the container and check the folders etc]]></description><link>https://rjgallac.github.io/enter_non_running_docker/</link><guid isPermaLink="false">https://rjgallac.github.io/enter_non_running_docker/</guid><pubDate>Fri, 30 Mar 2018 00:00:02 GMT</pubDate><content:encoded>&lt;p&gt;add this command to set off an infinite loop giving you time to bash into the container and check the folders etc&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    -c “while true; do sleep 2; date; done”&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[play with docker and open faas]]></title><description><![CDATA[A nice little way to test open faas as well is to use play with docker https://labs.play-with-docker.com start a new session, create an…]]></description><link>https://rjgallac.github.io/play_with_docker_and_open_faas/</link><guid isPermaLink="false">https://rjgallac.github.io/play_with_docker_and_open_faas/</guid><pubDate>Fri, 30 Mar 2018 00:00:01 GMT</pubDate><content:encoded>&lt;p&gt;A nice little way to test open faas as well is to use play with docker&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://labs.play-with-docker.com&quot;&gt;https://labs.play-with-docker.com&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;start a new session, create an instance and run this&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    docker swarm init --advertise-addr eth0 &amp;amp;&amp;amp; \
    git clone https://github.com/openfaas/faas &amp;amp;&amp;amp; \
    cd faas &amp;amp;&amp;amp; \
    git checkout 0.7.1 &amp;amp;&amp;amp; \
    ./deploy_stack.sh &amp;amp;&amp;amp; \
    docker service ls&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[play with docker and docker swarm]]></title><description><![CDATA[Reacquainted myself with docker swarm and followed the offical tutorial here https://docs.docker.com/get-started/. Also following along with…]]></description><link>https://rjgallac.github.io/play_with_docker_and_docker_swarm/</link><guid isPermaLink="false">https://rjgallac.github.io/play_with_docker_and_docker_swarm/</guid><pubDate>Fri, 30 Mar 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Reacquainted myself with docker swarm and followed the offical tutorial here &lt;a href=&quot;https://docs.docker.com/get-started/&quot;&gt;https://docs.docker.com/get-started/&lt;/a&gt;. Also following along with this &lt;a href=&quot;https://www.youtube.com/watch?v=bGYAkFGkUws&amp;#x26;t=306s&quot;&gt;https://www.youtube.com/watch?v=bGYAkFGkUws&amp;#x26;t=306s&lt;/a&gt; reminded me of the online sandbox &lt;a href=&quot;https://labs.play-with-docker.com/&quot;&gt;https://labs.play-with-docker.com/&lt;/a&gt;.  I managed to reproduce the stack from my local on the online sandbox is seconds.  The only issue was with the redis data folder which I fixed by simply mounting the data folder inside the container. The youtube video above talks about using ngrok but the play-with-docker site publishes these ports anyway so didnt see the point.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[openfaas and localstack]]></title><description><![CDATA[I’ve only dabbled with these on my local machine but the following let you play about with serverless on you machine.  Something I really…]]></description><link>https://rjgallac.github.io/openfaas_and_localstack/</link><guid isPermaLink="false">https://rjgallac.github.io/openfaas_and_localstack/</guid><pubDate>Thu, 29 Mar 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;I’ve only dabbled with these on my local machine but the following let you play about with serverless on you machine.  Something I really want to get into but just haven’t had the time to do as yet.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/openfaas/faas&quot;&gt;https://github.com/openfaas/faas&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/localstack/localstack&quot;&gt;https://github.com/localstack/localstack&lt;/a&gt;&lt;/p&gt;</content:encoded></item><item><title><![CDATA[groking and ELK]]></title><description><![CDATA[Run into a bit of trouble with logstash and it not processing ERROR level messages from spring boot.   Countless searches turned up nothing…]]></description><link>https://rjgallac.github.io/groking_and_ELK/</link><guid isPermaLink="false">https://rjgallac.github.io/groking_and_ELK/</guid><pubDate>Tue, 27 Mar 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Run into a bit of trouble with logstash and it not processing ERROR level messages from spring boot.   Countless searches turned up nothing. By slowly building up the grok expression it turned out the problem was a rouge space. INFO and DEBUG have two spaces whilst ERROR and WARN have one.  So the end expression is so&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    &quot;(?&amp;lt;timestamp&gt;%{YEAR}-%{MONTHNUM}-%{MONTHDAY} %{TIME})%{SPACE}%{LOGLEVEL:level} %{NUMBER:pid} --- \[(?&amp;lt;thread&gt;[A-Za-z0-9-]+)\] [A-Za-z0-9.]*\.(?&amp;lt;class&gt;[A-Za-z0-9#_]+)\s*:\s+(?&amp;lt;logmessage&gt;.*)&quot;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Yak Shaving]]></title><description><![CDATA[Talk about shaving a yak.  I created a tool to analysis spring bean dependencies.  It worked fine on a simple test app I created and…]]></description><link>https://rjgallac.github.io/Yak_Shaving/</link><guid isPermaLink="false">https://rjgallac.github.io/Yak_Shaving/</guid><pubDate>Sat, 24 Mar 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Talk about shaving a yak.  I created a tool to analysis spring bean dependencies.  It worked fine on a simple test app I created and produced a nice Directed graph.  Ok, so I wanted to try it on a semi real app I created however it wasn’t working. I realised it the actuator /beans endpoints had a different formatted json output which I realise must be a version difference of spring.  So I thought I’ll just rewrite the node app that outputs the json in the required format for D3js.  Ok,  30 mins later I think instead of this I’ll upgrade my semi real app to spring 2.  3 hrs later after writing the app so its uses the new repo methods getById , the native queries needed changing from using mappers to projections, updating flyway, updating my tests, fixing caching.&lt;/p&gt;
&lt;p&gt;I forget what the hell I was trying to do in the first place.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[redis spring boot caching]]></title><description><![CDATA[spent a long time investigating jedis unexpected end of stream issue.  I’m using docker and it turns out spring boot couldn’t see it…]]></description><link>https://rjgallac.github.io/redis_spring_boot_caching/</link><guid isPermaLink="false">https://rjgallac.github.io/redis_spring_boot_caching/</guid><pubDate>Wed, 21 Mar 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;spent a long time investigating jedis unexpected end of stream issue.  I’m using docker and it turns out spring boot couldn’t see it.  Solved it by adding –net=host for the mean time.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[jmeter etags and 304 not modified]]></title><description><![CDATA[When testing 304 not modified etag using jmeter you need to add http cache manager and tick use cache control/expires headers. This did kind…]]></description><link>https://rjgallac.github.io/jmeter_etags_and_304_not_modified/</link><guid isPermaLink="false">https://rjgallac.github.io/jmeter_etags_and_304_not_modified/</guid><pubDate>Sat, 03 Mar 2018 00:00:04 GMT</pubDate><content:encoded>&lt;p&gt;When testing 304 not modified etag using jmeter you need to add http cache manager and tick use cache control/expires headers.&lt;/p&gt;
&lt;p&gt;This did kind of work for me however it looked like to was only doing it for every second request.  The solution – update jemeter.   Looks like there may be an issue in 3.1 of jmeter.  I upgraded to version 4 of jmeter and alls good&lt;/p&gt;</content:encoded></item><item><title><![CDATA[REST]]></title><description><![CDATA[Made a small realisation this morning. I’ve read up a lot of REST and the background etc. As you know ReST stands for Representational State…]]></description><link>https://rjgallac.github.io/rest/</link><guid isPermaLink="false">https://rjgallac.github.io/rest/</guid><pubDate>Sat, 03 Mar 2018 00:00:03 GMT</pubDate><content:encoded>&lt;p&gt;Made a small realisation this morning. I’ve read up a lot of REST and the background etc. As you know ReST stands for Representational State Transfer. I’ve read about the four levels or what is called the Richard Maturity Model&lt;/p&gt;
&lt;p&gt;level 0 – being the swamp of Pox (no order and all chaos)
level 1 – being resources ( /customer/, /order/1 etc)
level 2 – being using verbs correctly (POST, PUT, GET etc)
level 3 – being HATEOAS(hypertext and the Engine of Application State)&lt;/p&gt;
&lt;p&gt;The big realisation I made as I code my latest example app was that as I was adding caching and eTags to my spring boot app I was adding the most important element of ReST.  Understanding the levels above was important but more important is to know what it means to be an application at ReST.&lt;/p&gt;
&lt;p&gt;An application at ReSt should not be making unnecessary calls to the database and this is where the cache comes in.  An application at Rest should not be returning large payloads to the front end when its not necessary and this is where eTags come in.  As long as you are doing GETs which are meant to be idempotent i.e. the dont change anything there should be little to no activity on the backend.  The application is at ReST.&lt;/p&gt;
&lt;p&gt;As soon as a POST is made which are not idempotent ie they do change something then something will be removed from the cache, you will see a database hit , evict and update cache but after that the system should be back at ReST.&lt;/p&gt;
&lt;p&gt;There’s still a lot for me to learn in the area but hopefully getting there&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Jest code coverage]]></title><description><![CDATA[I was experiencing a lot of frustration with coverage and jest this weekend. I would write tests but the coverage was not going up. Turns…]]></description><link>https://rjgallac.github.io/Jest_code_coverage/</link><guid isPermaLink="false">https://rjgallac.github.io/Jest_code_coverage/</guid><pubDate>Sat, 03 Mar 2018 00:00:02 GMT</pubDate><content:encoded>&lt;p&gt;I was experiencing a lot of frustration with coverage and jest this weekend. I would write tests but the coverage was not going up. Turns out theres a cache.&lt;/p&gt;
&lt;p&gt;I tried adding&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    –no-cache&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;and it would but as soon as I removed the flag I’d be back to square one. There is another option&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    –clearCache&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;which worked a treat&lt;/p&gt;</content:encoded></item><item><title><![CDATA[docker volumes , backing up and restore]]></title><description><![CDATA[Its useful to be able to restore a database to an original state for integration/end to end testing. Create a volume using the -v command…]]></description><link>https://rjgallac.github.io/docker_volumes_backing_up_and_restore/</link><guid isPermaLink="false">https://rjgallac.github.io/docker_volumes_backing_up_and_restore/</guid><pubDate>Sun, 11 Feb 2018 00:00:02 GMT</pubDate><content:encoded>&lt;p&gt;Its useful to be able to restore a database to an original state for integration/end to end testing.&lt;/p&gt;
&lt;p&gt;Create a volume using the -v command which link the /var/lib/mysql folder in the container to my local folder /home/bob/dockerdata/mysql
e.g.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    docker run -v /home/bob/dockerdata/mysql_sivtest:/var/lib/mysql -p3306:3306 –name sivtest_mysql -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=sivtest -d mysql&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;backup the data by navigating to /home/bob/docker/data and run&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    sudo tar -cjf mysql_sivtest_archive mysql_sivtest&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;to restore the data you’ll have to stop the container , restore the data and start the container.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    docker stop sivtest_mysql
    sudo tar -xvf mysql_sivtest_archive
    docker start sivtest_mysql&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This is working very well for me&lt;/p&gt;</content:encoded></item><item><title><![CDATA[vuejs and axios]]></title><description><![CDATA[When trying to mock ajax calls I tried moxios however I couldn’t get it to work. I had more success with axios mock adapter https://github…]]></description><link>https://rjgallac.github.io/vuejs_and_axios/</link><guid isPermaLink="false">https://rjgallac.github.io/vuejs_and_axios/</guid><pubDate>Sun, 11 Feb 2018 00:00:01 GMT</pubDate><content:encoded>&lt;p&gt;When trying to mock ajax calls I tried moxios however I couldn’t get it to work. I had more success with axios mock adapter &lt;a href=&quot;https://github.com/ctimmerm/axios-mock-adapter&quot;&gt;https://github.com/ctimmerm/axios-mock-adapter&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;to mock out a call&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    import the modules

    import MockAdapter from &apos;axios-mock-adapter&apos;;
    import axios from &apos;axios&apos;
    and an example would look like

    it(&apos;Company mounted 1 company&apos;, (done) =&gt;{
        mock = new MockAdapter(axios); 
        mock.onGet(&apos;http://127.0.0.1:8082/company/&apos;).reply(200, [{&quot;id&quot;:1,&quot;name&quot;:&quot;company name&quot;}]);
        const wrapper = mount(Companies)
        setTimeout(() =&gt; {
        expect(wrapper.findAll(&apos;table tr.result&apos;).length).toEqual(1)
        done()       
        },0)
    })&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The set timeout is important as I believe it gives the async call time and the done() is also important as the test will wait until you tell it you’re done.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[vuejs and unit tests]]></title><description><![CDATA[Was getting a lot of issues doing unit tests getting errors around vuejs trying to pull in the router and other components. Discovered vue…]]></description><link>https://rjgallac.github.io/vuejs_and_unit_tests/</link><guid isPermaLink="false">https://rjgallac.github.io/vuejs_and_unit_tests/</guid><pubDate>Sun, 11 Feb 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Was getting a lot of issues doing unit tests getting errors around vuejs trying to pull in the router and other components. Discovered vue-test-utils which greatly simplifies a lot of the mocking &lt;a href=&quot;https://vue-test-utils.vuejs.org/en/&quot;&gt;https://vue-test-utils.vuejs.org/en/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You simply your components as follows&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    const wrapper = mount(Companies)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You can print the html like so&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    console.log(wrapper.html())&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;and expect like so&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    expect(wrapper.html()).toContain(&apos;&amp;lt;div&gt;&amp;lt;h1&gt;HOME&amp;lt;/h1&gt; &amp;lt;p&gt;Welcome to Your Vue.js App&amp;lt;/p&gt;&amp;lt;/div&gt;&apos;)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;it also has some handy utils that simplify click events&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    wrapper.find(&apos;#addcompany&apos;).trigger(&apos;click&apos;)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Router params can be mocked like so&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;    const $route = {
        params: { providerid: &apos;1&apos; },
    }

    const wrapper = mount(Benefits, {
        mocks: {$route}
    })&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This library has been instrumental in getting my vuejs unit tests working&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Docker Registry]]></title><description><![CDATA[https://yourserver.com:5000/v2/_catalog
https://dockreg:5000/v2/hello/tags/list]]></description><link>https://rjgallac.github.io/Docker_Registry/</link><guid isPermaLink="false">https://rjgallac.github.io/Docker_Registry/</guid><pubDate>Wed, 17 Jan 2018 00:00:00 GMT</pubDate><content:encoded>&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;mkdir registry_certs

openssl req -newkey rsa:4096 -nodes -sha256 \
-keyout registry_certs/domain.key -x509 -days 356 \
-out registry_certs/domain.cert

put domain.cert here on all clients
/etc/docker/certs.d//ca.cert

docker run -d -p 5000:5000 \
-v `pwd`/registry_certs:/certs \
-e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.cert \
-e REGISTRY_HTTP_TLS_KEY=/certs/domain.key \
–restart=always –name registry registry:2

docker pull hello-world
docker tag hello-world dockreg:5000/hello
docker push dockreg:5000/hello
docker tag hello-world dockreg:5000/hello:1
docker push dockreg:5000/hello:1&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href=&quot;https://yourserver.com:5000/v2/_catalog&quot;&gt;https://yourserver.com:5000/v2/_catalog&lt;/a&gt;
&lt;a href=&quot;https://dockreg:5000/v2/hello/tags/list&quot;&gt;https://dockreg:5000/v2/hello/tags/list&lt;/a&gt;&lt;/p&gt;</content:encoded></item><item><title><![CDATA[SOLR search POC]]></title><description><![CDATA[I wanted to set up a quick test to see if I could pass in a user created search lucene search string that would mean users could write their…]]></description><link>https://rjgallac.github.io/SOLR_search_POC/</link><guid isPermaLink="false">https://rjgallac.github.io/SOLR_search_POC/</guid><pubDate>Sun, 17 Dec 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;I wanted to set up a quick test to see if I could pass in a user created search lucene search string that would mean users could write their own queries. Seemed simple enough.&lt;/p&gt;
&lt;p&gt;I tried using some guides on the web to get me started with spring data solr which was the first hurdle. None of the tutorials I found worked, possibly because of dependency issues. I ended up using spring initializr and specified web and solr. &lt;a href=&quot;https://start.spring.io/&quot;&gt;https://start.spring.io/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Next hurdle, I couldn’t see any ways for using spring data CRUD repo to create the query from a passed in string. The CRUD is fine for hard wired queries but not for what I Wanted. Figured I have to go a level down and use the solrclient.&lt;/p&gt;
&lt;p&gt;Next issue was converting the solr results into POJOs. This is done via getBeans but I had issues with SOLR and its automatic schema creation. It guesses my strings were all multivalue. So I figured out a way of editing the schema manually and setting the multivalue to false and it works.&lt;/p&gt;
&lt;p&gt;heres my repo
&lt;a href=&quot;https://github.com/rjgallac/solrtest&quot;&gt;https://github.com/rjgallac/solrtest&lt;/a&gt;&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Portainer]]></title><description><![CDATA[A nice UI for docker. http://127.0.0.1:9000/]]></description><link>https://rjgallac.github.io/Portainer/</link><guid isPermaLink="false">https://rjgallac.github.io/Portainer/</guid><pubDate>Fri, 15 Dec 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;A nice UI for docker.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href=&quot;http://127.0.0.1:9000/&quot;&gt;http://127.0.0.1:9000/&lt;/a&gt;&lt;/p&gt;</content:encoded></item><item><title><![CDATA[SASS and vuejs]]></title><description><![CDATA[add this to build/webpack.base.conf.js and in your component import yout scss However I’m strongly considering the benefits of SASS when…]]></description><link>https://rjgallac.github.io/SASS_and_vuejs/</link><guid isPermaLink="false">https://rjgallac.github.io/SASS_and_vuejs/</guid><pubDate>Sun, 10 Dec 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;add this to build/webpack.base.conf.js&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;{
test: /\.s[a|c]ss$/,
loader: &apos;style!css!sass&apos;
}&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;and in your component import yout scss&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;&amp;lt;style lang=&quot;scss&quot; &gt;
@import &apos;./component1.scss&apos;;
&amp;lt;/style&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;However I’m strongly considering the benefits of SASS when using vue components. SASS lets you break up your stylesheets into smaller composable chunks which is pretty much out of the box with vue. Variable substitution is still beneficial, there might be a way to do this in vue too. Time for some investigating me thinks&lt;/p&gt;</content:encoded></item><item><title><![CDATA[angular and docker]]></title><description><![CDATA[issuing the following three commands sets up angular through a docker container and serves it on http://localhost:4200/]]></description><link>https://rjgallac.github.io/angular_and_docker/</link><guid isPermaLink="false">https://rjgallac.github.io/angular_and_docker/</guid><pubDate>Fri, 08 Dec 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;issuing the following three commands sets up angular through a docker container and serves it on &lt;a href=&quot;http://localhost:4200/&quot;&gt;http://localhost:4200/&lt;/a&gt;&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;docker run -it --rm -v &quot;$PWD&quot;:/app -w /app node:9-alpine npm install @angular/cli
docker run -it --rm -v &quot;$PWD&quot;:/app -w /app node:9-alpine node_modules/.bin/ng new my-app --directory ./
docker run -it --rm -p4200:4200 -v &quot;$PWD&quot;:/app -w /app node:9-alpine node_modules/.bin/ng serve --host 0.0.0.0 --open&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[and lastly react through docker]]></title><description><![CDATA[Closing leaves no existence of node/npm.. The nice thing about these in a development environment is ensuring everybody is using the same…]]></description><link>https://rjgallac.github.io/react_through_docker/</link><guid isPermaLink="false">https://rjgallac.github.io/react_through_docker/</guid><pubDate>Fri, 08 Dec 2017 00:00:00 GMT</pubDate><content:encoded>&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;docker run -it –rm -v “$PWD”:/app -w /app node:9-alpine npm install create-react-app
docker run -it –rm -v “$PWD”:/app -w /app node:9-alpine node_modules/.bin/create-react-app react-app
docker run -it –rm -v “$PWD/react-app”:/app -w /app node:9-alpine npm start&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Closing leaves no existence of node/npm..&lt;/p&gt;
&lt;p&gt;The nice thing about these in a development environment is ensuring everybody is using the same version of node/npm, the docker container ensures the project is built on the same platform i.e. linux for consistency, its pretty lightweight and I can through it away when finished.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Node , NPM and docker]]></title><description><![CDATA[A follow up post. Using the offical node image to install npm packages and run an express app. docker run -it —rm -v “$PWD”:/app -w /app…]]></description><link>https://rjgallac.github.io/NodeNPManddocker/</link><guid isPermaLink="false">https://rjgallac.github.io/NodeNPManddocker/</guid><pubDate>Thu, 07 Dec 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;A follow up post. Using the offical node image to install npm packages and run an express app.&lt;/p&gt;
&lt;p&gt;docker run -it —rm -v “$PWD”:/app -w /app node:9-alpine npm init
The -it takes you to the terminal to fill in the package info. The –rm will remove the container. Once complete you should see a package.json in the local directory.&lt;/p&gt;
&lt;p&gt;docker run —rm -v “$PWD”:/app -w /app node:9-alpine npm install express body-parser cookie-parser multer —save
The above will install the packages in the local directory.&lt;/p&gt;
&lt;p&gt;docker run —rm -p8081:8081 -v “$PWD”:/app -w /app node:9-alpine node index.js
The above will run the app and remove the container when finished.&lt;/p&gt;
&lt;p&gt;The following is the index.js
var express = require(‘express’);
var app = express();
app.get(’/’, function (req, res) {
res.send(‘Hello World’);
})
var server = app.listen(8081, function () {
var host = server.address().address
var port = server.address().port
console.log(“Example app listening at http://%s:%s”, host, port)
})&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Node and docker]]></title><description><![CDATA[I don’t tend to install node on my laptop as I don’t want to clutter my machine with a lot of different software.  I like to try stuff out…]]></description><link>https://rjgallac.github.io/Nodeanddocker/</link><guid isPermaLink="false">https://rjgallac.github.io/Nodeanddocker/</guid><pubDate>Thu, 07 Dec 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;I don’t tend to install node on my laptop as I don’t want to clutter my machine with a lot of different software.  I like to try stuff out save it to github and forget about it for a few months.  Docker lets me do this.&lt;/p&gt;
&lt;p&gt;for example to run a quick node script&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;docker run -p8080:8080 -v &quot;$PWD&quot;:/app node:9-alpine node app/console.js&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;console.js&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;console.log(&quot;Hello World!&quot;);&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Another example – running a webserver.&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;docker run -p8080:8080 -v &quot;$PWD&quot;:/app node:9-alpine node app/webserver.js&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;webserver.js&lt;/p&gt;
&lt;div class=&quot;gatsby-highlight&quot; data-language=&quot;text&quot;&gt;&lt;pre class=&quot;language-text&quot;&gt;&lt;code class=&quot;language-text&quot;&gt;http.createServer(function (req, res) {
res.writeHead(200, {&apos;Content-Type&apos;: &apos;text/html&apos;});
res.end(&apos;Hello World!&apos;);
}).listen(8080);&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</content:encoded></item><item><title><![CDATA[Another test – docker , webpack and vuejs]]></title><description><![CDATA[I wondered if I could use docker to prepare, install and run a webpack server inside docker containers. Again without installing node/npm on…]]></description><link>https://rjgallac.github.io/docker_webpack_vuejs/</link><guid isPermaLink="false">https://rjgallac.github.io/docker_webpack_vuejs/</guid><pubDate>Thu, 07 Dec 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;I wondered if I could use docker to prepare, install and run a webpack server inside docker containers. Again without installing node/npm on my machine.&lt;/p&gt;
&lt;p&gt;docker run -it —rm -v “$PWD”:/app -w /app node:9-alpine npm install vue-cli
This will initialise the project in the current folder. You should see prompts and fill in the detail.
docker run -it —rm -v “$PWD”:/app -w /app node:9-alpine node_modules/.bin/vue init webpack .
This will create a default vue project for you in the current folder using the awesome vue cli..&lt;/p&gt;
&lt;p&gt;docker run -it —rm -v “$PWD”:/app -w /app node:9-alpine npm i
This will install the packages. You should see npm pull down all the related packages specified in the package.json&lt;/p&gt;
&lt;p&gt;docker run -it —rm -p8080:8080 -v “$PWD”:/app -w /app node:9-alpine npm run start
And this will run up the app on port 8080. Just go to localhost:8080&lt;/p&gt;
&lt;p&gt;N.B, you might need to edit package.json and add –host 0.0.0.0 as an option to the webpack-dev-server command&lt;/p&gt;
&lt;p&gt;as an added bonus you might want to build the project and package it up into a nginx docker image for running as the webpack dev server is not production ready. Simple create the following Dockerfile
FROM nginx:1.13-alpine
COPY dist /usr/share/nginx/html
then
docker build -t nodevue .
then
docker run —rm -p8080:80 nodevue
then browser to localhost:8080
when you close there should be no evidence that node or nginx was ever on your machine 🙂&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Camel and activemq]]></title><description><![CDATA[Camel does not seem to want to pick up the broker url when specified in spring boot properties file. instead you have to add it to the url…]]></description><link>https://rjgallac.github.io/ActivemqTopicsandQueues/</link><guid isPermaLink="false">https://rjgallac.github.io/ActivemqTopicsandQueues/</guid><pubDate>Sat, 28 Jan 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Camel does not seem to want to pick up the broker url when specified in spring boot properties file.&lt;/p&gt;
&lt;p&gt;instead you have to add it to the url like so&lt;/p&gt;
&lt;p&gt;activemq:queue:people.processpeople?trustAllPackages=true&amp;#x26;brokerURL=“+activemqBrokerUrl&lt;/p&gt;
&lt;p&gt;in addition it doesnt pick up the trustAllPackages properties so specify that there as well&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Activemq Topics and Queues]]></title><description><![CDATA[When working on a quick proof of concept I was going to try to programmatically get camel to multicast to all listening microservices when I…]]></description><link>https://rjgallac.github.io/Camelandactivemq/</link><guid isPermaLink="false">https://rjgallac.github.io/Camelandactivemq/</guid><pubDate>Sat, 28 Jan 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;When working on a quick proof of concept I was going to try to programmatically get camel to multicast to all listening microservices when I stumbled upon the subtle but important difference between queues and topics. Queues will distribute messages to one of the listening services whereas with topics messages will get distributed to all listening services.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/rjgallac/robamq&quot;&gt;https://github.com/rjgallac/robamq&lt;/a&gt;&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Docker – clean up old images]]></title><description><![CDATA[If you do a > docker images you might notice a lot of images with the name of none.  I believe these are a load of out of date images. You…]]></description><link>https://rjgallac.github.io/docker-clean/</link><guid isPermaLink="false">https://rjgallac.github.io/docker-clean/</guid><pubDate>Tue, 01 Nov 2016 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;If you do a &gt; docker images&lt;/p&gt;
&lt;p&gt;you might notice a lot of images with the name of none.  I believe these are a load of out of date images. You can clean these up by executing the following on the command line&lt;/p&gt;
&lt;p&gt;docker rmi $(docker images -f “dangling=true” -q)&lt;/p&gt;</content:encoded></item><item><title><![CDATA[docker install – linux]]></title><description><![CDATA[tall – linux
Docker can be a pain to install.  You can follow lots of install instructions and apt-get install or just follow execute this…]]></description><link>https://rjgallac.github.io/docker-install/</link><guid isPermaLink="false">https://rjgallac.github.io/docker-install/</guid><pubDate>Tue, 01 Nov 2016 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;tall – linux
Docker can be a pain to install.  You can follow lots of install instructions and apt-get install or just follow execute this.&lt;/p&gt;
&lt;p&gt;wget -qO- &lt;a href=&quot;https://get.docker.com/&quot;&gt;https://get.docker.com/&lt;/a&gt; | sh
also, to install docker-compose&lt;/p&gt;
&lt;p&gt;sudo apt-get -y install python-pip
sudo pip install docker-compose
most of this taken from here&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-ubuntu-14-04&quot;&gt;https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-compose-on-ubuntu-14-04&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I do recommend the digital ocean tutorials.&lt;/p&gt;</content:encoded></item><item><title><![CDATA[Freeeeeee certs from lets encrypt]]></title><description><![CDATA[Not tried this but intend to very soon. Get your free SSL certificates from lets encrypt. Seems like a good deal to me and something I see…]]></description><link>https://rjgallac.github.io/free-certs/</link><guid isPermaLink="false">https://rjgallac.github.io/free-certs/</guid><pubDate>Mon, 14 Dec 2015 22:12:03 GMT</pubDate><content:encoded>&lt;p&gt;Not tried this but intend to very soon. Get your free SSL certificates from lets encrypt. Seems like a good deal to me and something I see popping up in my RSS feeds very often.
&lt;a href=&quot;https://letsencrypt.org/&quot;&gt;https://letsencrypt.org/&lt;/a&gt;.&lt;/p&gt;</content:encoded></item></channel></rss>