Thursday, May 28, 2015

Ruby script to make Kohls auto payments

I published a Ruby script today to make payments to Kohls somewhat less painful. I always found it very annoying that Kohls does *not* allow auto payments to be set.. I ended up paying late fees as a result once as well. Hopefully with this script setup as a cron job I'll not miss my payment. I'll just copy what the script does from the readme here.

The script can be found at

A ruby script to make auto payments to Kohls at
It allows one to login to their Kohls account and make payment for the
'current balance' (if any). I'm using this script as a cron job
that runs daily, and thought it may prove useful to others.

What is needed to run the script?
Phantomjs (
Capybara (
Poltergeist (
Mail (

On my OS X, I found homebrew ( to be the easiest way
to get all these installed.

Also, please update the kohls user/pass and security questions/answers
in 'setupUserConfig' method of 'Kohls' class. Optionally, put your
gmail user/pass if you wish to receive email report of the payments made.

What are current limitations?
1. only the 'current balance' on the account is paid
2. only Gmail is supported for sending the email for payment report

Tuesday, February 17, 2015

Tip: XML mixed content

If someone would've asked me whether this is valid XML, I would've thought twice before saying yes or no... thanks to the quick and awesome tutorials on, now I know this, in fact, is valid XML :)

  Dear Mr.<name>John Smith</name>.
  Your order <orderid>1032</orderid>
  will be shipped on <shipdate>2001-07-13</shipdate>.

Wednesday, September 17, 2014

Tip: making sense of database indexes

Use The Index, Luke
Had been trying to get some insight into indexes - was very happy to see them explained in clear and simple terms right in the1st chapter 'Anatomy of an Index' Thanks a lot Markus Winand.

Friday, February 14, 2014

WCF and XML serialization

..continued from earlier post

The default DataContractSerializer used in WCF will serialize ‘strings containing control characters with a hexadecimal value below 20 as XML entities.’ This is obviously going to produce invalid XML 1.0.
But it was interesting to find that XML 1.1 spec makes valid ‘the use of character references to the control characters #x1 through #x1F, most of which are forbidden in XML 1.0.’  In fact, it makes all Unicode characters valid. 
[#x1-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]    /* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */

I wonder then if we can make WCF use XML 1.1 only? I don’t know – but  as per Whats New in SOAP 1.2 SOAP 1.1 uses XML 1.0, and for SOAP 1.2 ‘it is left to the specification of a binding to an underlying protocol to specify the XML serialisation used in underlying protocol data units. The HTTP binding specified in [SOAP 1.2 - Part 2] uses XML 1.0 as the serialisation of the SOAP message infoset.’ So it may not be readily possible to make WCF use XML 1.1, even if ones decides to support only SOAP 1.2. It’ll require more research

Tuesday, January 21, 2014

Invalid XML characters

Recently I investigated an issue with one of our WCF based services where the client’s XML parser (Java SAX) complained of invalid XML characters.
org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 24; Character reference "&#
    at Source)
    at$JAXPSAXParser.parse(Unknown Source)
    at org.xml.sax.helpers.XMLFilterImpl.parse(Unknown Source)
    at org.apache.xalan.transformer.TransformerIdentityImpl.transform(

Although the character that caused the exception was not shown here, one of my colleagues used the WCFTestClient to get at the actual SOAP message (see below) and it showed some interesting looking characters like &#x6; and &#x2;  in the message field.

<s:Envelope xmlns:s="" xmlns:a="">
    <a:Action s:mustUnderstand="1">.../GetErrorsResponse</a:Action>
    <GetErrorsResponse xmlns="AppSecInc.Checks.Service">
      <GetErrorsResult xmlns:b="" xmlns:i="">
        <b:Error i:type="b:ScanError">
          <b:Message>..: Exception Information
           Exception type=WeOnlyDo.Exceptions.SSH.TimeoutException
           Message=Timeout occurred due to inactivity.
           StackTrace=   at &#x6; .&#x2;(String &#x2;, String[]&amp; &#x3;, Int32 &#x5;, Int32&amp; &#x8;, String&amp; &#x6;)
           at WeOnlyDo.Client.SSH.Execute(String Command, String Prompt, Int16 Timeout)
Thanks to a post on stackexchange these did, in fact, turn out to be invalid XML characters. As per the Characters section of XML spec from W3C  only these characters are valid
#x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]    /* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */

At least, by default, WCF does not seem to do anything special about them. I do not know if anything could be done at the WCF level, but I want to explore if an extension to WCF can be implemented that will filter such invalid characters.

Monday, January 20, 2014

DB2 - Can’t revoke access to functions under SYSIBM/SYSFUN

I was a bit surprised that one can’t revoke access to any of the functions under the system defined SYSIBM and SYSFUN schemas. Although these are system defined, it seems strange that DB2 does not allow revoking access to any of them. For example, there is a function called ‘GET_DBM_CONFIG’ in 8.2 which gives a lot of configuration related information to PUBLIC and you can’t revoke access to it.

db2 => revoke execute on sysfun.get_dbm_config from test
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0204N "SYSFUN.GET_DBM_CONFIG" is an undefined name. SQLSTATE=42704

Ref -

Thursday, September 12, 2013

SOAP message logging in WCF

A simple way to turn-on SOAP message logging is to add something like the below to app.config

<source name="System.ServiceModel.MessageLogging">
<add name="messages"
initializeData="c:\logs\messages.svclog" />