My quick and dirty way of doing it. The target tag is the most relevant part if you're already using NLog.
This is just a spot to keep miscellaneous links. It also shows you what a geek I am.
Thursday, April 10, 2014
Wednesday, April 09, 2014
My Favorite .NET Code Decorations a.k.a. Attributes
[MethodImpl(MethodImplOptions.Synchronized)]
The method can be executed by only one thread at a time. Locks the instance or, for static methods, the class.[EditorBrowsable(EditorBrowsableState.Never)]
Hides a method from Intellisense.Thursday, March 27, 2014
Migrate away from MSBuild-based NuGet package restore
Very nifty trick. In the end, your solution will look like the following. Note the .nuget folder has only a NuGet.Config file:
Link: http://www.xavierdecoster.com/migrate-away-from-msbuild-based-nuget-package-restore.
Here are the instructions on how to undo it: http://docs.nuget.org/docs/workflows/migrating-to-automatic-package-restore. Note: where the article says "using TFS," read it as "using version control" because the instructions also apply to Git.
Update 4/4/14: You might have to close the solution and delete any .suo files or Visual Studio will stubbornly bring back the .csproj settings that you deleted.
Update 4/9/14: This doesn't appear very stable when using version control features where you backtrack in history -- for instance to merge a feature branch. Visual Studio stubbornly resurrects the import and target tag in the project file, and killing this won't work unless you first close the solution and delete the .suo file.
I'm actually considering moving back to NuGet package restore. At least it's reliable.
Second update 4/9/14: This doesn't play well with ReSharper's cool feature where it automatically adds NuGet packages to a project instead of just a reference.
Link: http://www.xavierdecoster.com/migrate-away-from-msbuild-based-nuget-package-restore.
Here are the instructions on how to undo it: http://docs.nuget.org/docs/workflows/migrating-to-automatic-package-restore. Note: where the article says "using TFS," read it as "using version control" because the instructions also apply to Git.
Update 4/4/14: You might have to close the solution and delete any .suo files or Visual Studio will stubbornly bring back the .csproj settings that you deleted.
Update 4/9/14: This doesn't appear very stable when using version control features where you backtrack in history -- for instance to merge a feature branch. Visual Studio stubbornly resurrects the import and target tag in the project file, and killing this won't work unless you first close the solution and delete the .suo file.
I'm actually considering moving back to NuGet package restore. At least it's reliable.
Second update 4/9/14: This doesn't play well with ReSharper's cool feature where it automatically adds NuGet packages to a project instead of just a reference.
Wednesday, March 05, 2014
Thursday, February 20, 2014
Tuesday, February 18, 2014
How to do a rebase with git gui
Who knew? I thought it wasn't possible, but apparently it is if you modify git config.
http://stackoverflow.com/questions/4830344/how-to-do-a-rebase-with-git-gui
http://stackoverflow.com/questions/4830344/how-to-do-a-rebase-with-git-gui
Add this to the .gitconfig file in your home directory to add rebase commands to the Tools menu:
[guitool "Rebase onto..."] cmd = git rebase $REVISION revprompt = yes [guitool "Rebase/Continue"] cmd = git rebase --continue [guitool "Rebase/Skip"] cmd = git rebase --skip [guitool "Rebase/Abort"] cmd = git rebase --abort [guitool "Pull with Rebase"] cmd = git pull --rebase
Wednesday, January 29, 2014
AngularJS Dependency Injection Cheatsheet
I finally get it. A cheatsheet for AngularJS dependency injection is as follows:
The core Angular dependencies (those in ng) are not listed in the angular.module() call, but they are listed in the .controller() call and in the function signature.
The 'What_it_provides' name seems to be used by the dependency injection framework in calls to angular.module(), i.e. the provider name, e.g. SomethingService. But the name would just be Something.
The 'Name' name seems to be used in parameter lists of implementation functions and in calls to controller(), factory(), etc.
See the example from the AngularJS tutorial step 11.
var somethingController = angular.module('What_it_provides', ['what', 'it', 'depends', on']);
somethingController.controller('Name', ['$what', '$it', 'depends', 'on', function('$what', '$it', 'depends', 'on') {
// implementation, which returns a value, presumably.
}];
somethingController.controller('Name', ['$what', '$it', 'depends', 'on', function('$what', '$it', 'depends', 'on') {
// implementation, which returns a value, presumably.
}];
The core Angular dependencies (those in ng) are not listed in the angular.module() call, but they are listed in the .controller() call and in the function signature.
The 'What_it_provides' name seems to be used by the dependency injection framework in calls to angular.module(), i.e. the provider name, e.g. SomethingService. But the name would just be Something.
The 'Name' name seems to be used in parameter lists of implementation functions and in calls to controller(), factory(), etc.
See the example from the AngularJS tutorial step 11.
Friday, January 24, 2014
Tuesday, December 03, 2013
Remote Desktop Keyboard Shortcuts
There's some cool stuff in here!
From the article:
From the article:
http://www.mydigitallife.info/keyboard-shortcuts-in-remote-desktop-connection-rdc-for-navigation/
- CTRL+ALT+END: Open the Microsoft Windows NT Security dialog box (CTRL+ALT+DEL)
- ALT+PAGE UP: Switch between programs from left to right (CTRL+PAGE UP)
- ALT+PAGE DOWN: Switch between programs from right to left (CTRL+PAGE DOWN)
- ALT+INSERT: Cycle through the programs in most recently used order (ALT+TAB)
- ALT+HOME: Display the Start menu (CTRL+ESC)
- CTRL+ALT+BREAK: Switch the client computer between a window and a full screen
- ALT+DELETE: Display the Windows menu
- CTRL+ALT+Minus sign (-): Place a snapshot of the entire client window area on the Terminal serverclipboard and provide the same functionality as pressing ALT+PRINT SCREEN on a local computer (ALT+PRT SC)
- CTRL+ALT+Plus sign (+): Place a snapshot of the active window in the client on the Terminal server clipboard and provide the same functionality as pressing PRINT SCREEN on a local computer (PRT SC)
Monday, November 04, 2013
15 Famous Business Books Summarized In One Sentence
Famous Business Book Summaries - Business Insider -- "Want to read 15 famous business books in under a minute?
To save you some time and money, we've made it possible. We boiled down some of the most popular and influential business books out there to their central lessons.
For those looking to bone up on some business theory, here are the highlights."
To save you some time and money, we've made it possible. We boiled down some of the most popular and influential business books out there to their central lessons.
For those looking to bone up on some business theory, here are the highlights."
Monday, July 22, 2013
How to automatically number paragraphs in Word 2007
Finally!
http://www.dummies.com/how-to/content/numbering-headings-in-word-2007-multilevel-lists0.html
The Shauna Kelly site has a 404. At least I think so -- her 404 is so confusing that I'm not even sure I'm looking at a 404. In any case, no instructions are found on her site on how to actually do it.
http://www.dummies.com/how-to/content/numbering-headings-in-word-2007-multilevel-lists0.html
The Shauna Kelly site has a 404. At least I think so -- her 404 is so confusing that I'm not even sure I'm looking at a 404. In any case, no instructions are found on her site on how to actually do it.
Wednesday, February 20, 2013
Tuesday, January 15, 2013
Finding jQuery Event Handlers with Visual Event
This looks incredibly useful: Finding jQuery Event Handlers with Visual Event
Monday, April 02, 2012
10 Value Proposition Examples
Next time someone asks you to write value propositions, you can refer to this page for ideas. 10 Value Proposition Examples:
'via Blog this'
'via Blog this'
Tuesday, March 20, 2012
Using Backbone.js with CoffeeScript | Atomic Spin
Using Backbone.js with CoffeeScript | Atomic Spin - great advice on writing idiomatic CoffeeScript for use with Backbone.js.
Monday, January 09, 2012
Wednesday, November 23, 2011
MVC3 app_code directory
I just found out from K. Scott Allen’s MVC3 training video on Pluralsight that the app_code directory in MVC3 is alive and well. Basically the Razor helpers here are pre-compiled and can be accessed globally in the application.
Apparently the usage in a Razor page is as follows:
@Common.Script(“myscript.js”, Url)
Note to self: compare and contrast with shared “editor” partial views.
Note: I composed this post with Windows Live Writer 2011 but it doesn’t seem to play well with Blogger’s own editor. ¡Qué pena!
Tuesday, October 25, 2011
MVC3 ModelState and overwriting model properties
I will expand this later, I swear.
Caution: when you are using strongly typed models in MVC3 and you modify a property of the model in an Action, that property will get discarded when you create the view unless you clear the ModelState first. When building the view, the model fields are overwritten with values from ModelState, so clearing the ModelState prevents this.
UPDATE 11/10/2011:
This only applies to values passed in via a POST (or a GET?) that you're attempting to override by changing the corresponding fields in the view model.
UPDATE 11/10/2011:
This only applies to values passed in via a POST (or a GET?) that you're attempting to override by changing the corresponding fields in the view model.
Wednesday, October 19, 2011
How To: Reset Identity column in SQL Server
Who knew? How To: Reset Identity column in SQL Server
In a nutshell:
DBCC CHECKIDENT('Company', RESEED, 1)
Thursday, October 13, 2011
RegExes for replacing MVC3 hard-coded hrefs with @Url.Content hrefs
I'm posting this here mainly as a memory aid for myself.
My app is sprinkled with lots of links like this:
I'd like them to look like this, since NuGet seems to be cognizant of such references and apparently changes them on upgrades:
So the following search and replace with RegExes will work:
Include the quotes, and be sure to select "Use regular expressions."
Note that the consistent relative path "../../" must be changed as per your circumstances.
UPDATE on 11/2/11:
This "Replace With" parameter might be better:
"@Href("~\1")"
My app is sprinkled with lots of links like this:
<script src="../../Scripts/jquery-ui-1.8.11.min.js" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.min.js")" type="text/javascript"></script>
So the following search and replace with RegExes will work:
| Find what: | "\.\./\.\.{/[^"]*}" |
| Replace with: | "@Url.Content("~\1")" |
Include the quotes, and be sure to select "Use regular expressions."
Note that the consistent relative path "../../" must be changed as per your circumstances.
UPDATE on 11/2/11:
UPDATE on 11/22/11:
Now, according to this article, I see that Url.Content is supposed to be better anyway.
Now, according to this article, I see that Url.Content is supposed to be better anyway.
