January 2005 - Posts

Bid for oyur own personal develper conference !

 

Wow, the chance to hire 30 developer presenters for a total of just $3K US !!  Imagine, that's the equivalent of having almost 4 days of straight presentations, or one in house presentation every week for six months !!  Talk about an absolute bargain.  So what are you waiting for ? Get in there, an get your own in house presentatons from some of the world's best and at the same time help the Tsuami relief effort.

 

Oh, and if you are in australia, Adam Cogan's on the list too (for $100 it'd still be cheap just to get him to detail your car for you )

 

Posted by bill | with no comments

Wave goodbye to Crystal Reports ..

 

If you are tired of using Crystal Reports, then you jsut got to read this post by Yag !!

 

Absolutely love it !!!!

Posted by bill | with no comments

VB Future language enhancements ala Omega ??

 

For some time now there has been talk about adding relational aspects to C#.  these days it seems to be the primary think Anders will talk about if you ask him about future language enhancements.  Yag also mentioned how they are working at making these concepts cross language/framework level.

See John Wood's blog entry for a good overview of what C Omega has in these areas.

 

I hope soon we can start talking about these specific features in relation to VB smile

Posted by bill | with no comments
Filed under:

there's chocolate then there's ....

Carob !!!

 

I saw Julia's blog entry about her favourite local business, and I just had to blog about this Aussie company that makes really yummy carob goodies.  I got sent the banana ones and the fruit and nut ones ! this stuff is better than chocolate !!! smile

 

Posted by bill | with no comments

Bill Gates is blogging !

Well I s'pose this is a sign of blogging being part of the establishment

 

Add Bill to your RSS feed or visit his blog here.

 

 

 

[via IPattern]

Posted by bill | 2 comment(s)

Pocket PC 2003 and VS.NET 2003

Thanks to a fellow MVP Phil Webster I inherited his PPC 2003 upgrade for the ViewSonic V37 when his Viewsonic met with an untimely death.  I had been trying to get my hands on this some time ago, but when it was available to the rest of the world, Viewsonic wouldn't ship it to Australia, and Viewsonic Australia wouldn't supply it !  Then the item disappeared from the web sites altogether.  (BTW: sadly it seems ViewSonic Australia views the Australian market as one to keep way behind the rest and to dump only old products on.  For example they still only list the V35 on their product page here )

 

Anyway, my V37 which I originally got thanks to Chuck is finally upgraded !! :)  Thanks Phil !!!!

 

The next step of course was to code to it.  Well for VS.NET 2003 you need to install the SDK for Windows Mobile 2003-based Pocket PCs 

Nick Randolph helped me locate the right download on MSDN, then I found it on the MSND DVD's on the grey SDK disc of course.  disc 2426.

 

Finally I had to run as admin for a second to fix what appeared to be a firewall issue, although it may also have been an activesync install needed to run as admin to finish.  Anyway there was a firewall message to allow VS.NET, and i did, and all works happily. 

 :)

 

Thanks everyone.  (btw: yes I do feel incredibly out of date working on 2003 stuff in 2005 ;))

Posted by bill | with no comments

Fixing Default Instances

About six months ago I blogged about some of the issues with Default Instances. More recently Paul started to blog about Default Instances. Now judging from the feedback Paul has gotten, and the conversations I have had, there seems to be a lot of people unhappy about the current implementation... so... in this blog entry I am going to put forward a set of proposals that I think address all the major issues. Then finally I will add some comments to the fray ;)


Issues to date are :

+ Ability to test for null
+ Preservation of data
+ Namespace mangling (interference with Shared methods)
+ inability to turn it off
 

Ability to test for null

To their credit the VB team has added a little bit of magic that now allows Default Instances to be tested for null.  That is, when they parse the code they change the code to use the backing field when the code is like 
      If My.Forms.Form1 Is Nothing Then
It compiles to:
     If My.Forms.m_Form1 Is Nothing Then

The problems with this little bit of magic are many, but the main two issues I have with it are it’s (a) not extensible, and (b) it compromises encapsulation.

(a) making it extensible would have been to make this available to any developers code, not just the My generated classes.  To do this, it would have meant just using an attribute, something like   <VBNullTestField(“m_Form1”)>    would have done the trick, and would make more sense if they decide to add other default instances further down the track.

(b) This is where it gets a bit tricky… To expose the backing field for a null test, it means it can’t be marked private.  You can see the weirdness this causes today in the beta bits.. For example, if you have My.Form1, you’ll notice that you can’t set that to be any other instance or derived instance as the property set only allows Nothing as the value.  But because m_Form1 is actually exposed, you can change the backing store value.  This means you can actually write code that bypasses the property Set !!!  (not a good thing !!)

So rather than expose the backing field, I suggest they use an attribute that exposes a delegate.  The delegate signature would have no parameters and a Boolean return type:

      Delegate Function NullTest() As Boolean

The attribute would then become:

     <VBNullTest(AddressOf(MyNullTestFunction))>

This would mean that a method was called, and the backing store would NOT be exposed.  Encapsulation is one of the primary OO rules, so I think this modification is crucial !!
 


Preservation of data

As I outlined in my earlier blog posting, default instances have “issues” with preservation of data.  With WinForms once a form is closed and dispose is called, you can no longer re-show that form.  SO the Default Instance has to re-incarnate the form and hence all data is lost.  What I propose is that the following class be added to the VB runtime…

 ' KeepAliveFormHook class.

' purpose: monitors a form's handle created and destroyed,

' and overrides wndProc preventing wm_close calling dispose

' by destroying the handle and setting visible to false

Public Class KeepAliveFormHook

   Inherits NativeWindow

 

   WithEvents m_frm As Form

 

   Public Sub New(ByVal form As Form)

      SetForm(form)

   End Sub

 

 

   Public Sub SetForm(ByVal frm As Form)

      m_frm = frm

      hook()

   End Sub

 

   Private Sub hook()

      If Not m_frm Is Nothing AndAlso m_frm.IsHandleCreated Then

         MyBase.AssignHandle(m_frm.Handle)

      Else

         MyBase.ReleaseHandle()

      End If

   End Sub

 

 

   Private Sub frm_HandleCreated(ByVal sender As Object, ByVal e As System.EventArgs) Handles m_frm.HandleCreated

      MyBase.AssignHandle(m_frm.Handle)

   End Sub

 

   Private Sub frm_HandleDestroyed(ByVal sender As Object, ByVal e As System.EventArgs) Handles m_frm.HandleDestroyed

      MyBase.ReleaseHandle()

   End Sub

 

 

   Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)

      Const WM_CLOSE As Int32 = &H10

      If m.Msg = WM_CLOSE Then

         Me.DestroyHandle()

         m_frm.Visible = False

      Else

         MyBase.WndProc(m)

      End If

   End Sub

 

End Class

Code for the Default Instance would then work something like this:
 

      Public Property Form3() As Form3

         Get

            If m_Form3 Is Nothing OrElse m_Form3.IsDisposed Then

               m_Form3 = New Form3

               SetHook(m_Form3Hook, m_Form3)

            End If

            Return m_Form3

         End Get

         Set(ByVal Value As Form3)

            m_Form3 = Value

            SetHook(m_Form3Hook, m_Form3)

         End Set

      End Property

 

 

      Private Sub SetHook(ByRef hooker As KeepAliveFormHook, ByVal frm As Form)

         If hooker Is Nothing Then

            hooker = New KeepAliveFormHook(frm)

         Else

            hooker.SetForm(frm)

         End If

      End Sub

 

So it’s just a minor addition., but the change in functionality is huge.  With this, Default Instances can now be used as data stores, so reading a field value after a default instance is closed will actually work :)


Namespace mangling

This issue is the one that gets me the most.  Personally I hate the Form1.Show as it means code like Form1.Foo is no longer clear … is that the default instance or is Foo a Shared member ?  From discussion with other people it seems this issue is big with them as well and for a variety of reasons.  Some feel the Form1 default instance is actually confusing for a lot of people.  I tend to agree, and I think that was actually one of my huge learning hurdles I hit when I first learnt VB …  Anyway, enough on the problems, let’s look at solutions ..

To me the simplest solution for this is to use the Imports statement.  So for code upgraded from Vb6 (and perhaps standard project templates), there would be an :
  Imports My.Forms
at project level.  With that in place, Form1.show works.  Remove it, and the code has to be My.Forms.Form1.Show.

inability to turn it off

Finally, the ability to turn it off is also a must have.  Default Instance code might not be wanted for some forms, so we need a way to hide them.  Once again I think an attribute would do the trick, e.g:

 <VBNoDefaualtInstance>

If you put that on a form, then no default instance would be generated for that form.  This would be an opt out scheme.  Ideally this attribute would also be allowed at assembly level, hence turning off all default instances for that assembly.

 

-----------------------------------------------------------


Okay, so now onto the comments…  Personally I am not a big fan of Default Instances as they were in VB6. That doesn’t mean the concept is not potentially useful !  For cross form communication (think an Options form etc, etc) then Default Instances can really make life a lot easier.  But the key to their success is the way they are implemented.  I think if the above modifications are adopted, they become a win-win for everyone. 

 

Posted by bill | 12 comment(s)
Filed under: , ,

Accessibility is about equality (and freedoms) !!!

Don Kiely blogs asking if folks are interested in accessibility.  Damn straight people do !!!

I still remember back in the mid 90's as part of the work I was doing at a local University I was asked to help someone with their PC.  The person in question was quadriplegic, and relied on voice operated software and a stick pointer they could use with their mouth.  That person's patience with their computer absolutely amazed me !!  No other humans would be so damn tolerant ...  But the reason for that is pretty obvious when you stop to think about it.  The computer allowed them to complete their university work in this particular case. But more importantly it gave them the freedom to grow to learn, to express themselves.

For many people with disabilities, computers are the key to liberating them, to giving them the freedoms we generally take for granted.  If we don't consider accessibility, we really are being a'holes when all is said and done.  Sure time and cost go into it, but that's probably why it is more important that these things be integrated into the development process from day zero, not tacked on later.  Winforms is a good start.  Perhaps we also need fxcop rules for accessibility, and some kind of testing application that checks for accessibility.  For web sites, we can always use Bobby Watchfire.

Anyway, to answer Don's question, yes people do care, especially those people with disabilities !  Perhaps we should all care a bit more, and perhaps there should be a UI certification which requires you spend some time working with people with disabilities and computers to start to understand just how very important this is. 

 

Posted by bill | with no comments

Got any VB body art ?

Ah, it's the new year proper now.  Often hard to get motivated the first week in the year, especially here where it's summer ... those lazy hot summer days ... plus all the seasonal festivities of friends, family, fun and feasting.. seems such a shame we only do it once a year

I think the motivation, the inspiration starts kicking in as we finish looking at the year that was and start of focus on all the good things to achieve this year  

Sometimes though it's a bit hard to get started and positive distractions can actually be a good thing, help shake you up a bit and help you see the big picture...  So, while thinking of "pictures", Paul is having a bit of trouble get inspired at present..  So maybe we can all help ?  Maybe if we send him pictures of body art with a VB flavour, that should get him going and blogging again 

Or maybe if I promise Paul NOT to send him pictures of my VB body art ....

 

 

Posted by bill | with no comments

FlashWindowEx

Yesterday Mitch posted how he was having trouble with FlashWindowEx API.  I thought I had written that code sometime ago, but I didn't find it on my system (although perhaps I need better searching software there ), but a quick search on google for me and FlashWindowEx, found this post by Mike showing my code   (don't you just love distributed storage systems )

One word of caution, I noticed that Mitch pointed to Pinvoke.net for source code for FlashWindowEx  There they have the size and count members of the FLASHWINFO structure as 16 bit, whereas I believe that the definition is as UINT which is generally the same in size as int which is 32 bit. Perhaps that's why Mitch was havign trouble with their code.

 

Imports Runtime.InteropServices


 Declare Function FlashWindowEx Lib "user32" (ByVal pfwi As FLASHWINFO) As Boolean


<StructLayout(LayoutKind.Sequential)> _ 
Class FLASHWINFO 
    Public Size As Int32 
    Public Hwnd As IntPtr 
    Public Flags As FlashWindowFlags 
    Public Count As Int32 
    Public TimeOut As Int32 

    Sub New(ByVal hwnd As IntPtr, ByVal flags As FlashWindowFlags, ByVal count As Int32) 
       Me.New(hwnd, flags, Count, 0) 
    End Sub 

    Sub New(ByVal hwnd As IntPtr, ByVal flags As FlashWindowFlags, ByVal count As Int32, ByVal timeout As Int32) 
       With Me 
          .Size = Marshal.SizeOf(GetType(FLASHWINFO)) 
          .Hwnd = hwnd 
          .Flags = flags 
          .Count = Count 
          .TimeOut = timeout 
       End With 
    End Sub
End Class

Enum FlashWindowFlags
    [Stop] = 0
    Caption = 1
    Tray = 2
    All = Caption Or Tray
    Timer = 4
    TimertillforeGround = &HC
End Enum

Posted by bill | 1 comment(s)
Filed under:

restrictiveness depends on the view point

Rocky talks about higher level languages and frameworks restricting choice.  That really is a view from inside, one that says you can't go outside.  But from my view point, higher level languages ADD to the choices you have... their whole basis is they provide another way, ideally a simpler way to achieve the goal.

So it's really a question of where you view things from.  For example, let's say you look out a window in a building.  Usually that view is somewhat restricted, and the view is actually better if you step outside, at least for ground level buildings.  But once you start getting to higher levels the view from inside, although restricted still, is often better as it gives you an advantaged view point.  There will be those who prefer to climb the mountain rather than take the elevator to the top floor, and although sometimes the view from the mountain may be spectacular, I still think much of the euphoric sense one gets from the mountain summit is from the sense of achieving, of climbing that mountain, be it hours or days to do it.

Higher level languages are not the mountains. Their goal is to take you to the top level view point as quickly as possible.  It's not the climb that is important there, it's the view.  And "great" higher level languages give you the observation deck, quickly giving you amazing panoramic views, helping free you from the navigational issues of trying to climb the mountain and allowing you to, from your vantage point, choose the right path to take.  In fact, I'd argue that it's the high level languages that have brought with them those concepts of frameworks as each tries to provide developers with even better views.

Are higher level languages really restrictive or do they actually provide more choice ?

Posted by bill | with no comments

ASP.NET masterpages and themes ?

By way of Chuck , I see the ASP.NET team is wanting to know what people would like in their master page templates.

As I seem to always be telling folks at MS, make it flexible, extensible  (oh, and make it optional). 

I think it has to be flexible enough that I can go back and change my mind without having to start from scratch.  One thing I have always loved about frontpage or publisher, is the ability to change colour schemes & layouts while preserving the content. It's a great way of sampling.

Extensibility is also important here. I would like there to be a mini master page template SDK   so as I could easily modify templates and create new ones.  I would also like this "themeing" to tie into some of the portal concepts and user based custom themes.

Of course, a lot of this screams out "wizard", but for those hard core html coders out there, it should be easy to apply these things without using the wizard.  That is, the wizards should be viewed as being optional.

So... flexible, extensible and optional ...

 

Posted by bill | 1 comment(s)
More Posts Next page »