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

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

Visual Studio Conditional Pre-Build Event

by Victor 9. January 2013 08:35

Say, for example, you want to execute a pre-build event if the current configuration is not Debug. Then you can do it like so:


if not '$(ConfigurationName)' == 'Debug' [YOUR PRE-BUILD STATEMENT]

Sorting with CanJS

by Victor 20. December 2012 18:06

I need to sort a list based on the selected value of a dropdown. I didn't find anything built in in CanJS. The can.Model.List does not have a sort method. Luckily, Curtis created a fiddle that does sorting. I adapted his code a bit and added the dropdown.


You can see the jsfiddle here

Tags: , ,

Web Development | javascript

"Invalid column name 'CreatedOn'" - Entity Framework Code First

by Victor 7. September 2012 16:53

I started getting this error in a production system a day ago but nothing had changed in that application. The application is a REST web service and hasn't been touched in months. BUT, I did deploy a different application that uses the same database. The new application uses Entity Framework 5.0 and the existing application uses 4.3. Also, the new application uses Code First Migrations so a new table called __MigrationHistory was automatically added. It turns out that the existing application had automatic migration enabled. So, all I had to do was turn that off using this line of code and redeploy the dll.


I don't think automatic migrations should be enabled by default but I suppose some people would want it. Sometimes I think MS tries to put too many "automagic" features in their frameworks...

Tags: , ,

Entity Framework | Software Development | Web Development

Entity Framework 5.0!

by Victor 23. August 2012 01:33

Finally, Entity Framework 5.0 is out and it has a whole slew of new cool features. Well, they're cool in the sense that they're finally here but better late than never.

What’s New in EF5

EF 5 includes a number of new features and bug fixes to the EF4.3 release. Most of the new features are only available in applications targeting .NET 4.5, see the Compatibility section for more details.

  • Enum support allows you to have enum properties in your entity classes.
  • Spatial data types can now be exposed in your model using the DbGeography and DbGeometry types.
  • Performance enhancements - these are exciting. Essentially queries will be compiled automatically now. Read more here
  • Code First will now detect if you have LocalDb or SQL Express available for creating new databases. Visual Studio 2012 includes LocalDb, whereas Visual Studio 2010 includes SQL Express.
  • Code First will add tables to existing database if the target database doesn’t contain any of the tables from the model.

The EF Designer in Visual Studio 2012 also has some new features:

  • DbContext code generation for new models means that any new models created using the EF Designer will generate a derived DbContext and POCO classes by default. You can always revert to ObjectContext code generation if needed. Existing models will not automatically change to DbContext code generation.
  • Multiple-diagrams per model allows you to have several diagrams that visualize subsections of your overall model. Shapes on the design surface can also have coloring applied.
  • Table-Valued functions in an existing database can now be added to your model.
  • Batch import of stored procedures allows multiple stored procedures to be added to the model during model creation.


Here's a link to the getting started page of Entity Framework if you're new to it or want to see how to use features like Migrations.

Tags: , , , ,

Entity Framework | Software Development

Rotating text using CSS

by Victor 15. August 2012 21:18

This is a short style rule to help you rotate text in your html page using CSS.


.rotated-text {
    width:100px; height:20px; line-height:20px;
    -moz-transform: rotate(310deg);  /* FF3.5/3.6 */
    -o-transform: rotate(310deg);  /* Opera 10.5 */
    -webkit-transform: rotate(310deg);  /* Saf3.1+ */
    transform: rotate(310deg);  /* Newer browsers (incl IE9) */
    /* IE8+ - must be on one line, unfortunately */    -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.6427876096865394, M12=0.766044443118978, M21=-0.766044443118978, M22=0.6427876096865394, SizingMethod='auto expand')";      /* IE6 and 7 */    filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.6427876096865394, M12=0.766044443118978,            M21=-0.766044443118978, M22=0.6427876096865394, SizingMethod='auto expand');   /*    * To make the transform-origin be the middle of    * the object.      */
    margin:0 0 0 0;

Tags: , , , , , ,

ASP.NET | CSS | CSS3 | IE | Safari 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