Tools & Apps

T4 Cheat sheets!

Submitted by Robert MacLean on Wed, 11/17/2010 - 09:56

I’ve been spending a lot of time working on two things recently: T4 (Text Template Transformation Toolkit) and Windows Phone 7. Part of my work around T4 included creating some cheat sheets to make it easier to get to grips with it!

There is now three posters available (High res PDF’s below or on the DRP site):

General Overview

This provides a high level overview of the various components in T4.

Slide1

@template detail

The @template directive has a lot of options and this sheet provides detail on those.

Slide2

Examples

This sheet provides usage examples of various aspects directives in T4.

Slide3

You can see my time with Windows Phone 7 leaking into these two as I loosely designed them around the Metro UI design guideline that Windows Phone 7 uses. Interestingly for me is that Metro seems to work fantastically well for cheat sheets as these are some of the nicest and easiest to grok sheets I’ve ever done.

Pull - October 2010 Release

Submitted by Robert MacLean on Fri, 10/15/2010 - 08:53

I’m happy to share my second stable release of Pull, the simplest podcast/vidcast download tool, in the world, this release has had a ton of new work done to it to get it more usable and some plumbing work to improve it. 

image

Major features in this release

Full Proxy Support

Proxies are either really easy to use or completely destroy your application. Previously Pull used what ever Internet Explorer specified, now you can tell it there is no proxy, in case your IE proxy settings are different for some reason, or provide proxy settings. This should help people use it in a variety of environments.

image

Add multiple podcasts at once

Want to subscribe to multiple podcasts? Just use the new add dialog box to add them.

image

Automatic backup of feeds to OPML

Have a database? Then you better have a backup. These are rules for all software and Pull does the same now by automatically backing up your feeds to an OPML file, just in case Smile

image

New jumplist options

Right click on the Pull icon in Windows 7 and you will get the jumplist which contains two new options – Play next unplayed episode and Force refresh of podcasts.

Since putting in the play un-played I’ve used it a ton as it allows me to keep playing podcasts quickly. When one podcast finishes, it is two clicks to get the next one started, without having to switch to the application to do it!

image

Ability to automatically download latest episode when subscribing to a podcast

When you subscribe to a podcast, you likely want the latest episode and so we now have an options to enable that. Options are available on both the new podcast dialog box (see above) and also if you are adding via protocol handlers or OPML.

For those last two you can turn it off in the settings:

image

Ability to cancel downloads

Right click on a download in the download pane and you will be able to cancel a download!

Locking

Often I have a podcast I want to keep forever, now you can right click on a podcast and select lock which adds a little lock icon next to it. Repeat the process to unlock.

This prevents the file from being deleted and from a clean-up perspective this means you can now select all played episodes and hit delete and it will ignore the locked items.

image

Ability to prevent Windows from going to sleep during downloads

In settings you can control if you have an active download is the computer allowed to go to sleep.

image

Ability to selectively import or export podcasts from OPML file

Want to export your podcast, except that one which will make your mother blush? Or maybe your friend gave you an OPML file you want to import but you don’t want all his podcasts. You can now select individual podcasts and export and import selectively.

Delete to recycle bin

When you delete a podcast, it now goes to the recycle bin and not into the ether. This also means you can hit retry now if the delete fails for any reason.

Scan for Episodes

Another new small feature lets you scan an existing folder for episodes you have already downloaded in Pull or other application. This was added to help people migrate to Pull and quickly associate their existing episodes, but if you want to re-associate a deleted episode this works great for that too!

image

Welcome wizard to make getting up and running easy

Pull used to only need two settings from you and so when you started it for the first time it showed you the settings dialog to get those settings. However this release added a number of settings and to not scare off a new user with a million settings we get now start with a simple welcome wizard which asks for the two we really need and makes the user feel at home in the application.

Future

I am planning another release for about a month away and I want to add some more download management features in it but if you have any ideas drop me a line or leave a message in the Pull discussions forum.

Poken @ Tech·Ed 2010

Submitted by Robert MacLean on Mon, 10/11/2010 - 13:49

image[8]We live in an increasing digital and disconnected world where we seldom meet face to face, and in less than a week that will all change because it will be time for Tech·Ed Africa 2010! Last year there was a new piece of hardware unveiled, the Poken – which I can assure you will be even bigger this year.

For those who do not know what a Poken is, it’s a small device which links your digital persona to a physical world! Or put more simply it’s a way to share details about who you are with other people, think like a digital business card.

From Ruari Plints post on these guys, here is what you need to do:

  1. Pop onto Poken website to find out all about it and why we going crazy “Poken-ing” everyone this year.
  2. Sign up foryou own Poken account.
  3. Get your Poken device, before or at TechEd Africa.
  4. Join us and go “Poken” you friends, and then some.
  5. Create your own “Poken” language and make us all laugh at the possibilities.
  6. Pop on to the TechEd Social media sites and start expressing yourself.

I have it on good authority that the Poken’s on sale at the event will be at a special price and plenty will be available to WIN!

Redirected down a one way: Clearing the Internet Explorer host redirect cache

Submitted by Robert MacLean on Wed, 10/06/2010 - 08:51

Internet Explorer 9 is fast, really, really fast! A lot of that speed comes from the massive caching improvements in IE9 – but this is a bit of a double edge sword, especially for developers when caching gets in the way of what is actually happening. I spent two hours debugging an odd caching issue recently and this is the sad story.

For some testing I needed to setup a redirect, in this case a 301 permanent redirect (handy HTTP status codes cheat sheet in case you don’t remember these). What this would do is enable me to have site alpha (http://localhost:5000/Demo) redirect to site beta (http://localhost:9000/Demo).

Prior to this the scenario look like this:

image

Behind the two browser windows is the IE 9 Developer tools and their fantastic new network capture feature. You can easily see that when I hit site alpha I got a 200 result, meaning all good and it loaded.

Once I setup the redirect, you’ll see I get a 304 this is because the data is already cached. Note that even though I typed in the site one URL it immediately loaded site two. This is because the browser had cached the redirect and so skipped the network steps for performance.

image

Now the problem, I wanted to turn off the redirect – however the browser cached it and so would ignore the change. Clearing cache, deleting files, rebooting and even using the IE reset option did nothing to solve this Crying face 

The only way to fix it was to fire up the fantastic Fiddler tool and use it’s Clear Cache option with the option to delete persistent cookies, which flushes the WinINET cache.

image

Considering that this is supposedly the same as clearing the IE cache I have no idea why this works and IE cache clearing doesn’t but it does work.

Cannot add a Service Reference to SharePoint 2010 OData!

Submitted by Robert MacLean on Mon, 09/27/2010 - 11:22

SharePoint 2010 has a number of API’s (an API is a way we communicate with SharePoint), some we have had for a while like the web services but one is new – OData. What is OData?

The Open Data Protocol (OData) is a Webprotocol for querying and updating data that provides a way tounlock your data and free it from silos that exist in applicationstoday. OData does this by applying and building upon Webtechnologies such as HTTP, Atom PublishingProtocol (AtomPub) and JSON toprovide access to information from a variety of applications,services, and stores.

The main reason I like OData over the web services is that it is lightweight, works well in Visual Studio and works easily across platform, thanks to all the SDK’s.

Clipboard01SharePoint 2010 exposes these on the following URL http(s)://<site>/_vti_bin/listdata.svc and you can add this to Visual Studio to consume using the exact same as a web service to SharePoint, right click on the project and select Add Service Reference.

Once loaded, each list is a contract and listed on the left and to add it to code, you just hit OK and start using it.

Add Service Reference Failed

Clipboard03The procedure above works well, until it doesn’t and oddly enough my current work found a situation which one which caused the add reference to fail! The experience isn’t great when it does fail – the Add dialog closes and pops back up blank! Try it again and it disappears again but stays away.

Clipboard04If you check the status bar in VS, you will see the error message indicating it has failed – but by this point you may see the service reference is listed there but no code works, because the adding failed.

If you right click and say delete, it will also refuse to delete because the adding failed. The only way to get rid of it is to close Visual Studio, go to the service reference folder (<Solution Folder>\<Project Folder>\Service References) and delete the folder in there which matches the name of your service. You will now be able to launch Visual Studio again, and will be able to delete the service reference.

What went wrong?

Clipboard06Since we have no way to know what went wrong, we need to get a lot more low level. We start off by launching a web browser and going to the meta data URL for the service: http(s)://<site>/_vti_bin/listdata.svc/$metadata

In Internet Explorer 9 this just gives a useless blank page Sad smile but if you use the right click menu option in IE 9, View Source, it will show you the XML in notepad. This XML is what Visual Studio is taking, trying to parse and failing on. For us to diagnose the cause we need to work with this XML, so save it to your machine and save it with a .csdl file extension. We need this special extension for the next tool we will use which refuses to work with files without it.

Clipboard07The next step is to open the Visual Studio Command Prompt and navigate to where you saved the CSDL file. We will use a command line tool called DataSvcUtil.exe. This may be familiar to WCF people who know SvcUtil.exe which is very similar, but this one is specifically for OData services. All it does is take the CSDL file and produce a code contract from it, the syntax is very easy: datasvcutil.exe /out:<file.cs> /in:<file.csdl>

Immediately you will see a mass of red, and you know that red means error. In my case I have a list called 1 History which in the OData service is known by it’s gangster name _1History. This problem child is breaking my ability to generate code, which you can figure out by reading the errors. 

Solving the problem!

Clipboard09Thankfully I do not need 1 History, so to fix this issue I need to clean up the CSDL file of _1History references. I switched to Visual Studio and loaded the CSDL file in it and begin to start removing all references to the troublemaker. I also needed to remove the item contract for the list which is __1HistoryItem. I start off by removing the item contract EntityType which is highlighted in the image along side.

The next cleanup step is to remove all the associations to __1HistoryItem.

Clipboard10Finally the last item I need to remove is the EntitySet for the list:

BREATH! RELAX!

Ok, now the hard work is done and so I jump back to the command prompt and re-run the DataSvcUtil tool, and it now works: Clipboard12

Clipboard14This produces a file, in my case sharepoint.cs, which I am able to add that to my project just as any other class file and I am able to make use of OData in my solution just like it is supposed to work!

Visual Studio 2010 Training in Jo'burg

Submitted by Robert MacLean on Tue, 09/21/2010 - 11:47

Notion Solutions will be running some Visual Studio 2010 training in Johannesburg at the end of October. These are not free courses but the value you will get from training with one of the worlds top ALM companies will be worth it.


Tester Training with Visual Studio 2010 Ultimate (4-Day Course)

This course provides students with the knowledge and skills to use the latest testing tools provided by Visual Studio 2010 to improve their ability to manage and execute test plans. Test case creation and management will be covered, as well as test execution and automation practices using Test Manager. Creating and managing virtual lab environments using Lab Management 2010 will be discussed within the context of test planning and execution. By the end of the course, students are equipped to begin planning the implementation of Visual Studio 2010 for improving testing practices within their organizations.

October 25 – October 28, 2010 09:00 – 17:00


Overview of Visual Studio 2010 (4-Day Course)

The Visual Studio 2010 Overview course provides students with the knowledge and skills to improve the development practices of their entire organization and team. A broad set of features provided with Visual Studio 2010 will be covered to assist your team with application design, test management and execution, development standards and collaboration, automated build and release management, database schema management and test lab management. This course covers all of the most important features without going overly deep. By the end of the course, students are equipped to better understand how Visual Studio 2010 can be used within their organizations.

November 1 – November 4, 2010 09:00 – 17:00

Making Money with CodedUI

Submitted by Robert MacLean on Mon, 09/06/2010 - 10:17

Saturday was Microsoft’s Dev4Dev’s event, where each presenter gets 20min to cover one topic. It is fantastic fun and a great way to learn.

For the event I decided to tackle CodedUI, which is just a great testing technology and in 20min I showed off a number of features using it. Below is the slides, which are not valuable - unless you jump to the hidden content where you find my demo script and some extra information!

If you are wanting to play with the demo’s you will also need my pre-constructed demo bits:

For those who attended and saw my second demo not go according to plan, I apologise again Crying face I’ve since run it again and it works every time, I guess the massive audience scared CodedUI into breaking Winking smile

South African ID Number Checker in Excel version 2

Submitted by Robert MacLean on Thu, 08/26/2010 - 10:37
18 February 2016: Fixed a bug in the multiple checks with the date display. Thanks to John Sole for pointing it out.
8 August 2014 - Just a quick note that the spreadsheet has been updated with better checking if the date is valid (including leap years), plus has been cleaned up a lot and finally will show you both years if we can not be certain which century the person was born in. Tested with Excel 2013 - your mileage may vary on other versions.
Want this as an app for your smartphone? Click here

A long time ago I built a simple Excel spread sheet which worked out if an ID number was valid or not. Since I released it, I have received a lot of feedback about the spreadsheet. Most of the feedback was around how it worked, but a week ago Riaan contacted me and pointed out a bug in it so I took this as an opportunity to rebuild it.

Not only does the new version check the validity of the ID number, it also tells you where the person was born, gender and birth date.

image

Something else that I wanted to do was clean up the calculations. So now they have been moved to their own (hidden) tab and are documented.

image

For those who need to do a bulk checking, the second sheet of the Excel spreadsheet contains the ability to check multiple ID numbers.

image

I want to extend a massive thanks to Riaan Pretorius, not only for pointing out the bug but also running the new version through it’s paces and finding some issues in it. The fact this one is much better is owed to him, I just typed the code Open-mouthed smile

You can download the Excel file below!

Pulled Apart - Part X: Visual Studio Rulesets

Submitted by Robert MacLean on Thu, 08/26/2010 - 10:24

onebit_26

Note: This is part of a series, you can find the rest of the parts in the series index.

Microsoft has offered a great tool called fxCop for a number of years now. This free tool takes your compiled .NET code and runs it against a number of rules to check things like security, compatibility, globalisation and so on.

imageSome of the higher SKU’s of Visual Studio have included fxCop directly in the IDE, via the Code Analysis option. In previous versions of Visual Studio this just ran the fxCop command line and returned the results. There was not much else happening except a shortcut to having to run a separate tool.

In Visual Studio 2010 the fxCop integration has had a major improvement, with the addition of a dedicated interface for the management of what rules are run and the ability for you to create a bespoke collection of the rules that you care about by ignoring the rules you do not care about. The other great feature is that you can set if a rule throws a warning or an error in Visual Studio. Very useful for enforcing rules!

image

For Pull, I took the opportunity to create a dedicated rule set.

Step One – Theft

The first thing I did was to take the Microsoft All Rules rule set and copy it to my project and rename it to pull.ruleset. You can find the Microsoft All Rule rule set file at: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\Rule Sets\AllRules.ruleset

Step Two – Minor Tweak

Next I opened the pull.ruleset file in a text editor (it is just XML) and changed the rule set name and description.

image

Step Three – Associate

Next I used the Browse option in the rule set selector to select my pull.ruleset file.

Step Four – Adjust Rules

Now I can use the Visual Studio rules editor (click the Open button) to adjust what rules I want to keep and what severity level I want them at. As I started with the Microsoft All Rules, I have all the rules listed initially and so this took a little bit of time to adjust.

image

Step Five – Source Control

Make sure you check in your custom rule set file so that everyone in the team can enjoy it’s powerful magic. If I was using a fully featured ALM tool (like TFS) and not just a source control tool, then I could also include the rules in my check-in policies which ensure that code that is checked in comply and also in my build server.

Tech·Ed Africa 2010: Want to go for free?

Submitted by Robert MacLean on Tue, 08/24/2010 - 09:53

Win 1 of 4 Tickets to Microsoft Tech·Ed Africa 2010 worth R6 150 each!!!

Venue:    ICC Durban

Date:       17th - 20th October 2010

All you need to do is take a photo of a Microsoft Tag in a really cool/funny/practical place and upload the picture to the Facebook competition page.

More details in the competition animated video here.

Full Competition Rules on our Facebook page.

Dates for Submissions & Announcements of Winners:

  • 25 Aug 2010    -    Last Date For Submissions (week 1) (5pm)
  • 27 Aug 2010    -    Week 1 Winner Announced
  • 01 Sep 2010    -    Last Date For Submissions (week 2) (5pm)
  • 03 Sep 2010    -    Week 2 Winner Announced
  • 08 Sep 2010    -    Last Date For Submissions (week 3) (5pm)
  • 10 Sep 2010    -    Week 3 Winner Announced
  • 15 Sep 2010    -    Last Date For Submissions (week 4) (5pm)
  • 17 Sep 2010    -    Week 4 Winner Announced

Submissions & Announcements of Winners:

  • A new winner will be selected weekly.
  • Last date for submissions for a particular week is 5pm Wednesday of that week.
  • Winner for that week will be announced on the Friday.
  • Submissions after 5pm will count towards the following week.
  • Submissions which did not win in a previous week will still be considered in following weeks and need not be re-submitted.
  • A person can only win once, thereafter all his other submissions will be ignored.
  • You cannot submit on behalf of another person.
  • Submissions are done by posting a photo to the Facebook page wall.

Terms and Conditions apply:

This competition is limited to Tech·Ed Africa 2010 entrance and does not include Travel, hotel or any other expenses. You will be required to help out at the Developers Community Lounge at Tech·Ed Africa 2010 for 3 hours a day if you do win. For Full list of rules please consult the Facebook page.