adhocshare Blog
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...
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 *...
VirtualBox tips
Increase size of VDI file (Windows) Go to Virtualbox folder > cd “C:\Program Files\Oracle\VirtualBox” Run resize command (unit size is MB) Below command will make the disk size grow up to 16GB > VBoxManage modifyhd “C:\Users\robin\C:\Users\v737050\VirtualBox VMs\Centos 6\Centos 6.vdi” –resize...
Lightweight web application with Python Flask connecting to database using ODBC
Simple web app in Python using flask. This app connects to a database and compares the cost of calls, using new connection object each time, vs reusing same connection object HTH from flask import Flask import pyodbc...
Extract query time from hiveserver2 Interactive log
Got in a situation where you were asked to extract hive queries and the time they took to execute? Steps On log files run below 2 extracts awk ‘match($0, “^([^ ]+).*Completed executing command\\(queryId=([0-9a-z_-]+)\\); Time taken: (.*)”, a) {print “COMPLETE\t” a[1]...
HDFS data sizing
Below is data storage estimator based on message size and throughput. Input HDFS replication and the amount of data end users will generate over time using raw data. Hope this helps you. Data calculator Message size in bytes Message per...
Create many files with random content
Source: https://unix.stackexchange.com/questions/199863/create-many-files-with-random-content For example, Name size file1.01 2K file2.02 3K file3.03 5K etc. Strategy – 1 #! /bin/bash for n in {1..1000}; do dd if=/dev/urandom of=file$( printf %03d “$n” ).bin bs=1 count=$(( RANDOM + 1024 )) done ...
snakebite – Python HDFS client
Source: https://snakebite.readthedocs.io/en/latest/client.html Example: >>> from snakebite.client import Client >>> client = Client(“localhost”, 8020, use_trash=False) >>> for x in client.ls([‘/’]): … print x Warning Many methods return generators, which mean they need to be consumed to execute! Documentation will explicitly...
Setup multiple access points and ranger extenders with same SSID
Impatient? Each AP can have same SSID They should be on different non-overlapping channels Configuration tips Set radio power Set radio power to as low or medium Use RSSI in advanced settings to facilitate clients roaming to the “best” AP....