December 2008 - Posts

 

When I was going through the snippet editor code to put it on CodePlex, I wanted to grab a screen shot of the snippet schema.  immediately I was confronted with there being no visual designer for schemas in VS 2008, but the worse part was I could have sworn there use to be.  To clear up that confusion here’s an illustrated history lesson on schema views in Visual Studio.

 

In earlier versions of Visual Studio the schema designer was a bit like the early dataset designer.

This is Visual Studio 2005 :

xsd2005

 

It was detailed as far as types and constraints goes but omitted documentation.  With complex schemas it was a mess, but you could hide parts.

Then in Visual Studio 2008 they decided to get rid of the schema designer completely !!  I’m really not sure the logic on that. There was however a CTP for the new Schema Explorer, and come Visual Studio 2008 Service Pack 1, the schema explorer was included.  (I hope I’ve got that bit of history right)

xsd2008

The Schema explorer gives a nice overview, and provides for navigation but totally lacks real details (not synchronized with the properties window).  Sadly for Visual Studio 2008 that’s as best as it gets, the rest is wading through the actual xsd file as xml.

 

The first CTP of Visual Studio 10, reveals a new designer that can be used in conjunction with the Schema Explorer.

 

xsd2010

 

This pretty visual representation is all done in WPF so you can zoom in and out nicely. As well as the ability to easily expand and shrink elements, it’s really nice way to get an overview.  You can even turn on documentation so as you can see any comments from the schema:

xsd2010_with_doc

 

Although this is very pretty, and a great visual aid, it still doesn’t provide any means to create a schema or edit one… it’s simply a view.   Some things I’d like to see improved are :

  • Provide designer editing and creation of schemas 
  • have an export to .png feature
  • Ability to fully expand comments for all items.  At present only the first two lines are shown and you have to double click on each element to get the comments to fully expand
  • did I mention editing ?
  • tear-offs would be nice, such that I could then use the width of the screen (eg: Drag the “Header” element from the above picture to the right, and then it expands over there rather than in situ.)
  • show restrictions. For example, the SnippetType is restricted to three possible legal values, “Expansion”, “SurroundsWith” and “Refactoring”.  To find that out I have to delve into the xsd.
  • Synchronise with Properties window allowing for more detail to be shown and edited in the Properties window
  • Provide Copy as Path. The bottom of the screen shows the path of the selected node, but it would be great if you could select to copy that to the clipboard as an XPath. Even cooler if you could choose between XPath, VB XML Axis/Literal sytnax, or XElement syntax (for those poor ol’ C# folks ;) )
  •  

 

The Visual Studio 10 stuff looks promising, but still has a long way to go. (did I mention the lack of editing ?)  In the interim it would be nice if there was something, anything !  I’m really not sure why the 2005 xsd designer was dropped. Sure some of it was ugly, especially the way it shows things like the string restrictions, but it was and is less ugly than the XML for  that part of the xsd !!

Visually we have progressed... but what about the editing ??

with 4 comment(s)
Filed under: , , , , , , ,

I’ve just finished uploading the Snippet Editor to CodePlex

http://www.codeplex.com/SnippetEditor

It includes some minor bug fixes from the previous release.

Enjoy :)

And Merry XMas :)

From a recent discussion on using lists, and whether or not you can remove items in while iterating, I decided to write an extension that allows you to get a “transaction” for an IList(Of t).  This ListTransaction(Of T) caches adds and removes until you call commit (kudos to Duncan for the idea !!).  It also implements IDisposable so you can use a using scope, eg:

 

      Using listTran = mylist.GetTransaction

         For Each item In mylist

            ' other code here

            listTran.Remove(item)

         Next

      End Using

 

And here’s the implementation:

 

Module ListExtensions

 

   <Runtime.CompilerServices.Extension()> _

   Function GetTransaction(Of T)(ByVal list As IList(Of T)) As ListTransaction(Of T)

      Return New ListTransaction(Of T)(list)

   End Function

 

 

   Public Class ListTransaction(Of T)

      Implements IDisposable

 

      Private _list As IList(Of T)

      Private _adds As List(Of T)

      Private _removes As List(Of T)

 

      Public Sub New(ByVal list As IList(Of T))

         _list = list

      End Sub

 

      Public Sub Add(ByVal item As T)

         If _adds Is Nothing Then _adds = New List(Of T)

         _adds.Add(item)

      End Sub

 

      Public Sub Remove(ByVal item As T)

         If _removes Is Nothing Then _removes = New List(Of T)

         _removes.Add(item)

      End Sub

 

      Public Sub Commit()

         If _list Is Nothing Then Exit Sub

         If _adds IsNot Nothing Then

            For Each item As T In _adds

               _list.Add(item)

            Next

            _adds = Nothing

         End If

         If _removes IsNot Nothing Then

            For Each item As T In _removes

               _list.Remove(item)

            Next

            _removes = Nothing

         End If

      End Sub

 

      Public Sub Rollback()

         _adds = Nothing

         _removes = Nothing

      End Sub

 

 

      Public Sub Dispose() Implements IDisposable.Dispose

         Commit()

         GC.SuppressFinalize(Me)

      End Sub

 

   End Class

 

End Module

with 6 comment(s)
Filed under: , , , ,


fan tailed cuckoo

 

Rain, rain, glorious rain !!!!

It’s been raining for about 24 hours now. Nothing really heavy, not more than say half an inch in an hour, rather it’s been a good soaking rain.  I can’t remember the last time it rained as good as this :)  I think we got a good couple of inches all up so far, with more forecast for the next week.  October was terribly dry, only half an inch when usually we get more than three, so this rain is most welcome.

Typically (or is that historically ?), here we get most of our rain in winter (temperate climate), with August being the wettest averaging a about three and a half to four inches, or 9 cm in modern talk. (I’d use mm but that sounds too precise ;))  And it slowly decreases, October usually above 7 cm, December down to about 4 to 5 cm, and the driest being Feb at about 3 to 4 cm.  Our summer rains though can be more intense, as is highlighted by the difference between the mean and median for Feb, being 35 mm and 23 mm respectively. (knew you geeks would like that bit of details <g>)

 

So on to the garden.  Well it’s raining and I don’t want to get my camera wet, so just a few photos from the camera’s SD card over the last month:

A heron on the pond:

 

In the veggie patch the tomatoes are growing well. There’s broad beans ready to eat and more on the way, and soon there’ll be other beans and snow peas.  Self sown lettuce are still popping up all over the place.  Many of the climbing plants are doing really (maybe some photos next month)  I just love the different ways they climb.

I got a few new potatoes the other way while pulling out some that had self sown from that crop I didn’t dig up properly many many years ago.  This year I also planted more potatoes: the first in many years. There’s the usual white potatoes that have white flowers:

 

 

And then there’s these other ones I planted that have violet flowers :

 

 

I was quite amazed by the colour of those flowers.  They’d make a really nice border plant in any garden bed.

Oh, if you look carefully, you can see a snow pea plant leaning over and touching the flower at the front. I planted snow peas between two rows of potatoes and they’re all looking really happy :)

 

Had my first cherry for the season the other day. It will still be a few more weeks till they come in.  The plums are looking promising again too:

 

Elsewhere in the garden the roos are keeping busy mowing the lawn (kind-of).  A buck roo came in and was all feisty the other week:

 

 

 

When they stand up like that, it’s often territorial. Always best to stand back a bit ;)

 

This little fella (below) is not a kangaroo, rather he is a wallaby:

 

Much smaller in size, usually darker coloured, and like this one have distinct facial markings.

with no comments
Filed under:

One of the things you have to be careful about here is snakes on the bike trails and roads.  Some years I see none, others a few. It always seems worse when you are going fast downhill, especially if on gravel ;)

So tonight when I decided to go for a ride I thought I’d do a loop, as there’s a really nice section of rail trail that’s mainly downhill, but it can be hard to spot the snakes on it especially if you are powering down the grade. So I thought I’d go around and ride up hill on the rail trail.  But just as I entered the national park I remembered they had laid down road base on a large section, and that’s like riding a rough stone creek bed. So I quickly doubled back and took any even wider detour. And sure enough only a couple of km’s in, I encountered another snake on the road.

Fortunately I wasn’t going too fast, and I got a good clean look at him.  It was of course a tiger snake. They’re the most common around here, along with copper heads (not to be confused with the American copper heads) and the occasional red belly blacks.  All the ones I’ve seen on trails have been tiger snakes.  Not sure if it is a coincidence of when I tend to ride, but I usually see them mid to late afternoon, but at least a couple of hours before dusk.  Sometimes they are probably warming themselves, but at least twice I’ve seen them look like they were crossing then they stop as I get nearer. Tonight the tiger wasn’t that big, probably about 3 foot (< 1m) long and only 40 mm or so wide. He was moving as if he was crossing the road, but when I got about 10m away he seemed to stop.  The road was wide enough so I just rode around his tail end.   For the next few kms I couldn’t help but think of all the scars I have on my legs from twigs and branches that flick up as I ride and the occasional stone… I wonder if I should consider shin guards of some sort.

The rest of the ride was lovely, took in a few kms of flat and some nice hill climbs. About 40 km in total with minimal pain, which is good because I haven’t been riding much lately due to the lousy weather (cold/ drizzle or very windy). 

And of course, encountering a snake on the trail just adds to the reasons to have a beer when you get home :)

with 1 comment(s)
Filed under:

Over the last week I’ve got a sudden influx of emails about the Snippet Editor.  I’m figuring this is stemming from Lisa’s recent blog entry and her tips and trips for VS 2008 presentation :) 

Some of the emails have been really nice praise, folks wanting to add some features, a bug on XP 64 (which unfortunately is about the only OS I don’t have in my testing suite), and some general questions around snippets.  So I gave this lots of thought and decided to put up a site on CodePlex. This will allow people to add features, work together on bugs, and share discussions around snippets including future directions for the snippet editor.

The new codeplex site will be at http://www.codeplex.com/SnippetEditor

It’s not ready yet, and will probably be a week while I get all the bits together and ensure there’s no rude words in the code comments etc ;)  I was hesitant about moving to CodePlex as I was really disappointed how gotdotnet was just closed down and not migrated. And I should add here a word of caution for those in charge should CodePlex go a similar route.. I will travel the continents and track you down and when I find you stare at you for a really long time until you feel uncomfortable !!  ;)  (Seriously, please don’t close codeplex)

So, all going well, the Snippet Editor will be on CodePlex this time next week.  I’ll make sure to post when it’s ready and redirect my current site there.  Any suggestions on the open  source license eula etc most welcome.

As I was driving home last night , Venus, Jupiter and the crescent moon were aligned to form a smiley in the sky.  Unfortunately I didn’t have my camera with me. This picture is from the dailymail taken in Sydney:

 

Here it looked a lot brighter even though there was partial cloud cover. The clouds blocked pretty much all the other stars so it was only Jupiter, Venus and the moon in the sky.  :)

with no comments
Filed under: