C# Pass Arguments to the first instance of a program

Sometimes you don’t want the user to run more than one instance of a program. But if the user associates a filetype with your programm it shall open the filetype in this first instance. The code below uses interprocess communication to find out if there is already another instance. It further allows the first instance […]

C# Pitfalls

Closures If you have code like this: // strings is a list containing the values a, b and c foreach (string str in strings) { Button btn = getButton(str); btn.Click += new EventHandler(delegate { MessageBox.Show(str); }); } The result will be that each button shows a Messagebox with c. Altough one would expect to see […]

Oracle Index – Synchronize periodically

You can create an index which will be synchronized automatically everytime you commit: Create index … on … INDEXTYPE IS CTXSYS.CONTEXT PARAMETERS (‘SYNC ( ON COMMIT)’) or just periodically (p. x. every hour): Create index … on … INDEXTYPE IS CTXSYS.CONTEXT PARAMETERS ‘SYNC (EVERY “SYSDATE+1/24”)’) See Topic on StackOverflow

Oracle log script errors in a table

Prepare a table to store the script error logs — this table shall hold our script errors create table script_error_log ( error_timestamp TIMESTAMP(9), script_name VARCHAR2(255), error_number NUMBER, error_message VARCHAR2(255), error_stack VARCHAR2(2000)); Prepare a method to call if an error happens in a script: — this method can be called from scripts to log some message […]

Oracle tnsnames configuration

Usually the file is located under: C:\oracle\tns_admin\tnsnames.ora You can add an entry like this: <myapp> = (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=<ipaddress>)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(service_name=<myapp_servicename>))) If everything is ok you can try to test the connection Issuing a ping tnsping myapp or login as user sqlplus myuser@myapp or login as sysdba sqlplus sys@myapp as sysdba

Disable validation of Self-Signed Certificates

You can use the following code: ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, errors) => true; Be aware that this code does just accept every certificate and it is not only active for one request but for all requests. You should think before you use this code. But for development convenience or on a test system it […]