Posts

Edit Default Visual Studio 2012 Item and Project Templates

After adding a new file or project within a Visual Studio solution there are certain settings that I always update.  Follow the steps below to edit the default templates so these settings become the default. Visual Studio 2012 Project and Item Template files are located here: C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\ItemTemplates C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\ProjectTemplates Add "public" to all new C# class files: Edit the Class.cs file by adding the word "public" in front of the word "class" The Class.cs can be found here: C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class\Class.cs After you're done, it should look like this: using System; using System.Collections.Generic; $if$ ($targetframeworkversion$ >= 3.5)using System.Linq; $endif$using System.Text; $if$ ($targetframeworkversion$ >= 4.5)using System.Threading.Tasks; $e

JavaScript Null Checking, Undefined and ! Unary Operator

Image
Google searches of "JavaScript null check" and "How to check for null in JavaScript" were returning results that left something to be desired in my opinion, so I compiled this list. See the code live here: JsFiddle:  http://jsfiddle.net/aaronhoffman/DdRHB/5/ Code also available here: https://github.com/aaronhoffman/utils/blob/master/JavaScript/NullChecks.js Comparison Chart: Hope this helps, Aaron p.s. I used a great tool Regex Pixie  http://www.regexpixie.com/  by StoneFinch  http://stonefinch.com/  to generate most of the code in this example (disclaimer, I currently work for them, however I would never promote a tool I don't use myself.)

Microsoft Excel 2013 Sort Pivot Table By Calculated Field

Image
Want your data to really pop ? Check out my latest project: Sizzle drag-and-drop interactive data visualization Sorting a Calculated field (or Value field) in Excel 2013 Pivot Tables may not be very clear.  Unlike the Row fields there is no option button in the column header allowing you to easily sort the column, but it is possible. In the example below, I have a Pivot Table with "ListItemAbv" as the Row and "Count of ListItemAbv" as a calculated field (there is also a filter on "RankOrder", but that is not relevant to the example) Notice that, by default, the Pivot Table is sorted by "ListItemAbv."  There is also an option button visible in the header column (A:3).  You can use that option button to easily sort the Pivot Table by "ListItemAbv." However, there is no option button available to sort the Pivot Table by the Calculated field "Count of ListItemAbv".  To sort by that calculated field, select

How to Turn Off Microsoft Arc Touch Mouse Scroll Sound Vibration

Image
I recently purchased a Microsoft Arc Touch Mouse and wanted to turn off the middle button wheel scroll sound vibration. It is possible, however perhaps not obvious.  First you need to download the "Mouse and Keyboard Center" executable available on this page https://www.microsoft.com/accessories/en-us/products/mice/arc-touch-mouse/rvf-00052#techspecs-connect . (direct link Win10 x64: https://go.microsoft.com/fwlink/?linkid=849754  ) Run the executable and install the software.  After the software is installed, turn off "Vibration." See image below: Hope this helps, Aaron p.s.  Want to make that next report really pop ? Check out this new tool I'm working on : drag-and-drop interactive data visualization

ASP.NET MVC 4 Membership, Users, Passwords, Roles, Profile, Authentication and Authorization

---------------- The easy way: Azure Site Extension to Add/Edit Users and Roles:  http://aaron-hoffman.blogspot.com/2016/08/aspnet-mvc-5-user-admin.html https://www.nuget.org/packages/AspNetUserMaintenanceAzureSiteExtension/ (old:  https://www.siteextensions.net/packages/AspNetUserMaintenanceAzureSiteExtension/ ) ---------------- ---------------- TLDR: Search for this line in your project and update it: WebSecurity.InitializeDatabaseConnection("DefaultConnection", "UserProfile", "UserId", "UserName", autoCreateTables: true); ---------------- There is a new Membership Provider in ASP.NET MVC 4 that can be used for Membership, Users, Passwords, Roles, Profile, Authentication and Authorization!  It is called the Simple Membership Provider .  It uses the WebMatrix WebData WebSecurity class as a facade. The Old Way You will no longer need to execute the old .NET 2.0 aspnet_regsql.exe like this: C:\Windows\Microsoft.NET\Framewor

Twitter Analytics: Thinc Iowa Popularity Contest

I find it more and more difficult to attend a conference without the assistance of Twitter.  It allows me to quickly get a feel for the room.  The quotes that landed well with people, what they disagree with, the interesting side stories of the day.  I've often thought the Twitter Search function lacks much of what I wish it could do/should do.  How would Q & A sessions be improved if Twitter was used to crowd source the questions (or the answers for that matter)?  This idea, of course, can be applied more broadly and is not just relevant to conferences.  Analyzing tweets based on #hashtags, instant polls of crowds - How would our world change if this data was put to use? Now this may be considered a bad  example (in every way) of what I mean, but let's take a look at some of the most occurring @mentions in Tweets that can be related to the Thinc Iowa closing party.  One reason I would consider this a bad example is because number of occurrences alone is not very meanin

Visual Studio Macro to Break on Every Method in File

While tracking down the source of certain features (read bugs) within overly complex applications, I have sometimes found it useful to break on every call to every method within a file. The functionality to "Break on Every Method" is not built into Visual Studio, but it is possible to set up the necessary break points through a macro.  I did not originally write this macro, but while trying to find it again at a recent job I couldn't, so I decided to post it here for safe keeping.  It is fairly primitive, but it gets the job done.  Simply place the cursor within the file you are working with right before the first method you want to break on.  The macro will then search through the file for each opening brace "{" and place a break point at each one.  Hope it helps someone. To "install" this macro simply open up your macro explorer, edit a module and paste this macro/method in.  If you do not have any macros you will need to record an empty macro fi