This tutorial is about using SSL certs with WiX for IIS websites. For those of you whom didn't know, WiX is an MSI generator. You can even deploy IIS applications with WiX's MSI's.
Using Action<>, Func<> to hide using statements
Ok so to give you all some background. I always write my data access with a repository pattern in c#. Now I often use dapper, however I'd guess this problem would also apply with Entity framework.
Excel Interop cannot open my file!
So a while back I made a website that uses the Excel interop (long story). Since I made it a while ago, the IIS configuration is not automated, and must be done artisanally.
Recently I have been working on moving it to a new server. I installed Excel, and the website.
Value types vs Reference Types in C#
In C# there are two kinds of types...Value and reference...
What are Reference Types?
Reference types in C# are mostly objects and strings. These are types when placed on a stack refer to a memory address in the heap.
What are Value Types?
Value types make up the bulk of types in c#. These include int, float, double, long, bool, etc. These types values are only stored in the stack.
Stack? Heap? What's the difference?
To put it short, the stack is a series of memory blocks (like a scratch pad) that is used for the current thread. The stack is used for basic property data access. Accessing the stack is very rapid, as its only used for trivial data. The heap is an area of memory for dynamic memory allocation. The heap is used to store things in data that are not value types, usually objects and strings. The heap is slower to access, but larger in size.
Reference type tripping points
Reference types are basically pointers. These pointers can trip you up in interesting ways. For example suppose you have an object called MyObjectName:
var MyObjectName = new SomeClass();
and you decide to make someone else's object name the same as you're name
var OtherObjectName = MyName;
When you change MyName to be something else, you will also change OtherName.
This is because objects are a reference type. On the stack the object is a pointer reference to the heap. When you make OtherName equal you are pointing it to the same memory address as MyName. You can see this in action here
var MyName = new SomeClass();
var OtherName = MyName;
MyName = MyName.Name = "Joe";
//OtherName will now equal Joe
This is also the same for array's if you make 1 array equal another, you will not have 2 array's with the same value. You will have 2 variables that point to the same array.
So the same must work for value types right?
No
If you have 2 ints and assign one int to equal the other. The value on the stack will be copied to that int, and since the stack value is the actual value they will be independent of each other.
Boxing and Un-Boxing
When you have a value type and you want it on the heap you must convert it to an object. This is called boxing
var val = 3;
var x = (object)val;
However once you do this, the two variables will be independent from each other. So if you change x you won't change val and vice-versa.
To get the object back on the stack you must cast it back into an int. This is called un-boxing
var y = (int)x;
Custom error pages in Nancyfx (C# Web Framework)
To do custom error pages in Nancy you must implement an IStatusCodeHandler. This class must provide 2 methods. HandlesStatusCode is a bool that basically should tell Nancy if this class will handle the status code. If this returns true then this class will be responsible for handling the request.
Getting SquishIt to work with Nancyfx and Razor (...and other static content issues)
SquishIt is a content bundler and minification tool. The github documentation contains exaples how to install and use it, and a sample application is provided. However I had some issues getting it to work with razor so I figured I would share these pain points with you.
Admob with Xamarin Android Part 2: InterstitialAd
Interested in Interstital ads, but not banner? Thats ok, but I recommend your read my first post about banner ads. The first steps, installing Google Play Services, altering your permissions, adding to your manifests files, and reviewing my github demo are located in that tutorial.
Admob with Xamarin Android Part 1: BannerAd
This will be a brief overview on how to get admob working with Xamarin.
Disclaimer
I highly suggest you run this on a real phone. I'm not sure if the virtual phones can load content on the internet. I always develop on a real phone.
Sample code located in a repo at github
Installing NodeBB on CentOS 6.5
NodeBB is forum software written on Node.js
The official installation instructions are on github, but the documentation is for Ubuntu.
To install on CentOS follow these instructions.
Setting up robots.txt for your ghost powered blog
Setting up your robots.txt file for your blog is easy, by adding a file called robots.txt in the root of your current themes directory.
Parsing, and Nesting Models in backbone.js
The Parse Function
The parse function allows you to do some pre-processing of the data sent from the server before the model is created. Parse should return an object containing the values that will make up this models attribues. This is called after the fetch command has recieved the data, but before the response is put into the model. The example below parses dates to local time before adding them to the model using moment.