clearError() in KO Validation updates validity too

June 1st, 2015

Let me start with the take-away message:

Don’t clear errors with clearError() if you reuse your form and if you set messagesOnModified to true (default value).

Now why. Say you have a Create Thingy form with a field for the new thingy name. Name is obligatory but you don’t want the creating experience to start with an error message. So you keep messagesOnModified at true.

User opens the dialog, chooses a name that is invalid and then gives up – clicks Cancel. Then following a sudden outburst of creativity, he opens the dialog again. At this point, you want the old invalid attempt to be gone, all errors cleared.

My solution was to clear the form values on, reset isModified(false) and get rid of errors with clearErrors(). Well, it turned out that if the user submitted the form immediately, with an empty value, it passed as valid!

The culprit was clearErrors() – it not only removes the error message but also marks the model as valid! So the right procedure here is to use error(null) instead of clearErrors().

Do you run PhpStorm in 64bit mode?

September 21st, 2014

Maybe you only think you do. Check out the About menu item. You should see amd64 in the JRE area and 64-Bit in JVM.

Read the rest of this entry »

The secret of deleting contacts from Constant Contact

September 10th, 2014

You can’t really. An e-mail address in your Constant Contact account tells about your relationship with its owner, the contact. If a recipient becomes fed up with your newsletters and unsubscribes, this information must stick. You must not be allowed to simply delete the address and start over, pretending that nothing has happened.

When you “delete” an e-mail address or a contact using the CtCt website (called GUI) it’s actually only hidden, remaining in the database. It no longer counts towards your quota so for all practical purposes, we can call it deleted. Now, how do you do that with API?

Read the rest of this entry »

Paginating in Constant Contact API

August 30th, 2014

Some services of Constant Contact API return only a subset of results and you’re supposed to submit additional requests with a “next” parameter to fetch more. The implementation isn’t exactly straight forward though, and for some reason, CtCt doesn’t provide any pagination code sample. So here it is, for getContactsFromList().
Read the rest of this entry »

Access denied in mysqldump after ip address change

July 17th, 2014

This one was a real hard nut to crack. My workstation ip address has changed and I could no longer connect to my MySQL server remotely. So far nothing new or interesting. I went to cPanel and added my new ip address to “Remote MySQL” – a list of ip addresses that are allowed to access the database server remotely. Being a cautious person, I also removed my old ip address while I was there.

So now I could connect remotely both from my IDE (via JDBC) and from my local mysql client but to my surprise, I was still getting access denied from mysqldump. Mhm…
Read the rest of this entry »