Tuesday, April 30, 2013

CKEditor and AngularJs Modal boxes

There is a AngularJs timing issue when adding the ckEditor rich text editor to a page when using ng-include to load modal boxes.  The code below nicely solves this problem using a directive.

I can't take credit for writing this code, found it on http://stackoverflow.com/questions/11997246/bind-ckeditor-value-to-model-text-in-angularjs-and-rails/12021632#12021632


angular.module('yourApp').directive('ckEditor',function () {
    return {
        require: '?ngModel',
        link: function (scope, elm, attr, ngModel) {
           
            var ck = CKEDITOR.replace(elm[0],
                {
                    toolbarGroups: [
                      { name: 'clipboard', groups: ['clipboard', 'undo'] },   
                      { name: 'basicstyles', groups: ['basicstyles', 'cleanup'] }
                    ]
                }
            );
            
            if (!ngModel) return;

            ck.on('pasteState', function () {
                scope.$apply(function () {
                    ngModel.$setViewValue(ck.getData());
                });
            });

            ngModel.$render = function (value) {
                ck.setData(ngModel.$viewValue);
            };
        }
    };
});


Saturday, April 6, 2013

Sql Data Projects in VS2012

I highly recommend using sql data projects in VS2012.  I'm not an expert.  If there is a better way; use it and drop me a line please.

There are two things that I do 'wrong' or 'backwards'. The two items are creating new database schema's (not tables) and installing xml schema collection objects.

It just works better if I do these tasks in sql studio first, then incorporate them in my project with schema compare. Then, I can use schema compare to create deployment packages, without any help from sql server management studio.

My most often used setting in Compare Schema is "Block on possible data loss".
To find the setting to show the dialog box, look for the cog or sprocket graphic after the scroll.
Compare->Update->Scroll->Cog

Monday, April 1, 2013

Samsung Note II

I have been using Personal Digital Assistants (PDA) since the mid 90's.  I have to say my Note II is the fastest most useful phone.  My usage is 75% PDA the rest laptop, for non work use, maybe some iPad.  I don't write code on it yet. I still prefer a mouse,  keyboard, and two screens for code; do I dare say copying and pasting code?