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: http://codeforcoffee.org/setting-up-angular-js-jasmine-and-karma-in-visual-studio/ (Setting it up with AngularJS)

Chutzpah Git: https://github.com/mmanela/chutzpah 

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);


Convenient C# .NET Regular Expression Tester

by Ethan 7. May 2014 01:51

Found a nice regular expression tester specifically for the .NET engine here.  It'll even give you the C# code to replicate what you tested!

Tags: , ,

.NET | C#

The version of SQL Server in use does not support datatype 'date'

by Rod 29. October 2013 20:51

Hey everybody!

It's been a while since I last blogged... anything, so I decided to post something a bit odd that happened to me today.

I've been developing software for over 3 years, and overall involved in professional industry for over 5 years, yet everyday there is always something that amazes me and leaves me wondering how did this program ever work?

In this particular case, I ran into the error "The version of SQL Server in use does not support datatype 'date'" when trying to deploy a windows service that worked perfectly on my local environment. The error was appearing when calling a stored procedure with a datetime as an input parameter VIA LINQ.

After a bit of research, it appears that the "Date" datatype was added to SQL Server 2008 and this error might appear then. Before the datatypes were smalldatetime and datetime. So I verify this:

My local environment was running SQL Server 2008. Check

The server I was deploying to was running SQL Server 2005. Wonderful. Upgrading the SQL server to 2008 was not an option.

So another bit of research and I found such a simple solution that throws the WTF alarm off: I changed the Dbtype parameter definition on the generated DBML designer.cs file (go to definition on the offending method accessed from the datacontext) from "Date" to "Datetime".

In other words I changed this:

public ISingleResult<GetMethodResult> GetMethod([global::System.Data.Linq.Mapping.ParameterAttribute(Name = "UpdateDate", DbType = "Date")] System.Nullable<System.DateTime> updateDate)
 IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), updateDate);
 return ((ISingleResult<GetMethodResult>)(result.ReturnValue));

public ISingleResult<GetMethodResult> GetMethod([global::System.Data.Linq.Mapping.ParameterAttribute(Name = "UpdateDate", DbType = "Datetime")] System.Nullable<System.DateTime> updateDate)
 IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), updateDate);
 return ((ISingleResult<GetMethodResult>)(result.ReturnValue));


That's it! Problem solved.

Until the next time,

Stay programming my friends!


ASP.NET | Linq | Software Development | SQL

Excel - Trim all cells

by Victor 31. May 2013 07:52

Here's a macro to trim all selected cells:


Sub TrimCells()
    Dim R As Range
    Application.EnableEvents = False
    On Error GoTo ErrH:
    If TypeOf Selection Is Excel.Range Then
        For Each R In Selection.Cells
            If R.HasFormula = False Then
                R.Value = Trim(R.Value)
            End If
        Next R
    End If
    Application.EnableEvents = True
End Sub

Tags: ,

Detecting the File Download Dialog in the Browser

by Victor 11. January 2013 19:22

I ran into a scenario in which I needed to know when a PDF file finished "rendering" to the browser. Actually, it was being served as an attachment. Either way, I needed to know when the client got the response back from the server. This stumped me for a while until I found this extremely useful block post describing a very elegant solution using a cookie. The gist of it is to create a token on the client side and send it to the server with your file request. I did it via the query string. On the server side, when the pdf is done, add a cookie with the value of the token. Back on the client side, poll for a cookie with the token. That's it! Check out the full explanation here.

Tags: ,

javascript | jQuery | Software Development | Web Development

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