Posts

Oracle SQL JSON construct JSON Object

Your REST Client can consume JSON produced from a REST API. You can use Oracle SQL JSON functions to construct a JSON object and you can then use this to abstract out the source of the data. Your REST API client does not need to know that the data came from a set of tables. Here is an example of how to construct a JSON object. WITH t AS (     SELECT                                     JSON_OBJECT ( 'measureDetails' VALUE (                                         SELECT                                             JSON_ARRAYAGG(JSON_OBJECT('measureName' VALUE b.measure_name, 'classifications' VALUE JSON_ARRAYAGG(JSON_OBJECT('classification'         ...

Oracle SQL JSON nested loop

This is a very cool way to do a depth first traversal of JSON that I have test in the Oracle 19c version of the database So the cool part is col3 clob format json with wrapper path '$.col3[*]' that stores a JSON objects for col3 so that the outer loop does not care what the object contents are the inner loop then parses this JSON. This is a very compact and readable way of traversing all of your JSON begin for rec1 in ( select col1, col2, col3 from json_table( '{"col1": 1, "col2" : 2, col3 : {"col3foo1" :4, "col3foo2": 5}}' , '$[*]' columns col1 varchar2 ( 200 ) path '$.col1' , col2 varchar2 ( 200 ) path '$.col2' , col3 clob format json with wrapper path '$.col3[*]' ) ) loop dbms_output.put_line( 'col1=' ...

Dictionary for Algorithms and Data Structures

I bumped into this CS dictionary while I was looking up DoubleMetaphone for Fuzzy Search of Text. Dictionary of Algorithms and Data Structures 

Web Local Storage IndexedDB using Dexie.js

Image
If you go to cnn.com and open the Chrome Browser Developer Tools. You can see that cnn.is storing data locally in an IndexedDB Dexie.js is a wrapper over IndexedDB. It makes it easy to do CRUD. Note that all Dexie operations are asynchronous. Belows is a simple example of setting up a new "FriendsAndPetsDB" IndexedDB. The ++id is the primary key. You can also version your database and let Dexie upgrade it. var db = new Dexie("FriendsAndPetsDB"); db.version(1).stores({ friends: "++id,name,isCloseFriend", pets: "++id,name,kind" }); db.open(); db.friends.add({name: "Ingemar Bergman", isCloseFriend: 0}); db.pets.add({name: "Josephina", kind: "dog", fur: "too long right now"})

Collapsible Tree using D3 for large number of nodes

Image
A beautiful collapsible tree built using D3. Clicking on the a node will collapse a tree. This is a great way to navigate a tree with large number of nodes

JSON Web Token

JWT or JSON Web Tokens can be used for securely transferring data between two apps. You can use this to build a lightweight Single Signon functionality within your webapps. An Introduction to JSON Web Tokens in Plain English

Chart Nested Labeling

Image
A Nice example of a Chart with Nested Labeling from Working in the Service Sector in Boston Another way to do this is by using Hierarchy Labeling from Oracle JET

FlightAware Misery Map

Image
Flight Aware has a great visualization for show flight delay across the USA. They call this the Misery Map It also has a timeline that you can play across the last three days

Learning UI Design and Data Palette Picker

I was listening to the Basics of UI Design for Engineers episode on the Programming Throwdown podcast where the interview Erik Kennedy. He has a great blog at Learn UI Design Blog . I have designed a color palette selector which can be applied to charts, maps and tables. A good description is in the Picking Colors Blog entry. He also has a great Data Color Picker tool for understanding palettes.

Linux Finding Directory with large number of files

I recently ran into an issue where there was some new software running which was writing a lot of trace files which was causing my disk space to be full. I was not sure which directory it was writing it in so I googled for a script and found this https://unix.stackexchange.com/questions/122854/find-the-top-50-directories-containing-the-most-files-directories-in-their-first I ran the following command and it found the offending directory in 2 mins. du --inodes -S | sort -rh | sed -n \ '1,50{/^.\{71\}/s/^\(.\{30\}\).*\(.\{37\}\)$/\1...\2/;p}'

Guided Tour Hopscotch Javascript Library

When a user sees a new application for the first time they have a tough time figuring out what part of the application to focus on. Hopscotch is a framework to make it easy for developers to add product tours to their pages. Hopscotch accepts a tour JSON object as input and provides an API for the developer to control rendering the tour display and managing the tour progress.

IDE One (Java equivalent of JSFiddle)

I had a Java and programming newbie ask me for some Java code to sum up a 2D array. I wanted to make sure that I can show him the entire working source code for doing this. So I searched for a Java equivalent of JSFiddle and found IDEOne . It supports 60 languages and is great for trying out small functions. It even has a very nice full screen mode.

Mustache Logicless Template Engine

I worked on a project a few years back where I worked on a UI which allowed the user to generate a bunch of predefined named formulas. I created a templating engine that allowed the user to define new templates where they could specify what calculation to generate and how to name the calculation. The user could also specify the inputs to the calculation and the application would dynamically generate the UI for specifying the calculation expressions. I had templates for generating the UI "Moving total (sum) of {1} in the {2} dimension and {3} hierarchy. Include {4} preceding and {5} following members within {6}."}, I had template for generating the name "{measure_name} || '_RANK_' || is_selected({hierarchy_level}, {hierarchy _level_name}, {dimension_name} || '_' || {rank_within_name})" I needed to do something similar for another project that I was working on but I needed the template to work in Java and Javascript. Mustache is a logic l...

Data Science

Kaggle is a great resource for Data Scientist as it has course on learning Data Science using Python . Also it has kernels/ notebooks that shows analysis of different datasets creating by users. It also has a lot of datasets that can be used for analysis.

curl to Javascript JQuery code using Postman

Image
I was looking for a tool that given a Curl Command can generate Javascript JQuery AJAX code. Postman does this where you can test your REST API and also generate the Javascript code. You can import the Curl command by clicking Import and pasting the curl command in Paste Raw Text You can then generate the code by clicking on Code (next to Cookies) and then selecting the language

Oracle Database Scripts

oracle-base.com  is one of the best websites that has SQL scripts that are very easy to run. It describes step by step how to try out different features in the database from 8i to 19c. 

Insomnia REST Tool

Image
I was having problems figuring out why authentication is not working for a REST Endpoint that I have exposing using Oracle ORDS. I was doing my testing using curl which is not very helpful and then I discovered Insomnia REST . It is a Windows and Linux based tool that quickly lets you try out your REST API calls.

Visualizations

ECharts Oracle JET Mike Bostock D3

Learn Data Science and Python for Free

Hear is a great video on how you can learn Data Science and Python for Free  The description has a long list of links on all the topics you can study for Data Science.

Debugging Node.js in Visual Studio Code

Visual Studio Code is fast turning into my default IDE for most of my web based development. It is very fast and snappy and just seems to do the right thing. I am architecting a new product and I wanted to write a prototype for processing some JSON and I decided to this all in Node.js. I was able to setup a fast coding and debugging environment by turning on Node Debug in Settings and then just running node --inspect-brk foo.js  in Terminal. Make sure that you set a breakpoint before running.