Skip to content

Instantly share code, notes, and snippets.

View isc-rsingh's full-sized avatar

Raj Singh isc-rsingh

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@isc-rsingh
isc-rsingh / acs_income_metadata.tsv
Last active October 4, 2018 18:55
metadata example for ACS income
What 2017 American Community Survey 1-Year Estimates INCOME IN THE PAST 12 MONTHS (IN 2017 INFLATION-ADJUSTED DOLLARS)
When 2017
Where US
Who US Census Bureau
How Survey https://www.census.gov/programs-surveys/acs/about.html
Which I don’t know. Probably custom software built by the Census.
Why Public officials, planners, and entrepreneurs use this information to assess the past and plan the future. When you respond to the ACS, you are doing your part to help your community plan for hospitals and schools, support school lunch programs, improve emergency services, build bridges, and inform businesses looking to add jobs and expand to new markets, and more.
@isc-rsingh
isc-rsingh / csv2objectscript.cls
Last active November 19, 2019 15:56
The simplest snippet to read from file in InterSystems Caché
set file = ##class(%File).%New( "data.csv" )
set sc = file.Open( "R" )
if $$$ISERR(sc) quit ; or do smth
while 'file.AtEnd {
set str=file.ReadLine()
for i=1:1:$length( str, ";" ) {
set id=$piece( str, ";" ,i )
write !, id // or do smth
}
ROUTINE RightTriangle
/* compute area and hypotenuse of a right triangle
this routine contains examples of
new ObjectScript features */
Write !, "Compute the area and hypotenuse of a right triangle",
!, "given the lengths of its two sides."
Set units = "feet"
Set side1 = 3
Set side2 = 6
Do Compute( units, side1, side2)
@isc-rsingh
isc-rsingh / ConcatArrays.cls
Created May 4, 2020 14:00
Concatenate JSON arrays in ObjectScript
/// ObjectScript does not include any built-in method for appending one JSON dynamic array to another.
/// This is equivalent to the JavaScript concat() method.
/// Call it with any number of arguments to concatenate them into a new array.
/// If an argument is a dynamic array, its elements will be added. Otherwise the argument itself will be added.
/// Thanks to Pravin Barton in this article https://community.intersystems.com/post/code-sample-concatenate-json-arrays
ClassMethod ConcatArrays(pArgs...) As %DynamicArray
{
set outArray = ##class(%DynamicArray).%New() // or []
for i=1:1:pArgs {
set arg = pArgs(i)
@isc-rsingh
isc-rsingh / pyodbc_iris_install.md
Created October 4, 2020 03:04
Get ODBC, PyODBC up and running for InterSystems IRIS

PyODBC installation instructions

Install ODBC

  • Windows: no installation necessary
  • Mac
    1. Run brew update
    2. Run brew install unixodbc
  • Linux
  1. Run apt-get update
@isc-rsingh
isc-rsingh / irisflask.py
Created October 7, 2020 14:10
Python Flask middleware app with InterSystems IRIS as the back end database
import pyodbc
from flask import Flask
from flask import request
from flask import render_template
import json
app = Flask(__name__)
connection = None
# default route
@app.route('/')