I recently “backed” a crowd funded project on Indiegogo called Stick ‘n Find.

I won’t bore you with the details, but basically they’re stickers that you can stick to stuff (such as keys, wallet, etc…. all the things I usually misplace) and then use an app that points you in the right direction.

Anyway, after eventually receiving my stickers (packed in cheap looking cardboard box, I might add, but I’ll let that one slide) I was keen to try it out.

Searched high and low on Google Play for the app:
Nowhere to be seen.

Checked out the comments on their Facebook page, LOTS of people asking “Where’s the android app”
Oh wait. There isn’t one.

Then, an update.
There’s an Android app.

I was recently doing some work involving Knockout and needed to implement drag / drop (with jQuery UI draggable and droppable)

I stumbled across this post from Wilsonhut that shows how to use custom binding to attach drag and drop functionality to your view model.

Since that post (and previous posts in the series) covers that in detail, I won’t elaborate.
However, I had a requirement to be able to use some of my own options, for example appendTo.

To do this, I slightly modified the handler as follows:

 (function ($, ko) {
    var _dragged, _hasBeenDropped, _draggedIndex;
    ko.bindingHandlers.drag = {
        init: function (element, valueAccessor, allBindingsAccessor, viewModel) {
            var dragElement = $(element);

            var dragOptions = {
                helper: function () {
                    return dragElement.clone().addClass("ui-dragon");
                },
                revert: true,
                revertDuration: 0,
                start: function () {
                    _hasBeenDropped = false;
                    _dragged = ko.utils.unwrapObservable(valueAccessor().value);
                    if ($.isFunction(valueAccessor().value)) {
                        valueAccessor().value(undefined);
                        dragElement.draggable("option", "revertDuration", 500);
                    } else if (valueAccessor().array) {
                        _draggedIndex = valueAccessor().array.indexOf(_dragged);
                        valueAccessor().array.splice(_draggedIndex, 1);
                    }
                },
                stop: function (e, ui) {
                    if (!_hasBeenDropped) {
                        if ($.isFunction(valueAccessor().value)) {
                            valueAccessor().value(_dragged);
                        } else if (valueAccessor().array) {
                            valueAccessor().array.splice(_draggedIndex, 0, _dragged);
                        }
                    }
                },
                cursor: 'default'
            };

            var customDragOptions = ko.utils.unwrapObservable(valueAccessor().dragOptions);
            for (var attrname in customDragOptions) { dragOptions[attrname] = customDragOptions[attrname]; }

            dragElement.draggable(dragOptions).disableSelection();
        },
        update: function (element, valueAccessor, allBindingsAccessor, viewModel) {
            var dragElement = $(element);
            var disabled = !!ko.utils.unwrapObservable(valueAccessor().disabled);
            dragElement.draggable("option", "disabled", disabled);
        }
    };

    ko.bindingHandlers.drop = {
        init: function (element, valueAccessor, allBindingsAccessor, viewModel) {
            var dropElement = $(element);
            var dropOptions = {
                tolerance: 'pointer',
                drop: function (event, ui) {
                    _hasBeenDropped = true;
                    valueAccessor().value(_dragged);
                    ui.draggable.draggable("option", "revertDuration", 0);
                }
            };
            dropElement.droppable(dropOptions);
        },
        update: function (element, valueAccessor, allBindingsAccessor, viewModel) {
            var dropElement = $(element);
            var disabled = !!ko.utils.unwrapObservable(valueAccessor().disabled);
            dropElement.droppable("option", "accept", disabled ? ".nothing" : "*");
        }
    };
})(jQuery, ko);

This now allows me to do the following, with it still working as before:


Worst ever version control system

I once worked for a company, who, when I asked if they used a ‘version control system’ their lead developer eagerly replied

“YES – At the end of every day, I copy my directory, zip it, and rename it with todays date”

The best part was

“To make it easy to find, we cleverly use the date format YYYY-MM-DD in the zip file name”

I left around a week later.

Just thought I’d post this quickly:

Typo noticed in Visual Studio 2012 CSS intellisense:

Typo in Visual Studio 2012 - Rigth

Recently, I was tasked with creating a minified version of a web applications Javascript files.

I settled on the Yahoo YUI Compressor, in particular, the .net port of it

When I tried to compress a particular file (the jquery.caret plugin), it would throw up a syntax error.

This error only occurred using the .net port of Yahoo YUI Compressor.
Using the standard java jar version of YUI Compressor did not throw such an error.

The error was a syntax error on this line:

(function($,len,createRange,duplicate){

It was saying invalid character at position 0.

After some time scratching my head, I opened the file in notepad++ and converted text to hex 16
Immediatlely, I could see there were some invalid characters around the function text:

Hex characters in jquery.caret

Removing those characters and saving the file solved my problem, and allowed the file to compress.

I looked at the issues page for the jquery.caret project, and found this issue had already been reported

Update

I’ve created an issue on the codeplex page for this now:

http://yuicompressor.codeplex.com/workitem/10742

Page 1 of 29