Opinionated Software

… we have opinions about everything!

Archive for the ‘Hints and Tips’ Category

REGEXP Problem —

A good friend asked me how to replace the last¬†full stop (period) in a field with another character using a regular expression e.g. a comma. When I asked “what language?” it turned out he wanted to do this using REGEXP_REPLACE in Oracle SQL. It’s a problem with a couple of solutions that I could immediately […]

Powershell ISE Editor Tip —

Here’s an interesting tip – if you need an editor on a Windows server that handles Unix line endings you can use Powershell ISE … it’s not installed by default, but open a Powershell prompt and enter these commands:¬† Import-Module ServerManager Add-WindowsFeature PowerShell-ISE And you will have a half-decent editor.

fsutil one-liner —

fsutil fsinfo ntfsinfo X: where X: is the drive letter gives output like this: NTFS Volume Serial Number : 0x101051a010518e1a NTFS Version : 3.1 LFS Version : 2.0 Number Sectors : 0x0000000074498860 Total Clusters : 0x000000000e89310c Free Clusters : 0x000000000447f222 Total Reserved : 0x00000000000016e2 Bytes Per Sector : 512 Bytes Per Physical Sector : 512 […]

Delete Too Long File Paths on Windows —

The 260 character limit on the file path makes deleting the file from applications like Weblogic problematic (especially the .patch_storage sub-folder structure). As a result the PeopleTools DPK “cleanup” command doesn’t actually clean everything up. Use: ROBOCOPY D:\TEMP\EMPTY .patch_storage /PURGEROBOCOPY D:\TEMP\EMPTY .patch_storage /PURGE or /MIR to delete the files recursively, where D:\TEMP\EMPTY is an empty […]

Opening UTF-16LE files in Perl —

Placeholder for useful code snippet: open my $fh, ‘<:raw:perlio:encoding(UTF-16LE):crlf’, $filenameopen my $fh, ‘<:raw:perlio:encoding(UTF-16LE):crlf’, $filename which will convert CR/LF combinations to LF only. Alternatively, to keep them intact: open my $fh, ‘<:raw:perlio:encoding(UTF-16LE)’, $filenameopen my $fh, ‘<:raw:perlio:encoding(UTF-16LE)’, $filename Useful for reading Windows registry export files, SQL server log export files etc.