Skip to content

Instantly share code, notes, and snippets.

@h3llborn
h3llborn / liquibase-core-data.xml
Created June 19, 2013 14:30
changeset movearound for h2 db
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<changeSet author="ben" id="disable-foreign-key-checks" runAlways="true" dbms="mysql">
<sql>SET FOREIGN_KEY_CHECKS=0</sql>
<changeSet author="ben (generated)" id="1227303685425-51">
<createTable tableName="person">
<column autoIncrement="true" name="person_id" type="int">
<constraints nullable="false" primaryKey="true"/>
</column>
<column defaultValue="" name="gender" type="varchar(50)"/>
<column name="birthdate" type="DATE"/>
<column defaultValueBoolean="false" name="birthdate_estimated" type="BOOLEAN">
<constraints nullable="false"/>
</column>
@h3llborn
h3llborn / liquibase-core-data.xml
Created June 20, 2013 17:06
changeset causing issues
<changeSet author="sunbiz" id="20110914-0228">
<comment>Switched the default xslt to use PV1-19 instead of PV1-1</comment>
<!-- using the <sql> tag instead of the <update> tag here so that xml syntax highlighting doesn't bog down editors -->
<sql splitStatements="false">
<![CDATA[
UPDATE form
SET xslt = '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n\r\n<!--\r\nOpenMRS FormEntry Form HL7 Translation\r\n\r\nThis XSLT is used to translate OpenMRS forms from XML into HL7 2.5 format\r\n\r\n@author Burke Mamlin, MD\r\n@author Ben Wolfe\r\n@version 1.9.7\r\n\r\n1.9.7 - moved encounter/encounter.encounter_id to use PV1-19 instead\r\n1.9.6 - added encounter/encounter.encounter_id to PV1-1\r\n1.9.5 - allow for organizing sections under \"obs\" section\r\n1.9.4 - add support for message uid (as HL7 control id) and transform of patient.health_center to Discharge to Location (PV1-37)\r\n1.9.3 - fixed rounding error on timestamp (tenths of seconds
<!--Commented out, insertion kept failing with H2 DB. Seems to work fine without changeset
still needs to be investigated.
author:h3llborn
-->
<!--<changeSet author="sunbiz" id="20110914-0228">
<comment>Switched the default xslt to use PV1-19 instead of PV1-1</comment>
&lt;!&ndash; using the <sql> tag instead of the <update> tag here so that xml syntax highlighting doesn't bog down editors &ndash;&gt;
<sql splitStatements="false">
<![CDATA[
UPDATE form
/**
* Filled out by user on the databasesetup.vm page Looks like; Added globalProperties
* modification ability so it can be changed via commandline for SDK
*/
public String databaseConnection = System
.getProperty(
"database.connection",
"jdbc:mysql://localhost:3306/@DBNAME@?autoReconnect=true&sessionVariables=storage_engine=InnoDB&useUnicode=true&characterEncoding=UTF-8");
@h3llborn
h3llborn / h2.properties
Created June 25, 2013 18:54
h2 database install file for openmrs
connection.url=jdbc:h2:@APPLICATIONDATADIR@/@DBNAME@;AUTO_RECONNECT=TRUE;DB_CLOSE_DELAY=-1
database_driver=org.h2.Driver
current_db_user=sa
current_db_pass=sa
@h3llborn
h3llborn / modification.java
Last active December 21, 2015 14:59
got xml modification working minor bug, keeps adding "xmlns" as attribute to newly added module. To run use java modification.jar -a <path to module>; Requires openmrs-project/pom.xml
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.dom4j.Document;
import org.dom4j.DocumentException;
@h3llborn
h3llborn / lastarg.sh
Last active August 29, 2015 14:07
assignment #2-q1
#!/bin/sh
# Author: Chris Niesel
# Class: Computer Science 2211A
# output the last argument passed to the script
# check if there are more than 0 argument
while [ $# -gt 0 ];do
# if current argument is the last one output it
if [ "$#" -eq 1 ]; then
@h3llborn
h3llborn / odd_prn.sh
Last active August 29, 2015 14:07
assignment #2-q2
#!/bin/sh
# Author: Chris Niesel
# Class: Computer Science 2211A
echo "Number of arguments passed: $#"
X=0 # var used for while loop that increments every run
while [ $# -gt 0 ];do # check if we have more arguments
# check if $X number is even if so, print it
if [ `expr $X % 2` -eq 0 ]; then
@h3llborn
h3llborn / q4 output
Last active August 29, 2015 14:07
question 4 output
obelix[279]% sh nums.sh ; echo $?
Usage: nums option input-file
1
obelix[280]% sh nums.sh 0; echo $?
Usage: nums option input-file
1
obelix[281]% sh nums.sh 5; echo $?
Usage: nums option input-file
1
obelix[282]% sh nums.sh 0 numbersfile; echo $?