Letzte Aktualisierungen Kommentarverlauf ein-/ausschalten | Tastaturkürzel

  • Andreas 11:30 am 11. May 2021 permalink  

    Shell timer 

    The Mac version for Sebastian Daschner’s simple bash timer (github.com/sdaschner/dotfiles/blob/master/bin/timer)

    #!/bin/bash
    if [[ "$1" == "" ]];

    then echo "Usage: ${0##*/} [message]"
    exit 1
    fi

    mins=$1
    message=$2
    echo "timer started for $mins min"

    (sleep $(echo "$1 * 60" | bc) && osascript -e "display alert \"Timebox over for: $message!\"" > /dev/null) &

     
  • Andreas 17:45 am 11. April 2020 permalink  

    html: base href 

    If you use
     
    To set the base path, always mind to add the TRAILING slash, to indicate it’s a folder. 

     
  • Andreas 10:14 am 23. January 2020 permalink  

    JPQL with left outer join 

    To remind my self!
    Main.class
    @OneToOne @JoinColumn(name = "pk_column_name_in_main_table", referencedColumnName = "column_name_in_depeding_table", insertable = false, updatable = false) public Description getDescription() { return this.description; }

    Depending.class
    @Id
    @Column(name = " column_name_in_depeding_table", nullable = true)
    public int getDescriptionId() { return descriptionId; }
    @Column(name ="language) Public String getLanguage(){return language;}

    Now if I want something like

    Select * from main m join depending d on m.pk_column_in_main_table = d.column_name_in_depending_table where d.column_name_in_depending_table is null

    You have to put the where-criteria directly into the „left join“ condition of the jqpl query. If you do it like in SQL and put it in the where-clause, JPA (or at least Eclipselink, haven’t tried Hibernate) creates and „old-style“ (ANSI-89) style query, where the join condition is put in the where-clause and you won’t get any results!

    @NamedQueries({ @NamedQuery(name = Main.FIND_BY_ID, query = "SELECT c FROM Main c left join c.description des on des.language = :language where c.id = :id")}

     
  • Andreas 08:20 am 17. December 2019 permalink  

    Which visualization should I use? 

    A nice overview of different chart types and when to use them. Scroll down a bit to „Visualization Category“

    antv.vision/en

     
  • Andreas 17:11 am 20. August 2019 permalink  

    Install Influx 1.7. on Raspian Stretch 

    As I have the latest zwave version 3.0 running, which only is supported by Raspian Strecth, the default InfluxDB that gets installed is version 1.0.2 and not the latest (1.7.x as of 8/2019). In order to get the correct version on your Raspberry, do the following
    1. Add „deb repos.influxdata.com/debian stretch stable“ to „/etc/apt/sources.list.d/influxdb.list“ 2. sudo apt-get update 3. sudo apt-get install influxdb 4. systemctl unmask influxdb.service 5. Enable Influx on boot: sudo systemctl enable influxdb 6. sudo systemctl start influxdb 

     
  • Andreas 19:24 am 21. May 2019 permalink  

    Set up a embedded Payara 5 for Arquillian tests with DB2 z/OS drivers 

    Despite a lot of tutorials on using embedded Payara with Arquillian, I struggled a while to get the container running. Here are the steps


    Code for configuring and deploying the embedded container

    @Deployment public static Archive createDeployment() throws IOException {
    File[] files = Maven.configureResolver().withMavenCentralRepo(false).loadPomFromFile("pom.xml").resolve("com.ibm:db2jcc4:version1234", "com.ibm:db2jcc_license_cisuz:version1234").withTransitivity().asFile();
    final WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war").addPackages(true, "my.org.backend").addPackages(true, "my.org.exceptions").addAsResource("persistence.xml", "META-INF/persistence.xml").addAsLibraries(files); // add all xml required for the queries
    Files.walk(Paths.get("src/main/resources/META-INF")).forEach(file - >{
    if (file.toFile().isFile() && !file.getFileName().toString().equalsIgnoreCase("MANIFEST.MF") && !file.getFileName().toString().equalsIgnoreCase("persistence.xml")) {
    final String fileName = file.toAbsolutePath().toString();
    final int start = fileName.indexOf("META-INF");
    final String resource = fileName.substring(start - 1);
    war.addAsResource(file.toFile(), resource);
    }
    });
    return war;
    }


    Mind to put the arquillian.xml under „src/test/resources“

    Maven dependencies:
    org.jboss.arquillian.junit arquillian-junit-container 1.4.1.Final test
    org.jboss.shrinkwrap.resolver shrinkwrap-resolver-impl-maven 2.2.6 test
    junit junit 4.12 test
    fish.payara.arquillian arquillian-payara-server-4-embedded 1.0.Beta3 test
    fish.payara.extraspayara-embedded-all5.181test

     
  • Andreas 22:15 am 1. March 2019 permalink  

    Google Chrome: CORS and Kiosk Mode 

    In order to avoid any problems with CORS when just running a local app
    open -a Google Chrome –args –disable-web-security –user-data-dir=„“
    If you want to have a nice full-screen Kiosk mode, install the **drums** „Kiosk“ app from the Chrome store. 

     
  • Andreas 22:49 am 26. February 2019 permalink  

    Building a CalDAV client with web components 

    Some steps and pitfalls on my way creating a CalDAV client with webcomponents
    1. If you want to use moment.js include it this way
    import moment from ‚moment‘; window.moment = moment; 
    2. The template for the „REPORT“ request should look like this, e.g. to get the events for a time range. Mind, there MUST NOT BE any whitespace between the backtick and the start of the xml declaration.
    const query = (start,end) => `                                             `;
    3. I had to start Chrome like this to get rid of CORS issues
    open -a Google Chrome –args –disable-web-security –user-data-dir=„“
    4. The fetch request should look like this
      let start = moment().subtract(5,’days‘);         let end = moment();         let startString =  start.format(„YYYYMMDD[T]000000[Z]“);         let endString = end.format(„YYYYMMDD[T]000000[Z]“);         let myHeaders = new Headers();         myHeaders.append(„DEPTH“,“1″);         myHeaders.append(„Authorization“,“Basic “ + authentication);
            console.log(‚caldaving‘, startString,endString)
            fetch(url,{             method: „REPORT“,             headers : myHeaders,             body : query(startString,endString)         })         .then(response => {             console.log(„reso“, response)             let xml = response.text();             console.log(‚Got appointments‘, xml);             return xml;         }).then(xml => console.log(‚xml‘,xml))
    5. To get the authentication as base64 use „ echo -n user:password | base64“ Mind the „-n“ otherwise you get a line break at the end!

     
  • Andreas 11:01 am 24. September 2018 permalink  

    Move cursor after last element with Javascript 

    _moveCursor(){ let range = document.createRange(); let lastSpan = this._getLastSpan(); range.setStartAfter(lastSpan); range.collapse(true); let selection = window.getSelection(); selection.removeAllRanges(); selection.addRange(range); }

    Props to: stackoverflow.com/a/15814297/4415951

     
  • Andreas 10:59 am 12. July 2018 permalink  

    Jenksfile: Pushing to git from pipeline script 

    • Add a read/write ssh-key to e.g. bitbucket
    • Add the key to Jenkins
    • Go to „pipeline syntax“ and create „sshagent“ step with just create credential identifier

    sshagent([‚the-credentials-id‘]) {
    // your code
    }

     
c
Neuen Beitrag erstellen
j
nächster Beitrag/nächster Kommentar
k
vorheriger Beitrag/vorheriger Kommentar
r
Antwort
e
Bearbeiten
o
zeige/verstecke Kommentare
t
Zum Anfang gehen
l
zum Login
h
Zeige/Verberge Hilfe
Shift + Esc
Abbrechen