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

Tuesday, November 15, 2016

How do you get milliseconds for timestamp in Perl?

use Time::Moment;

print "\n[ @{[Time::Moment->now->strftime('%Y-%m-%d %H:%M:%S.%6N')]} ]";
print "@{[Time::Moment->now->strftime('%Y%m%d%H%M%S%6N')]}\n";

#or

my $time = Time::Moment->new;
print $time->now->strftime('%Y%m%d%H%M%S%6N');

Monday, June 27, 2016

How do you create a jar file on Windows CLI?

1. Start Command Prompt.
2. Navigate to the folder that holds your class files:
   C:\>cd \mywork

3. Set path to include JDK’s bin.  For example:
   C:\mywork> path c:\Program Files\Java\jdk1.7.0_25\bin;%path%

4. Compile your class(es):
   C:\mywork> javac *.java

5. Create a manifest file and your jar file:
   C:\mywork> echo Main-Class: Craps >manifest.txt
   C:\mywork> jar cvfm Craps.jar manifest.txt *.class
  
   or
  
   C:\mywork> jar cvfe Craps.jar Craps *.class

6. Test your jar:
   C:\mywork> Craps.jar

   or

   C:\mywork> java -jar Craps.jar

Wednesday, June 8, 2016

How do you find out files with size more than 1GB in command prompt?

:: 1 GB = 1073741824 KB

forfiles /P E:\Movies\Hollywood\ /M *.* /S /C "cmd /c if @fsize gtr 1073741824 echo @path @fsize @fdate @ftime"

Wednesday, May 4, 2016

How do you pad a string?

use warnings;
use strict;
use 5.010;

my $FName = 'Rabindra';
my $LName = 'Nayak';

my $strlen = length $FName;

if ($strlen < 10) {
    $FName = $FName . ( ' ' x (10 - $strlen) );
}
print "$FName$LName\n";

#or

my $Name = sprintf "%-*s%s", $strlen, $FName, $LName;
print "$Name";

What are the additional delimiters & file extensions acceptable in delimited text file?

Comma (,) - .csv
Tabs (\t) - .tsv
Semi-colons (;)
Pipes (|) - .psv
Carets (^)
Tildes (~)

Monday, November 2, 2015

How do you run Salesforce queries in Perl?

use WWW::Salesforce;

my $username = '<UserName>';
my $password = '<Password>';
my $security    = '<Token>';
my $stoken      = "$password$security";

# Authenticate with the Salesforce API
my $sforce = eval { WWW::Salesforce->login (
                    username => $username,
                    password => $stoken );
                  };
die "Could not login to Salesforce: $@" if $@;

my $query = "SELECT Id, Name, Email, AccountId FROM Contact";
my $res = $sforce->do_query( $query );

open(FH, '>:encoding(UTF-8)', "SF_Report.csv")
  or die "Could not open file: \"SF_Report.csv\"";

foreach my $field (@$res) {
    print FH "$field->{'Name'},$field->{'Email'},$field->{'AccountId'}\n";
}