January 2009 - Posts

Came across this site today:

http://www.onesentence.org/

Enjoy :)

with no comments
Filed under:

That pink flowered weed I posted yesterday is likely to be a member of the Centaurium genus.

 

I’m guessing at Centaurium pulchellum. (Century).

“pulchellum” coming from the Latin word pulchellus meaning beautiful

Centarium is said to be from Greek mythology:

The lore associated with centaury is that it was used by the famous centaur, Chiron, to heal himself from an arrow laced with the poison of the hydra. Chiron is notable to herbalists as he was known in Greek mythology for his knowledge of herbs. The genus was even referred to as Chironia.

In medieval times it was mixed into incense to increase psychic awareness and altered states of consciousness. It was also burned on its own and the smoke was said to repel snakes from an area.

Excerpt from : http://www.bastyr.edu/academic/botmed/centaurium_erythraea.asp

 

Still a weed of course ;)

with no comments
Filed under:

I got this note from Julie I liked so much I just had to share :

Pretty flowers...good

Screaming bunnies...bad

:-)

with no comments
Filed under:

WARNING: If you’re feeling squeamish, please don’t read any further.

Most of you have probably heard of the film “The Rabbit Proof” fence. The fence is a striking symbology of the mistakes we’ve made, and the often flawed later attempts to address those mistakes.  I’m not going to talk about the actual subject of that film, the stolen generations, that’s way to massive mistake for me to give justice to.  But I did want to give you some insight into rabbits in Australia.

Rabbits were first introduced into Australia with the first fleet, but the main outbreak is attributed to a farmer who introduced 24 rabbits in the mid 19th century, claiming they could do little harm . He even had his workers dig holes for them.  Well they bred like rabbits. The population grew exponentially, causing severe environmental damage, loss of habitat, severe soil erosion, and economical impact on farms. At the start of the 20th century, the rabbit proof fence was an example of the structures the government put in place, with best of intentions, but failing to really understand the issues they were dealing with. It was of course a failure.  By the mid 20th century, a hundred years after that two dozen were introduced, the population was estimated at being over half a billion rabbits !!

Mid 20th century saw the introduction of biological weapons. “Mixo” or myxomatosis was introduced and wiped out large number of the rabbit population.  A mosquito transmitted disease, rabbits develop tumours and can often be seen wandering around during the day with eyes scabbed over. It takes weeks for the animals to die. It seems incredibly cruel. Yesterday I saw a rabbit with mixo, eyes scabbed over, but it was still grazing, so was early stages I’d say. It’s really hard to know what to do. I’m conflicted between knowing how bad these pests can be and doing what I would think is the humane thing.  Putting the animal out of it’s misery stops it spreading the disease to it’s brood, which eventually will just lead to an even bigger problem. I tend to let the un-natural nature take it’s course.

Last night I heard some rabbits scream.  If you’ve never heard a rabbit squeal, it’s a terrible sound. I doubt that was the virus, more likely to be some other introduced animal, dog, cat or fox finding easy prey. I was trying to explain this to a friend, hence this blog post. The terrible truth is when you see that little bunny rabbit hopping around the fields during the day, don’t look to close, because it will likely reveal a horrible disease, the compounding of human mistakes. We do have other biological controls these days which are somewhat limited in their spread, but from all accounts are a lot less cruel.

For more on rabbits in Australia see:
http://en.wikipedia.org/wiki/Rabbits_in_Australia

with no comments
Filed under:

The weather forecast for the next few days is record highs, so I took the opportunity to take a few snaps now before the heat wave sets in.  Some of the predictions are for a one in a hundred year heat wave .

Remember the strawflowers from a couple of months ago ?

Well two months later they look all sun bleached:

yet there are still new flowers coming on.

There’s this little weed that’s growing around the place too. Note sure what it is, but it puts on a nice touch of color:

 

Some of the climbers I planted around the veggie patch are in flower too:

 

In the veggie patch there’s lots of strawberries or was until I got there :)

there’s still an an abundance of snow peas, sugar snaps and beans.

The corn has shot up this last few week, and now has set fruit

 

The cherry tomatoes are giving me a few fruit each day. The main crop is still a ways off, although that might change with this heat wave. You can see all the strings are out for them to grow up on:

 

Lots of wild lettuce in the garden :

 

And this lettuce I let go to flower/seed again.
I don’t recall seeing these lavender coloured flowers like this on them before:

 

There’s broad beans ready for harvest, and some I’ll keep for seed, and more unplanned rows of broad beans where they have self seeded from the crop I turned in:

 

The pumpkins are growing wild at present, spreading all over the place. 
I keep moving runners back to try to keep them mainly on the one bed.
These pumpkins were wild from the compost:

They have set fruit already:

 

The zucchini have hit their growth spurt phase too:

 

The first crop of potatoes is dying down to reveal more peas and wild lettuce:

 

There’s some good “spuds” coming from them.

 

And in the orchard there’s different plums that are ripe (and delicious :) )

 

with 2 comment(s)
Filed under:

Last month (December 2008), Microsoft released some security updates for VB6 components such as the MS Chart control

The first update http://support.microsoft.com/kb/932349 updates MS Chart to 6.1.98.12. 
The second update http://support.microsoft.com/kb/957924  updates MSChart to 6.1.98.13.

Both these versions have a serious bug that will crash the application or cause instability, the chart not to draw or display garbage strings on the screen. 

The problem occurs if you display a DataPointLabel, eg:

Dim dpl As DataPointLabel
Set dpl = MSChart1.Plot.SeriesCollection.Item(1).DataPoints.Item(-1).DataPointLabel

dpl.LocationType = VtChLabelLocationTypeAbovePoint
dpl.ValueFormat = "0.00"

 

To work around this, add a manifest to your VB6 application, and copy the manifest and an earlier version of MSChart alongside your exe.  The manifest contents needed are:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">

   <assemblyIdentity name="Project1"  version="1.0.0.0"

                     processorArchitecture="X86" type="win32" />

   <file name="mschrt20.ocx">

      <comClass clsid="{3A2B370C-BA0A-11D1-B137-0000F8753F5D}"

                       tlbid="{65E121D4-0C60-11D2-A9FC-0000F8754DA1}"

                       progid="MSChart20Lib.MSChart.2"

                       description="Microsoft Chart Control 6.0 (OLEDB)" />

   </file>

</assembly>

 

Save that with a .manifest extension, e.g. Project1.exe.manifest.  Make sure you replace the name and version attributes in the assemblyIdentity node with your application’s name and version. 

Hopefully there will be a fix to fix the fix soon, but in the meanwhile use side-by-side (SxS) COM and an old version of the mschrt20.ocx to work around this new bug.

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

One of the nice things about the My application framework in VB.NET is the ability to easily show splash screens.  The splash screen is displayed using a separate thread and by default will close when your main form’s Load event is called. There is however a quirk with it sometimes.

Whilst testing, if I launched the application from Explorer, the splash screen would appear in front of the explorer window but the main form behind it.  When the splash screen closed, the main form didn’t come to the foreground.  This behaviour would depend on the system being tested and seems to only consistently show up when run from a VPC.  The fix for this is reasonably simple: you just need to call Activate in your main form’s Load event

 

   Private Sub Me_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load

      Me.Activate()

   End Sub

 

Kudos to the VB team for the fix :)

When the VB team suggested this fix to me, I could have sworn I had already tried that.  I had also looked into the my application framework code and saw it called Activate in it’s handler of the Load. So my first thoughts on it was it was a race condition, and hence I set up a single shot timer to call Activate, the timer being set to trigger a couple of hundred milliseconds after the load event.  At first I thought that fixed it, but that was the “sometimes” effect tricking me <g>

Kevin from the VB team suggested I try Activate in the Load event, and sure enough it seems to work *ALL* the time.  But this was even more puzzling as to why didn’t my timer approach work.  So I tried overriding the OnLoad method :

 

   Protected Overrides Sub OnLoad(ByVal e As EventArgs)

      MyBase.OnLoad(e)

      Me.Activate()

   End Sub

 

That actually fails ( yes “sometimes”).  But if you change that to:

 

  Protected Overrides Sub OnLoad(ByVal e As EventArgs)

      Me.Activate()

      MyBase.OnLoad(e)

   End Sub

 

Then it works. So the key is that Activate has to be called before the call to OnLoad completes.   Suddenly the pieces of the puzzle all fit together. 

What I think is happening is this: The my application framework hooks into the Load event and uses that to dispose of the splash screen. The problem occurs when the splash screen which has the UI input is closed before the call to Activate is made. Because the calling thread doesn’t have the UI Input, SetForeGround window doesn’t work.  Based on this hypothesis, I suggested a fix to the WindowsFormsApplicationBase.  Currently is has this method in it:

 

 

        '''**************************************************************************

        ''' ;HideSplashScreen

        ''' <summary>

        ''' Hide the splash screeen.  The splash screen was created on another thread so marshal

        ''' the call over to it.

        ''' </summary>

        ''' <remarks></remarks>

        <EditorBrowsable(EditorBrowsableState.Advanced)> Protected Sub HideSplashScreen()

            SyncLock m_SplashLock 'We can get called from two threads at once

               If m_SplashScreen IsNot Nothing AndAlso Not m_SplashScreen.IsDisposed Then

                    Dim TheBigGoodbye As New DisposeDelegate(AddressOf m_SplashScreen.Dispose)

                    m_SplashScreen.Invoke(TheBigGoodbye)

                    m_SplashScreen = Nothing

               End If

               If Me.MainForm IsNot Nothing Then

                    Call New System.Security.Permissions.UIPermission(UIPermissionWindow.AllWindows).Assert()

                    Me.MainForm.Activate()

                    System.Security.PermissionSet.RevertAssert() 'CLR also reverts if we throw or when we return from this function

               End If

            End SyncLock

        End Sub

 

 

My suggestion is to activate the main form before disposing of the splash screen :

 

          <EditorBrowsable(EditorBrowsableState.Advanced)> Protected Sub HideSplashScreen()
            SyncLock m_SplashLock 'We can get called from two threads at once

                 If Me.MainForm IsNot Nothing Then
                    Call New System.Security.Permissions.UIPermission(UIPermissionWindow.AllWindows).Assert()

                    Me.MainForm.Activate()

                    System.Security.PermissionSet.RevertAssert() 'CLR also reverts if we throw or when we return from this function

               End If

               If m_SplashScreen IsNot Nothing AndAlso Not m_SplashScreen.IsDisposed Then

                    Dim TheBigGoodbye As New DisposeDelegate(AddressOf m_SplashScreen.Dispose)

                    m_SplashScreen.Invoke(TheBigGoodbye)

                    m_SplashScreen = Nothing

               End If

            End SyncLock

        End Sub

 

 

Hopefully that will fix this issue completely.

 

In the meanwhile, simply call Activate in your main form’s Load event :)

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

A comment by Joe Duffy on the Framework Guidelines for Extension says :

Extension methods can also be used to provide actual concrete method implementations for interfaces.

And this is a very important point. In .NET there is no support for multiple implementation inheritance. So although you could use an abstract class (MustInherit) with some implementation in it, you would be tied to that single chain in your class inheritance. Interfaces on the other hand are extremely flexible, supporting multiple inheritance both in interfaces and implementing classes.  So by providing extension methods for interfaces, you get great flexibility and code re-use, and you also get to extend existing interfaces.. the classic example being the Enumerable set of extensions which extend IEnumerable(Of T)

with no comments
Filed under: , , ,

Queensland tourism has a six month position open:

The Island Caretaker will need to post a weekly blog, photo diaries and create video updates to let the world know about the unique experiences available on the Islands of the Great Barrier Reef. There will also be some interviews with members of the media. The contract involves spending six months on Hamilton Island, one of the Islands of the Great Barrier Reef. The Island Caretaker will also travel to other islands and enjoy activities such as sailing, kayaking, snorkelling, diving, picnics, bushwalking and more.

So if you want to get paid $150K to bum around on Hamilton Island for six months and blog about it, check out the job ad at : http://www.islandreefjob.com

with 4 comment(s)
Filed under:

 

with no comments
Filed under:

Earlier I posted what I hope wetted your appetite for some more info about Libraries in Windows 7.  So  what are libraries you ask//I ask ;) Well I hope the following provides some insight. 

caveat emptor: this is still just my first impressions !

A Library is really a view of different “folders”.  Each library is a file, which internally is an xml file.  The default library files are stored in the user’s roaming profile, eg:

C:\Users\Bill\AppData\Roaming\Microsoft\Windows\Libraries

This is an example of

<?xml version="1.0" encoding="UTF-8"?>

<libraryDescription>

   <ownerSID>S-1-5-21-168223323-3520011370-4180941423-1000</ownerSID>

   <version>3</version>

   <isLibraryPinned>-1</isLibraryPinned>

   <templateInfo>

      <folderType>{5C4F28B5-F869-4E84-8E60-F11DB97C5CC7}</folderType>

   </templateInfo>

   <propertyStore>

      <property name="HasModifiedLocations" type="boolean"><![CDATA[-1]]></property>

   </propertyStore>

   <searchConnectorDescriptionList>

      <searchConnectorDescription>

         <isDefaultSaveLocation>-1</isDefaultSaveLocation>

         <simpleLocation>

            <url>C:\Users\Bill\Documents\Visual Studio 2008\Projects</url>

         <serialized></serialized>

         </simpleLocation>

      </searchConnectorDescription>

   </searchConnectorDescriptionList>

</libraryDescription>

 

I omitted the contents of the serialized element for brevity.

You can programmatically access libraries via the IShellLibrary interface and some shell helper functions. 

You can add multiple “folders” to these library files.  I say “folders” in quotes, because according to the IShellLibrary::AddFolder documentation, the object in psiLocation can be a folder or a Search Connector (*.searchconnector-ms) file.

What’s this mean.  Well I don’t know for sure yet, but it looks to me like Libraries can be a way to aggregate search providers. At the simplest level they provide a view of directories, but they have the potential to provide a view over data from various sources, not just file based.  This of course leads us towards the topic of “Federated Search” (more on that in next episode <g>). 

So is it WinFS ? Not really. It is not reliant on managed frameworks like the entity framework… it is instead heavily reliant on XML. From the Library file, saved searches, right through to Federated Search which itself is based around RSS style of XML.  

Thankfully VB9 rocks when it comes to working with XML !

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

I downloaded a .docx file to my Windows 7 VPC, and thought I would have to copy it over to where I had Word installed.  But much to my delight, Wordpad in Windows 7 recognizes and opens .docx files.  :)

You can open and safe files in OOXML format (that’s the .docx format), ODF format for those open office folks, and of course rtf and txt are still there.

I like this !!  I can see a lot more uses for Vb’s xml literals and creating .docx files, as the prevalence of the .docx format expands. :)

with no comments
Filed under: ,

Some of you may recall the talk of a new file management system in the days leading up to Vista when Vista was called Longhorn.  WinFS was an object model/database.. in fact much of that seemed like a spin off from object spaces, which of course many of us know has itself spun off into the Entity Framework.   WinFS however never saw the light of day (and really neither did Object Spaces): it was cancelled prior to Vista being released.  Cancelled, not killed.  ;)

So today I was playing with Windows 7 (available now on MSDN for MSDN subscribers) and started reading the 7.0 Beta Platform SDK.  I had noticed “Libraries” in explorer and didn’t give it much thought thinking it was just those folks renaming folders like they seem to do with each release.  But as I waded through the compatibility documents I read this :

The Library is itself a file, and not a folder.

A what ?  A file ???  Seems this new virtual folder is some sort of database/datastore.. perhaps even an object model ?

 

Answers to all this and more in the next amazing episode of first looks at the Windows 7 SDK ;)

with 4 comment(s)
Filed under: ,

T’is the month of snow-peas !!  :)

 

 

The different varieties have different colour flowers (much like last month’s potatoes :)

Not sure which is which, but I think that deep pink one is “Mammoth”.  At least judging by the size of the snow peas it has  :

 

Most never make it inside, so nice to eat them straight away !

And the sugar snaps are providing plenty of pods now too:

 

 

The sugar snaps were all sown from seed I harvested last season.  Lots of plants, and lots more seed still in stock.  Where I planted them between the potatoes has worked really well. As the potatoes are dying back, the peas are popping through with plenty to harvest :

 

The zucchini have got their first baby fruit on them :

 

And the pumpkin  also have their first flowers :

 

These pumpkin were “wild” ones that survived my compost bin. They sprouted around the orange trees I planted, so I transplanted them to the veggie patch. They’re doing way better than any I actually tried to sow !!

 

And I had my first cherry tomato the other day.  December has been mild, but soon… soon :

and with promises of more :

The main season tomatoes are still very young :

 

Bush beans are lovely and tender crisp at present. These were hit hard by slugs when young, but a couple of nights of slug squashing saw them through :

 

My sweet corn that also got hit really hard by slugs is now recovering:

 

I planted a second lot of sweet corn, just in case the first didn’t recover:

That’s climbing beans growing inside the corn rows.  It will be interesting to see how that turns out.  I’m hoping the beans won’t  be too vigorous for the corn.

 

And the strawberries are in flower too.  The birds or something is beating me to most of them, so I might need to get the nets out.

 

The weather: December was mild and with a couple of good rains.  That’s slowed the garden down a lot, but that’s a small price to pay for the rains :)  As I write this the weather is about 25 C, which would normally be considered mild for this time of year, but given the really mild conditions it feels kind of hot.

with no comments
Filed under:

XML is very flexible and somewhat permissive in what it allows. Consider this piece of XML:

      el = <item>some values<first>one</first><second>two</second></item>

 

The element named item can contain both child elements and a text value.  Thankfully this kind of XML is rare: it poses a heap of whitespace formatting issues, and the value itself can reside in any combination of places between the elements, eg:

 

      el = <item>some values<first>one</first> are <second>two</second>in here</item>

 

How this is interpreted is questionable. You could argue that position needs to be preserved, in which case you’d work with the Nodes property, including both the nodes of type XElement and also XText. Each of the inline values, “some values”, “ are ” and “in here”  are actually XText nodes. 

If you’re just after the Text, you need to write a helper function.  If you try to use the Value property you get the Value of all nested nodes.  Calling el.Value with the last example will output:

some valuesone are twoin here

The extension I slapped together is :

   <Extension()> _

   Public Function GetText(ByVal el As XElement) As String

      If Not el.HasElements Then Return el.Value

      Dim sb As New StringBuilder

      For Each nd As XNode In el.Nodes

         If TypeOf nd Is XText Then sb.Append(nd.ToString)

      Next

      Return sb.ToString

   End Function

With this the output is :

some values are in here

Enjoy :)

with no comments
Filed under: , , , ,

When I’ve started new Visual Studio projects on my Vista x64 box, the Company field would always show up as “Microsoft”… somewhat presumptuous and definitely annoying.  At first I thought the problem was with the templates, but upon inspection they had the correct template parameters, $registeredorganization$.  A quick look in my registry and those keys looked right; then it dawned on me. Visual Studio runs as a 32 bit process, not 64, so it effectively looks in :

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion

And that’s the solution. In there RegisteredOrganization was set to “Microsoft”.   Changing that to your organization’s name solves the template issue.