Composer not autoloading your package?

May 16th, 2016

I needed to link a GitHub hosted library into my project with composer. It was my own fork of a library that was abandoned. I didn’t want to register it with because it already is infested with weeds of this kind. Conveniently, the library already had composer.json so I just needed to edit my project’s composer.json and link to the library. Easy I thought.

Read the rest of this entry »

AltDrive hangs when Creating Shadow Copy [SOLVED]

July 17th, 2015

I’ve been struggling with my online backup AltDrive recently. It seemed to continue a backup started a couple of days ago but never getting past the phase of Creating Shadow Copy. When I cancelled the backup process, I was able to start over but still the previous backup continued to hang in the progress window. I tried all sorts of things related to shadow copy but with no avail. I uninstalled the client (keeping settings because I didn’t want to lose backed up data) and installed a fresh version, no change.

Read the rest of this entry »

An island with a different viewModel

June 5th, 2015

I have a multi-page application with a navigation panel that is used across all pages. Each page has its own view model, the panel view model is the same. I could remember to always bind both models but I was hoping there would be a more universal solution. Some way to bind my one-page model to the whole document, and yet have an island of DOM elements automatically bound to a different model.
Read the rest of this entry »

KO validation with Bootstrap error and feedback? Can do.

June 3rd, 2015

I’ve been struggling to configure Knockout Validation to use Bootstrap error classes and form-control-feedback element. Finally, it’s working and now I’m going to brag about it. It’s quite simple really ;-)
Read the rest of this entry »

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().