March 2008 - Posts

Reading the blog entries around OOXML is almost as bad as sitting through an episode of Days of Our Lives.  Most of the opposition comes directly from different people that are directly vested in ODF. And now that the vote looks like it might accept OOXML, the conspiracy stories start, such as claiming of stacking.  One blog post I was reading said it was outrageous that Microsoft complained about the stacking of the Indian committee.  Funny how when Microsoft complains about the stacking that's bad, but when they complain about the stacking that's good.  Looking at the Indian panel one really does have to question the role of IBM, Sun and RedHat on the committee as clearly they are in direct competition to Microsoft in this area. One would expect as many of Microsoft's partners to be invited at a minimum just to balance that.

In the end though, it's unlikely that any of the irregularities on either side of the arguments really make much difference.  OOXML is indeed worthy of becoming an ISO standard. ODF possibly should have been if they hadn't of deliberately decided not to support features of existing documents.

But I don't believe the OOXML is of proper quality at present. That is, although I believe it eventually will be worthy, I think they need to take more time and fix the specification.  One advantage of it becoming a standard now, is that it may encourage working teams to set about that, rather than leaving it purely in the hands of Microsoft.

One thing people talk about is the size and complexity of the standard. I think there'd be value in having a "Lite" version of the standard or feature set levels, such as level 1 is the minimum functionality... level 3 or n is the full specification.  That is, make the benchmark for supporting OOXML in part clearly defined. As it stands it is unlikely there will be full support for the entire specification from anyone (even Office 2007 doesn't now have full support).  Really, a standard needs to be achievable, and OOXML is a bit vast for that to happen easily by anyone outside of Microsoft.

Regardless of the yes or no at ISO, this really has to be viewed as a first step, and either way, if Microsoft wants to be taken seriously they need to do a lot more, making OOXML more accessible and easier to implement and ensure conformity.

with 1 comment(s)
Filed under:

Paul Vick posted a speculative post as to Automatically Implemented properties for VB10.  Although it's kind of nice, it really is just a minor modification from what C# did in 3.0 and misses a lot of the "what if" scenarios we should be asking.

What if :

  • You want to add a break point on the property set  or get?
  • You need to add some validation or logging ?
  • You want your existing code to look consistent ?

What's being proposed falls down on all those counts.  A better approach, IMO, would be to just auto collapse properties, similar to what Refactor! does. That works with existing code1, and addresses all the what ifs above.

I also expect there will be IDE issues around the syntax Paul proposes as it is no different from the opening line of a Property today. So when you hit enter at the end of that line, you'd expect code completion. So adding lines between these auto properties will potentially break code.

And when you do press enter, let's assume it does complete the code block for you:  it would need to include the backing field otherwise it risks breaking code elsewhere. That's a major change from today, where unless you use a snippet, you only get the property stubs.

 

What I would like to see, is allow the backing field to be declared inside the property block, such as :

   Public Property Name() As String

     Dim m_Name As String

     Get

         Return m_Name

      End Get

      Set(ByVal value As String)

         m_Name = value

      End Set

   End Property

 

Then the property truly can be collapsed and expanded as it is fully encapsulated.

I'd also especially like us to be able to specify the default prefix used for backing fields when generated, be it m_ or _ or m etc.  We shouldn't have to change our coding styles to match an inflexible code generator.

I think this feature needs to be looked at in terms of existing code, and code maintenance, not just a quick fix for writing pass through properties.

 

 

 

1. There's a bug in Refactor with properties in a Module, where it hides the property, not the backing field.

with 4 comment(s)
Filed under: , ,

Paul Stovell finally notices the lack of support for statement lambdas in VB9.  Unfortunately Vb9 only supports lambda expressions such as can be expressed in today's expression trees.  .NET 4.0 will most probably include support for lambda statements, and hopefully at the same time VB10 will have support for them too.

When support for multi statement lambdas was dropped from VB, I complained bitterly.  It's a real pain, especially if you want to just add something benign like logging into a lambda: in VB9 you can't easily.  Yes there are "work arounds", but if you need to capture surrounding variables, then it's a huge pain as you need to manually write the captures (promotion of local variables into fields in another class).

Of course fixing this feature, is on my VB10 wish lists.  It's listed as item 6 in the first part of VB10 feature wishes.

The nice thing for VB in all of this though, is it will probably never have to separate what can and can't be expressed as an expression tree.  C# has kind of made a mess around anonymous delegates and lambdas (I've even heard Anders admit to that !). ;)

with no comments
Filed under: , , ,

Patrick Meader writes on the divide between VB and C# inside Microsoft, and raises an interesting question.

My response is probably going to be lengthy; more than I have time for at present. In the meanwhile, what do you think of the issues raised in Pat's editorial ?

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

Does VB need prefix and postfix increment and decrement operators ?  Here's an example I posted today for a question on adding an index with LINQ:

   Sub Main()

      Dim values() As String = {"aaa", "bbb", "ccc"}

      Dim index As Int32 = -1

 

      Dim view = From v In values _

                 Let x = increment(index) _

                 Select x, v

 

      For Each item In view

         Console.WriteLine(item.x & " : " & item.v)

      Next

      Console.ReadLine()

   End Sub

 

   Public Function increment(ByRef value As Int32) As Int32

      value += 1

      Return value

   End Function


 

And this is the same code in C#:

 

      static void Main(string[] args)

      {

 

         string[] values = { "aaa", "bbb", "ccc" };

         int index = -1;

 

         var view = from v in values

                    let x = ++index

                    select new{x, v};

 

         foreach (var item in view)

         {

            Console.WriteLine(item.x + " : " + item.v);

         }

         Console.ReadLine();

      }

 

Note in C# I didn't need to write the increment function.

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

with no comments
Filed under:

No, not the chocolate ones or the decorated chicken eggs... I mean software easter eggs.  Like the ones in Excel where you could display an animated scroll of all the contributors. And they had similar in Outlook, and even in Visual Studio 6 !  Has all the fun (and chocolate and caramel centres)  been taken out of Microsoft software  ?

 

BTW: Has anyone seen the easter egg in the VB Snippet Editor ?  It's pretty easy to find ;)

with 3 comment(s)
Filed under: , ,

Earlier today I followed Soma's link to the updated Visual Studio Express pages. Soma gave emphasis that the "approach was to add Silverlight without making it look like we just dropped something new into our existing site without any thought".  Hmmm, could have fooled me ;)

The first thing I noticed (other than having to allow the AgControl Class addon) was with the new site I have to wait for silverlight data to be downloaded.  And that is slow.  But why do I have to wait ?  Seems all that is really being brought down is a series of about 10 slide shows.  Sure to the naive they look pretty because the screen shots are on angles, but it's also incredibly useless. You can't even navigate through those slides.  It's like it was designed to wow the bosses inside on the corporate network as they sit back and watch the slide show.  As far as end user goes, it sucks.  Why the hell should I have to wait for (and pay for the bandwidth used by) a useless bunch of slides ?  What ever happened to *asynchronous* fetching of data ?

And the big problem for users is they don't know if they are able to get the same content without Silverlight.  Was there any real gain to the user ?  Or did it force the user to wait, and in fact make navigation more awkward (such as when you go forward and then go back, you have to sit and wait through the slide show again depending on which slide was relevant to you).

What scares me is that Soma is proud of this usage of SilverLight.  I guess that means he must have just sat back and watched the slide-show over the corporate intranet :(

with 2 comment(s)
Filed under: ,

"First time or casual programming" : that's apparently what VB is good for.  If you want a great combination of power and productivity that's what C# is good for......

well, at least that's how Microsoft tells it to us.

Microsoft, why do you treat VB so patronisingly ?

with 6 comment(s)
Filed under: ,

I got an email today asking about the use of the Microsoft.VisualStudio.Zip assembly.

Hi,

my name is XXXXXX and I'm from XXXXX.

I'm writing a custom .Vsi writer and I saw that in the Code Snippet Editor for VB 2008 (a great tool!) you made use of the Microsoft.VisualStudio.Zip assembly.

What are licenses related to this assembly? I mean.. can I reference it to a project of mine (which I'll release as an open source) or only Microsoft people can use it?

 

That's not an easy question to answer as I am certainly no lawyer.  But I did use it, and Microsoft has pointed to and distributed the code I wrote that uses it. But I am not from Microsoft, and Microsoft may have done that unknowingly.

The Microsoft.VisualStudio.Zip library ships with Visual Studio and is installed in the GAC, but usually you need to turn off fusion view to reference it.  My belief is that as long as you don't distribute the dll then there is no licensing issue. And I believe that you may even be technically able to distribute it to systems that have Visual Studio as they have a license to use it, but that's a grey area.

Personally, I think intent is the real issue, and I honestly can't see anything bad in anyone referencing the assembly if they are writing tools to extend Visual Studio in a manner that doesn't compete with Microsoft's different SKU's.

The sad thing is Microsoft doesn't actually provide a Zip library as part of .NET that you can reference and use in ANY project.  They provide and use Zip for their Packaging classes but they only include API for working with office OpenXML files.  They also provide the gzip stream stuff, but there's a fair bit of work to make that work with actual zip files.  The sad part of this is Microsoft views zip as important, be it .VSI files and Visual Studio, or OpenXML files  such as docx etc which are renamed zip files, yet they don't provide a Zip library as part of .NET, even though they have written one and use it themselves.

with 1 comment(s)
Filed under: , ,

It must be hot or I'm having one of those days.  I was just testing some code and it seemed to do the unexpected.  The problem was I had written :

   Public Overrides ReadOnly Property IsInvalid() As Boolean

      Get

         Me.handle = IntPtr.Zero

      End Get

   End Property

This function was not only returning the wrong value but it was also changing the state !!

Okay, obviously I meant that to read:

         Return Me.handle = IntPtr.Zero

but I made a mistake. The problem was exasperated by no warning from VB that the Get wasn't returning a value.  I hate that. It's as bad as that stupid implicit local variable VB creates for you with the same name of the function.  I wish I could easily turn off VB's desire to help me as that would be in fact far more helpful ;)

And of course if there was an option to have a different equality operator from an assignment operator, that would have possibly helped a little in this case.  Maybe I should write it using the double negative:

        Return Not (Me.handle <> IntPtr.Zero)

;)

with no comments
Filed under: ,

After my post about the first set of insults from the Windows Live team and the Search API samples, it was nice to see some VB samples released.  Sadly though they were just the C# samples run through an automated tool.  I mean look at this bullshit code from them :

 

Select Case searchFlagsValue
       Case 0
           .Flags = SearchFlags.None
           Exit Select
       Case 1
           .Flags = SearchFlags.MarkQueryWords
           Exit Select

  .......

 

The Exit Select is just utter crap. The only reason it's there is because the c# code uses break statements inside a switch block and that's what their machine translation mapped to Exit Select. It shows an incredible ignorance of VB, and demonstrates yet again complete contempt for the VB audience.

To add insult to insult, they also decided not to include the Windows.Forms sample for VB.

 

.

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

Kudos to Charlie Calvert for opening up the discussion of C# future features to the public (sure would be nice if the VB team did likewise). In the first post on future features, Charlie talks about dynamic lookups in C# ....

Although the catchy term "Dynamic" is used here, there is in fact nothing dynamic about what is being proposed: you need to know the member name at compile time. The object that you might be calling it on can (has to ?) be late bound (as Object), but your code is still required to provide the exact name at compile time.  So it's not your code that is dynamic, it may be the code that creates the type you are working with is dynamic, but it doesn't have to be. An example given is Office or COM types where it's late bound. All that the C# team is really talking about is a subset of VB's Strict Off late bound capabilities. (more on that in a minute)

Dynamic for your code would be such as when you store the member name in a database or xml file etc, retrieve that then call that member using the string.  It's dynamic because it is created on the fly at runtime.  That's what dynamic means: objects that are in motion.  A typical example of this in VB today is using the CallByName function. Adding this capability to C# would be adding dynamic lookup; what Charlie proposes is late bound lookup ;)

Late bound lookup is useful when dealing with types that don't expose their member metadata at compile time (COM or DL types). There's actually a complex set of capabilities to make it "smooth" when working with such types apart from member calls, such as casting, assignment and operators. Member calls are just one issue. For C# the issue gets more complex as they have to decide if they are going to require case sensitivity on members, even though the object language or runtime (COM or .NET etc) might not be.

If C# is going to support the full gamut of features for working with dynamic types, then a block scope as proposed makes sense. Block scope is basically what VB has, but in VB the scope is the entire code file where Option Strict Off is specified.  That's a royal pain in the a***.  For VB however I'd much rather see fine granular control such as dynamic identifiers: foo.(bar) or similar kind of syntax to indicate a late bound call, and perhaps foo!("bar") for the dynamic call where the member name is supplied as a string.  And of course, the use of dynamic interfaces to allow the applying of contracts to your code would also be nice :)

What Charlie has shown for C# seems to me to be the worse of all worlds: it's not truly dynamic, and it's unclear/uncertain if C# will have any other support in those blocks for late bound operations other than member calls. That being the case I think C# would be better to have a modifier such as ! or .. instead of . to indicate which member calls are late bound. Block scope just allows lots of rooms for errors in code that can't be determined till runtime: that's the cost of late bound calls.  Limiting their use and scope in code should remain the common goal.

with no comments
Filed under: , ,

 

Nearing midday today I could hear the local hawks calling to each other, so I decided to try to get a picture of them with my new camera.  The below shots are taken at full zoom !  That's 18x optical plus some digital taking it up to about 27x.  I just set the camera to automatic mode, point and clicked :)  (no tripod, no calculations etc).   To give you an indication of sizes and distances roughly speaking the goshawk is about a foot tall in the body, the tree it was sitting in is probably around the70 foot mark, and I would have been that distance again from the tree, so well over 100' feet away anyway.

 

 

 

The images were 2048 x 1536 and I scaled them down to 1280 x 960.  There was some noise in the originals that wasn't noticeable once scaled down

with no comments
Filed under:

waether

 

Doesn't look like it to me :)

with no comments
Filed under:

Yesterday I reported how the Windows Live Search team posted samples in 5 different languages, but not VB.  Well today the Live team has posted their Live ID Web Authentication SDK, which boasts :

This release includes a sample application for each of six different programming languages: ASP.NET, Java, Perl, PHP, Python, and Ruby.

But when they say ASP.NET, they actually mean C#.  Yes Microsoft can release samples in six different languages just as long as none of them are VB.  (can you say "the n word" ?)

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

Microsoft's Live Search API team have released samples in Java,  PHP, C#, Python and Ruby, but no VB samples.

live search

Better not say the "N word", even though that's the way it seems yet another team at Microsoft chooses to treat their supposedly most popular language base.  The question remains though, what will it take for the divisions inside Microsoft to treat VB equally.

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

February certainly has been a month of plenty :)

 

In the Orchard:

The fresh eating blood plums have come and gone (most deliciously). The last of the blood plums are still on the trees, and are nice for making jam. I've been adding Nashi and some apple or pear with the plums and it makes a great conserve (no need for sugar as the pears/nashi sweeten it) !

The apples have begun to ripen. There's some great eating ones now:

And the pears also are ripening. The standard type (Bartlett or similar) are ripening. They fall off the tree pretty quickly as they ripen, so you have to be vigilant or pick them slightly under-ripe and let them ripen inside. I tend to go for the later. Superb eating this year.

 

In the veggie path

The big new addition for this month has got to be the sweet corn :)

 

One unexpected early addition was a "Queensland blue" pumpkin.  I was turning it, and it broke off, so I had no choice but to harvest it ;)  To my surprise and delight it was quite ripe inside, and has been lovely steamed or roasted :) It was probably a 6 or 7 kg pumpkin (12 to 15 lb)

The tomatoes are doing well, with the late crop just starting now.  The grape tomatoes have been the main stay for salads (definitely on the plant next year list).  Sweet basil is flowering, although I am trying to delay that a bit by pinching out the tips.

Capsicums are all ripening and growing well:

And cucumbers are rampant at present (taking over the "rampant" growth trophy from last month's winner the zucchinis). 

The zucchinis have slowed down to a manageable harvest rate again (thank the heavens ;)).  Carrots are doing really well, getting quite large but no sign of hollowing and only the odd occasional one with a split. Celery is almost at "bunch" stage: I'm still thinning, and just taking a few outer stalks. Beetroot is also still doing good (no sign of bolting)

One disappointment turned out to be the scarlet runner beans. (or were they "purple king" ?) .  They have pretty much finished now, the plants have died back, and there's just the seed to collect.  The other green climbing beans are still doing well.  Looks like I need to investigate good climbing beans that produce over lengthy periods of time a bit more.  I really do like the "form factor" of climbing beans compared to bush beans.. aesthetically they impact on the entire feel of the garden (in a good way).

And of course there's silver beet and the next crop of lettuce is good for a few leaves here and there. Watermelons seem to be doing very little... I guess it's just not hot enough for them here. I doubt I will try them again.

The sunflowers are pretty much all in flower, with a range of colours. Some look like the petals have been painted with a brush, while others are reddish to orange and others pure yellow:

 

 

Seed:  I collected a fair bit of snow pea seed (well probably not even half a kilo, but still plenty for the next year and then some).  There's some cos lettuce seed and parsley seed almost ready to harvest, and the scarlet beans. Earlier in the season I collected a LOT of broad bean seeds as well.

 

Garden works: I dug up the second phase of the garden area, formed the beds and laid out T-Tape drip irrigation.  The new plot doubles the size of the current veggie patch, adding an extra 20 x 5 meter block. It's divided into six loosely raised beds for veggies, each about 8 or 9 meters long and roughly a meter (or 3 feet) wide. Each bed has two lines of T-Tape on it, with holes every 200 mm.On the outside of the plot, along the west, there's also a narrow bed that has vines (one grape, 3 kiwi fruit) and some black currants, as well as strawberries growing in between.  I planted that out the start of this season, but it was only this month I gave them automated watering with the T-Tape.  The difference the water makes is huge ;) 

Hopefully in the upcoming weeks I'll *make the time* to start sowing in the new section. At present the weed are only tiny, but everywhere as this is the first big dig and watering.  So a light cultivation and it should be ready to go :)  Two of the six new beds are mulched with all the weeds and veggie garden clippings (kind of open composting <g>), whilst another is occupied by the pumpkins that invaded from the first plot. the emphasis in there still is building up the organic matter.

 

 

Anticipation:

The Beurre-Bosc pears aren't too far away now:

 

And looks like some peaches this year as well:

 

The weather:

February was colder than average by a good few degrees Celsius. The mean temp was about 24, and there was only 3 days above 30 (happened to be 3 days in a row mid month with temps around 34 or 35). The rest of the month was unseasonably colder than usual. Rainfall was about average I think.

I've heard a few weather men talk about the end of summer, but I am sure they are mistaken ;)  .... after all, it never ends, just shifts around ;)

with 1 comment(s)
Filed under: