Tuesday, June 6, 2017

C program that prints itself.

#include <stdio.h>
#include <conio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
    FILE *fp;
    if ((fp = fopen(__FILE__, "r")) == NULL)
    {
        printf("Error! opening file %s\n", __FILE__);
        exit(1);
    }
    while(!feof(fp))
    {
        printf("%c", fgetc(fp));
    }
    fclose(fp);

    getch();   
    return 0;
}

Sunday, June 4, 2017

Mitrh & Intersystems CacheDB Connecivity Setup

1. Copy CacheDB.jar into C:\Program Files\Mirth Connect\server-lib\database in your Mirth v3.5 installation directory.
2. Update the dbdrivers.xml file ($MIRTH_HOME/conf/dbdrivers.xml) by appending a line defining the driver class (Driver Class = com.intersys.jdbc.CacheDriver) and JDBC URL( jdbc:Cache://<host>:<port>/<namespace>)

<drivers>
    <driver class="sun.jdbc.odbc.JdbcOdbcDriver" name="Sun JDBC-ODBC Bridge" template="jdbc:odbc:DSN" selectLimit="" />
    <driver class="com.mysql.jdbc.Driver" name="MySQL" template="jdbc:mysql://host:port/dbname" selectLimit="SELECT * FROM ? LIMIT 1" />
    <driver class="oracle.jdbc.driver.OracleDriver" name="Oracle" template="jdbc:oracle:thin:@host:port:dbname" selectLimit="SELECT * FROM ? WHERE ROWNUM &lt; 2" />
    <driver class="org.postgresql.Driver" name="PostgreSQL" template="jdbc:postgresql://host:port/dbname" selectLimit="SELECT * FROM ? LIMIT 1" />
    <driver class="net.sourceforge.jtds.jdbc.Driver" name="SQL Server/Sybase" template="jdbc:jtds:sqlserver://host:port/dbname" selectLimit="SELECT TOP 1 * FROM ?" />
    <driver class="org.sqlite.JDBC" name="SQLite" template="jdbc:sqlite:dbfile.db" selectLimit="SELECT * FROM ? LIMIT 1" />
    <driver class="com.intersys.jdbc.CacheDriver" name="CacheDB" template="jdbc:Cache://host:port/namespace" selectLimit="SELECT * FROM ? LIMIT 1" />
</drivers>

3. Restart mirth connecct.

Note: CacheDB.jar can be downloaded at following sites
    http://www.dbschema.com/cache-jdbc-driver.html
    https://www.oxygenxml.com/database_drivers.html

Wednesday, May 31, 2017

What are the differences between a v2.x and v3 message in HL7?

The key differences between a v2.x and v3 message are as follows:

v2.x was primarily meant for clinical communications - medical orders, patient registration etc. whereas v3.x has additional features for use by informaticists and for government reporting requirements.
v2.x was a custom format (barebones text - all coded and separated by a pipe with headers and multiple segments etc.) whereas an HL7 v3.0 message is an XML format - very verbose and detailed.

What is the difference between 'global' and 'static global' in C?

All static variables, no matter where they are allocated, as well as all global variables, are subjected to "static initialization". They must be initialized by the program before it starts. If you haven't initialized them explicitly, they are implicitly initialized to zero (or NULL for pointers).

Tuesday, May 30, 2017

How do you delete temporary files and folders?

@ECHO OFF
COLOR 0A
DEL /A /F /Q /S "%temp%\*.*"
FOR /D %%p IN ("%temp%\*.*") DO RD "%%p" /S /Q
DEL /A /F /Q /S "C:\Windows\Temp\*.*"
FOR /D %%p IN ("C:\Windows\Temp\*.*") DO RD "%%p" /S /Q
DEL /A /F /Q /S "C:\Windows\Prefetch\*.*"
FOR /D %%p IN ("C:\Windows\Prefetch\*.*") DO RD "%%p" /S /Q
FOR /D %%p IN ("C:\Windows\SoftwareDistribution\Download\*.*") DO RD "%%p" /S /Q