Tag: uom

Auditing and Analysing Image (Photo) Sizes

IPython Notebook File

Environment: Python 3.4
Main Libraries Used: reportlab, pandas, vincent


Column to String Converter

dev01.yznotes.com/column2string/
Ever had a list of column (or “who knows how”) oriented values that needed to be converted into a comma separated string? – This little web application tries to assist with this simple but sometimes annoying and time consuming task.

Please report if you find any bugs.

Selection_200

Oracle Wallet Set Up

Environment: Windows XP SP3, Oracle Client 11.1.0


Step 1:

Image

Open your sqlnet.ora file (mine is located in C:\oracle\product\11.1.0\db_1\NETWORK\ADMIN) and add section below at the end:

The DIRECTORY parameter in line 5 determines  where your wallet files will be created. It has to be an absolute path. To keep it simple I set mine to the same directory where sqlnet.ora, listener.ora and tnsnames.ora files sit.


 

Step 2:
Run shell command mkstore -wrl “C:\oracle\product\11.1.0\db_1\NETWORK\ADMIN” -create (see below). You will be asked to set up a password for the wallet. This password has no relation to the TNS credentials, it’s to protects wallet itself. The directory path has to be the same as in previous step (in my case it’s C:\oracle\product\11.1.0\db_1\NETWORK\ADMIN)

 

You will notice wallet files created in that directory:

ScreenClip[36]

 


 

Step 3:

Open tnsnames.ora file (usually in the same directory where sqlnet.ora sits), and create a new TNS entry which you will be using with the wallet. Normally you would want to just copy an exiting entry giving it a new alias. In example below I create a TNS entry PRDSPW by copying an existing TEST one:

 


 

Step 4:

Run shell command mkstore -wrl “C:\oracle\product\11.1.0\db_1\NETWORK\ADMIN” -createCredential PRDSPW dummy_user dummy_pass (see below), where PRDSPW is the special TNS name we created in Step 3, dummy_user – database username, dummy_pass – database password. You will be asked to provide wallet password that we set up in Step 2. Path (C:\oracle\product\11.1.0\db_1\NETWORK\ADMIN) – is the same as in all previous steps.

 


 

All done.

Now if you run command mkstore -wrl “C:\oracle\product\11.1.0\db_1\NETWORK\ADMIN” -listCredential it will list a new wallet entry that we just created:

 

From now on you can connect to PRDSPW by calling wallet entry without exposing your database user name and password:

SQLPlus:

 

cx_Oracle:

Command to delete an individual credential:

Python Script for Searching Log Files

Environment: Python 2.7 (Should run fine in PY3 as well after ‘fixing’ print statements)

This script was designed for searching interface log files for list of keywords. If ran as a standalone script, amend argumens highlighted in lines 29-31:

keywords – comma separated string with list of keywords we are searching for. Note that space symbol is also count, so, for example, keywords = ”’123, 345”’ means that you are interested in ‘123’ and ‘ 345’ (space and then digits ‘345’) entries

search_dir – root directory where the search starts, search is recursive

date_since – use this argument if you want to limit search to files that have been modified after specific date, so, for example, with date_since = “01/11/2012” only files modified on or after the 1st of Nov 2012 will be searched. date_since has to be entered in dd/mm/yyyy format, if not provided (or mistyped) – script runs without modified date parameter.

You may want to amend condition for file format in line 52, the current version searches only in files with extension ‘.log

 

Create Internal Sequence to Uniquely Identify Duplicates (Oracle Database)

Step 1: Create Test Table: 

 

Result:

 

Step 2: Run PL/SQLl anonymous block to deal with the duplicates:

 

Result: