- Implementing OAuth in ASP.NET for a number of providers
- Get out there! Go to conferences, meetups, do it all!
- Get the Execution plan for a running query in Microsoft SQL Server
Get Microsoft SQL Server Execution Plan of a Running Query
EXEC sp_who2 'active' -- Find the SPID of the query you're running
DECLARE @spid INT = 123 -- From above
SELECT EQP.query_plan, *
FROM sys.dm_exec_requests AS ER
CROSS APPLY sys.dm_exec_query_plan(ER.plan_handle) AS EQP
WHERE ER.session_id = @spid
Once that bottom query runs, you’ll be provided a link in the results grid that you can click to open up the graphical execution plan.
- Have Git ignore changes you make to a specific file like you didn’t make the changes, but still have it be part of the tracked files in Git.
Preface: Let’s say you have a connection string configuration file that you change to point to your local database. That config file needs to be tracked in Git, but you don’t want your changes to accidentally get committed and pushed up to the remote repo, then this command is for you.
Git Assume File Unchanged
git update-index /path/to/file --assume-unchanged
- Pay attention to the warnings in your IDE. It’s easy to get used to seeing several warnings and ignoring them because they’re not errors. Eventually a new one that actually matters will show up and by ignoring it, you could be creating heartache for yourself. If you can, resolve the warnings that are currently showing up so that if a new one surfaces, it’ll jump out at you like a sore thumb.
- Git checkout specific branch: git clone [clone-url] –branch [branch-name] –single-branch
- Use npm to setup your packages for other devs: npm install –save or npm install –save-dev
- SQL Sentry Plan Explorer – thanks Jeff Belina!
- Finding/Replacing text in WebStorm
- Having problems with similar routes in multiple controllers in WebAPI?
Attribute routing to the rescue!
[Route(“api/customers/getName”)] in CustomerController.cs and [Route(“api/employees/getName”)] in EmployeeController.cs
- Don’t forget to add swagger to your WebAPI projects with Swashbuckle!
- Sometimes you want to modify a collection, i.e. a List<T> or Dictionary<TKey, TValue> for example, that you are currently iterating over in a loop. However, in .NET, you’ll get a “Collection was modified; enumeration operation may not execute” runtime exception if you modify the collection you’re iterating over. So what to do? One way is to use a new collection object that can either represent the desired end state, i.e. only contains the items you want in the collection, or a list of items to be added or removed, however, this may be inefficient depending on the items to be added or removed. It’s a common question on Stack Overflow. Here’s an example where Allen illustrates maintaining a separate list of modifications to be swapped in later.
- Efficiently processing multidimensional arrays requires processing the inner arrays first before moving onto the next array element. So if X is an array of arrays, where each Y is an array at some index of X, your pseudocode to process this might look like for each array in X, process each element in Y. This works great for row-major order array arrangements. If, however, you’re working with a , the idea is the same, however, because X and Y represent coordinates, we want to iterate over each X element first before moving on to the next Y. Therefore, your pseudocode would be for each Y array, process each element in X.
- Create a task with a reminder(s) for the exact date/time your password is going to expire. On a Windows box connected to an Active Directory domain controller, type net user yourid /domain where yourid is your domain id, which are commonly in the form of firstname.lastname or flastname but may vary for your organization. Find ;the Password expires value and use that to create a task to change your password at that exact time. Then set a reminder (or reminders) ahead of time, to remind you that your password is expiring soon, such as a 7 day reminder. That should give you plenty of advanced notice to change your password before it’s too late, and if it’s not convenient to do so at the time of the reminder goes off, you can always snooze the alarm until it is.
- Baoding Balls – Exercise your hands for better blood circulation and relax the muscles and joints. Maybe then you won’t need one of the above wrist guards.
- Up For Grabs – Get involved with Open Source Software. This is an easy way to see a list of projects that have tasks specifically intended for new contributors.
- Find problematic queries that are killing your SQL Server…replace 123 with the spid from sp_who2.
DBCC INPUTBUFFER(123)If you want to be mean….replace 123 with the spid from sp_who2KILL 123
Additionally, if there’s high CPU and low I/O, it’s likely either a missing or a fragmented index.
- Tortoise Git
- Tip of the week is the Pseudocode podcast
- Copy and Paste XML or JSON into Visual Studio and have it auto-generate classes to represent the data
1. Copy the XML or JSON
2. In Visual Studio 2012 & up, click the Edit menu, then Paste Special and choose XML as Classes or JSON as Classes
- git grep -e ‘TEXT-TO-SEARCH-FOR’ $(git rev-list –all –max-count=500)
-e is necessary for strings that begin with a dash and should be used for scripts where input is passed to git grep.Quoting the pattern string is optional, but a good practice.–max-count is necessary if you get errors like “argument list too long” or “bad file number”. Both mean that the rev-list is too large.
- Templates / Themes built for easy integration with ASP.NET websites. Buy a design that’s ready to open up in Visual Studio.
- from Matthew Watkins:
Ability to assign macros to any keys you designate in Windows.
- Launch a browser in Incognito Mode directly from Visual Studio
- Need lots of data to play with? Amazon has you covered with Public Data Sets.
- Be nice to your co-workers and provide smaller merge bubbles. Use git pull‘s rebase option. WARNING: Not recommended for history that has already been published.
- Talked about two common ways of storing hierarchical data in a relational system: Adjacency Model and Nested Sets
- Stay tuned for more!
- Let us know what you think about some shorter episodes
- Allen’s blog post, the post that kicked this all off!
- use a “WHERE” clause – if you’re writing a SQL UPDATE or DELETE, put the WHERE CLAUSE!!!
- http://www.apiary.io – build server side API’s without any code
- “When you’re online, no one knows you’re dead” – Have directions for your significant other or family members in case you pass away. How to get into emails, get backups, etc. We take things for granted as techies and there are a LOT of people who don’t know how to do what we do. Do we need a Wiki for our life?!
- Git tab completion for commands – turns out this is for Git Bash and not the Git runtime…so it’s kind of a tip, if you’re using Git Bash!
Revised his tip to use one of Allen’s previous – ConEmu!
- tip via Andy Joiner – @tekkiesuk
Using a database transaction to test out your queries before you actually run the statement (helpful for updates / deletes) – this helps you do a sanity check before pulling the trigger
- Allen’s – Video speed controller – Chrome plugin – tip via Mike Barlow – @bardev
- Tilt 3D – View your code like a cityscape. Or use it to see how your divs stack up, it’s up to you.
- MacBook Retina causing you to have DPI issues with your 2nd monitor when booted to Windows? #FirstWorldProblems. Use the Windows key + the plus key to zoom in. Or the minus key to zoom out. Or the ESC key to exit. Now you can see those tiny letters.
- SqlPin – Have some SQL statement that you’d like to have repeatedly ran? Thanks to @leeenglestone now you can.
- Generic Unit of Work and Repositories
- Reply All Podcast! – Message App, New to the Internet, Swatting, Interview w/ Wiki Grammar Enforcer
- Find out if you can do something in a browser: http://caniuse.com/
- RogueSharp – a starting point for creating your very own Rogue-like video game using C# and .NET:
- You can’t uninstall a program in Windows because the option isn’t there? Oh…when there’s a will, there’s a way:
- People lie except in the mornings.
- Igal Tabachnik demonstrates the beauty of ReSharper’s “greedy brace” operation. Ctrl+Alt+Shift+Up (or +Down)
- Use a List<T>’s Sort() method to sort in place vs Linq’s OrderBy() that creates a sorted copy.
- NOTE: In this episode, Allen mistakenly referred to a Linq Sort() method but meant List. As he mentioned, while there may be a memory benefit between the two operations, Linq’s OrderBy method has been demonstrated to be faster overall. The Quicksort algorithm is one of the default algorithms used depending on the size of the list.
- Layouts O Rama – Configure your own layouts for Visual Studio that you can easily switch between with the click on a button.
- Remote Desktop Connection Manager – Do not right click on the server name and select Logoff. You have been warned.
- Windows Phone 8.1 – Allen might have been a little late updating his phone but hey, now the podcast app has variable speed playback.
- Delete a line in Visual Studio: SHIFT + DEL
- Programming music: Aphex Twin – Syro
- SQL Server Query Hints – WITH NOLOCK, WITH ROWLOCK
- Joe’s tip – SQL Fiddle
- Allen’s tip – Object initializers in C#
- Michael’s tips – Notepad++
- Poor Man’s T-SQL formatter
- SQL Server Profiler
- Joe’s tip – SQL Search Redgate’s SQL Search
- Allen’s tip – Ctrl + , for Navigate To http://visualstudiomagazine.com/articles/2014/02/01/6-top-tips-for-visual-studio-2013.aspx
- Michael’s tip – HTML 5 game creator https://www.scirra.com/construct2
- Bookmarks in Visual Studio
- Debugging Object Initializers (again, oops!)
- Click a word in your Visual Studio editor window, once the word highlights, use Ctrl + F3 to find the next instance of the word in the file
- Clean Code recommended using static methods instead of constructor overloads: static methods instead of constructor overloads Color.FromHex(“#ffff00”) instead of Color(“#ffff00”)
- Visual Studio 2013 – 64 bit code editing while debugging
- CTRL Shift S – Save All in VS…including sln/csproj files!
- Square Selections
- Source Control Plugins Slow
- Learn Git Branching: