Author: tom

  • Python – a quick selection

    I wrote a Python programme to select rows that contain NULLs. Whenever a null was found, it is written to a separate file. The programme uses data frames. This allows to treat data as matrix. Once it is interpreted as a matrix, one may inspect each row. If the row contains a NULL, it is…

  • Python cgi-bin

    I recently added a cgi-bin programme to my website (see van-maanen.com/cgi-bin/test.py. It allows me to add functionality to the website that cannot be achieved with standard html. Most web servers have the capability to add cgi-bin functionality to its website. I have a apache web server and I had to tweak the web server to…

  • Ping pong between server and client

    I worked with Salesforce in recent period. A nice feature of this application is the possibility to send requests via the http protocol. Doing so, one may add data to this system. How does it work? Generally speaking, one sends a signal to the system, upon which the system reacts. In my case, data are…

  • Salesforce Data structure

    Salesforce is a CRM application that is build upon a set of data. These data may refer to customers, but is is possible to create your own data structures. These data structures have two types of field that are used to create the relation ships. The first type can be seen in object (Boek__c) that…

  • Finding errors in Oracle

    It is possible to trap errors in the loading process. This is handy when we work on a migration project. We simply load a table and trap all possible errors. Let us use a simple table (emp_c) that must be loaded. However, one field is too narrow which loads to errors. These error will be…

  • Oracle HR schema

    Oracle has a use that may act as an example user with a series of tables. This example can be used to get acquainted with oracle SQL or data modelling in general. The script can be found here:

  • Encrypting in Python

    Encrypting in Python can be very easy. Below, a snippet is provided that allows to encrypt data. The code can be found here : However, as the code is simple, it comes at a price: the Vigenere cipher is rather insecure. If the key length is equal to the cipher text length then the cipher is absolutely secure if the key is chosen…

  • Adding data in Azure with the bulk loader

    I am quite impressed with Azure SQL Server. The DBMS is easy to understand as will be shown below. The problem is how to add data from a local file (“uit”) to the Azure SQL Server environment. This is done in two steps. The first step is to create a table from the command line…

  • Using Python to read and write in a SQL Server database

    Below, I provide a snippet to read data from an Azure SQL Server database. Subsequently, it is written to another table in the same database. The trick here is to read the data, store them in a matrix which will be written out to a second table. Elements within the matrix can be accessed with…

  • Hierarchical query in Oracle

    Below, you find a nice example of an hierarchical query in Oracle. The idea is that you see the top-down hierarchy with some indications on the level that is shown. First the query: select level, case when level=1 then first_name||’ ‘||last_name when level>1 then lpad (first_name||’ ‘||last_name,length(first_name||’ ‘||last_name)+level-1, ‘-‘) end tree from employees start with…