web analytics

Windows: get product key

To find the product key for Windows Vista / 7 / 8.x /10, run the following in the command line:

wmic path softwarelicensingservice get OA3xOriginalProductKey

Powershell analog:

powershell “(Get-WmiObject -query ‘select * from SoftwareLicensingService’).OA3xOriginalProductKey”

Windows: disable sticky keys

If some keyboard key is pressed several times in the short period of time, the accessibility window will appear. It’s possible to disable this behaviour.

Just create the following REG-file and import it with the regedit:

Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Control Panel\Accessibility\StickyKeys] "Flags"="0"

Alternative: just do it from the command line:

REG ADD "HKEY_CURRENT_USER\Control […]

Oracle Data Modeler: unable to create Java instance

The following error was displayed during the start of Oracle SQL Developer Data Modeler (v3.3.0.734) on Windows:

Unable to create an instance of the Java Virtual Machine Located at path: ..\..\jdk\jre\bin\client\jvm.dll

This could be fixed by editing the file datamodeler\bin\datamodeler.conf : try to change the following line AddVMOption -Xmx768M to AddVMOption -Xmx512M

and restart Data […]

Oracle Data Modeler: change user interface language

Oracle Data Modeler in the current version (3.3.0.x) does not allow to change the user interface language in “Options” or somewhere else in the GUI.

However, it’s possible to force it to switch to some other language, using datamodeler\bin\datamodeler.conf configuration file. The following lines should be added to the file for English:

AddVMOption -Duser.language=en AddVMOption […]

Oracle: error messages for read only database

The old Oracle database (8i) was switched to the read-only mode. The following messages are shown now in alert.log: ***Warning – Executing transaction without active Undo Tablespace

It’s possible, that the error is caused by Oracle bug 3270493 (EXCESSIVE QMNX TRACE FILES WHEN PLACING STANDBY IN READ ONLY MODE). Workaround is to set aq_tm_processes parameter […]

Perl: print the name of the input file

The special variable $ARGV could be used to get the name of the input file. It returns the name of the file or ‘-‘ if the standard input was used.

Here are some examples:

perl -nle ‘END { print $ARGV }’ /etc/passwd /etc/passwd echo test | perl -nle ‘print $ARGV’ – $ (echo test; echo […]

Unix: show tcp packets

TCP packets could be catched by tcpdump:

tcpdump -n -i any ‘tcp[tcpflags] & (tcp-syn|tcp-ack) == tcp-syn and port 80’

Oracle: converting timestamp to date

Here is the method to display timestamp in the convenient format:

SELECT TO_CHAR (SYSTIMESTAMP, ‘YYYY-MM-DD HH24:MI:SS’) s_date FROM DUAL;

Simple conversion of the timestamp:

SELECT CAST(SYSTIMESTAMP AS DATE) x_date FROM DUAL;

UNIX: mounting CD

Here are the mount commands for different *nix systems.

HP-UX

nohup /usr/sbin/pfs_mountd & nohup /usr/sbin/pfsd & /usr/sbin/pfs_mount -t rrip -x unix /dev/dsk/c5t2d0 /SD_CDROM

AIX

mount -r -v cdrfs /dev/cd0 /cdrom

Solaris Intel

mount -F hsfs -r /dev/dsk/c0t6d0p0 /cdrom

SPARC Solaris

mount -r -F hsfs /dev/dsk/c0t6d0s2 /cdrom

TRU64

mount -t cdfs -r -o nodefperm,noversion,rrip /dev/rz4c /cdrom […]

Perl: how to get the position of the match

Let’s search for the word “brave” in the string “Hello, new brave world!”. There are several methods to get the position of the match in Perl.

#1 – use POS function Function pos returns the position, where search was finished.

$txt = "Hello, brave new world!" ; $txt =~ m/(brave)/g; my $pos = pos($txt) – […]