NumericUpDown is a nice control... eh

on Wednesday, November 22, 2006

NumericUpDown Bug

From the site:

FAQs

NumericUpDown Print these FAQs
How do I get the Tooltips to be shown on a NumericUpDown control?

This is because of a bug in the .NET Framework. When tooltips are set on a control that hosts other controls within it (like the NumericUpDown), tooltips are not shown on those child controls. To workaround this issue, do the following in code:

[C#]

foreach ( Control c in numericUpDown1.Controls )
tooltip.SetToolTip( c, "mytooltip" );

[Visual Basic]

Dim c As Control
For Each c In numericUpDown1.Controls
tooltip.SetToolTip(c, "mytooltip")
Next

Contributed from George Shepherd's Windows Forms FAQ

.NET Bugs Registry

on Tuesday, November 21, 2006

Nice handy list for those weird things that can bite you when you least expect it...

Focusing on cue

One of the challenges of implementing the Winforms behaviour from scratch is emulating all the little quirks that have accumulated over the years on Windows and that show up in .NET.

One of these little thingies that make for big headaches is the visual focus cue. You know, that little rectangle that appears in controls whenever they have focus. Well, it turns out this apparently simple thing as showing a rectangle drawn on a button is not so simple at all, because it doesn't show up every time a control has focus... there are certain rules that control when it should appear (the headache part :p)

It all started when a few bugs started showing up on the Mono Bugzilla, filed by people comparing the same application in Mono and MS.NET and discovering that the focus rectangle was being drawn in one but not in the other... or vice-versa.

After a quite lengthy chat on the #mono-winforms channel, I had several different tests and quite a few links with which to start tackling the problem of figuring out exactly what rules apply when deciding whether to show the focus rectangle or not. I learned that there are two types of visual cues on Windows: the focus rectangle, and the keyboard shortcut underlining. I further learned that there is an option on Windows that controls the keyboard underlining cue... and that this option also controls the focus rectangle cue, but it doesn't say so when you change the setting. Don't you just love it? Eh. The option is available under Display / Effects / Hide underline...

Anyway, in theory, the visual cues should work like this: since that checkbox controls both the focus cue and keyboard cue, if it is checked it means that the keyboard cue will only show up if you press the Alt key, and the focus cue will show up if:

1) you press Tab, or navigate between controls with the keyboard, or
2) you activate the window with the keyboard. This second part is important, because sometimes people don't notice how they activated the window, and so don't quite get the behaviour they think they should. Activating the window means opening it with the keyboard, for instance, instead of with the mouse.

if, on the other hand, the option is not checked, the both the keyboard and the focus cues will show up regardless of how you activate the window or how you navigate between controls in it.

Now, since there has been a lot of reports of different behaviours when this checkbox is checked or unchecked that don't quite fit with the theory, it stands to reason that there is something else fiddling with these options. It's quite possible that certain themes or tweaking applications change one of these options but not the other, so that certain systems don't exhibit the behaviour shown above.

Finally, all of this reeaaallly doesn't matter all that much because there is no such equivalent in Linux, , so essentially Mono should behave according to a default behaviour chosen to actually make sense :) and stick with it.

Isn't this fun? :D

references:
http://blogs.msdn.com/saraford/archive/2004/04/16/114935.aspx
http://blogs.msdn.com/oldnewthing/archive/2005/05/03/414317.aspx
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/KeyboardAccelerators/AboutKeyboardAccelerators.asp

New job, new open source project, happy little coder

As the title says, I have a wonderful new job, working full time at Novell on my favourite open source project, Mono. What more can I say? :D *happy little coder does happy little jiggly dance*

A bit of a SHOUT

on Tuesday, August 08, 2006
So there was I, coding happily along, without a care in the world, when it hits me.

Well, it didn't hit me, it more of skipped me. I mean, not me. The music. It skipped. Aargh. Focus lost, damn stupid tracks, winamp what's the matter with you?!

Ok, so I get my mp3 off the TeraStation. The TeraStation is very nice, very lovely, very cute RAID-5 network-attached data storage (note the marketing speek - ain't it nice) box looking thingie all in silver. It does data. Huge amounts of it. Over the network. That's about all it does, really, but it's enough. I have my collection stored away in there, so I don't have to fill up my disk space with it. Whenever I want to, I listen from it.

The problem, ya see, is that I'm getting my music fix over a vpn, seeing as the Tera is at one location, and I'm on another. And that makes my music skip. Aaargh.

Determined to get rid of the annoying skippies, I went and got the SHOUTCast server and DSP plugin for winamp (over at Nullsoft). Because winamp doesn't do buffering on it's own, ya see (as far as I can tell). So this is what I did:

1. Get the server running. Easy enough, just, well, run it :p No extra configurations required, it listens on the 8000 port by default. You can change it in the ini, or not.

2. Load up your selection of music on winamp.

3. Configure the DSP plugin on winamp. Just fill in the name of the server (localhost), and the port. When you're done, connect. Don't close that window yet.

4. Start playing the list. The plugin properties window should start showing bytes sent, and the shoutcast server window
should acknowledge the connection.

Easy enough. Now I'm getting music from my Tera over at the other location and streaming it to the shoutcast server. And I can hear it playing. But wait, what I'm hearing is the unbuffered thing, before it gets to the server... no good :p

What I need is to have one winamp sending to the server, and another one getting it form the server. No problem... I just open another winamp, right? (clicking on the Options-Allow Multiple instances first, of course. Duh). Second winamp opened, add url localhost:8000, play...

Now this is nice... now I'm hearing *2* versions of the music. One is unbuffered, the other buffered. LOL

Ok, chuckles aside, how do I get rid of the unbuffered one? Hmmm... Could I turn the volume down on that winamp? Nope, that turns both down (what fun!)

The answer was just another search away... just redirect the Output of the first winamp to the Null Output plugin. Wohoo, no more confusing echoes of music, the unbuffered winamp is sending it's output to the dev/null graveyard. Nice...

So now I can go back to my happy, buffered coding world. Groovy.

PS: you can close that window now...

The Active Directory datatype cannot be converted to/from a native DS datatype

on Thursday, January 19, 2006
The nice sentence above gave me quite a headache today... as I was deploying the authentication for web app, it blew up with this rather cryptic message, as did every other authenticated web app installed on the machine.

The solution is very simple, so if you happen to get hit by this one, the problem is essentially that the type cache has gone corrupted in a rather typical windows manner, so you have to force it to be rebuilt. You do this by going to %WINDOWS%/SchCache and deleting the files in that directory. Reboot afterwards, and you're done :)

Forgot the Administrator's Password? - Change Domain Admin Password in Windows Server 2003 AD

on Tuesday, January 17, 2006
Forgot the Administrator's Password? - Change Domain Admin Password in Windows Server 2003 AD

Some amazing tidbits of information on how to manipulate windows to do your bidding. It really shows how complex applications end up being almost impossible to secure... especially when they were not designed to be secure to begin with.

How to write Buffer Overflows in Assembly

How to write Buffer Overflows in Assembly

Just as the author wrote the article as a reminder of how to do it, so I am putting this one here so I can remember where to find it! :p Wish I'd do as he did more often, I seem to keep losing code everywhere nowadays...