Tuesday, 28 July 2020

[modelio] corrupted diagrammes

Sympom

I experienced several times now that diagrammes got currupted. Some components missing others renamed. Very annoying and tedious to fix.

Cause

I did not actually test this, but I suspect that the cause is copying a diagramme to take advantage of already defined objects. But then
  • one renames some objects
  • one deletes some objects
  • one adds objects
Latter is no problem at all but as the objects of the copy diagramme are not copies but sort of links to the original
  • renaming will rename the orignal
  • deleting will delete the original
thus rendering the original diagramme in a dire state. I have not found means neither to just remove objects from a Diagramme instead of deleting them nor to cut the link to the original.

Solution

Create an all new Diagramme.

Wednesday, 1 July 2020

[git] rename a remote branch

Apparently, it is not possible to rename a remote branch directly. You need to rename the local branch push it to a new remote branch and delete the remote branch then:
#bash
# If you are not on the branch to rename, do
git branch -m <old_name> <new_name>
# or check it out
git checkout <old_name>
git branch -m <new_name>

# Push it to the remote repo and make it track at the same time
git push origin -u <new_name>

# Delete the old branch in the remote repo
git push origin --delete <old_name>
You  might run into problems, e.g. when you already created the new remote branch, maybe using the branch functionality in JIRA to have a link between branch and issue. The symptom is when running the push to the new remote:
#bash
To ssh://git@stash-prod.pnet.ch/adw/adw1.git
 ! [rejected]        bugfix/kellnerth/SGA-1872-abhangigkeiten-in-arbitrary--monthly--outbound -> bugfix/kellnerth/SGA-1872-abhangigkeiten-in-arbitrary--monthly--outbound (non-fast-forward)
error: failed to push some refs to 'ssh://git@stash-prod.pnet.ch/adw/adw1.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
This behaviour is independent of pulling from the repository. You can push the new branch to remote by forcing it, e.g.
#bash
git push -f origin <new_name>
Apparently it is not a good solution. I ended up with two local branches apart from the "prefix" origin/ identically named. The local "origin" branch was not tracking any

[Logitech MX Vertical] starts to creep its cursor

Symptom

Even if you do not touch the mouse, its cursor creeps over the screen.

Solution

Switch it off and on again possibly waiting a couple of seconds inbetween.

Monday, 25 May 2020

[DB2 LUW] Single multiple key records

Goal

Say you have a table without primary key imposed but there are records sporting the same value over a select number of attributes and want to only one record of those to remain within the table, you cannot use a function like ROWID in Oracle because DB2 LUW does not expose such a function/(pseudo) column (see how-to-delete-multiple-records-of-key)

Solution

Use sort of subquery, i.e.

delete from (select rownumber() over (partition by <list of attributes over which uniqueness is supposed to be>) as RN
               from <table>) as T
      where T.RN > 1;

Example

delete from (select rownumber() over (partition by TABLE_NAME,
                                                   ROW_SCAN_NUMBER,
                                                   DWH_REG_TIME) as RN
               from ADW_ETL.ETL_OGG_ROW_SCAN) as T
      where T.RN > 1;

Wednesday, 31 July 2019

[Db2 LUW] When is a table reorg needed?

Some operations on a table of a Db2 instance let the table in an unusable state. I shall try to list the operations. Please be aware the list is probably not complete!

Require reorg

  • drop at least one column
  • increase the size of a decimal column

Do not require reorg

  • add columns (at least 5 are possible, did not test more)
  • increase the size of a varchar column

[Db2 LUW] buggy (left) outer join?!?

Problem

Following queries lose against DB2 v11.1.1.1 fixpack number 1(Linux) lose the left row without match on the right side.
with G as
    (select   *
        from ADW_ETL.ETL_GDT_UNIQUE_KEY
        where TABLE_NAME in('BAP_KOMMUNIKATION',
                            'BAP_GESCHAEFTSVORFALL',
                            'BAP_GFSCHRITT',
                            'BAP_GFSCHRITTADD',
                            'BAP_AUFTRAG',
                            'BAP_AUFTRAGPRODUKT')
    )
  select   G.TABLE_NAME,
      C.FLAG_ACTIVE,
      G.STORE_FLAG,
      G.OGG_PACKER_FREQUENCY,
      C.DWH_TIME_DELAY,
      I.*
    from G
    left outer join ADW_STATMON.DWH_ODS_CTRL C
    on G.TABLE_NAME = C.DWH_ODSCTRL_GDT_NAME
    left outer join ADW_STATMON.DWH_INBOUND_REG I
    on I.DWH_TRG_TABLE_NAME = G.TABLE_NAME
    where nvl(I.DWH_REG_TS, current_timestamp) >= current_timestamp - 9
;
with G as
    (select   *
        from ADW_ETL.ETL_GDT_UNIQUE_KEY
        where TABLE_NAME in('BAP_KOMMUNIKATION',
                            'BAP_GESCHAEFTSVORFALL',
                            'BAP_GFSCHRITT',
                            'BAP_GFSCHRITTADD',
                            'BAP_AUFTRAG',
                            'BAP_AUFTRAGPRODUKT')
    )
  select   G.TABLE_NAME,
      C.FLAG_ACTIVE,
      G.STORE_FLAG,
      G.OGG_PACKER_FREQUENCY,
      C.DWH_TIME_DELAY,
      I.*
    from G
    left outer join ADW_STATMON.DWH_ODS_CTRL C
    on G.TABLE_NAME = C.DWH_ODSCTRL_GDT_NAME
    left outer join ADW_STATMON.DWH_INBOUND_REG I
    on I.DWH_TRG_TABLE_NAME = G.TABLE_NAME
    where I.DWH_REG_TS                         >= current_timestamp - 9
       or I.DWH_REG_TS                         is null
;
I am pretty sure it is not iso standard behavior, and to me counterintuitive for sure.

Solution

Either pack the filtering into with constructs or move the filter on the outer table (the one not necessarily retaining its records) into the on clause. Example for the latter:
with G as
    (select   *
        from ADW_ETL.ETL_GDT_UNIQUE_KEY
        where TABLE_NAME in('BAP_KOMMUNIKATION',
                            'BAP_GESCHAEFTSVORFALL',
                            'BAP_GFSCHRITT',
                            'BAP_GFSCHRITTADD',
                            'BAP_AUFTRAG',
                            'BAP_AUFTRAGPRODUKT')
    )
  select   G.TABLE_NAME,
      C.FLAG_ACTIVE,
      G.STORE_FLAG,
      G.OGG_PACKER_FREQUENCY,
      C.DWH_TIME_DELAY,
      I.*
    from G
    left outer join ADW_STATMON.DWH_ODS_CTRL C
    on G.TABLE_NAME = C.DWH_ODSCTRL_GDT_NAME
    left outer join ADW_STATMON.DWH_INBOUND_REG I
    on I.DWH_TRG_TABLE_NAME = G.TABLE_NAME
    and I.DWH_REG_TS >= current_timestamp - 9
;

Friday, 19 July 2019

[git] Get the unpushed commits of a local repository and their commit timestamp using zsh

Run within the local repository
_LOG="$(git log)"
for _COMMIT in "${(@f)$(git cherry -v)}"
# '${(@f)VARIABLE}' splits VARIABLE (can be command substitution) at linebreaks (otherwise it would get split into words)
do
    _DATE_STRING=$(echo "${_LOG}" | grep -A2 ${_COMMIT[(w)2]} | grep -F Date)
    # (w) spilts into words, [..2] takes the second element
    echo "${_DATE_STRING}  ${_COMMIT}"
done
or as oneliner
_LOG="$(git log)" ; for _COMMIT in "${(@f)$(git cherry -v)}" ; do _DATE_STRING=$(echo "${_LOG}" | grep -A2 ${_COMMIT[(w)2]} | grep -F Date) ; echo "${_DATE_STRING}  ${_COMMIT}" ; done

[git] Create a local branch from another branch

From the active branch git checkout -b <LOCAL_BRANCH> From a donator branch git checkout -b <LOCAL_BRANCH> <DONATING_BRANCH...