Useful extensions for Visual Studio

by Victor 21. October 2015 01:37

Web Compiler:
The easiest and most powerful way to compile LESS, Scss, JSX and CoffeeScript files directly within Visual Studio or through MSBuild.

Image Optimizer:
Lossless optimization of JPEG, PNG and Gifs - including animated Gifs

Bundler & Minifier:
Adds support for bundling and minifying JavaScript, CSS and HTML files in any project.

Web Analyzer:
Provides static analysis directly in Visual Studio for JavaScript, TypeScript, JSX, CSS and more

Querying BsonIgnore fields in MongoDB using LINQ

by Victor 8. October 2015 22:27

If you have a BsonIgnoreIfDefault attribute on a property, that property will not get serialized and persisted to your MongoDB database if its value is the default for its type. The default for reference types is null. The default for primitives are: int/double/long/decimal = 0, bool = false.


Now, let's take a look at a use case. Here, we want MiddleName to never be null, and to be an empty string if it's never set.


public class Person
    public string FirstName { get;set; }

    public string MiddleName
        get { return _middleName; }
        set { _middleName = value == null ? "" : value; }
    private string _middleName = "";

var john = new Person { FirstName = "John" };

PersonRepository.Where(p => p.FirstName == "John", p.MiddleName == "");


In this case, the query will not return anything because an empty string is the default for middle name and we told the serializer to ignore MiddleName if it's the default. So, in the database, this Person object is saved without a MiddleName field. In order to query for any Person that does not have a MiddleName, you have to use null, like so:


PersonRepository.Where(p => p.FirstName == "John", p.MiddleName == null);


.NET | C# | MongoDB

Formatting a phone number in .NET

by Victor 8. October 2015 22:24

If you save your phone numbers as only numbers, eg., 5615551234then you can use this code to format it for display:




which will output 561-555-1234. Neat huh?

Tags: , ,

.NET | ASP.NET | C# | Software Development

ASP.NET Bundling of AngularJS templates

by Victor 7. October 2015 23:47

Saving this link here for future reference. Great post on how to add your AngularJS templates to ASP.NETs bundling and minification process.

Tags: , , ,


Easy Javascript Unit Testing (QUnit, Jasmine, Mocha) In Visual Studio

by Kevin 3. October 2014 20:34

I recently found the need to do my JavaScript unit testing inside of my IDE(Visual Studio). I mean who wants to carry around two devices because one has features the other doesn't when you can have a single device do both?  So after struggling with finding a couple of bad eggs I came across the golden egg Chutzpah.  I found a nice post explaining how to hook it up so instead of writing a wall of text here I'm going to give you two URL's so you can go ahead and get your environment setup quickly and read the fluff later.


Tutorial: (Setting it up with AngularJS)

Chutzpah Git: 

Tags: , , ,

javascript | Visual Studio | Unit Testing

Rename database in MongoDB

by Victor 27. September 2014 00:42

db.copyDatabase('OldDatabaseName, 'NewDatabaseName');

use OldDatabaseName




LINQToExcel OLE DB Excel Provider Column Types

by Kevin 7. August 2014 02:51

Ran into an issue where the Excel OLE DB provider was saying a column type was unable to be set returning null for the columns values.  This was happening because the first 8 values read for the given worksheet were empty so the column type couldn't be set by the OLE DB provider.  Obviously this can happen to anyone, but in my special case of using LINQToExcel if you use the method called ExcelWorkSheetNoHeader() it removes the header row as a type and returns the whole excel file as a text values with the type of strings.

This will allow the provider to properly parse your excel file rather than returning empty columns because a data type couldn't be properly set.


That's it problem solved!

Hopefully that helped someone else who was stuck on this problem as well.

Tags: ,

.NET | C# | Visual Studio

Visual Studio javascript extensions

by Victor 23. July 2014 20:39

This one adds AngularJS intelisense:


This one adds outlining for regions, brackets, braces, and comments:


Tags: , ,

Getting full path in Windows Service

by Victor 14. July 2014 18:53

If you need the application path inside of a Windows Service you can use this property to get it. Something I always forget so here it is for easy reference.

Tags: , ,

.NET | C# | Software Development

Return a JSON object using mixedCase properties

by David 16. May 2014 20:17

Normally if you were to use JObject or something similar to return a JSON Object, the properties are formatted in whatever way you have them originally saved. So if you return an object from your Mongo or SQL database and they contain properties such as FirstName or CreditCard, the JObject returns them in exactly that manner, which may not match the naming scheme you use for Javascript, which may be mixedCase instead of CamelCase. 

The following code lets you do just that, return your code in mixedCase.

var jsonSerializerSettings = new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() };

var json = JsonConvert.SerializeObject(design, Formatting.Indented, jsonSerializerSettings);


Powered by BlogEngine.NET

About Us

Wuji Touch is a software consulting firm based in Delray Beach, Florida. We specialize in Microsoft technologies, but we also have experience with Progress OpenEdge, iOS, and Android development. This is our blog. These are the tales of the pains and pleasures we experience daily in our journey through 1s and 0s.

Month List