This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| To minimize the differences: | |
| 1. On the JDBC connection string: 'MODE=MySQL', full example jdbc:h2:mem:test_one;DB_CLOSE_DELAY=-1;MODE=MySQL;DB_CLOSE_ON_EXIT=FALSE;IGNORECASE=TRUE; | |
| 2. Interactive SQL: SET MODE MySQL; | |
| H2 does not like multiple 'ADD COLUMN' commands for one ALTER TABLE. | |
| In mysql the following works | |
| ALTER TABLE SOME_TABLE | |
| ADD COLUMN USER VARCHAR(64) NOT NULL SET DEFAULT '', | |
| ADD COLUMN DESCRIPTION VARCHAR(1024) NOT NULL SET DEFAULT '' AFTER USER, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public XdmNode chainNodes(List<XdmNode> nodesToChain) throws SaxonApiException { | |
| XdmNode node; | |
| switch (nodesToChain.size()) { | |
| case 1: | |
| node = nodesToChain.get(0); | |
| break; | |
| case 2: | |
| node = append(nodesToChain.get(0), nodesToChain.get(1)); | |
| break; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.proquest.xslt; | |
| import java.io.StringReader; | |
| import java.util.Iterator; | |
| import javax.xml.transform.stream.StreamSource; | |
| import net.sf.saxon.s9api.DocumentBuilder; | |
| import net.sf.saxon.s9api.Processor; | |
| import net.sf.saxon.s9api.SaxonApiException; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // A very simple using restlet ( org.restlet.resource.ClientResource ) to get a JSON resource. | |
| ClientResource resource=new ClientResource(url); | |
| Representation representation=resource.get(MediaType.APPLICATION_JSON); | |
| ObjectMapper mapper=new ObjectMapper(); | |
| AnAnnotatedJsonObject npr = mapper.readValue(representation.getStream(), AnAnnotatedJsonObject.class); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Copied from: | |
| # https://github.blog/2020-01-17-bring-your-monorepo-down-to-size-with-sparse-checkout/ | |
| % git clone --no-checkout https://github.com/derrickstolee/sparse-checkout-example --depth 1 | |
| % cd sparse-checkout-example/ | |
| % git sparse-checkout init --cone | |
| # git sparse-checkout init to skip top level files. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Adds the option to go to eg. http://localhost:8080/actuator/health for seeing the running configuration | |
| #see https://docs.spring.io/spring-boot/docs/current/reference/html/actuator.html#actuator.endpoints | |
| management: | |
| endpoints: | |
| web: | |
| exposure: | |
| include: "health,prometheus" | |
| spring: | |
| main: | |
| allow-circular-references: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Random number from 1 to numberOfSides. | |
| function dx(numberOfSides) { | |
| return Math.floor(Math.random() * numberOfSides + 1); | |
| } | |
| let xDy = (n, f) => { let x = 0; while(n-- > 0) x += dx(f); return x}; | |
| // usage: numDiceSideDrop(4,6,1) | |
| // examples: | |
| // numDiceSideDrop(4,6,1) Roll four six sided dice and drop the lowest die: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Stack, StackProps } from 'aws-cdk-lib'; | |
| import { Construct } from 'constructs'; | |
| import {Role, ServicePrincipal, PolicyStatement, User, PolicyDocument, Policy} from 'aws-cdk-lib/aws-iam'; | |
| /** | |
| * Create an AWS IAM user with access (DescribeCluster, ListClusters, ListTagsForResource) | |
| * to named cluster. | |
| * Warning: minimal testing so far, 2023-03-13 | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from random import randint | |
| def main(debug=0): | |
| if debug == 1: | |
| results = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] | |
| for i in range(0, 5000): | |
| results[rolldice(2, 6)] += 1 | |
| for i in range(0, 26): |
OlderNewer