cruft_folder_2Usually when jumping into a new OS, I largely disregard the built in programs. My typical thought is that they’re for newbies, grandmas, and otherwise lack the features that other 3rd party programs offer. (think MSPaint, Getting Started, Fax/Scanner Wizard, Welcome to XP videos, etc). It got so annoying that I actually go out of my way on new installs to make a new folder on the Start Menu to bury those shortcuts.

Windows 7 Snipping Tool Special-K  brought the new Windows 7 Snipping Tool to my attention, and it’s most definitely a productivity enhancer. My snap judgement was “really, a built-in Windows tool?”, but after 10 seconds of using this tool, I knew I’d be using it immediately in place of my current screenshotting process.

Screenshotting

Here’s my typical OLD style of creating a screenshot. Typical use case here is to send a cropped & marked-up screenshot by email, or perhaps for insert into Windows Live Writer.

paint_net Total Clicks/Buttons = up to 15

  • Alt-PrtScn
  • Open Paint.NET
  • Ctrl-V
  • Start cropping
  • Change the color selector to red or yellow or something to make your selection stand out
  • Select the Oval or Rectangle tool to highlight what you need. When Oval doesn’t line up the way you want, Ctrl-Z, and try again x3.
  • Either: a) Select All –> Ctrl V into a new email or b) Save As –> enter a filename, save to desktop. Open email client (Gmail or Outlook), and attach to email as attachment.

Stop the Insanity with Win7’s Snipping Tool

 

Windows 7 Snipping Tool Total Clicks = max 5

  • Keyboard Start key
  • Type sn as if you were typing snipping tool. Hit Enter.
  • Start cropping
  • Highlight, markup, erase, recrop to your heart’s content.
  • Click the Email button to generate a new email message with the image embedded. Launches the default mail client. Works well with Outlook and Gmail.
snip_types

Being the artsy type, you’ll probably want to screenshot in different ways. I think the typical use-case would be the rectangle, whereby you click-drag a rectangle to highlight the parts of your screen that you want. Otherwise, you have the ability to screenshot:

  • a window you choose (it outlines the window when you hover over it, Win7 style)
  • free-form, lasso-style!
  • the entire screen

 

Caveats (or not!)

  • doesn’t work well when you’re trying to capture something from your Start menu!
  • not a caveat – it’s super easy to snip/screenshot your entire toolbar. Select Window Snip, and click your toolbar. The tool captures just your toolbar, from Start button to minimize button. Awesome!
  • not a caveat – saves as .png by default. Yes, Paint.NET does this as well.
  • not a caveat – turns out the .exe isn’t named winsnip.exe (which I would have loved), but rather c:\Windows\System32\SnippingTool.exe

snipping_tool_windows_7_markup_msdn


Posted in: windows 7 , shortcuts , microsoft  Tags:
Actions: E-mail | Permalink | Comments (0) |
Phil posted on November 2, 2009 01:10

I recently had the privilege of working on a contract where the main goal of the project was to port/convert the web project and associated assemblies (business and data layers) from one .NET language to another. The other tasks were around fixing a handful of defects, and adding a few bits of functionality. The project was hard-capped at a set quoted number of hours, so there was little room for error.

The solution consisted of three .NET 3.5 projects:

  • ASP.NET web project – this project had roughly 10 pages and a handful of helper classes in the App_Code directory. This project already had VB as its language.
  • Business Layer Assembly – 6 classes brokering access to the data layer. Very much pass-through code with not a lot of business logic in between the web layer and data layer. There were moderate amounts of looping and updating of the business object properties.
  • Data Layer Assembly – the DL included the matching DL classes for each of the 6 classes above. The most challenging (code for the converter here was the Linq-To-Sql code.

Sizing Up the Task

The largest part of the project for me was the conversion task. All told, the conversion/translation involved:

  • 12 .cs files
  • ~55 methods
  • ~500 lines of code

I had previously figured the smartest way to spend my time was not rewriting code by hand. If there’s anything a developer should be good at, it’s evaluating and choosing to use the right tool for the job. That’s a major part of your job as a developer!

Enter the Telerik Batch Converter Tool

A quick Bing search brought me to a few options: online-in-the-browser-cut-and-paste style, or full file upload.

I first noticed that Telerik had a batch converter tool. This allows the user to upload a handful of source code files, and the converter will do its magic on the server. This was right up my alley, as it meant that I didn’t have to laboriously open each code file, copy, paste, and make a new source code file.

Telerik Batch Code Converter Upload

The initial load of the page shows the user 3 input boxes where you can browse to the location of your code file. Obviously for those ASP.NET web projects needing conversion, you don’t need to upload your .aspx files, but rather your code-behind files. This particular project was using code-behind files, rather than inline <script>.

Aside: It’s amazing to me that some developers are using <script> tags to hold their code which belongs in a code behind  Page.aspx.cs or .vb file. Obviously it’s a style or configuration issue, but to me it just feels wrong. I like the separation of .NET code and HTML markup. Perhaps it’s just a side effect of trawling the web for source code, and people are choosing to format their .aspx to include code within, instead of posting separate files.

Back to the task. The process is easy:

  • Browse one-by-one for the files you need converted. Make sure to remember to pickup your Linq-To-Sql’s .designer.vb or .cs class. That’s the file where your SQL Server tables are mapped to POCO [Plain Old CLR Objects ;) ]
  • Upload, Convert and Download a .zip containing the artifacts of the conversion. Included are all the converted files, and a Report.txt file.

Telerik Batch Code Converter Done

Results & Conversion Report

The real answer you’re looking for is right here: the results of the conversion with the Telerik tool, for me, were 100%. Absolutely no problems were had in compiling a new project with these new files added to it. I can’t believe it was so easy. Here’s the report that Telerik included in the .zip (irrelevant or repetitive bits snipped):

Conversion Error Report (Created [datetime])

Every time a possible conversion problem is located, the file name, problem severity , and problem description are recorded. There are three levels of severity:

    Warning    = code will convert and will likely work, but conversion may need manual improvement
    Minor    = code will convert, but it will likely need manual correction to work
    Major    = code will not convert. It must be modified before used with converter

There are also general issues to remember when converting web sites:
    - Events connected with the Handles syntax in VB will not work in C#. Events must be connected in code or in the control markup.

Report Details:
================================================
1: TEST.designer.cs    Minor    Your region may not convert from C# to VB if quotes have not been used to name the region. Make sure       region name is surrounded in quotes before using code.
2: TEST.designer.cs    Minor    Your region may not convert from C# to VB if quotes have not been used to name the region. Make sure       region name is surrounded in quotes before using code.

End Report (11 total matches)

Easy & Accurate Results

I can’t believe it was so easy to convert the code. It really meant that I could spend more time ADDING VALUE to the project by way of adding features and fixing defects than by the drudgery of converting source between languages. The price to pay for the Telerik online batch tool was the included comments at the bottom of each source file. That’s an easy price to pay! Can I say now a BIG THANK YOU to Telerik, NRefactory & SharpDevelop, and Todd Anglin @ Telerik for making this tool free and available for the world at large!

TelerikBatchCodeConverter_Comments

Stitching your Converted Files Back Into a Project & Solution

The tricky work is to then take the output of the converter and create a new project. For each of the assembly projects, I:

  • copied all the reusable non-.NET files from the old solutions - *.xml, *.config, etc.
  • made new .vbproj projects in Visual Studio
  • for the web project, Add Existing Files –> Select all your converted files.

For those converting a web project, just create a new Web Project. For each of your pages, modify your .aspx  to have its Page directive to have the appropriate configurations:

<%@ Page Language="VB" MasterPageFile="~/SomeMaster.master" CodeFile="SomeFile.aspx.vb"

Then do the same Add Existing Files routine for all your converted .aspx.vb or .cs files.

Quick Online .NET VB and C# Converters

In some cases, you’ll find snippets online (yes, the bathroom wall of code) where you actually like the snippet, but rather want it in the language of your choice. I recently searched for and used both these tools when needing to convert a large snippet of VB to C#.

Try DeveloperFusion’s online code conversion tool - http://www.developerfusion.com/tools/convert/vb-to-csharp/

Telerik’s Code Converter is of course, likely to be mostly used for its quick online code converter - http://converter.telerik.com/


Posted in: linq-to-sql , c# , vb , shortcuts , best practices  Tags:
Actions: E-mail | Permalink | Comments (0) |

When hammering away at a unit test, I often found myself wanting to test the current unit test and its associated code. I of course wanted to use the debugger, break points, inspect values, use the Watch tool, etc.

The First Iteration

  • Put the cursor in the test method.
  • Go to Visual Studio IDE’s menu 
  • Click Tools - Run - Tests in Current Context
  • Debug as per normal

ide

Uh, Do It Smarter

Then I remembered that you could put the shortcuts in the right click context menu. Ah ha!

rightclick

You can see where this is going if you paid attention to the first iteration, as well as the title of this blog post. Taking your hands off the keyboard to move to the mouse adds so much more wasted time in development. File this under “what were you thinking?”.

Smartest

Now it’s all keyboard goodness:

  • Cursor in the test method
  • use a cute mnemonic in your head when you're typing in this combo. Re Test
  • Ctrl-R, Ctrl-T

What is YOUR favorite Visual Studio keyboard shortcut?


Posted in: development , shortcuts , visual studio  Tags:
Actions: E-mail | Permalink | Comments (0) |

So your application needs to send emails to stakeholders/customers/admins/managers. You know the kind of emails:

  • password reminders,
  • account balances,
  • reminders & status updates
  • confirmations of all sorts

Typically my development routine consisted of something like this:

  1. Write a template email. String constants with placeholders, etc. Dear [FirstName] [LastName],
  2. Read all appropriate details from a data-store. You know, the things specific to the recipient of the email. Replace [FirstName] [LastName] with real names, or a link specific to their account to reset their password, etc.
  3. Write the email sending business logic. System.Net.Mail and all the goodness within. Attachments, BCC, SMTP, all those good things provided by that namespace. (Thank you Microsoft, for helping us forget CDONTS.)
  4. Put in your own email address to receive the unit tests and integration tests.
  5. Brace for the email flood into your mail client.
  6. Context switch between the mail client and development IDE. More back and forth for you!

New Tool in the Toolbox – Already Built into the .NET Framework!

While testing, you can have emails sent to a directory instead of being sent to SMTP server. Simply put this in your web.config:

<system.net> 
    <mailSettings> 
        <smtp deliveryMethod="SpecifiedPickupDirectory"> 
            <specifiedPickupDirectory pickupDirectoryLocation="c:\SomeEmailDirectory\" /> 
        </smtp> 
    </mailSettings> 
</system.net> 

 

So What?

So how much time does it really save you? It’s negligible, really, when your mail server is on the LAN. If you are working with an SMTP server that is unreliable, slow, or keeping accounting on mail count/charging for bandwidth, the seconds per sent email can add up.

No matter about SMTP servers… good, bad or ugly. You could monitor a directory with the .NET FileSystemWatcher to watch for newly dropped email files, and then open them automatically!

Imagine, your unit or integration tests create a new email to be sent, and another dev tool (using FileSystemWatcher) can automatically ShellExecute it for you. That saves you the time of switching to the directory, double clicking the newly created email, and then getting on with the work of checking for correctness.

Credit

Yep, this StackOverflow question keeps on giving!

http://stackoverflow.com/questions/54929/hidden-features-of-asp-net


Posted in: asp.net , c# , development , email , shortcuts , testing  Tags:
Actions: E-mail | Permalink | Comments (0) |
Phil posted on April 27, 2009 06:33

Got wind of a great idea. Some organizations are making an effort to reduce printing, print devices and printing costs. Please note, this isn’t my original idea, and IANAEA (I am not an Exchange admin). I am just being loud about it, perhaps you'll turn out to be a green hero where you work. This will work for any SMB or large organization.

Some organizations work like this: someone is assigned the fax machine, and part of their job is to take care of the incoming faxes. Holy hum-drum, Batman!

Lessen the burden on those fax-gathering-folk

  • Acquire a fax machine that will transform an incoming fax to an email with an attachment (pdf, tif or whatever). Obviously the smaller filesize the better.
  • Have that incoming fax document emailed to an account that only deals with email.
  • Be nice though. Setup their email client with a new folder and rule so that emails from fax@mycompany.org go to only one folder.
  • Perhaps have that account checked only X times a day to limit the interruptions to the human.
  • They can then filter and send to the recipients.
  • This is a human-powered time-consuming spam filtering mechanism as well. Just imagine all the restaurants, travel agents, and sundry fax spammers whose hopes and dreams are crushed by this system.
  • Encourage the end-recipients not to print that fax.

Level Up

Now that you are saving paper, go the extra step. Save some human time. Let’s assume you are using Microsoft Exchange and Outlook. Any version will work.

  • Create yourself a new Public Folder - one per fax line that you have. Do you have 'private' fax lines for the HR types, or director types? Lock it down with Active Directory permissions! Simple stuff!
  • Modify the ‘to’ email address on the fax machine to send to that new Public Folder.
  • Direct people to visit that Public Folder when they're expecting a fax.
  • Build your own set of business rules around when to remove items from this Public Folder. i.e. If the fax is meant for you, and only you, then delete or move it to your personal Inbox as you will. Fwd to anyone concerned is also appropriate. Standard email rules apply here as well (etiquette, attachment size, etc).
  • Have people add that Fax folder to their Favorites in Outlook Public Folders.

Write a nice how-to document for people on how to visit that Public Folder. How to Move/Copy to their inbox. Set the business rules here. Obviously management buy-in will be important.

"So What?! It's just a few pieces of paper!"

Well let's do the math. Here's my quick and dirty formula.

  • 20 faxes per day.
  • .0055 hours (20 seconds) to analyze a fax and determine who to redirect it to, and forward the email. (20 seconds /3600 seconds per hour = .0055 hours)
  • $15 per hour for a human
  • 10 cents per page printed. Assume that includes TCO items: paper, printer toner (galaxies more for ink), printer maintenance, amortized cost of the printer.

20 x (($15 x .0055) + $.10) = $3.65 per day

$3.65 x 255 work days per year = $930.75

My example company is spending $930 a year on receiving faxes. I know this number is dwarfed by the time-costs of email, but it's something to look at. I know the fax-hunter-gatherer would love to have that task melt away.


Actions: E-mail | Permalink | Comments (0) |