The life and times of this developer...

WPF, C#, XML and other stuff

  Home  |   Contact  |   Syndication    |   Login
  25 Posts | 0 Stories | 30 Comments | 0 Trackbacks

News

Tag Cloud


Archives

Post Categories

Cool Tools

Thursday, December 18, 2014 #

I recently had cause to reference two libraries which both contained the same class file. The Namespace : Class where therefore ambiguous within my application. Interestingly enough the .Net compiler simply takes it’s bat and ball home and does not allow you to access any of the exported types from these assemblies.

To resolve this you need to create an alias for at least one of the dlls. You do this in the Reference Properties:

  1. Add references in your app to the dlls.
  2. Right click on one of the assembly entries in the References list and click Properties.
  3. In the properties windows you will see an ‘Aliases’ property with the value of ‘global’. Change this to be ‘global, myalias’.

Click build and everything should be OK except when you try to use the ambiguous class. I.e. the .Net compiler will now be happy about the scope of all of the other exported items.

To use the actual ambiguous class you need to add an extern alias:

namespace MyApp
{
    extern alias myalias;
    public class MyClass
    {
        var myClass = new myalias::AmbiguousNamespace.AmbiguousClass();
    }
}

Note: you could prefix every declaration using the ‘global::’ scope, but that is the default so we don’t need to bother.

#


Wednesday, November 26, 2014 #

Sometimes you just can’t figure out why stuff isn’t working as expected in your C# code due to odd things occurring within the .Net framework. So the first point of call might be to use a decompiler tool such as JetBrains dotPeek (free). Often this will help you to realize you are making the wrong call or the wrong sequence of calls due to subtleties of .Net.

However, sometimes this just will not shed the required amount of light of the issue at hand, so you think ‘If only I could step through the .Net Framework code!’.

As it turns out this is quite simple as Microsoft allow you to download the .pdb files directly from Visual Studio as described here:

http://msdn.microsoft.com/en-us/library/cc667410.aspx

So now when you run your application in Debug and hit a breakpoint, instead of seeing a stack trace full of greyed out entries, you can simply step through the code and work out either the framework has an issue…or more often, as I find, that you’re doing it wrong.

Hope this helps someone.

#


Thursday, March 13, 2014 #

After a frustrating waste of time I finally worked out how to Uninstall NuGet Package Manager from Visual Studio.

Usually I would just expect to run Tools->Extension Manager, then select the item from the list and click Uninstall, but the NuGet Package Manager Uninstall button was disabled.

I then checked Control Panel->Uninstall a Program, but there was no entry for the Visual Studio extension (I didn’t think there would be as they are managed within VS).

Finally, I had a brainwave, maybe it was permissions? So I right-clicked the Visual Studio icon and selected ‘Run as administrator’ and sure enough the Uninstall button magically became active and the world was a good place again.

Just thought I’d share this as you too may be losing the will to live trying to find a solution.

#


Wednesday, March 5, 2014 #

I've just got round to looking at Liquid XML 2014. I have been tasked with investigating W3C XML Schema 1.1 standard (XSD 1.1) and as if by magic Liquid Technologies have provided 1.1 support in their excellent XML Schema Editor. Here is what they say...

XML Schema 1.1 Support

XSD 1.1 AlternativeThe Liquid XML Schema model now supports the XSD 1.1 standard. This adds many useful constructs including asserts, openContent and alternatives. These constructs can be modelled and edited graphically, and XML 1.1 compliant instance documents can then be validated against XSD 1.1 schemas.

Choice of XSD Engines

The XML and XSD validation processor has been completely re-written for 2014. It now supports a plugin architecture making it possible to select the validation engine to be used for XML schema and XML document validation. These validation engines also operate asynchronously providing background validation as you type. The 2014 edition supports the .Net 4.0 XSD Engine, and the Xerces XSD Engine.

--------

So they are now providing an option to use the Xerces engine for XSD 1.1 support. You can still choose the .Net engine for XSD 1.0 support, the .Net engine appears a little more strict, but as I discussed out in a previous post, it is unlikely Microsoft will support XSD 1.1 in .Net any time soon.

However, the major improvements are the new XSD 1.1 features within the graphical Design view where you can now graphically add XSD 1.1 specific options. I have only really scratch the surface so far, but the improved interface makes things a lot easier, which I guess is the point.

I also like the new inline XSD properties and annotations, this really simplifies things as you can see everything without having to look at the properties or documentation windows and is especially useful when you print your schema out.

One other thing I really like in the 2014 version is the improved support of type restrictions. You can now graphically see which items have been restricted in a derived type. This is really useful when you are looking at a complex schema and cannot figure out why you can’t add a particular item into your xml document without an error.

In summary, I really like Liquid XML 2014. The new features are very useful rather than just a gimmick as in other software upgrades I have seen recently.

#


Friday, November 15, 2013 #

Microsoft Visual Studio sometimes crashes when the .sln solution file gets out of sync with the hidden .suo file. The .suo file stores information such as the active project and is automatically created by Visual Studio.

To fix this issue, try deleting the .suo file. Visual Studio will just create a new one for you and the solution should open up correctly.

If you can't see the .suo file, check your hidden file settings in explorer:

Tools->Folder Options...->View->Hidden files and folders->Show hidden files, folders, or drives

#

 


Sunday, August 25, 2013 #

My weekly Windows Backup failed with Error code: 0x81000037, which is a bit odd.

I googled the error and got to the Microsoft help page which explained:

0x81000037: Windows Backup failed while trying to read from the shadow copy on one of the volumes being backed up0x81000037: Windows Backup failed while trying to read from the shadow copy on one of the volumes being backed up.

It also contained a work around, but this proved to be incorrect for my issue!

So, I checked the Windows event log 'eventvwr.msc' and found the following in Windows Logs->System:

'Microsoft Antimalware has detected malware or other potentially unwanted software.'

'Name: Exploit:Java/CVE-2013-1493'

Turns out that the Java Cache on my PC had something looking like Malware in:

'Users\.....\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\29\127e0a5d-67114f2a->ahrlsP.class'

So the Backup refused to work, which I guess is a good thing if only the error message had been clear.

To play it safe I deleted the folder 'Users\.....\AppData\LocalLow\Sun' and all was well.

 

#

 


Thursday, April 11, 2013 #

XML Schema (XSD) 1.1 was given W3C Recommendation status in April 2012, so do Microsoft intend to add support for 1.1 validation in .Net 5?

I’m not sure this will happen anytime soon. The reason I say this is that they would need to add support for XSLT 2.0 in order to add the ability to define assertions against the document (see summary of XSD 1.1). XSLT 2.0 and XQuery 1.0 are technologies that so far Microsoft has chosen to ignore in favour of developing their own LINQ to XML technology.

So if you are given a schema developed in XSD 1.1 and need to use it to validate your xml data in C# or VB .Net what do you do?

Currently I think the only answer is to resort to using a 3rd party library, but this could be impractical and may add an additional expense that may be difficult to justify to your boss. I suppose you could always strip out the 1.1 references, but the validation would not then be true.

Any other suggestions?

 

#


Wednesday, March 13, 2013 #

I had always assumed Android was limited to Java and iOS (iPhone/iPad) was limited to Objective-C, but you can now use Mono for Android and MonoTouch for iOS to write your apps in C#.

I didn't know this was possible until I read the What's New for Liquid XML 2013 where it mentioned support had been added for XML Data Binding with Mono from a company called Xamarin.

Xamarin got the rights to develop Mono extensions from Novell in 2011, I downloaded the free trial and it is a really great product. It integrates within Microsoft Visual Studio, and has good examples to get started. Within a few minutes I had an app running within the android emulator that is provide in the install. Note: The install is huge (940MB) but includes all of the third party products such as Android SDK.

I think this is a big step forward for developing on these platforms as cross platform support is now made easier...hopefully I can now make a fortune writing the next app to go viral, hmm I wonder if birds and piggies would work?!

#

 


Thursday, January 3, 2013 #

I wasted a bit of time on this issue today, so I thought I’d add it to my blog.

I just wanted to schedule a task in Windows 7 Task Scheduler to run every hour forever. I already had this working on an old XP box so thought porting to a new Windows 7 box would be easy. I copied and pasted all of the options and then clicked run. The task failed and in the ‘Last Run Result’ column in the task list on the ‘Task Scheduler Library’ page I got the error code 0x8007010B.

It turns out that this is caused by enclosing the ‘Start in’ path in quotes! This is surprising as you are required to surround the ‘Program/script’ path in quotes if you have spaces in the path.

Anyway, I removed the quotes and it ran OK.

#

 


Wednesday, January 2, 2013 #

As a techie it is often useful to quickly look at a file in notepad, so I always add it as a shortcut in the 'Send to' right click option of Windows explorer. Trouble is I always forget where to add the shortcut when I use a new PC! So for future reference...

1. In windows explorer go to the folder:
%USERPROFILE%\AppData\Roaming\Microsoft\Windows\SendTo

2. Right-click and select New->Shortcut

3. Choose file: %WINDIR%\notepad.exe

Obviously you can add other shortcuts in here too.

#

 


Wednesday, October 31, 2012 #

Sky doesn't seem to understand what their own errors mean, so I cobbled together an understanding from some other posts and managed to get it working.

When you see the error [t6013-c1501] instead of your TV programme in Sky Go, it seems to mean:

'You registered a device, but then changed the hardware, so now I'm confused!'

In other words, the Digital rights management (DRM) used between Sky Go and Silverlight stored an old fingerprint of your PC, but rather than recognising this and allowing you to remove the device, it just disappears from the 'Manage Devices' page.

DISCLAIMER: Perform the following steps at your own risk. It worked for me, but I didn't care if it broke stuff. If you care....don't do it!

So, to fix this I did the following:

1. Login to Sky Go and click 'Watch live TV' from the home page. It will attempt to show Sky News and fail with the error [t6013-c1501].

2. Right click on the error and you should see the Menu option 'Silverlight'. Select this and a dialog should appear. Click the 'Application Storage' tab and delete any entry that relates to sky go. Click OK to close the dialog.

3. Close the browser (if you don't the next bit will fail as it will be using the file you need to rename).

4. Open explorer and navigate to the folder C:\ProgramData\Microsoft\PlayReady

Note: This folder might be hidden on your PC, if so in explorer select Organize->Folder and Search Options->View->Show hidden files and folders and click OK.

5. Rename the file mspr.hds to mspr.hds.OLD

Note: Don't rename/delete the folder C:\ProgramData\Microsoft\PlayReady or you will get the error [t6000-c1501]. The folder must exist in order for the new file to be created by Silverlight.

6. Log back into Sky Go and click 'Watch live TV', this time you should see a message saying something like downloading security components.

 

Techie talk:

So whoever wrote the code to create a new mspr.hds file didn't write code to check the folder existed causing what I assume is a generic error t6000, probably something like:

catch (Exception ex) { WriteToLog("Oops, something broke!"); }

#

 

 

 


Friday, August 24, 2012 #

Yesterday I installed Microsoft Visual Studio 2012 for the first time (all 8.5GB) and after 20 years of (mostly) happy times using VS they have removed Macros, one of the most handy features.

The first thing I wanted to do when I upgraded my VS2010 project was to add a #elseif block to each file. This would usually be simple case of find in files of the previous #elseif and then Ctrl+Shift+R to record a macro which would be: F8 (to select the next file from find list), F3 (to find the correct position in file), Ctrl+V to paste the new code. Then all I would need to do is keep Ctrl+Shift+P (Play Macro) pressed until all the files were processed.

But alas Ctrl+Shift+R does nothing! I won’t say that I use Macros every day but it was a very useful feature.

To continue my moaning a little more, I also don't like the bland interface. This has been well documented by others, but now I have used it myself, I find it difficult to tell one grey area of screen from another and the lack of colour makes the icons unclear.

I also don't see why the menus now need to SHOUT in capital letters?

On the plus side, they have now added the ability to see WPF properties in the debugger...a bit of an oversight in Visual Studio 2010. Oh, but you still can't edit and continue on files that contain templated code.

Whilst Visual Studio 2012 is not a complete disaster like Windows 8 (why develop a desk top OS to be the same as a Smart device OS), it does not float my boat.

Rant over.

#

 


Thursday, June 7, 2012 #

Liquid XML Editor is one of my favourite tools, but I was slightly concerned with the original 2012 release as the new XML Data Mapper tool was a bit buggy. So I was pleased to see SP1 is now available for download.

Sure enough the issues have been fixed and it's once more a great tool!

The data mapper can also now be run from the command line (this was a little limiting before as you had to open the IDE to run the mapping) and the Help now contains full documentation.

#

 


Tuesday, January 31, 2012 #

Hi, it's really handy to be able to add Trace to your .Net application using the System.Diagnostics.Trace class.

The only problem is how the heck do you get it to Trace out at runtime?

The simple solution is to add this to your app config file...

  <system.diagnostics>
    <trace autoflush="true">
      <listeners>
        <clear/>
        <add name="textwriterListener" type="System.Diagnostics.TextWriterTraceListener"
          initializeData="c:\temp\outfile.txt" traceOutputOptions="ProcessId, DateTime"/>
      </listeners>
    </trace>
  </system.diagnostics>

#

 


Thursday, December 1, 2011 #

After clicking a YouTube video link, I was presented with the helpful message ‘You need to upgrade your adobe flash player to watch this video’ along with a link to Adobe to do just that.

After a long and frustrating cycle of install/uninstall Flash Player, I finally realised that this was a bogus message and should instead have said…

‘Looks like you have accidentally clicked Tools->ActiveX Filter option in IE9!’

Arrggghh…hope this helps someone else out who is getting this message (or me again if I misplace another mouse click).

#

 


Thursday, September 22, 2011 #

I may be a bit slow on the uptake here, but I'm not sure how excited to get about my social networks influencing my search results?

I think it's good that you can indicate you like something on Facebook as your friends can have a look at the item or choose to ignore it, and I guess it makes sense that if you like something, then some of your friends will like the same thing.

But when I do a Google search, do I *really* want it to show bias towards things my friends have liked? Also, how many clicks does an item have to get before it is seen as noteworthy for others? Isn't the pool going to be too small?

Either way, good or bad, as a reaction to the noise about this stuff I was tasked with adding the +1 button to a site. This was painless enough...the official Google instructions can be found here:

http://www.google.com/webmasters/+1/button/

I will now monitor the clicks, but somehow I don't think the count will go up that swiftly!!

#

 


Tuesday, March 15, 2011 #

I have had to rebuild my Windows 7 PC and all has gone fairly well until I tried to connect to a Samba share on a legacy Linux box running Redhat 8.

No matter what combination of domain / user /password I would just see the same message of:
"The specified network password is not correct."

This is a misleading error, very annoying and a little confusing until I found a hint that Windows 7 default authentication was not supported on older Samba implementations.

I guess I figured this out once before as it used to work before the rebuild! Anyway here is the solution:

1. Control Panel->System and Security->Administrative Tools->Local Security Policy (or run secpol.msc).
2. Select Local Policies->Security Options->Network security: LAN Manager authentication level.
3. Select 'Send LM and NTLM - use NTLMv2 session security if negotiated' and click OK.

#

 


Tuesday, March 8, 2011 #

I spent most of yesterday removing an annoying virus from my PC. I feel slightly foolish for getting one in the first place, but after so many years I guess I was always going to eventually succumb. I was also a little surprised at the failure of various tools at removing it.

The virus would redirect the browser to websites including ‘licosearch’, ‘hugosearch’ and ‘facebook’, and the disk would be thrashing away infecting dlls in some way.

I had the full up to date version of McAfee installed. This identified that there was an issue in some dlls on the system and was able to ‘fix’ them. But they kept getting re-infected. So I installed Microsoft Security Essentials and this too was able to identify and ‘fix’ the infected dlls.

The system scans take forever and I really expected better results. I also tried Malwarebytes, Hitman Pro, AVG and Sophos to no avail.

Eventually I thought I’d investigate myself. It turned out that on reboot, the virus would start 3 instances of Firefox.exe which I’m guessing would do bad things including infecting as many dlls on the system as possible.

I removed Firefox and the virus cleverly then launched 3 instances of Chrome! So I uninstalled Chrome and yes, it then started to launch 3 instances of iexplore.exe. If I’m honest, by this stage I was just seeing if it would be able to use any of the browsers!

As it was starting these on reboot, I looked in my User Startup folder and there was a <randomly named>.exe and several log files. I deleted these and rebooted. When I looked they had been recreated. So I then looked in the registry Run and RunOnce entries: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run. Sure enough there were entries to run a file in C:\Program Files\<random name folder>\<random name file>.exe.

I deleted this and rebooted and it was fixed. I also looked in the event log and found a warning that Winlogon had failed to start the file C:\Program Files\<random name folder>\<random name file>.exe

So I also checked HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon and this entry had also been changed.

Finally I ran a full system scan to clean up any infected dlls. I hope it’s gone for good!

[UPDATE]

Unfortuately this is the ramnit virus and there are too many infected files to trust that it will be gone for good, so only one solution...format hard drive and start again.

Note: reports about w32.ramnit.a / w32.ramnit.b say that only .dlls, .exes and .html files are compormised, however, my svn source cotrol is showing .doc and .xls files have also changed.

Fortunately I have recent backups which I feel slightly *smug* about as my work colleagues have been less than sympathetic!

 #

 


Friday, March 4, 2011 #

Looking in Web Analytics I could see several external sites pointing at an old .htm file on my web server that no longer existed, so I thought I would get IIS to redirect to the new .aspx replacement. How hard could it be?

This has annoyed me for quite a while today so here is the answer.

1. Install the Http Redirection module - this is not installed by default!!

Windows 7
Start->Control Panel->Programs and Features->Turn Windows Features on or off.
Internet Information Services->World Wide Web Services->Common Http Features->HTTP Redirection.

Windows Server 2008
Start->Administrative Tools->Server Manager.
Roles->Web Server (IIS).
Role Services->Add Role Services.
Common Http Features->HTTP Redirection.

2. Edit your web.config file

<configuration>
    .....
    <location path="oldfile.htm">
        <system.webServer>
            <httpRedirect enabled="true" destination="/newfile.aspx" exactDestination="true" childOnly="true" httpResponseStatus="Permanent" />
        </system.webServer>
    </location>
    .....
</configuration>

When a user clicks or Google crawls ‘oldfile.htm’ it will get a permanent redirect to ‘/newfile.aspx’ - and should take any Page Rank to the new file.

 #

 


Monday, February 28, 2011 #

Microsoft provide an article of the same name (previously published as Q319401) and it shows a nice class 'ListViewColumnSorter ' for sorting a standard ListView when the user clicks the column header.

This is very useful for String values, however for Numeric or DateTime data it gives odd results. E.g. 100 would come before 99 in an ascending sort as the string compare sees 1 < 9. So my challenge was to allow other types to be sorted. This turned out to be fairly simple as I just needed to create an inner class in ListViewColumnSorter which extends the .Net CaseInsensitiveComparer class, and then use this as the ObjectCompare member's type.

Note: Ideally we would be able to use IComparer as the member's type, but the Compare method is not virtual in CaseInsensitiveComparer , so we have to create an exact type:

public class ListViewColumnSorter : IComparer
{
    private CaseInsensitiveComparer ObjectCompare;
    private MyComparer ObjectCompare;

    ... rest of Microsofts class implementation...
}

Here is my private inner comparer class, note the 'new int Compare' as Compare is not virtual, and also note we pass the values to the base compare as the correct type (e.g. Decimal, DateTime) so they compare correctly:

private class MyComparer : CaseInsensitiveComparer
{
    public new int Compare(object x, object y)
    {
        try
        {
            string s1 = x.ToString();
            string s2 = y.ToString();
 
            // check for a numeric column
            decimal n1, n2 = 0;
            if (Decimal.TryParse(s1, out n1) && Decimal.TryParse(s2, out n2))
                return base.Compare(n1, n2);
            else
            {
                // check for a date column
                DateTime d1, d2;
                if (DateTime.TryParse(s1, out d1) && DateTime.TryParse(s2, out d2))
                    return base.Compare(d1, d2);
            }
        }
        catch (ArgumentException) { }
 
        // just use base string compare
        return base.Compare(x, y);
    }
}

You could extend this for other types, even custom classes as long as they support ICompare.

Microsoft also have another article How to: Sort a GridView Column When a Header Is Clicked that shows this for WPF, which looks conceptually very similar. I need to test it out to see if it handles non-string types.

#


Wednesday, February 23, 2011 #

The reason I pose this question is that I'm looking at WPF development and so using the latest version seems sensible. However, this means rolling out the .NET 4 runtime to PCs on old versions of the framework.

Windows XP is still the number one O/S (estimated 40%+ market share). To run .NET 4 on XP requires Service Pack 3, and although it is good practice to move to the latest service packs, often large companies are slow to keep up due to the extensive testing involved.

In fact, .NET 4 is not installed as standard with any Windows O/S as yet - Windows 7 and 2008 Server R2 have 3.5 installed.

This is not quite as big an issue as it was for .NET 3.5 as .NET 4 is significantly smaller as it doesn't include the older runtimes - .NET 3.5 SP1 included .NET 3 and .NET 2 and was 250MB, although this was reduced by doing a web install.

The size is also reduced a bit if you target the .NET 4 Client Profile, which should be OK for many WPF applications, and I think this may be rolled out as part of Windows service packs soon.

But still, if your application is only 4-5 MB and you need 40-50 MB of Framework it is worth consideration before jumping in and using the new shiny features.

#


Monday, February 21, 2011 #

T-SQL has never been my favorite language, but I need to use it on a fairly regular basis and every time I seem to Google the same things. So if I add it here, it might help others with the same issues, but it will also save me time later as I will know where to look for the answers!!

1. How do I SELECT FROM WHERE to filter on a DateTime column?

As it happens this is easy but I always forget. You just put the DATE value in single quotes and in standard format:

SELECT StartDate FROM Customer WHERE StartDate >= '2011-01-01' ORDER BY StartDate

2. How do I then GROUP BY and get a count by StartDate?

Bit trickier, but you can use the built in DATEADD and DATEDIFF to set the TIME part to midnight, allowing the GROUP BY to have a consistent value to work on:

SELECT DATEADD (d, DATEDIFF(d, 0, StartDate),0) [Customer Creation Date], COUNT(*) [Number Of New Customers]
FROM Customer
WHERE StartDate >= '2011-01-01'
GROUP BY DATEADD(d, DATEDIFF(d, 0, StartDate),0)
ORDER BY [Customer Creation Date]

Note: [Customer Creation Date] and [Number Of New Customers] column alias just provide more readable column headers.

3. Finally, how can you format the DATETIME to only show the DATE part (after all the TIME part is now always midnight)?

The built in CONVERT function allows you to convert the DATETIME to a CHAR array using a specific format. The format is a bit arbitrary and needs looking up, but 101 is the U.S. standard mm/dd/yyyy, and 103 is the U.K. standard dd/mm/yyyy.

SELECT CONVERT(CHAR(10), DATEADD(d, DATEDIFF(d, 0, StartDate),0), 103) [Customer Creation Date], COUNT(*) [Number Of New Customers]
FROM Customer
WHERE StartDate >= '2011-01-01'
GROUP BY DATEADD(d, DATEDIFF(d, 0, StartDate),0)
ORDER BY [Customer Creation Date]

 #

 


Sunday, February 20, 2011 #

When I found out yesterday that one of my top 5 development tools .NET Reflector will no longer be free at the end of February, I thought I'd see if work had started on a good open source alternative...and guess what...work on ILSpy is already well underway!!

There seems to be a difference of opinion on what Red Gate said when they purchased .NET Reflector from Lutz Roeder in 2008. They say that they would try to keep it free, where as others think they promised to keep it free. Either way at the time I thought it was a smart purchase by Red Gate as it would raise their profile overnight within the .Net community.

But not only are they going to charge $35 for v7 (which is up to them), they have also time-bombed v6 to force users to pay. This I think will lower their profile overnight within the .Net community!!

Maybe they are been slightly naive in thinking the community wouldn't just write an alternative?

UPDATE: JetBrains now has a free decompiler called dotPeek:
http://www.jetbrains.com/decompiler/

Features:

  1. Decompiling .NET 1.0-4.5 assemblies to C#
  2. Support for .dll, .exe, .zip, .vsix, .nupkg, and .winmd files
  3. Quick jump to a type, assembly, symbol, or type member
  4. Effortless navigation to symbol declarations,
    implementations, derived and base symbols, and more
  5. Accurate search for symbol usages
    with advanced presentation of search results
  6. Overview of inheritance chains
  7. Support for downloading code from source servers
  8. Syntax highlighting
  9. Complete keyboard support
  10. dotPeek is free!

#

 


Saturday, February 19, 2011 #

When applying to join Geeks with Blogs I had to specify the development tools I use every day. That got me thinking, it's taken a long time to whittle my tools of choice down to the selection I use, so it might be worth sharing.

Before I begin, I appreciate we all have our preferred development tools, but these are the ones that work for me.

Microsoft Visual Studio

Microsoft Visual Studio has been my development tool of choice for more years than I care to remember. I first used this when it was Visual C++ 1.5 (hats off to those who started on 1.0) and by 2.2 it had everything I needed from a C++ IDE. Versions 4 and 5 followed and if I had to guess I would expect more Windows applications are written in VC++ 6 and VB6 than any other language.

Then came the not so great versions Visual Studio .Net 2002 (7.0) and 2003 (7.1). If I'm honest I was still using v6. 2005 was better and 2008 was simply brilliant. Everything worked, the compiler was super fast and I was happy again...then came 2010...oh dear.

2010 is a big step backwards for me. It's not encouraging for my upcoming WPF exploits that 2010 is fronted in WPF technology, with the forever growing Find/Replace dialog, the issues with C++ intellisense, and the buggy debugger. That said it is still my tool of choice but I hope they sort the issue in SP1.

I've tried other IDEs like Visual Age and Eclipse, but for me Visual Studio is the best. A really great tool.

Liquid XML Studio

XML development is a tricky business. The W3C standards are often difficult to get to the bottom of so it's great to have a graphical tool to help. I first used Liquid Technologies 5 or 6 years back when I needed to process XML data in C++. Their excellent XML Data Binding tool has an easy to use Wizard UI (as compared to Castor or JAXB command line tools) and allows you to generate code from an XML Schema. So instead of having to deal with untyped nodes like with a DOM parser, instead you get an Object Model providing a custom API in C++, C#, VB etc.

More recently they developed a graphical XML IDE with XML Editor, XSLT, XQuery debugger and other XML tools. So now I can develop an XML Schema graphically, click a button to generate a Sample XML document, and click another button to run the Wizard to generate code including a Sample Application that will then load my Sample XML document into the generated object model.

This is a very cool toolset.

Note: XML Data Binding is nothing to do with WPF Data Binding, but I hope to cover both in more detail another time.

.Net Reflector

Note: I've just noticed that starting form the end of February 2011 this will no longer be a free tool !!

.Net Reflector turns .Net byte code back into C# source code. But how can it work this magic? Well the clue is in the name, it uses reflection to inspect a compiled .Net assembly. The assembly is compiled to byte code, it doesn't get compiled to native machine code until its needed using a just-in-time (JIT) compiler. The byte code still has all of the information needed to see classes, variables, methods and properties, so reflector gathers this information and puts it in a handy tree.

I have used .Net Reflector for years in order to understand what the .Net Framework is doing as it sometimes has undocumented, quirky features. This really has been invaluable in certain instances and I cannot praise enough kudos on the original developer Lutz Roeder.

Smart Assembly

In order to stop nosy geeks looking at our code using a tool like .Net Reflector, we need to obfuscate (mess up) the byte code. Smart Assembly is a tool that does this. Again I have used this for a long time. It is very quick and easy to use.

Another excellent tool.

Coincidentally, .Net Reflector and Smart Assembly are now both owned by Red Gate. Again kudos goes to the original developer Jean-Sebastien Lange.

TortoiseSVN

SVN (Apache Subversion) is a Source Control System developed as an open source project. TortoiseSVN is a graphical UI wrapper over SVN that hooks into Windows Explorer to enable files to be Updated, Committed, Merged etc. from the right click menu.

This is an essential tool for keeping my hard work safe! Many years ago I used Microsoft Source Safe and I disliked CVS type systems. But TortoiseSVN is simply the best source control tool I have ever used.

---

So there you have it, my top 5 development tools that I use (nearly) every day and have helped to make my working life a little easier. I'm sure there are other great tools that I wish I used but have never heard of, but if you have not used any of the above, I would suggest you check them out as they are all very, very cool products.

#

 


Friday, February 18, 2011 #

Hi and welcome!

I'm a software developer and this is my geeks blog. I have 20 years Visual Studio mainly C++, MFC,  ATL and now, thankfully, C# and I am embarking on the new world (well new to me) of WPF, so I thought I would try and capture my successful...and not so successful...WPF experiences with the geek world.

So where to start? WPF?

What I know so far...

From wiki..."Windows Presentation Foundation (or WPF) is a graphical subsystem for rendering user interfaces in Windows-based applications."

Hmm, great but didn't MFC, ATL (my head hurt with that one), and .Net all have APIs to allow me to code against the Windows Graphical Device Interface (GDI)?

"Rather than relying on the older GDI subsystem, WPF utilizes DirectX. WPF attempts to provide a consistent programming model for building applications and provides a separation between the user interface and the business logic."

OK, different drawing code, same Windows and weren't we always taught to separate our UI, Business Layer and Data Access Layer?

"WPF employs XAML, a derivative of XML, to define and link various UI elements. WPF applications can be deployed as standalone desktop programs, or hosted as an embedded object in a website."

Cool, now we're getting somewhere. So when they say separation they really mean separation. The crux of this appears to be that you can have creative people writing the UI and making it attractive and intuitive to use, whist the geeks concentrate on writing the Business and Data Access stuff.

XAML (eXtensible Application Markup Language) maps XML elements and attributes directly to Common Language Runtime (CLR) object instances, properties and events. True separation of the View and Model.

WPF also provides logical separation of a control from its appearance. In a traditional Windows system, all Controls have a base class containing a Windows handle and each Control knows how to render itself. In WPF, the controls are more like those in a Web Browser using Cascading Style Sheet, they are not wrappers for standard Windows Controls. Instead, they have a default 'template' that defines a visual theme which can easily be replaced by a custom template.

But it gets better. WPF concentrates heavily on Data Binding where the client can bind directly to data on the server. I think this concept was first introduced in 'Classic' Visual Basic, where you could bind a list directly to a data from an Access database, and you could do similar in ASP .Net. However, the WPF implementation is far superior than it's predecessors.

There are also other technologies that I want to look at like LINQ and the Entity Framework, but that's all for now.

#