Monday, November 2, 2009

DevTnT 15 – Reflector Power Commands

Reflector Power Commands is a collection of additional Reflector commands that includes such goodies as “Reorder Assemblies” “Enum Viewer” (with Bit Flag calculator), “Assembly List Import/Export”.

PowerCommandsImages

The CodePlex site does a good job of describing all commands.  For those who want to dive a bit deeper, there’s a blog post that describes installation and the finer points of usage. The post is written in an Asian-looking language but there are lots of images that tell you all you need to know.

Friday, October 16, 2009

DevTnT 14 – IxEdit

IxEdit is a JavaScript-based page-plug-in that helps you to design jQuery-based interaction on a web page.  Designers (and developers as well) need only have a basic knowledge of HTML and CSS, but no JavaScript experience.

ixedit

You can design interactions like showing, hiding, or animating (to name just a few) elements based on user actions (like clicking on an element).  The design work is done by selecting elements and setting properties for actions, reactions, … The finished script can then be exported for inclusion in your web page.

IxEdit uses Google Gears and local database storage to save you work – that means that you’ll still have your lovingly crafted interactions after the html page is refreshed.

Friday, September 25, 2009

DevTnT 13 – StyleCop for ReSharper

In my previous post, I talked about StyleCop and how it helps you to enforce a consistent source code style throughout your project. However, StyleCop only flags violations but does not fix them – even though most of the times the fix is trivial.

Enter StyleCop for ReSharper, a plug-in for ReSharper that will show StyleCop violations in real time, and offers a number of quick fixes (light bulbs) for most cases.

stylecopresharper

StyleCop for ReSharper includes an automatic update detection mechanism and will prompt you if a new version is available.

DevTnT 13 – StyleCop

Most people agree that having a consistent coding style throughout a solution is beneficial to the development process.  In the past it has been difficult to enforce a style, though.  StyleCop is one answer to that problem.

StyleCop – the tool formerly known as Source Analysis – is a tool that analyzes C# code and warns about violations against “a common set of best practices for layout, readability, maintainability, and documentation of C# source code.” It can be run from inside Visual Studio, and can also be integrated into MSBuild scripts.

When run inside Visual Studio, StyleCop integrates with the Error List tool window, and double-clicking on a warning will take you to the appropriate spot in your source files.

stylecop

It is possible to configure which rules StyleCop should check, however it is not possible (yet) to modify existing rules or define your own rules.

StyleCop can also be used as part of your build process using the out-of-the-box MSBuild integration.

DevTnT 13 – GhostDoc

GhostDoc is a plug-in for Visual Studio that can automatically generate XML comments. GhostDoc uses a configurable rule set to derive meaningful comments for constructors, events, properties and events.

For example: XML comments for constructors should start with “Initializes a new instance of the <classname> class.” GhostDoc can automatically generate that comment.

A method called “button1_Click” will be commented with “Handles the Click event of the button1 control”, complete with comments for the parameters.

A property “NameOfTheUser” will be commented “Gets or sets the name of the user”.

The rules of GhostDoc can be extensively customized, but in my experience this usually isn’t necessary because the default rules are pretty good.

GhostDoc_Config_771x637

One disadvantage of GhostDoc is that there is no official support for documenting an entire class (or project or solution) at once. There is an unofficial Visual Studio macro that does exactly this, though: http://jb-brown.blogspot.com/2008/09/using-ghostdoc-in-macro-to-comment.html.

Friday, August 28, 2009

DevTnT 12 - Firefox Plug-In: MeasureIt

MeasureIt is a Firefox that enables you to measure the size of parts of the page you are viewing. MeasureIt shows up as a small button in the lower left corner of the Firefox window.

When you click on the button, the browser window will be overlaid with a whitish layer and the cursor turns into a cross.  Click and drag the cursor over the area you want to measure.

measureit

A floating element will show the size of the select area.  Clicking on the red square with the white cross will close the ruler but keep the whitish overlay. Pressing Esc on the keyboard removes the overlay.

DevTnT 12 – Firefox Plug-In: Screengrab

Screengrab is a plug-in for Firefox that enables you to take a screenshot of (part of) the current web page.  You will find Screengrab in the lower right corner of the browser window.

Screengrab

You can either save the screenshot to a file or copy it to the clipboard.

DevTnT 12 - Firefox Plug-In: WCAG ColorChecker

WCAG ColorChecker is a Firefox plugin that enables you to test the colors of a web page for easy readability with regard to contrast and several Discromatopsia. It installs itself as a button in the lower left corner of the status bar. Clicking on the button opens a side panel. You can select elements or colors on the page using ColorZilla, and ColorChecker will show you its results using either a green check mark or a red cross next to the criteria.

ColorChecker

DevTnT 12 - Firefox Plug-In: ColorZilla

ColorZilla is a Firefox plug-in that enables you to determine which color an element on a web page is using. Click on the Eyedropper tool in the bottom-left corner of your Firefox window. The cursor will turn into a cross and the html element you’re hovering on will have a red border. The color values of the element you click on will be added to the status bar.

ColorZilla2

ColorZilla also contains a color- and palette-manager. You can open it by right-clicking anywhere on the page, pointing to ColorZilla and selecting either Color Picker or Palette Browser.

ColorZilla

DevTnT 12 - Firefox Plug-In: Microsoft .NET Framework Assistant

Microsoft .NET Framework Assistant is a plug-in that is installed as part of a hotfix for version 3.5 SP1 of the .NET Framework. It enables you to install ClickOnce-applications using Firefox.

DotNetFrameworkAssistant

Not everybody is happy about this plug-in being installed automatically. In addition the plug-in cannot be easily uninstalled because it is a computer-level plug-in.  There is a documented way of uninstalling it, though: http://support.microsoft.com/kb/963707/.

DevTnT 12 - Firefox Plug-In: IE Tab

IE Tab is a plug-in for Firefox that enables you to display web pages in a Firefox tab using the Internet Explorer rendering engine. This enables you for example to quickly compare different rendering behaviors or run Microsoft Update from Firefox.

Tabs being viewed using IE Tab don’t display the normal favicon of the site but rather the IE logo. In the screenshot below the left tab uses the Firefox rendering engine while the right tab uses the IE rendering engine.

IETab

DevTnT 12 - Firefox Plug-In: HttpFox

HttpFox is a Firefox plug-in that enables you to monitor HTTP traffic made by the page you are viewing in Firefox. Its  functionality is similar to Fiddler, but is a “native” Firefox plug-in.

httpfox

An additional advantage over Fiddler is that HttpFox can watch traffic to localhost as well.

DevTnT 12 - Firefox Plug-In: FiddlerHook

FiddlerHook is a Firefox plug-in that enables you to use Fiddler with Firefox. You will first need to enable FiddlerHook in Firefox (menu Tools –> Monitor With Fiddler –> Use Fiddler Automatically). Then add a Fiddler button to the navigation bar by right-clicking and selecting Customize. Drag the Fiddler button to the navigation bar, click done and click on the Fiddler button.

Fiddlerhook1

HttpFox is similar to Fiddler, and is a “native” Firefox plug-in.

An interesting advantage of using Fiddler through Fiddlerhook with Firefox when compared with Fiddler with Internet Explorer is that you can watch traffic to localhost.

Fiddlerhook2

PS: you can use Fiddler in IE if you set Fiddler as proxy for IE.

Friday, August 21, 2009

DevTnT 10 – Copy Work Item in Team Explorer

In Visual Studio Team Explorer it might be useful to create copies of work items to start with instead from creating a new one from scratch. Especially if you run two parallel systems with similar issues: e.g. a ticketing system for customers and a bug tracking system for the development.

You can by opening the work item in question and then use the Create Copy of Work Item… command in the Edit menu:

CopyWorkItem1

or in the context menu of the work item:

CopyWorkItem1a

After clicking, the Copy Work Item dialog appears and you can determine the team project that you want to copy the work items to.

CopyWorkItem2

See further information, especially on the implications of the selected Work item type, here.

DevTnT 10 - CTRL+G in Visual Studio

Depending on the current view, there are three different meanings of CTRL+G:

  • in the editor view the Go To Line dialog pops up and you can jump to the entered line number: GoToLineDialog
  • when dealing with work items, the Go To Work Item window pops up and you can navigate to a particular issue: GoToWorkItem
  • in the source control view, CTRL+G opens the Find Changeset dialog which allows you to query for change sets:FindChangesets

Sunday, August 16, 2009

DevTnT 11 - Firefox Plug-In: Current Site IP

Current Site IP is a Firefox plug-in that shows the IP address of the site you are currently viewing in the status bar. This is especially useful when there are separate development, test, staging and production environment and you have to switch between them using host file entries.

CurrentSiteIP

DevTnT 11 - Firefox Plug-In: XPather

XPather is a plug-in for Firefox that shows you the xpath expression for selecting an element on a web page. You can open it by right-clicking on an element and choosing “Show in XPather”. You can then edit the xpath expression; if the expression matches multiple nodes all those nodes are shown in a table.

XPather

DevTnT 11 - Firebug Plug-In: YSlow

YSlow is a plug-in for Firebug (which is a plug-in for Firefox) that will analyze your web page and make recommendations on how to improve its load time. YSlow is developed by Yahoo and is similar to Google’s Page Speed.

YSlow

DevTnT 11 - Firebug Plug-In: Page Speed

PageSpeed is a plug-in for Firebug (which is a plug-in for Firefox) that will analyze your web page and make recommendations on how to improve its load time. Page Speed is developed by Google and is similar to Yahoo’s YSlow.

PageSpeed

DevTnT 11 - Firebug Plug-In: FireFinder

FireFinder is a plug-in for Firebug (which is a plug-in for Firefox) that enables you to enter a CSS selector and will show all items on the page that match the selector in a red or blue border.

FireFinder

FireFinder can use XPath expressions as well. XPather offers much more XPath functionality, though.

DevTnT 11 - Browser Plug-in: Firebug et al.

Firebug is a plug-in for Firefox that enables you to inspect the DOM of the web page that you are currently viewing. It also enables you to inspect the CSS styles of any given element, and trace those styles back to their definitions in CSS files. There is also a script debugger and a console.

FireBug

Firebug also comes as a light version for Internet Explorer, Opera and Safari: http://getfirebug.com/lite.html. It is a JavaScript file that you can either include in your html file (if you are developing the html file) or as a bookmarklet if you don’t own the html file.

Other browsers have their own Firebug-like plug-ins of course: Internet Explorer Developer Toolbar for IE, Dragon-Fly for Opera (Menu Tools –> Advanced –> Developer Tools), Chrome (Page button –> Developer –> JavaScript Console) and Safari (Page button –> Develop –> Show Web Inspector).

Note: if there is no “Develop” menu in Safari, you can enable it using Setting button –> Preferences –> Advanced –> Show Develop menu in menu bar.

Friday, July 31, 2009

DevTnT 10 – Who to Blame for Code Changes?

In Visual Studio there is a feature called Annotate. In the Solution Explorer just right-click on a source code file and select Annotate. The result will be a view of this file where you have meta information for each line of code:

  • who did the latest change
  • when was it done
  • which changeset contains this modification

annotate

This can be useful in a code review or other situations where nobody remembers (or wants to remember ;-) who did the modifications.

DevTnT 10 – Debugging Windows Services with .Net

It depends on your architecture how easily you can debug the code running a Windows Service. Most propably you use a layered architecture which allows you to directly call the code doing the critical work. E.g. by a Winforms test application or via a administrative page in your web application.

But what if you have to find out what is going wrong in the service infrastructure itself? I usually install the service on my local machine directly from my <Service>\bin\Debug folder. Of course you will always have to make sure the service is stopped if you want to rebuild.

When running the service you can attach to the process and hopefully are fast enough to step in at the critical part of your code. Otherwise you can use the Debugger.Launch() method. I would suggest to put this call into the OnStart() of the service or into your Start() block :

debugger_launch

When the framework executes the Debugger.Launch() method and prompts you to select the debugger, select the VS instance that shows the service code and continue to run the service under the control of the debugger.

Be careful that the debugger dialog does not show up in a released version. To avoid this you can check with #if DEBUG or use command arguments which you provide in the service properties:

serviceproperties

Alternatively implement a while-loop which waits for the debugger to be attached. You can find a code snippet here.

DevTnT 9 – Transpose Functionality in Excel

In Excel, the Transpose function returns a transposed range of cells. For example, a horizontal range of cells is returned if a vertical range is entered as a parameter. Or a vertical range of cells is returned if a horizontal range of cells is entered as a parameter.

This can be useful especially if you have to copy rows from a database with a large number of fields. The transposed row-oriented result may be easier to read as the default column-oriented view:

transpose

  1. Highlight the cells that you want to copy.
  2. Then right-click on the cell where you'd like to paste the values and select Paste Special from the popup menu.
  3. Then select the Transpose checkbox and click on the OK button.

Wednesday, July 15, 2009

Follow-Up For “A SOLID Audio Rant”

A few weeks ago I sketched some waves that got high in the community concerning an in the first glance not so friendly episode of the StackOverflow Podcast (see post “A Solid Audio Rant”). Besides other topics, Joel Spolsky and Jeff Atwood, the guys performing on that podcast, talked about the SOLID principles advocated by Robert C. Martin (aka Uncle Bob).

Now by chance I found a letter that Uncle Bob published on objectmentor.com in reaction to the offensive StackOverflow-Episode: An Open Letter to Joel Spolsky and Jeff Atwood.

And that letter is really interesting if you just listened to the podcasts I mentioned in my earlier post. Because in that podcasts the climate changed from ranting to an almost esteeming atmosphere. But as we now can read from that letter mentioned above, Mr. Martin’s first reaction was not so friendly by really harnished (up to menacing steps towards legal contention).

So, check it out!

Sunday, July 5, 2009

DevTnT 8 - Tools: TotalCommander

If you're sick of the usual Windows-Explorer and want to try smth new, and in my Opinion smth improved, I would suggest to give TotalCommander a try.

Most of you will recognize the UI of this Tool from way back: like NortonCommander or MidnightCommander but TotalCommander is a really well done Port for the Windows-World and was already available in the Win3.11 times: and this is actually the one and only weakness: it looks rather old :)

Compared to its advantages, you might forget the Surface:
  • TabStructure: you can save your most used places as tabs and get them everytime the TC starts (lazy loaded for network/external devicec)
  • Splitted Screen to work with 2 folders in parallel
  • Queued copy/move for Files: no more blocking/slowing down parallel copyjobs (esp. for network transfers!)
  • Custom Fileassociations besides "open"
  • Integrated FTP/WEBDav: no use for special FTP-Software
  • Copying fully qualified filenames in the clipboard
  • Integrated RAR/ZIP handler
  • A large repository of plugins (Filesystems, Tools, etc.)
  • Showing all files in Subfolders
  • MultifileSelection via Wildcards/Regex
  • Multirenaming via Wildcards/Regex and common statements (Date, etc.)
  • Folder Synchronization
  • Commandline in the active Folder
  • File Splitting/Encoding/Hashing
  • fully customizable hotkeys
  • and a lot more!
The TC is a Shareware-Tool which is fully functional in the free Version and costs 26€ licenced.

Note: if you want to use it in an 64bit environment, I would suggest to try the current betaversion (7.50 beta6)

Friday, July 3, 2009

DevTnT 6 – ReSharper: Expanding the selection with Ctrl+W

In a previous post, Sebastian drawed our attention to a nice selection expansion feature of ReSharper. I also think this feature is cool, and want to present it here in more depth.

Visual Studio by itself supports the expansion of the current selection in a text editor window by pressing Ctrl+W.

With this command you can change a current selection like this …

Cursor in source code before expansion

… to a selection of the whole word:

Selection in source code after expansion

 

If your existing selection spans several words like this …

Selection in source code spanning two words

… after pressing Ctrl+W you end up with the word selected that is at the end of the selection:

Selection in source code after expansion

(Funnily, if you made your selection from right to left the left word gets selected:

image )

Further pressing Ctrl+W does not do anything more.

 

Text Expansion With ReSharper

ReSharper has taken that expansion feature to the max (that’s why we love this tool!).

Beginning with no selection …

image

… by pressing Ctrl+W ReSharper selects the whole word:

image

But now, you can press Ctrl+W several times more to expand the selection to several areas, one larger than the one before.

From the single word selection you get the selection of the whole string without the quotes:

image

Then ReSharper selects the string including the quotes

image

… then the whole concatenated string from the beginning of the expression

image

… and then incrementally the whole string expression line by line:

image

image

 

And so it goes on with every stroke on Ctrl+W until the whole file content is selected:

The whole statement

image

… the whole block without the braces

image

… the block including the braces

image

… the whole member

image

… the type’s content without the braces

image

  … the whole namespace’s content without the braces

image

… the whole namespace

image 

… and finally the complete content of the file:

image

As you may guess, the whole stuff can be done in reverse order pressing Ctrl+Shift+W.

Good to know!