This is a small snippet for Visual Assist to encapsulate member objects and making sure that you can not use those objects unless they are instantiated or assigned. Also making sure that assignment operation is type safe.:

$end$$SymbolType$ $GeneratedPropertyName$() const { if (this->$SymbolName$ == nullptr) throw std::bad_function_call(“The object you are trying to use is empty. This functionality is not avaible. Please pass an object before usage.”);

Or with assertion on both operations(for minimal overhead for release version):

$end$$SymbolType$ $GeneratedPropertyName$() const { assert($SymbolName$ == nullptr && “The object you are trying to use is empty. This functionality is not available. Please pass an object before usage.”);

My Notes on a painful journey to learn, make and publish a Azure hosted MVC, Sinlge-Page application, Android client app and a WebAPI working with-one another. Software technology can be real pain in the ass!!!

MVC loads older script files

This is due to browser script caching. The easiest solution for this is to set the browser which you are using to debug to retrieve the newest versions of web page content on each time you visit a webpage.

Missing Key definition from Model when creating a controller

You might get an error like this: EntityType ‘your type’ has no key defined. Define the key for this EntityType.

How to create/populate a collection with data with an unknown data type

You may ask yourself why would anyone needs this? Well I do not why would others needs this but I came into a situation where I needed this.

I had a solution where I needed to be able to create data from a back-end server WebAPI to a JS HighCharts JS library without knowing what kind of data I would be processing, also I wanted to have the possibility to extend the back-end code so that it can return any kind of data to the client and let the client figure out what to do with the data.

So how to do this?

In a human language it goes something like this: Use LINQ in your code to go through the data set, select your data and return it as and array of objects, then create a new collection by passing to the constructor your processed data as an array of objects. Ofcourse your collection must store objects as well. The data type information is going to be stored because every class in C# is a descendant of the Object class.

The Average lambda expression will throw the above exception error message because the Where clause may return Zero elements back(Notice that for example the Count expression will not throw a similar exception).

To fix(go around the problem, yes there might be other solutions but this was mine at the moment :) ) I created an anonymous function that checks if there are elements returned by the clause and only then perform the Average operation on the elements. The solution is highlighted with the green color.

The “parent.parent.parent.children” part means that we need to get the cell with the actual value. The reason why I did not try to directly to get the value with jquery but went to the value through a work around is because I had problem getting the value. The value is populated by SharePoint javascript meaning that I was not able to find a good way to identify the exact table cell where a particular value of a field resided. If you have a better solution please let me know in the comments, thx :).

JQuery code to find and perform styling and possible data alteration to a Display form table cell(s):

// Get the value and remove any whitespaces to make sure that there is actual data or if we want to process that data var creditStoppageValue = $.trim($(“.ms-formtable tr td.ms-formlabel h3.ms-standardheader a[name=’SPBookmark_your_field_id’]”).parent().parent().parent().children(“td.ms-formbody”).html());

If you experience slow development images with WMWare, especially with SharePoint 2013 images you can try the WMWare Defragment utility.

​I have succesfully defraged several SharePoint 2013 images and sped up them condiderably. If you wonder how much speed is gained? For my images I got from wainting a minute or two to a few second on a certain operation such as opening a site for the first time or accessing site settings.

What you need to do is:

Close your development image if it is open

Make sure you have several tens of GBs of empty space on the hard drive partition/disk where you image resides (this is required for the defragment operation)

Select your development image in WMWare

In the devices section select a virtual hard disk, a pop up should open

Then seek the Utilities drop down button and press it

The option “Defragment” should appear, select it and let the defragment operation finish

Do the same thing for all virtual hard disks in your development image

Speed up WMWare Image

This is especially useful when working with Microsft SharePoint 2013 images.