The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,862 other subscribers

Archive for October, 2012

.net – WinForms Load vs. Shown events – Stack Overflow

Posted by jpluimers on 2012/10/31

The order of events and what you can do in events is very important in Windows applications.

This includes the WinForms applications – still popular for business applications – the first .NET framework that supported building Windows applications.

WinForms has two important event/method combo’s:

In descendants, you override the methods. In the form designer, you use the events.

Both the methods and events rely on Windows messages to get fired. This means they depends on which message loop is active. And this limits in what you can do during them.

One of the things you should not do in Load or Show is perform a MessageBox, ShowDialog or any other form of message pumping (like in COM).

Hans Passant explains it this way:

Avoid using MessageBox.Show() to debug this [ed: debug Shown/Load behaviour]. It pumps a message loop, disturbing the normal flow of events. The Load event is triggered by Windows sending the WM_SHOWWINDOW message, just before the window becomes visible. There is no Windows notification for “your window is now fully shown”, so the WF designers came up with a trick to generate the Shown event. They use Control.BeginInvoke(), ensuring the OnShown() method gets called as soon as the program goes idle again and re-enters the message loop.

This trick has lots of other uses, particularly when you have to delay the execution of code started by an event. However, in your case it falls apart because you use MessageBox.Show(). Its message loop dispatches the delegate registered with BeginInvoke(), causing the Shown event to run before the window is shown.

Krishnan Sriram explains that if you use proper debug logging (see what Hans wrote), you get this order of events:

  1. Form – Client Size Changed : 8/14/2010 10:40:28 AM
  2. Form – Control Added – button1 : 8/14/2010 10:40:29 AM
  3. Form – Constructor : 8/14/2010 10:40:29 AM
  4. Form – Handle Created : 8/14/2010 10:40:29 AM
  5. Form – Invalidated : 8/14/2010 10:40:29 AM
  6. Form – Form Load event : 8/14/2010 10:40:29 AM
  7. Form – Loaded : 8/14/2010 10:40:29 AM
  8. Form – Create Control : 8/14/2010 10:40:29 AM
  9. Form – OnActivated : 8/14/2010 10:40:29 AM
  10. Form – Shown : 8/14/2010 10:40:29 AM
  11. Form – OnPaint : 8/14/2010 10:40:29 AM
  12. Form – Invalidated : 8/14/2010 10:40:29 AM
  13. Form – OnPaint : 8/14/2010 10:40:29 AM

Finally, Ahmed Said indicates that there can be form size differences in the Load and Shown state:

The Shown event occured after the load event, the main difference is not in the visibility but in state of the form (width,hieght,..etc). I will give you an example to clarify if we create a form with default size 100,200 and set the windowstate = Maximized in the load event the size will be 100,200 but in shown event the size will be your screen size

–jeroen

via: .net – WinForms Load vs. Shown events – Stack Overflow.

Posted in .NET, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, Development, Software Development, WinForms | Leave a Comment »

WebSphere MQ Client 5.3, 6.0 and 7.0

Posted by jpluimers on 2012/10/30

Some of the links in my post on WebSphere MQ Client 5.3 and 7.0 last year didn’t work any more, so below an updated  download link list:

One of the reasons for being at least at V6.0, is that it allows you to specify credentials during a MQCONNX call and using MQCNO_VERSION_5 which enables the use of the SecurityParams (a demo is here) of the MQCNO structure.

–jeroen

via: WebSphere MQ Client 5.3 and 7.0 « The Wiert Corner – irregular stream of Wiert stuff.

Posted in Development, MQ Message Queueing/Queuing, Software Development, WebSphere MQ | 1 Comment »

HOW TO: Change the Default Selection in the Active Directory Manager Snap-in

Posted by jpluimers on 2012/10/29

When managing entities in more than one Active Directory, it is very nice to know that the Active Directory Manager Snap-in supports command line parameters select the domain (and if you want the domain controller).

(Further tweaking needs to be done using scripts like this one)

From the HOW TO: Change the Default Selection in the Active Directory Manager Snap-in. documentation:

Specify the Domain Controller Before Starting the Snap-in

To specify the domain controller to be used before starting the Active Directory Users and Computers snap-in, use the “/SERVER=” switch as a parameter to the MMC saved console (.msc) file. In the process of connecting to the server, the domain of which the controller is a member is automatically detected. For example, either from a command prompt or in the Open box, type:

dsa.msc /server=dc-01.domain.com

Specify the Domain Before Starting the Snap-in

To specify the domain to be used before starting the snap-in, use the “/DOMAIN=” switch as a parameter to the MMC saved console (.msc) file. A domain controller for the domain specified is located automatically and used as the default domain controller. For example, either from a command prompt or in the Open box, type:

dsa.msc /domain=childdomain.domain.com

–jeroen

via: HOW TO: Change the Default Selection in the Active Directory Manager Snap-in.

Posted in Power User, Windows, Windows Server 2003, Windows Server 2008 | Leave a Comment »

Research item: duplicate file finders

Posted by jpluimers on 2012/10/26

Some links I need to research to find a duplicate file finder that fits my needs:

–jeroen

Posted in Power User, Windows, Windows Server 2003, Windows Server 2003 R2, Windows Server 2008, Windows Server 2008 R2 | Leave a Comment »

One or more types required to compile a dynamic expression cannot be found. Are you missing references to Microsoft.CSharp.dll and System.Core.dll (via: C# 4.0 and .Net 3.5 – Stack Overflow)

Posted by jpluimers on 2012/10/25

If you get any of the two errors below while compiling your .NET app, then one of these things happened:

  1. You moved .NET 4 or higher code that makes use of dynamic into an assembly that does not reference the Microsoft.CSharp.dll and System.Core.dll assemblies.
  2. You tried changing the .NET version of a project back to .NET 3.5 or lower.

Note that it is not so much declaring a variable as dynamic, but using that variable.

Predefined type ‘Microsoft.CSharp.RuntimeBinder.Binder’ is not defined or imported

One or more types required to compile a dynamic expression cannot be found. Are you missing references to Microsoft.CSharp.dll and System.Core.dll?

–jeroen

via C# 4.0 and .Net 3.5 – Stack Overflow.

Posted in .NET, .NET 4.5, C#, C# 2.0, C# 3.0, C# 4.0, C# 5.0, Development, Software Development | Leave a Comment »

Dell’s new S2340T 23″ Multi-touch monitor: 10-finger touch at 1920 x 1080 full HD resolution in a 23″ inch form factor

Posted by jpluimers on 2012/10/24

A while ago, I wrote about Some notes on multi-touch and Windows.

Today, Dell introduced the S2340T 23″ monitor with multi touch support, aimed at Windows 8. It surpasses the minimim requirement of 5 fingers:

It also features a multi-position, articulating stand, a 10-point touch and Full HD 1920 x 1080 resolution.

This comes much closer to Microsoft Surface Table. Hopefully that SDK will fully support this monitor.

–jeroen

via: Dell’s new S2340T 23″ Multi-touch monitor brings touch to systems upgrading to Windows 8 – Direct2Dell – Direct2Dell – Dell Community.

Posted in .NET, Development, Microsoft Surface, Software Development | 1 Comment »

Resetting the SMC again solved my MacBook Air Fan Noise With Lion problem

Posted by jpluimers on 2012/10/24

Today, my MacBook Air again kept keeping the fan speed at high, even though nothing was using CPU or other power.

So I again resolved it by following: Resetting the SMC solved my MacBook Air Fan Noise With Lion problem « The Wiert Corner – irregular stream of stuff.

The not so cool thing is that this ONLY works if your Mac is connected to a Power Source.

–jeroen

Posted in Apple, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.7 Lion, MacBook, MacBook-Air, Power User | Leave a Comment »

Reminder to research this: TFS bindings, .vspscc and .vssscc files

Posted by jpluimers on 2012/10/24

I need to put some time into researching how TFS source control bindings really work, as it is not only based on these extensions:

  • .vssscc (Visual Studio Solution Source Code Control)
  • .vspscc (Visual Studio Project Source Code Control)

Information is also stored in the .sln solution files. These postings should get me going:

–jeroen via: Google search for TFS+vspscc+vssscc

Posted in .NET, Development, Software Development, Source Code Management, TFS (Team Foundation System) | Leave a Comment »

Twitter / AdobeType: Source Sans Pro v 1.038 got released on October 19th, 2012: small caps and more.

Posted by jpluimers on 2012/10/23

Reminder to self:

Source Sans Pro v 1.038 is released. Now with small capitals (and more)! GitHub: https://github.com/adobe/source-sans-pro/downloads … SourceForge: https://sourceforge.net/projects/sourcesans.adobe/ …

With Source Sans Pro goes the – also free – Source Code Pro.

All fonts come in OTF and TTF format. Since there are quite a few differences between OTF and TTF, I’d use OTF over TTF whenever possible.

I also found a great interview with Paul D Hunt, the main designer of these fonts, and his Pilcrow Pabulum blog.

–jeroen

via Twitter / AdobeType: Source Sans Pro v 1.038 is ….

Posted in Font, Power User | Leave a Comment »

I totally missed the OCZ Octane 1TB 2.5 inch SSD Review, too bad it is soo expensive

Posted by jpluimers on 2012/10/23

About 4 months ago, I missed the OCZ Octane SSD Review – Internal Hard Drives – CNET Reviews.

Too bad that at roughly USD 2400 (the lowest price vendor at CNET lying), it is about three times as expensive as the Google Shop search for Hard Drives Intel Solid State 600 GB that I already have.

–jeroen

Posted in Hardware, Opinions, Power User, SSD | 1 Comment »