Category: Programming

0

Extracting table and column names from SQL query

(Not original article) sql-metadata is a Python library that uses a tokenized query returned by python-sqlparse and generates query metadata. This metadata can return column and table names from your supplied SQL query. Here are a couple of example from the sql-metadata github readme:...

0

Case insensitive string comparison in C++

(Not an original article) The standard library component std::basic_string<> (better known as std::string, which is a convenient typedef for std::basic_string<char>), is an important and widely used element of the standard C++ library. The declaration of basic_string<> in the standard library...

0

Connecting to msaccess database from Python

Connect to msaccess file from Python and tweak it to emit desired format. import pyodbc conn = pyodbc.connect(r’Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=path where you stored the Access file\file name.accdb;’) cursor = conn.cursor() cursor.execute(‘select * from table name’) for row in...

0

Process JSON data in SQL Server 2012

Source: http://mtkcode.blogspot.com/2014/08/parse-json-string-by-sql-script.html SQL Server 2016 and above support JSON_VALUE function to parse JSONs. To process JSONs in older versions add this function to database – https://github.com/khanhmai/Parse-JSON-String-by-SQL-script/blob/master/ParseJSON-FUNCTION.sql Then we can write queries such as below, — Query sample 1 select *...

0

Java unsupported major minor version 52.0

If you are reading this then perhaps you are having java version mismatch. Several apps based on implementations may present you with errors such as class not found error (yes! That’s what R did to me) or class version error –...

0

python web scraping (stockfetcher.com pull)

Python code below, It fetches all contents from 5 urls, general discussion, filter exchange, public filters, stock picks and indicators. Destination dir: /tmp File type: csv   #!/usr/bin/env python from lxml import html import requests import csv import sys import...

0

Maintaining database of price file using R

Source: http://www.thertrader.com/2015/12/13/maintaining-a-database-of-price-files-in-r/ Steps Prepare a list of securities (onetime) Setup initial data file (onetime) Update data files (periodic)   1. Prepare a list of securities One time setup. If changed on demand then will have to call initial data setup. File: /Users/rdebnath/robin/ticker_data/r-input/listOfInstruments.R...