Skip to content

Instantly share code, notes, and snippets.

Avatar

Kirill Marchuk 62mkv

  • Kuehne+Nagel
  • Tallinn, Estonia
View GitHub Profile
@62mkv
62mkv / README.md
Created Jan 7, 2021
XPath cheatsheet
View README.md

XPath cheatsheet

(inspired by this)

Find nodes with XPath expressions

  • / - root
  • x - element named "x"
  • x/y - all children of "x" named "y"
  • * any element
@62mkv
62mkv / README.md
Created Dec 27, 2020
Liquibase + SQLite problem with _temporary tables
View README.md

How to resolve Liquibase exception "Table 'TABLE_NAME_temporary" not found, when working with SQLite

As it's already second time I face this, here's a brief overview:

Occassionally, constraints in SQLite Database get "corrupted" (maybe it's just me, I dunno), and, when applying migrations, you might come across an exception that looks like this:

Caused by: liquibase.exception.MigrationFailedException: Migration failed for change set db/changelog/changelogs/008-add-lexemes.xml::8-3::62mkv:
     Reason: liquibase.exception.UnexpectedLiquibaseException: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: java.sql.SQLException: Table not found: 'ARTICLES_temporary'
@62mkv
62mkv / README.md
Last active Sep 7, 2020
XLST transformation example
View README.md

How to extract names and values of parameters from a collection inside XML document

Use Altova XMLSpy. The XLST template example given:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/xpath-functions" exclude-result-prefixes="xs fn xsl"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tns="http://xlogics.eu/blackbox">
	<!--output format close to xquery-->
@62mkv
62mkv / README.md
Last active Jul 17, 2020
OpenStreetMap cheatsheet
View README.md

Find all car repairs services, open on Saturday:

Open http://overpass-turbo.eu/ and paste this into query area, then press "Run"

/*
This has been generated by the overpass-turbo wizard.
The original search was:
“shop=car_repair”
*/
View run-git-commands-in-jenkins-pipeline.groovy
/* using the Jenkins pipeline DSL? We are using */
sshagent([configuration.bitbucketSshCredentialsId]) {
sh "git add ."
sh "git commit -m '$commitComment'
sh "git push $featureBranchName"
}
/* The credential entry is of type "SSH Username with private key" and the corresponding public key is registered for a technical user in Bitbucket. */
@62mkv
62mkv / example.sql
Created May 20, 2020
How to use XPath against XML text fields with PostgreSQL
View example.sql
/* real-world example */
select xpath('/ns2:PrintData/Meta/Document/@id', xmlparse (document payload),
ARRAY[ARRAY['ns2', 'http://iopm.int.kn/iopm4xml/meta/v1.4']]) from request_history_step_payload rhsp
join request_history_step rhs on rhs.step_uuid = rhsp.step_uuid
where rhs.step_type = 'PRINTER_REQUEST' and rhs.started_at between '2020-05-19' and now()
@62mkv
62mkv / README.md
Created May 5, 2020
How to catch those flaky tests
View README.md

Today I've run into situation where some of the tests started failing randomly. Sometimes, 3 times in a row they could be executed successfully, but then would fail.

In order to collect more statistics I created this test.bat:

for /L %%i in (1,1,10) do (
   gradlew clean test
   zip -r0q build%%i build/ 
)
@62mkv
62mkv / README.md
Created Apr 17, 2020
Gradle tests verbosity
View README.md

Executing gradle commands with -i seem to seriously enhance debugging experience, especially when tests are failing to initialize (as if when Testcontainers fail to connect to Docker daemon) and there're almost no logs in the JUnit XML reports

./gradlew -i clean test

Also see here: https://docs.gradle.org/current/userguide/java_testing.html

@62mkv
62mkv / README.md
Created Apr 17, 2020
Tricky Testcontainers execution case (Jenkins, Docker, and tests failing under Gradle)
View README.md

The excerpt from logs:

 14:56:01.405 [Test worker] INFO  org.testcontainers.dockerclient.DockerClientProviderStrategy - Loaded org.testcontainers.dockerclient.EnvironmentAndSystemPropertyClientProviderStrategy from ~/.testcontainers.properties, will try it first
    14:56:01.942 [ducttape-0] DEBUG org.testcontainers.dockerclient.DockerClientProviderStrategy - Pinging docker daemon...
    14:56:01.987 [ducttape-0] DEBUG com.github.dockerjava.core.command.AbstrDockerCmd - Cmd: 
    14:56:02.699 [ducttape-0] DEBUG org.testcontainers.dockerclient.DockerClientProviderStrategy - Pinging docker daemon...
    14:56:02.699 [ducttape-0] DEBUG com.github.dockerjava.core.command.AbstrDockerCmd - Cmd: 
    14:56:03.200 [ducttape-0] DEBUG org.testcontainers.dockerclient.DockerClientProviderStrategy - Pinging docker daemon...
    14:56:03.209 [ducttape-0] DEBUG com.github.dockerjava.core.command.AbstrDockerCmd - Cmd: 
    14:56:03.712 [ducttape-0] DEBUG org.testcontainers.dockerclient.DockerClientProviderStrategy - Pin
@62mkv
62mkv / README.md
Created Apr 15, 2020
How to validate an XML document with XMLSpy
View README.md

Ensure that root element of the XML file will contain something like this:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:PrintData xmlns:ns2="http://iopm.int.kn/iopm4xml/meta/v1.4" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://iopm.int.kn/iopm4xml/meta/v1.4 path/to/xsd/file/schema.xsd">

and then click F8

You can’t perform that action at this time.