Setting up Redis on Windows with Chocolatey

by Victor 22. January 2016 20:25
Step 1
Install chocolately (
Open cmd prompt as Administrator
Run the following:
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString(''))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin

Step 2
Install redis using chocolatey
Open cmd prompt as Administrator
Run the following:
choco install redis-64

Step 3
Set up redis to run as a service (if it didn't set it up automatically, check local services if "Redis" exists)
Open cmd prompt as Administrator
Run the following:
cd C:\ProgramData\chocolatey\lib\redis-64
redis-server --service-install ""

If the service won't start, open redis.window-service.conf and make sure the path in the logfile setting uses forward slash (/) not back slash (\). Also make sure the "logs" folder exists at C:\ProgramData\chocolatey\lib\redis-64\logs.
If you need to uninstall, run:
redis-server --service-uninstall
Here's a link to a free Redis explorer:

Tags: , ,

.NET | Software Development | Web Development

AngularJS - Browser autocomplete not updating model

by Victor 18. December 2015 00:15

This doesn't apply just to AngularJS but to any js framework that uses models. Some browsers (Safari, Chrome) have been known not to emit the change event when a user fills in a field using the autocomplete feature of the browser. Use this polyfill to have the change event fired

This still won't be enough to get the view value back into the model. But, now that you have an event to hook into you, you can use a directive like this to transfer the value from the view to the model.

app.directive('autoFillSync', ['$log', function ($log) {
return {
require: 'ngModel',
link: function (scope, elem, attrs, model) {
elem.change(function (event) {
Then use the directive on your input element
<input type='text' ng-model='city' auto-fill-sync />
This solution was inspired by this StackOverflow answer:

Tags: , ,

AngularJS | javascript | jQuery | Web Development

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: , , ,


Rename database in MongoDB

by Victor 27. September 2014 00:42

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

use OldDatabaseName




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

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: ,

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