Skip to content

Instantly share code, notes, and snippets.

@nikosvaggalis
nikosvaggalis / patient_event_A01.pl
Last active November 19, 2018 19:57
Connecting the database to the outside world with Perl and Database Events
##Author:Nikos Vaggalis
##Licensed under Artistic License 1.0
##Accompanying code of the "Connecting the database to the outside world with Perl and Database Events"
##article on i-programmer.info
##https://www.i-programmer.info/programming/perl/12299-connecting-the-database-to-the-outside-world-with-perl-and-database-events.html
use DBI;
use Encode qw(:all);
use Net::HL7::Message;
use Net::HL7::Segment;
@nikosvaggalis
nikosvaggalis / patient_event_gateway.pl
Last active November 19, 2018 19:58
Connecting the database to the outside world with Perl and Database Events
##Author:Nikos Vaggalis
##Licensed under Artistic License 1.0
##Accompanying code of the "Connecting the database to the outside world with Perl and Database Events"
##article on i-programmer.info
##https://www.i-programmer.info/programming/perl/12299-connecting-the-database-to-the-outside-world-with-perl-and-database-events.html
use strict;
use DBI;
my $dbh = DBI->connect ('DBI:IngresII:syntag::psnodb') || die "$DBI::errstr";
@nikosvaggalis
nikosvaggalis / insert_data.sql
Last active November 19, 2018 19:58
Connecting the database to the outside world with Perl and Database Events
/*
Author:Nikos Vaggalis
Licensed under Artistic License 1.0
Accompanying code of the "Connecting the database to the outside world with Perl and Database Events"
article on i-programmer.info
https://www.i-programmer.info/programming/perl/12299-connecting-the-database-to-the-outside-world-with-perl-and-database-events.html
*/
insert into PatientAssignor
(universal_id,namespace_id,universal_id_type)
@nikosvaggalis
nikosvaggalis / create_rule_sp_dbevn.sql
Last active November 19, 2018 19:59
Connecting the database to the outside world with Perl and Database Events
/*
Author:Nikos Vaggalis
Licensed under Artistic License 1.0
Accompanying code of the "Connecting the database to the outside world with Perl and Database Events"
article on i-programmer.info
https://www.i-programmer.info/programming/perl/12299-connecting-the-database-to-the-outside-world-with-perl-and-database-events.html
*/
create dbevent evn_insert_patientvisit;
grant register on dbevent evn_insert_patientvisit to user;
@nikosvaggalis
nikosvaggalis / create_tables.sql
Last active November 19, 2018 19:57
Connecting the database to the outside world with Perl and Database Events
/*
##Author:Nikos Vaggalis
##Licensed under Artistic License 1.0
##Accompanying code of the "Connecting the database to the outside world with Perl and Database Events"
##article on i-programmer.info
https://www.i-programmer.info/programming/perl/12299-connecting-the-database-to-the-outside-world-with-perl-and-database-events.html
*/
create table patientassignor(
universal_id varchar(20) not null not default,
@nikosvaggalis
nikosvaggalis / utoalex.pl
Last active September 2, 2018 14:25
unicode to ascii one line Perl lexer
use utf8;
# “ Unicode Character 'LEFT DOUBLE QUOTATION MARK' (U+201C) decimal 8220
# ” Unicode Character 'RIGHT DOUBLE QUOTATION MARK' (U+201D) decimal 8221
my $string="aaa“bbb”ccc";
%dispatch=(8220=>'X',8221=>'Y');
my $string1=$string=~ s/(.)(?{ if (ord $1 >127 ){$dispatch{ord($1)}} else {$1} })/$^R/gr;
@nikosvaggalis
nikosvaggalis / session_table_with_rule.sql
Last active June 20, 2018 11:14
Actian X/Ingres - Working around the limitations of the GLOBAL TEMPORARY/SESSION TABLES
/* An attempt to work around the
"Limitations of Database Procedures when used with Global Temporary Tables"
https://communities.actian.com/s/article/Limitations-of-Database-Procedures-when-used-with-Global-Temporary-Tables
*/
/* Successfully tested on II 9.2.0 (int.lnx/118)NPTL */
/* On II 10.0.1 (a64.lnx/100)NPTL returns error
E_SC0206 An internal error prevents further processing of this query.
Associated error messages which provide more detailed information about
the problem can be found in the error log, II_CONFIG:errlog.log
@nikosvaggalis
nikosvaggalis / smadeseek1.js
Created November 23, 2017 11:59
Puppeteer - Scrape smadeseek.com 1 level deep
const puppeteer = require("puppeteer");
const url = "http://smadeseek.com/index.html";
const imgSelector = "#about > div > div.row > div img";
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto(url, { waitUntil: "load" });
@nikosvaggalis
nikosvaggalis / smadeseek2.js
Created November 23, 2017 11:57
Puppeteer - Scrape smadeseek.com 2 levels deep
const puppeteer = require("puppeteer");
const url = "http://smadeseek.com/smartphones";
const imgSelector = "#contentx > div > div img";
const tableSelector = "#masthead";
const tableSelector2 = "#masthead > div > div:nth-child(2) > div > div > div.col-md-6.col-sm-6 > table:nth-child(2)";
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
@nikosvaggalis
nikosvaggalis / gist:8ea47a2c6f418f4c6d88503ad61c6273
Created May 11, 2017 19:05
Perl "Advanced Perl Regular Expressions - The Pattern Code Expression" article on i-programmer.info
##Author:Nikos Vaggalis
##Licensed under Artistic License 1.0
##Accompanying code of the "Advanced Perl regular expressions - the pattern code express"
##article on i-programmer.info
##URL to full article: http://bit.ly/1QnpfmX
use Win32;
use Win32::API;
use Cwd;
use File::Spec::Functions;