Backbone.js
Underscore
jQuery
data.js
bootstrap
Highcharts
jQueryUI
Modernizer

Short and sweet sample of using userstory and BDD, all credits to http://dannorth.net/whats-in-a-story/

Story: Account Holder withdraws cash 

As an Account Holder 

I want to withdraw cash from an ATM 

So that I can get money when the bank is closed 

Scenario 1: Account has sufficient funds 

Given the account balance is \$100 

And the card is valid 

And the machine contains enough money 

When the Account Holder requests \$20 

Then the ATM should dispense \$20 

And the account balance should be \$80 

And the card should be returned 

Scenario 2: Account has insufficient funds 

Given the account balance is \$10 

And the card is valid 

And the machine contains enough money 

When the Account Holder requests \$20 

Then the ATM should not dispense any money 

And the ATM should say there are insufficient funds 

And the account balance should be \$20 

And the card should be returned 

Scenario 3: Card has been disabled 

Given the card is disabled 

When the Account Holder requests \$20 

Then the ATM should retain the card 

And the ATM should say the card has been retained

I have been browsing the net on the lookout for good resources on the callback concept that JavaScript is using. There is alot of confusion on this piece of black magic code especially when you mix it with the async concept.

“In computer programming, a callback is a reference to a piece of executable code, that is passed as an argument to other code. This allows a lower-level software layer to call a subroutine (or function) defined in a higher-level layer.”

“Sometimes a method will invoke web requests that need some time to process, or it may call another method that has to do some processing or is waiting for user input…  These kinds of operations can be implemented asynchronously, and the only way to manage that logic programmatically is with a callback parameter.”

“A callback is nothing more than a delegate. The term callback is used because you generally pass it (the delegate) into a method (as an argument) and is then invoked in that method to signal something.”

“Sync and Async callbacks are that. Synchronous, execute on the same thread that called the method (started the action). Async are generally executed on another thread (but not always).”

“JavaScript is normally synchronous: it executes each line in sequence. Certain functions, however, operate asynchronously: they do not halt execution, yet you need a way to get the results at a later time. To deal with these situations, you usually pass in a callback function that is run when the asynchronous call completes.”

“When you pass a function into another where it will be called, it’s generally known as a callback.”

“Here’s a simple example. There’s nothing too complicated going on here: all we’re doing is passing a callback into the function that’ll get called once the function’s real work is done.”

var printDone = function () {
console.log("done printDone");
};
var doSomeWork = function (whenDone) {
// do some work here
console.log("done doSomeWork ");
whenDone();
};
doSomeWork(printDone);

OR

var doSomeWork = function (whenDone) {
// do some work here
whenDone();
};
doSomeWork(function () {
console.log("done");
});

Sample: callback on custom jQuery extension

Let’s say our custom jQuery extension gets data by making some AJAX request.

$.extend({
  myFunc : function(someArg){
    var url = “http://site.com?q=” + someArg;
    $.getJSON(url, function(data){
        // our function definition hardcoded
    });
  }
});
What is bad in this jQuery code is that the callback function is defined and hardcoded right in the plugin itself. The plugin is not really flexible and its user will have to change the plugin code, which is bad!

So the solution is to define your own custom callback function argument. Here is how it is done:

 $.extend({
  myFunc : function(someArg, callbackFnk){
    var url = “http://site.com?q=” + someArg;
    $.getJSON(url, function(data){
      // now we are calling our own callback function
      if(typeof callbackFnk == ‘function’){
        callbackFnk.call(this, data);
      }
    });
  }
});
$.myFunc(args, function(){
  // now my function is not hardcoded
  // in the plugin itself
});

Credits to;
http://blog.boyet.com/blog/javascriptlessons/javascript-for-c-developers-callbacks-part-i/
http://jquery-howto.blogspot.com/2009/11/create-callback-functions-for-your.html

Abit on the side: The Call() method

“The call() method will execute the function it’s called on and set the this variable to the first parameter. All the other parameters are then passed to the function itself.”

I find that most of the advice and lessons on usability often boils down to plain common sense. It also strikes me how hard it is to stick to this common sense approach while designing and creating for the web. Let these quotes guide you in making the web a happier place.

Quotes from Steve Krugs book Don’t Make Me Think

“Happy talk must die”

“Try to avoid instructions”

“When I look at a web page it should be self-evident, Obvious and Self-explanatory”

“Making pages self-evident is like having good lightning in a store: it just makes everything seem better.”

“puzzling over things that don’t matter to us tends to sap our energy, enthusiasm and time.”

“most people are going to spend far less time looking at the pages we design than we’d like to think.”

“If you can’t make a website self-evident because of complexity, strive for self-explanatory.”

“we don’t read pages. We scan them.”

“most of the time we don’t choose the best option we choose the first reasonable option.”

“Known conventions are your friends.”

“As a rule, conventions only become conventions if they work. Well applied conventions makes it easier for users.”

“It’s important to make it obvious what’s clickable and what’s not.”

“One of the great enemies of easy-to grasp pages is visual noise”

“When everything on the page is claymoring for my attention the effect can be overwhelming.”

“what really counts is not the number of clicks it takes me to get what I want, but rater how hard each click is, the amount of thoughts required, and the amoucnt of uncertanity about whether I’m making the right choice.”

“Users don’t mind a lot of clicks as long as each click is painless and they have continued  confidence that they’re on the right track.”

“The point is, we face choices all the time on the web and making the choices mindless is one of the main things that make a site easy to use.”

“Omit needless words.”

“Two of the purposes of navigation are fairly obvious: to help us find whatever it is we’re looking for, and to tell us where we are.”

“Every page needs a name. Just as every street corner should have a street sign.”

“The name of the page should match the words I clicked to get there. It may seem trivial but Its actually a crucial agreement. Each time a site violates it, I’m forced to think, even if only for milliseconds”.

“One of the ways navigation can counteract the Web’s inherent ‘lost in space’ feeling is by showing me where I am.”

Installing Farm Solutions and Features with PowerShell

Install commands
Add-SPSolution “C:\Users\keg.LAB\Documents\Visual Studio 2010\Projects\ContentTypeProject5\ContentTypeProject5\bin\Debug\ContentTypeProject5.wsp”

Add solution to your farm – (Visible but not deployed)

Install-SPSolution –Identity ContentTypeProject5.wsp -GACDeployment

If you omit the -WebApplication option the solution will be deployed globally to the farm.

Enable-SPFeature –identity 1d7a2dbd-bb32-455e-9dec-ad1e380964bf -URL http://dc1
Uninstall commands
Uninstall-SPSolution -Identity 5b12edb8-712f-4bbb-92a9-d459c3c9d23b

Uninstall-SPSolution -Identity MySolution.wsp

If the solution is deployed this command will undeploy it but not remove it from the server

Remove-SPSolution -Identity 5b12edb8-712f-4bbb-92a9-d459c3c9d23b

Remove-SPSolution -Identity MySolution.wsp

Deletes a SharePoint solution from a farm. Before you use this cmdlet, you must use the Uninstall-SPSolution cmdlet to retract the solution files from the front-end Web server

Disable-SPFeature 1d7a2dbd-bb32-455e-9dec-ad1e380964bf

Deactivate a Feature with specific GUID

Uninstall-SPFeature 1d7a2dbd-bb32-455e-9dec-ad1e380964bf

Remove/Uninstall solution with specific GUID

List all Features in Site or Web scope

Get-SPFeature

List all Features in Site Collection Scope

Get-SPFeature -Site http://dc1/ | Sort DisplayName | FT DisplayName,Id
Get-SPFeature

List all Features in Site Web Scope

Get-SPFeature -Web http://dc1/ | Sort DisplayName | FT DisplayName,Id

I ran into a problem with deploying my solution on a multiserver farm from Visual Studio 2010

Error message; “Error occurred in deployment step ‘Activate Features’: Feature with Id ‘929fe67d-0b32-4954-8846-3663421c40f9’ is not installed in this farm, and cannot be added to this scope.”
When you try to deploy your solution in a Farm environment like this it will be added to your farm but not deployed…

I have not found a way to remedy this, but my options came down to;

1 – Manually install the Solution with “Install-SPSolution –Identity KimsApplicationPage.wsp -GACDeployment”

2- Remove server no2 from the farm – Central Admin -> System Settings -> Manage servers in this farm -> Remove Server

I ran into this puzzle when trying to subscribe to a Content Type Hub from a Team Site Template.

If the Content type publishing option is not accessible on you Site Collection you need to activate the feature from PowerShell with the following command.

stsadm -o activatefeature -id 73EF14B1-13A9-416b-A9B5-ECECA2B0604C -url http://toplevelsitecollection

Now that this is sorted out you can access the Content type publishing option from your top level subscription site. Click Site Actions -> Site Settings -> Site Collection Administration and locate Content type publishing.


This is an attempt to clarify mostly for myself on how to install SharePoint 2010 with best practice/least privilege. It is always tempting to give full access to all your installation accounts and just keep on trucking. At some point this approach might come back and bite you.

SharePoint will elevate the following accounts as necessary during installation. Read the rest of this entry »

When setting up new SharePoint apps you often want your URLs to be easy and understandable for your users. This is where host headers come in, it lets you set the name you want.

PS! If you dont have access to a dns server and want this to work locally you have to skip point 2 and instead add the host header name in the hosts file(C:\Windows\System32\drivers\etc\hosts).

  Read the rest of this entry »

In this article I will try to give you an overview of some of the tools that could make your troubleshooting issues with SharePoint somewhat easier.

This list is not by all means complete, but it’s a start.

Read the rest of this entry »