Posts

SqlServer | Oracle equivalent DBA tables

I'm a hard-core ORACLE programmer and lately I had to work with SQL server for a specific project. First thing I noticed is that its a bit hard to search for column names, table_names (*across all databases*) etc in sql server. In oracle, we have the DBA views like DBA_tables, DBA_tab_columns etc, which are very handy for these purposes. In SQL sever we have a stored proc called "sp_msforeachdb" to somewhat do this task. But it opens up so many result windows and also creates one window for each DB, even if the DB doesnt have any results. So I ended up making few stored proc which will work somewhat similar to the oracle's DBA views. Use the below script to create the working tables. create table my_dba_tables( db sysname, table_name sysname, object_id int); create table my_dba_tab_columns( db sysname, table_name sysname, object_id int, table_column sysname); create table my_dba_objects( db sysname, object_name sysname, object_id int); Download the stored...

Parse | Adhoc JavaScript Request to execute Cloud Code

I'm doing an IOS app which uses Parse's(www.parse.com) Cloud code. Being a IOS developer I found it a bit tedious to test the output of my Cloud Code(CC) using objective C (especially when I'm changing and developing the cloud code) I thought it would be easy if I can check the output of my CC using a JavaScript directly from the browser, because you can see the output of you CC immediately and also get a better understanding of what values are being returned. so I made a quick template which uses Parse JS API to   Login to Parse( In my app you can call a CC only if you login as a App user) Call could code and display its result. Download the template from this link - Venkat-GitHub-Page-Parse Remember to edit the index.html file and put your <app_ID> and <java-script-key> at Parse.initialize Edit the login details Edit the Cloud code function details and parameters( if any)

Tableau custom shapes or Polygons

Image
This example is to show that you can draw your own shapes in tableau ( not just on maps) and use that for operational purposes. Lately I have been working on hadoop and big-data and want to monitor which servers are up and running, so that it is easy for operational monitoring purposes. In the below example I have combined the shapes and the server status( "Running") on the same file, but if you cant/dont want to do that you can use the data blending technique to combine 2 different data source You can download the source from the below "Tableau Public" link Learn About Tableau

Tableau : Convert ESRI shapes into Tableau Format

Image
Click here for other Tableau related Blogs Requirement is to convert data in ESRI Map shapes into Tableau format. Tools Required Quantum GIS -  http://www.qgis.org/en/site/ Python  Download the below Python Code -  https://github.com/venkat-vs-id/python import csv import re import sys #def convertESRI2TableauFormat( p_inputfile, p_outputfile): l_outfileName = 'c:/ESRI_suburb_tab_format.csv' # make changes here.. l_ESRIFileName ='c:/ESRI_suburb.csv' # make changes here.. rdx=0 csv.field_size_limit(sys.maxsize) outfile = open( l_outfileName, 'w', newline='') csvWriter = csv.writer( outfile, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL) with open( l_ESRIFileName, 'r') as csvfile: csvR = csv.reader( csvfile, delimiter=',', quotechar='"') for row in csvR: rdx += 1 ci=0 rowValues = [] rowValues.append(row[1]);# ssc_code rowValues.append(...

Tableau - Accessing Tableau's DB

Image
Click here for other Tableau related Blogs Please note that TABLEAU does not advice anyone to access their DB. So if you are doing it you are on your own. Tableau has 2 DB Postgresql for managing all its reporting repositories FireBird for mapping repositories Tools Required pgAdmin 3 for PostgreSql Flamerobin for FireDB Accessing Tableau's PostgreSQL DB Tableau has 2 buitin userid tableau = with read-only access to some of Tableau's view tblwgadmin = admin user will all privileges Please note tblwgadmin is like a admin user, so if you are using this you have to be very careful. Or if you dont admin privs but just need enough access to read the tables then use just "tableau" user. Get access for "tableau" user.  First set a password for "tableau" userid open command prompt go to <Tableau_Home>\Tableau Server\7.0\bin run -  tabadmin dbpass <give a password> Restart the server Now open pgAdmin3 and from...

Tableau: Convert Oracle Spatial Data into Tableau Format

Click here for other Tableau related Blogs I had requirement to shapes we had in Oracle Spatial data( which we used for MapInfo) in Tableau. Since tableau doesnt support Oracle spatial type columns, I had to extract that data in Tableau readable format. Here are the steps to convert oracle spatial data into format useable by Tableau. Run the Oracle package ven_OraSpatial_2_TabData in your oracle environment. Now run the below "ConvertDataFormat" code to extract the data into Tableau format Now use extracted data in tableau ( refer to my blog -  Tableau Maps - Custom shapes / polygon - Basics ) You can also download the code from this link -   VEN_ORASPATIAL_2_TABDATA.zip Oracle package ven_OraSpatial_2_TabData SPEC CREATE OR REPLACE PACKAGE VSUBR.ven_OraSpatial_2_TabData as ----- TYPE TYPE rec_LatLong IS RECORD( Polygon_ID NUMBER, LAT NUMBER, LON NUMBER ); TYPE tab...

Bayes Theorem | Disease problem Solved

Recently I came across a puzzle which can be solved by using Bayes probability theorem.  Thought I will share that. Puzzle: If a person has malaria, there is a 90% chance that his/her test results are positive. However the test result are not very correct, There is a chance for 1% error. Also only 1% of the total population get affected by Malaria. Now one person's test result came out as Positive. Whats the odds that he will actually have Malaria. Bayes theorem: Before getting into the solution - here is the simple explanation of Bayes theorem. Bayes theorem gives you the actual probability of an event from the measured test probabilities and the skewness . In other words - If you know the real probabilities and the chance of skewness ( i.e. false positive and false negative), you can make correction for measurement errors. Solution: Applying Bayes formula                             ...