Sunday, September 14, 2014

This is my next: Site Reliability Engineer at Stack Exchange

AvoidInjuryIn my career I have been very lucky to work with some great people at incredible companies, and although there have been a few curveballs along the way I have always felt like I was exactly where I was supposed to be. Well a few months ago I stumbled across an open position at a company I admire that fit my skill set, and while I was enjoying my current position at 3M HIS I knew I would regret if I didn’t at least investigate the opportunity. Fast forward to today and I am excited to announce that next week I will be starting a new job as a Site Reliability Engineer (SRE) at Stack Exchange focusing on Windows and PowerShell.

The company is based out of New York, but I will be working remotely from home to make sure that the world’s best network of Q&A sites is always available to answer any questions you may have ranging from Bicycles to Mathematics, Scifi to Skeptics, and Cooking to Home Improvement. I have used their original trilogy of websites on just about a daily basis to get answers to questions about programming, system administration, and general PC issues. I have watched as the company grew from a idea about how to improve the Q&A experience into one of the top 100 network of websites in the US and experienced a few curveballs of their own along the way.
In my new position I will get to work with an all-star team of system administrators and software developers and be a part of a community that has quickly become an integral part of the software development experience (and other online communities). I am excited to be in a position where sharing knowledge and experience is a core tenant of the company and where I am encouraged to both use and contribute to open source projects. I can’t wait to dig into the Tools and Hardware, and who knows, I may even have something interesting to talk about at a future users group or conference.

Create TFS Patch File With Pending Changes using TF and 7Zip

I recently had to do a TFS migration and upgrade and during that process needed a way to copy pending changes between the Production and Staging TFS servers. The goal was to be able to test the upgrade in a stage environment, modify the build scripts so that they worked using a new code structure, and then create a patch file that could be applied to the production instance of TFS. I checked online and found a solution that used the unified diff feature of the tf.exe program, but this didn’t work very well if you had to checkout or add many files as part of applying the patch. Also instead of creating a large TXT file I wanted a ZIP file that had full versions of all the files that were modified in the current workspaces.
After playing around with the tfvc commands I was able to write up a PowerShell script that would detect any pending changes in your current workspace and then use 7Zip to create a patch file with just those files. Here is an example of the Export-TFSPatch.ps1 script:
image
Here you can see it detected 10 files that were checked out in the workspace and created a zip file with just those files:
image
You can then copy that zip file to another system and use the Apply-TFSPatch.ps1 script to apply those changes to the new workspace. This includes checking out any existing files so they can be overwritten and adding any new files from the patch to the TFS workspace.
image
After applying the patch you can then use TFS to check in the pending changes on your workspace:
image
If you want to use these scripts you can find them at my CodeBlog Github repository.
The TF.exe command is very sensitive to which version of Visual Studio you used to create your workspace, so if it complains try changing the $tfexe variable to use 11.0 (VS2012) or 12.0 (VS2013).

Wednesday, June 25, 2014

Notepad++ Save As Admin Plugin

I’ve used Notepad++ for a while now, but only recently started exploring all the various plugins that are available. One very helpful plugin is called “Save as Admin”, which can overcome a common issue when trying to edit files for which the local Users group does not have modify permissions. This often happens with web.config files, which by default live in a folder that only Administrators can modify. Even if you are a member of the Administrators group, you will still receive a “Save Failed” error message asking “Please check if this file is open in another program.” when you try and save any changes:

Please check if this file is opened in another program

If you check the permissions of the file, you will see the Users group only has read & execute, and does not have modify permission:

image

To fix this you have a few options:

  1. Close Notepad++ and re-open it as an administrator.
  2. Use the edit button on the security tab of the file properties to give the Users group or your individual user modify permissions.
  3. Save the file to another location like your desktop, and then copy from there into the destination folder. This will cause Explorer to display a “You must be an administrator to perform this action” window, but it will allow you to use your Administrator role to complete the action.
  4. Use the “Save as Admin” plugin in Notepad++ to elevate to the Administrator role and save the file.

If you have already made changes to the file and do not have the plugin installed, option 2 or 3 is the only way to keep those changes (the others require closing and reopening Notepad++). Once you install the “Save as Admin” plugin you can then use that to overcome any permissions issues.

To install the plugin open the Plugin Manager:

image

Type the letter S to find “Save as Admin” and check the box. You can install multiple plugins at once, and I recommend also adding “Compare”, “Reload"Button”, and “XML Tools”.

Save as admin plugin

Once you have selected the plugins you want press the Install button. It will download and install the plugins, most of which show up under the Plugins folder. When finished it will prompt you to restart Notepad++

image

NOTE: if you had pending changes to a file you may see the following:

image

There are actually two dialogs here, and the second one is hidden. You will need to click the grey bar behind the blue bar (or just click on Notepad++ in your task bar) to display the hidden window:

image

Here you should press no (loosing any changes) or yes and save to another location. Notepad++ should then restart. Now when you try to save a file that requires Administrator privileges you will get a UAC prompt:

image

Pressing Yes will allow Notepad++ to save the file using your administrator role.

Monday, January 6, 2014

Tx.Windows Parsing WC3 IIS Log files in LINQPad and PowerShell

I saw a tweet today from the @ReactiveX account about a new release called Tx (LINQ to Logs and Traces). It appears to have a lot of plumbing to use the Reactive Extensions (Rx) to parse through Event Logs and Event Tracing files. One of the slides on the Tx Codeplex site also mentioned parsing IIS W3C Logs, which is something I spend a fair amount of time doing.

Even better Tx has a custom LINQPad Driver, which is one of my favorite tools for playing around with LINQ and Rx. I downloaded the sample traces and was able to view low level event tracing details from the HTTP.sys driver used by IIS, but I didn’t immediately see how to parse the IIS log files using Tx. After downloading the source I found a W3CTest.cs file that showed how to parse log files using the Tx.Windows.W3CEnumerable.FromFile or FromFiles methods.

To use this in LINQPad you do NOT need the Tx Driver, but instead you use F4 to add a reference to the Tx.Windows Nuget package:

image

image

Once the reference is added to your LINQPad query, you may also want to add the following additional namespace imports:

image

This gives you access to the common LINQ functions used in the Tx samples. Now I can write a query in LINQPad that uses the W3CEnumerable to parse the log files. You can write complex LINQ queries or use the toDataGrid parameter of the Dump method to display the data in a grid format:

image

After I had it working in LINQPad, I next thought: “Why can’t I use this in Powershell?”. The Tx library targets .NET 4.0 and 4.5, so as long as you have PS 3.0 or later you can add a reference to the Tx.Windows.dll and then use the W3CEnumerable class to work with Log files.

#Load Tx.Windows.dll from current user’s LINQPad nuget local cache
[Reflection.Assembly]::LoadFile("C:\Users\$($env:username)\AppData\Local\LINQPad\NuGet\Tx.Windows\Tx.Windows.1.0.31229\lib\Net40\Tx.Windows.dll")

#Load log file and sent output to screen
$log = [Tx.Windows.W3CEnumerable]::FromFile("C:\inetpub\logs\LogFiles\W3SVC1\u_ex131230.log")
$log | select -Last 10 |  ft dateTime,cs_method,cs_uri_stem,cs_uri_query,cs_username,sc_status,time_taken

#Sent log to gridview
$log | out-gridview

image

The Gridview is very helpful since you can add filters to target specific entries similar to a LINQ query

image

All this in the first hour of playing with Tx! I am really excited to see if we can use Tx with IIS Failed Request Tracing or ASP.NET Tracing to track down issues in our .NET web apps.

Tuesday, February 12, 2013

Samsung Epic 4G CyanogenMod Notes and Links

Up until a few months ago I very much enjoyed having the Samsung Epic 4G as my personal phone. It is the best Android phone with full QWERTY keyboard that I have ever used, but the hardware is a bit dated and the WiMax speeds were not as fast as LTE, so I decided to upgrade to the Galaxy Note II on Verizon. Samsung stopped updating the software on the Epic 4G a while ago, but the CyanogenMod community has done a great job at supporting the phone and even has Android Jelly Bean 4.1 ROMs with full functionality. I still have friends with the Epic 4G so I thought I would post all the links I used for loading custom ROMs.
Most recent versions (As of January 2013)

Sprint has Steps to activate phone, which includes instructions for activating a used phone. These may not work in CM 10, but I usually put a temporary boot ROM on the SD card that will boot into the stock FC09 ROM
Temporary Stock Boot Instructions:
  1. Boot into CWM5 on your Epic 4G
  2. Install zip from sdcard > choose zip from sdcard > multiboot > FC09 > boot_FC09.zip
  3. WAIT.  It will take a while to boot.  You might see a "com.android.phone is not responding", do not worry, it is harmless.  Wait until Media Scanning is complete before doing anything.
  4. Follow instructions for activating phone or calibrating tilt sensor
You can also revert the Epic 4G to original locked boot loader and stock ROM if you have any issues with the custom ROMs or have to take it in for service/support.
Hope this helps any Epic 4G users out there. If Samsung ever decides to make another Galaxy S phone with a keyboard definitely will consider buying it, but for now I am enjoying the Galaxy Note II with flygrip.

Wednesday, May 25, 2011

Looking for a .NET programmer in Salt Lake City, Utah? You should hire me!



UPDATE 6/01/2011: I have accepted a great position at GE healthcare that interestingly has very little to do with .NET and everything to do with making better software. I look forward to diving back into Linux and BASH scripting and am already having nightmares about Oracle!

UPDATE 5/15/2013: Although I am still working for GE (Now part of a joint venture with Microsoft) I am also actively looking for new challenges in Software Engineering or Developer Operations.

UPDATE 8/01/2013: No longer active on the job market. I have accepted a position with 3M Health Information System and am excited to bring some DevOps to a company most known for making office products :-P

UPDATE 7/14/2014: The examples in this post are a bit dated now (see full resume instead), but I occasional still get emails about job opportunities. I am happy at 3M but am always open to new opportunities involving .NET/SQL/Powershell. If the word Help Desk or Phone Support is in the job description though I will probably ignore any emails you send.

My 30 second over-hyped elevator pitch:
The most hirable man in the worldMost people don’t have the time to read through a full resume nowadays, so I’ll keep things short and to the point. You should hire me! Why? Because I am smart and I get things done. The last time I was in the job market I turned a 3 week software testing project into a 6 year pursuit helping to convert a small ISV into a cloud driven heavyweight. I don’t always code in .NET, but it is definitely my platform of choice. Life is too short to worry about pointers and memory leaks. If I wanted to do that I’d go back to working in assembly language on an 8086 like God intended. I can automate just about anything using a combination of BASH, PowerShell, AutoIT, VBA, WatiN, MSAA, a bunch of HWNDs, a packet sniffer, a few servos, and a roll of duct tape. I work well as part of the A-Team or sent out solo in the wild like Rambo. In short: I am the most hirable man in the world! :-P Keep coding my friends!

I live my life like an open book, indexed by Google. I have a thirst for knowledge and a passion for technology. I pay great attention to detail and strive for nothing less than perfection. A lot of my past projects are internal or backend systems, but below is a sample of what has kept me busy over the last decade or so.



Personal Coding projects:
PhraseMeme Scanner, WinFone Alpha (Windows Phone, 2010-2011)
Silverlight port of ZXing Barcode Scanning library (Silverlight, C#, 2010-2011)
Texas Holdem Monte Carlo Simulator (Silverlight, Windows Mobile, 2009)
Resolver one: Texas Holdem, Pivot Charts/Auto filter, Web page automation, WPF Charts, Mad Lib generator (IronPython spreadsheet, 2009)
GnuMap P2P Mapping project (Visual Basic, Web Spider, aiSee, 2002)




Samples of documents I have created:
High level overview graph (Visio 2007)
Detailed technical overview chart (Visio 2009)
In depth technical documentation (Word 2008)
Short section of web based training material (PowerPoint 2010)
Samples of feedback reports w/ synopsis (Acrobat 2006)
Flash Memory Summit Conference Presentation (PowerPoint 2007)





Screencasts and videos of project I have created:
PhraseMeme scanner demo video (3 mins, Camtasia, PowerPoint 2010)
WinFone Alpha demo video (3 mins, Camtasia, PowerPoint 2010)
Texas Holdem Monte Carlo Simulator (5 mins, Camtasia, PowerPoint 2009)




Coding Competitions:
PhraseMeme Scanner received good rankings in Windows Phone 7 Competition sponsored by Red Gate (2010)
Texas Holdem app received honorable mention in 2009 INETA Code Challenge and 2009 Telerik Silverlight contest
Monte Carlo spreadsheet was the winner of $4,000 prize in April 2009 round of Resolver One Challenge

Monday, January 17, 2011

InvalidOperationException from IsolatedStorageSettings.Save on Windows Phone 7

I just had my first failed test from the marketplace certification for PhraseMeme Scanner v1.2. You can view the full error report here, but the important part is:

Comments: The application terminates unexpectedly when the user turns on/off one of the setting while trying to scroll to

another page.

Steps to reproduce:

1. Launch the application.

2. Scroll over to the setting menu.

3. At the same time, press and scroll on any of the settings.

4. Notice the application terminates unexpectedly when the user turns on/off one of the setting while trying to scroll to

another page.

The settings page uses ToggleSwitches from the Silverlight for Windows Phone Toolkit with a simple two-way binding to a values stored in an IsolatedStorageSettings class, so I was a bit confused where the error was coming from. Using Visual Studio I found that the IsolatedStorageSettings.Save method was throwing an InvalidOperationException whenever the user changed a setting and navigated way from the page at the same time.

The MSDN documentation doesn’t mention that the method can throw this error, but my guess is that either the value is in an indeterminate state or there is a conflict between the save method and the two-way binding. The error could have been there all along, but in this version I had moved all the IO calls to background threads to increase performance where as previously the exception was captured by a try/catch block on the calling method.

Luckily it was an easy fix: I added a try/catch statement to the save code block and inserted a delay to let whatever processing it was conflicting with finish before it tried to save the settings. Below is the new code that can be used for saving settings stored in an IsolatedStorageSettings class:

/// <summary>

/// Save settings to isolated storage. Will run using background thread to prevent blocking UI thread.

/// </summary>

public static void Save()

{

    ThreadPool.QueueUserWorkItem(func => {//Save items using background thread.

        try

        {

            //NOTE: may throw InvalidOperationException exception if user is in process of changing settings and navigating away from page

            System.Threading.Thread.Sleep(200);

            issSettings.Save();

        }

        catch (Exception ex)

        {

            Debug.WriteLine("Error saving settings: " + ex);

        }

    });

}

 

Hope that helps someone prevent a failed submission to the marketplace.

Blog.TheG2.Net - Your guide to life in the Internet age.