Saturday, June 23, 2007

KISS #5

This will be my last entry for a few days (probably more like a week).  I'm the scoutmaster of troop 440 and we're attending summer camp next week so I will not have much time available to email and blogging.  However, KISS #5 happened last night while I was activating my kids Vista computer.

The whole idea is that any message, error or otherwise, needs to be understandable by the average user.  This is the main reason why Linux will not get any serious traction on the desktop.  The gear heads that use it can't stand to dumb down the interface of their baby and the current Linux desktop experience is just to complex.  If the user has to know what a swap partition is or that a file named ifconfig even exists, then it's too complex.  But I digress.

So last night Katie (my daughter) tells me that her computer is broken.  Thinking that's odd since I just built it, I asked her what it's doing.  She says it's telling her that she needs to activate it.  No problem.  I go upstairs and activate the computer (activation might be a KISS entry at some point but not this time).  While I'm there I see an icon for Age of Mythology on her desktop.  That's a terrific game that my son plays on the same computer.  Knowing that she never plays it and the icon was placed there because the game did an 'all users' install, I drag the icon to the trash.

Bam!  Kiss, right on the mouth.  :)  Let's skip past the fact that it stupidly asked me if I really wanted to throw it away and fast forward to the next dialog which was a UAC prompt asking for my password.  Huh?  I'm logged in as Katie, looking at Katie's desktop, and throwing away an icon that is sitting on Katie's desktop.  And I'm not allowed to do it.  How in the world can my 11-year old understand this kind of crap. It's hard enough to get her to understand why I had to move Sims into her profile directory to get it to run (it was attempting to write back to the program files folder).

This utterly ridiculous.  I realize that the game ran as admin and therefore the icons created by it are owned by admin however a user should have complete and total control over their own desktop.  If I want to throw away something sitting on my own desktop, Vista should have nothing to say about that.

And that, my friends, is KISS #5.  See you next week.

Friday, June 22, 2007

KISS #4

This is really too easy.  Finding stupid and idiotic things about Vista is really just too easy.  This installment is not about any type of GUI but rather with the lack of secure inter-machine remoting capability.

Here at MySQL we have several Windows virtual machines setup to perform builds and tests of both our server code and our connectors.  Our builds are automated to be sure but our build engineers still need to "shell" into a remote box to perform some functions.  As any reasonable group would, we use ssh authentication for both our Linux and Windows boxes.  The problem, of course, is that no edition of Windows has shipped with a secure shell server or client.  Our build team is left with only a few alternatives and they have chosen to install cygwin on the Windows boxes.  Considering that cygwin has only recently become stable on 64 bit systems, this was shaky at best.

Now I realize that ssh networking is cutting edge technology <grin>, but Microsoft either doesn't realize that no one is using telnet anymore or they are delusional enough to think that no one really needs to shell to a remote command prompt.  Either way,  it's KISS #4.  Here's to you, Microsoft.  Keeping it simply stupid.

Wednesday, June 20, 2007

KISS #3

So Vista has this "great" new feature called UAC which allows a user to run as a standard user until he or she needs elevated permissions at which point the system will prompt either for an administrator's password or for your consent if you are already an administrator.  Everyone seems to generally hate it but we seem to be stuck with it.  In any case, that's not what this post is about.

Those of  you who are software developers know that we often need to set environment variables for ourselves.  We use BitKeeper for source control so I need a BK_USER environment variable.  I also often need to add things to my path.  So what could be wrong with this?  Oh, let me count the ways.

First, environment variables for the currently logged on user are not properties of the computer.  Computer properties would be computer name, description, performance settings, etc.  However, the first way you get to the place where you can set environment variables is by right clicking on the computer icon and selecting properties.  You can also get to it by going to your control panel and choosing the System and Maintenance area and then the System area. 

Second, getting to the area where I can set my environment variables requires no less than 4 mouse clicks (assuming UAC is active) and one screen flash due to UAC.  Nasty.

Third, because the area where we set environment settings is tucked inside a dialog that is also full of system wide settings, we must suffer through UAC just to set our own environment settings.  Let me say that again.  Your account must be elevated to administrator level to set your own environment settings.  Keep It Simply Stupid.

KISS #2

Well, I'm already behind but managed to find time to get KISS entry #2 out.  This is a fairly easy one and one that I've blogged about before.  Consider this screenshot of my installed programs.

image

Applying the KISS principle to software installation (as Apple generally does) would mean that a single icon would indicate that a piece of software is installed and dragging that icon to the trash would either complete the uninstall or at least start the process.  But, as we've already discovered, Microsoft believes in the secondary KISS meaning (Keep It Simply Stupid).  The installation of Visual Studio 2005 does not produce a single icon but instead we get a whole series of things that are installed.

What in the heck is 64 bit Prerequisites?  Sure, I know technically what it is but why on earth is it a separate item here (and please don't give me some lame answer as it coming from a different group and being it's own MSI).  Am I really anticipating uninstalling or upgrading that item in isolation.  I don't think so.  Microsoft treats this list as a hard list of actual components that are installed rather than a nice, user-friendly list of applications that are installed.

Microsoft could easily have made it possible to double click an application icon in this list and see a list of components that make it up.  That list for VS 2005 might have included the prereqs, the remote debugger, the J# redist package, etc, etc.  It's really quite comical to read the setup instructions for new beta builds of Visual Studio and see that you have to remove previous beta bits in precisely the right order or things might not work right.  The list of things you have to manually remove is huge.

The whole idea behind software package management is that you can at least attempt to remove any package and, if it succeeds, your system is still in a usable state.  Try removing the 64 bit Prerequisites.  It will genuinely attempt to uninstall even though doing so would leave Visual Studio still installed but crippled. 

Simply stupid.

Tuesday, June 19, 2007

Long overdue...

Way back in February I gave a webinar on using our Visual Studio integration product with MySQL.  At the time, our code did not integrate very well with the TableAdapter wizard.  To be precise, you really couldn't use stored procedures with a table adapter at all.  During the broadcast, someone asked me about using stored procedures and I told him that I would blog about it once I got it working.  Well, here we are.

Actually, we've had it working for a couple of weeks now but I'm just now getting to the blog post.  You know how it is.  There were several problems at play here but the biggest issues were the fact that we needed to provide an enumerator object for columns that would be returned by a stored procedure.  The second issue was needing to use the DbProviderSpecificTypeProperty attribute on our provider specific type property on the parameter class.  Let's look at each one of these in more detail.

During the TableAdapter wizard, there is a page where you select the procedures you want to use for each operation (select, update, insert, and delete).  Once you choose the procedure for the select operation, the wizard wants to enumerate the columns that will be returned from this procedure.  It does this because, later, it will want to map parameters to the other procedures to these columns.  To support this, we needed an enumerator object.  MySQL doesn't have the ability to execute a procedure but only return the metdata without making any other changes.  Therefore, when we execute the procedure to return the metadata, any other changes the procedure makes will happen.  So it is important to not do anything in this procedure except return the required columns.  Don't write any logs, update any counts, etc.

The second issue was the wizard was unable to properly determine the types of the parameters.  This is typical Microsoft since the provider includes a parameters schema collection that provides all this information.  That's too easy.  Instead the wonderful designers at Microsoft created a new attribute named DbProviderSpecificTypeProperty.  This allows the wizard to reflect on the parameter class, determine what property should be set with the provider specific type value, and set it.  It could have  used the generic DbType property but I guess that's just too easy.

So, to sum up, Connector/Net 5.1.2 now includes the full ability to use stored procedures to manage the data in a datatable or dataset.

Monday, June 18, 2007

VI for Visual Studio

Not sure why you would want to but I've had several people ask me about VI emulation under Visual Studio.  Yes, Virginia, it exists.  Check it out here.  Will set you back $70 but if you really need it....

Apple understands - KISS #1

This is a post I've been thinking about for nearly a week.  It started about the same time I downloaded Safari for Windows.  I've never used Mac OS X for any extended period of time but I've tried to study how they develop their features.  Coming from the Windows camp, I can tell you that neither Tiger nor Leopard really does much of anything that Vista doesn't do.  And I'm not the only one thinking this either.  However, that really is not the point.  It doesn't matter how advanced a piece of software is; it only matters that the software does what the user expects and be easy to use.  Both the designers and developers at Microsoft need to reread that last sentence again.  Want some examples?

1) Take a look at this post by Scott Hanselman.  I dare you to find any dialog box in Mac OS X that looks like this.

2) Take a look at these option pages from Safari and IE7.

image 

I realize that IE7 has more capabilities than Safari (add-ons, etc) and thus more options, however this first page of each browser's options dialog just shows the difference in thinking. The only thing I can do directly from this dialog in IE7 is set my home page.  With Safari, I can do tons of things.  I can set what browser is default, what search engine is default, what my home page is, where my downloads go, etc, etc.  Microsoft shows a complete inability to try something radically new in user interface design. 

It seems that Microsoft is just one letter away.  Instead of Keep It Simple Stupid, they must think it stands for Keep It Simply Stupid.  With that said, this post starts my 10 days of Microsoft UI stupidity.

Friday, June 15, 2007

Turning off pingback and trackbacks.

We live in a world full of truly lousy people.  I know this based on the amount of porn pingback and trackbacks I'm getting on this blog.  I don't yet know how to solve this so, for now, I'm turning those off.

Finally got the site updated to DNN 4.5.3

I've had the site turned off for sometime now.  I just redirected requests for www.bytefx.com to www.bytefx.com/blog.  However, I've been interested lately in putting up some new content so I decided to reactivate the site and thought it would be a good idea to move to the latest version of DotNetNuke.


Well, the first attempt left the side disabled giving some error in the version 4.4 db script about an integer value.  I was  unable to find the error in the log so I'm not sure what the problem was.  So, from there I manually deleted all the database tables and procedures and attempted to setup the "New Install" package of DNN.  Same problem.  Frustrated and wondering if Community Server would setup easier, I tried one last time.  This time I set the objectQualifer to 'dnn4_'.  This is the string that will be prefixed to all database objects.  And that was the magic that got  my site online.


The next step was to reenable my blog (which is powered by dasBlog and sits in a child web named 'blog') and a second child web that I built for my wife.  A few carefully added lines in the child web's web.config got that going.  I had to remove all the DNN namespaces, remove some httpModules, and remove some httpHandlers.  If anyone needs the specifics, I can email it to you.


Now all I need is some new content.....

Wednesday, June 13, 2007

MySQL Connector/Net 5.1.2 Beta has been released

MySQL Connector/Net 5.1.2 a new version of the all-managed .NET driver for MySQL has been released.

Connector/Net 5.1 represents a change in how we package our products. Until now, we've shipped our core provider and the Visual Studio integration bits as separate downloads. This has become a bit of a problem. Often we would fix a bug that involved changing code both in the VS package and in the core provider. This provided a versioning problem where users would need to upgrade both products to see the benefit of the bug fix. To solve this, we've decided to discontinue Tools for Visual Studio as a separate product and have, instead, integrated it into a new Connector/Net installer. We hope this provides a better "out of box" experience for our users.

All previous versions of Tools for Visual Studio should be uninstalled prior to installing this product.

Version 5.1.2 works with all versions of MySQL including MySQL-4.1, MySQL-5.0, MySQL-5.1 beta or the MySQL-6.0 Falcon "Preview". Please be aware that this version is beta quality software and should not be used in production environments.

It is now available in source and binary form from [http://dev.mysql.com/downloads/connector/net/5.1.html] and mirror sites (note that not all mirror sites may be up to date at this point of time - if you can't find this version on some mirror, please try again later or choose another download site.)

Issues fixed

  • Fixed integration with the Website Administration Tool.  Before this fix, the test link was visible but did not work and  user management did not work.
  • Reintroduced code to properly return field values as byte[] when the binary flag is present. (See release notes)
  • Fixed problem preventing the DataSet Designer or TableAdapter wizard from being able to generate insert, update, and delete statements. (Bug #26347)
  • Fixed problem preventing use of stored procedures for insert, update, and delete statements in a table adapter.
  • Fixed problem where text columns would not appear in the Visual Studio query builder (Bug #28437)

Bugs fixed in 5.0.8 that are now appearing in 5.1.2

  • Log messages are no longer truncated to 300 characters (Bug #28706)
  • Fixed a problem with compression over a network.  We were letting the inflate stream read directly from the network stream.  Under certain situations, two bytes were being left unread and this messed up our byte counts.  Now we are using a WeakReference to an internal buffer that we read the compressed data into before inflating. (Bug #28204)
  • Fixed problem where we were not closing prepared statement handles when commands are disposed.

Where to get information

.NET forum: [forums.mysql.com]
.NET mailing list: [lists.mysql.com]
Reggie's blog: [www.bytefx.com]
Planet MySQL: [www.planetmysql.org]

As always we thank you for your use of our products and keep those bug reports coming!

Monday, June 11, 2007

Found this great memory stress tool -- called Safari

So I was surfing around Apple's website this afternoon and found this new Windows download called Safari.  Wondering what it is I downloaded and installed it.  Turns out it's a great memory stress tool.  Check out this screenie of it using nearly 300 megs on my Vista x64 system.

image

This is great!  I was able to see how all my other apps work in low memory situations.  As useful as that is, right before I was going to write this blog entry I discovered this wonderful app also renders web pages.  Holy cow!!  This is too much.  What are those Apple guys going to think of next?

Saturday, June 9, 2007

Use String.Compare -- sometimes

I recently came across this blog post on using String.Compare instead of the tried and true method of converting one string to lowercase and comparing to a known lower case value.  It's important to remember that strings in .NET (as in Java) are immutable so the act of lower casing a string will always make a new string.  The memory subsystem for .NET is turned for  handling lots of small objects but the fewer objects you create, the fewer that have to be checked and managed by the garbage collection system.

Still I wondered what the time difference would be between the two approaches.  So I setup a very simple test where I compared the string "FooBar" to a string variable that contained the value "foobar" one million times.  The first test used the approach of lowercasing the first string and then doing a simple equality comparison.  The average time spent for the entire loop was like .12 seconds.

The second comparison was to use String.Compare("FooBar", s, true) where s had the value "foobar" and true means to do a case insensitive comparison.  The average time spent in the loop was .10 seconds.  From this we can deduce that we should always use String.Compare right?  After all it's faster and definitely consumes less memory.  Well, not always.

My next test was a common scenario where you compare a value to a series of known values.  In this test, my input was the value "FooBar2" and I compared to "foobar", "foobar1", and "foobar2".  With the first test, I converted it to lower case just once and then did the comparisons using a series of if/else statements.  Time in the loop was .19 seconds.

The second test used String.Compare for each one of the if statements.  Time in the loop was .34 seconds.  So if you are doing a single string comparison, then String.Compare is your friend.  If you are doing a series of comparisons, then use a switch statement or the lowercase approach if speed is your concern.

Friday, June 1, 2007

Looking a gift horse in the mouth

I've been following the comments to Jamie's latest post and I have to say that most of the people who left comments are not thinking logically about this.  Most (not all) are outraged that Microsoft would try to prevent Jamie from enabling his most excellent TestDriven.Net product on the Express line of products (Visual C# Express, etc).

As a consumer I would love to be able to use plugins in the Express products.  I use Visual C++ Express to code on the MySQL server frequently.  However, I'm smart enough to realize when I've been given something for free. Let me say this slowly and clearly:  Microsoft is a business, not a public service.  They didn't have to make the Express products available at all.  It takes a great deal of time and money to build something as complicated as these products.  To my way of thinking, they made a reasonable request.  Use our free products for as long as you want.  If you want to use extensions, then buy our full product.

There are many companies (including us) that look for ways to differentiate between a free product and a for-pay product.  I guess these people think that Microsoft shouldn't have any for-pay products.  Why doesn't Microsoft just give away Vista and Office too!  After all, I'm a consumer and I want that.  That's all that really matters, right?