Simple XSLT ifnull for numbers

Answer to question how to display zero instead of NaN in XSLT for non existing node containing number values (kind of ifnull or coallesce functions that are available in SQL). You can do it by standard expressive XSLT way, with using variable and <xsl:choose>, or abuse built-in sum() function and do whole thing in one […]

Disable Windows 7 hotkeys

This little script disables Windows 7 hotkeys if you have no local admin rights and registry editor (regedit) is also disabled.  Simply save it as hkey.vbs and execute. Option Explicit ‘Declare variables Dim WSHShell, rr, MyBox, val, ttl Dim jobfunc, itemtype On Error Resume Next Set WSHShell = WScript.CreateObject(“WScript.Shell”) val = “HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\DisabledHotkeys” itemtype = “REG_EXPAND_SZ” […]

StartCom StartSSL certificate + nginx

Quick guide to use free and widelly accepted (week ago Microsoft added StartSSL certificates to known authorities !) SSL certificate on nginx webserver. create certificate on startssl.com download certificate (ssl.pem) and generated key (remove password from key using: openssl rsa -in ssl.key-pass -out ssl.key) download helper certificates (from http://www.startssl.com/certs/ (according to your class level, usually […]

Solving MAX(COUNT()) problem 2 – optimizations

In previous post I’ve tried to present my solution for solving max(count()) problem.  The solution was slightly suboptimal and I’ve needed to speed it up a bit, because I’m using it now in some statistical calculations and every millisecond is important. This is original solution. CREATE VIEW data_view_source AS SELECT DISTINCT ON (dp_id) dp_id, ds_id […]

SQL timeline and statistical computations

This is simple way how-to generate time table (list of consequencing timestamps, or timeline) in PostgreSQL. Nothing spectacular, but might help you ,when trying to do some time based statistical selects (can feel like OLAP :-)). Code: CREATE OR REPLACE FUNCTION gen_time_list( tim IN TIMESTAMP, tim_stop IN TIMESTAMP, step IN INT) RETURNS TABLE(ts1 TIMESTAMP, ts2 […]

Solving MAX(COUNT()) problem

I’ve been solving problem of doing grouped MAX(COUNT()) in PostgreSQL, and because I’ve not found anything really usable out there (doing correlated sub-queries is definitely not good idea for thousands of records) I’ve had to find my own solution. Situation plan My configuration is a bit complicated to explain this, so i’ll try do it […]