Category Archives: Tools

how a developer saves two minutes of their precious time

I had a new table to add to a sql server database. The table was already pre-defined in a dataset schema in vs.net. I thought”wouldn’t it be nice to create a table from an xsd as easily as I can create an xsd from a table?“

I could have created the table by hand in 2 minutes.

But instead I went over the XMLSpy website to see if they had that feature and it looks like they do. So I installed XML Spy Enterprise 2004 from my demo cd. I went to register for the 30 day trial and got a message that said it was an outdated version and I needed to download a new one. So I downloaded XMLSpy Professional latest version and isntalled that. Then I downloaded the software that integrates it with VS.NET. Then I waited while the help file updated. So now it has been over an hour. And let’s see how much longer it will take me to figure out how to do that task in XML Spy so I can save myself 2 minutes. Isn’t this typical for all of us, though?

Update: 10 minutes. That was only because there were multiple tables in the dataset with relationships and I had to do it over again so that I could get just the one table I wanted. Very nice and easy. Of course this is about  .05% of XML Spy and the entire product is a bit overkill for just that but now that I finally have it installed, I will surely begin playing with its new features. This particular feature is not in the free XML Spy Home Version. The feature-rich Pro version is $500, which I would be hard pressed to buy unless I couldn’t live without it. I did pay $300 just for one XCeed component – the .NET Stream Compression tool. So it’s not that I’m cheap or unwilling. Although it did kind of kill me to recieve a few free licenses to raffle to my user group 4 months later.

Crystal Reports Error in Formula Record_Selection

This was a REALLY difficult problem to track down so I am adding it into the world for google to help someone else (or even myself again).

I used one cyrstal report as a basis for another. So I literally copied the report files to a new folder.

When running the report an error was thrown that I could not debug:

Error in File C:\DOCUME~1\Julie\LOCALS~1\Temp\temp_8c3aef3e-caf3-4214-99ee-6ff344a4c8a7.rpt:

Error in formula <Record_Selection>.

‘{MDTTests.fieldreportid} = {?Pm-FieldReportswithProject.fieldreportid}

This field name is not known.

What is strange about this error is that the namespace MDTTests is from the original report. So I knew that it was left over somewhere in this report. It took me over an  hour to find it. Now it seems obvious and easy to find, I don’t know what took me so long to try this

Once in here, I could see the offending code that just needed to be deleted. This is related to linking a sub report but does not show up in the dialog for linking a sub report and it does not get cleared on it’s own for some reason. In fact you can see that each time I went to fiddle with this setting through the link sub-report dialog, it just kept adding to the list.

I removed all but the last of these lines and my report came up perfectly.

Debugging WinForms and WebForms with a non-admin Domain Account

I just spent 4 hours trying to figure this out — so here it is for the next sucker.

I have a new machine on my network and it will be my development machine. I added my domain account on to this machine as a non-admin. (Do you hear cheering?) I used an admin account to install my software, including Visual studio.NET, which very kindly added my admin account to the Debugger Users group. However, I need my account to be a Debugger User. I tried the right click run as method which is a pia and works for WinForms but not WebForms – but I hate hacks.

Using the basic tool in Windows XP, you can assign/change groups but you can only have one group at a time. I replaced “Power Users“ with “Debugger Users“ but could not log back in. I needed them both. I went a little further to use the MMC snap-in for “Local Users and Groups“ but come hell or high water (leon, did I get that right?), I could not get it to recognize my domain. I spent a lot of time googling this and saw many requests for help with this problem but no solutions. Here is a snapshot showing the problem of not accessing my domain when trying to add users

Finally I remembered my own similar situation wtih SQL Server a few months ago. After upgrading my server to Win2003 and IIS6, I needed to add the “NT AUTHORITY/NETWORK SERVICE“ account to my sql server logins. The account was just not available through the UI and I had to add it through TSQL (command line).

So with this idea, I started searching again and quickly came across many features of the NET command line tool (part of DOS) that I never knew about. Here is the TechNet reference to this invaluable tool. Net Services Overview  and Net Services Commands

I used the “NET localgroup” command to add my domain account to the local Debugger Users group and now am back in business!

net localgroup “Debugger Users” MYDOMAIN\julie /add

Here are a few key words for google: add domain account group local user accounts windows xp

on updating from WinXPSP2 RC1 to RC2

I read the instrux, went to the update windows site and sat and waited and waited and waited while it said “checking for updates”.

I stopped it and started it again. And waited and waited and waited.

After at least a 1/2 hour of this nonsense, I finally noticed the very small and very unnoticable notice above the i.e. box that i.e. was blocking activex scripts and I should press some key or another to let the activex script run.

So Windows XP SP2 RC1 was preventing itself from updating itself. And I, a “professional” couldn’t figure it out. Hmmmm….

My use of a marble mouse for 4 years has messed up my arm and hand

If you have ever had a meal with me, you probably noticed that my right hand is really shaky. Soup is getting to be a serious problem and chopsticks, too. I have had it checked over the last two years with no recommendations oustide of take a long vacation or try a new mouse. Others have suggested the onset of carpal. The mouse suggestion was actually pretty close.

I saw a neuro-anatomist today and learned how messed up my muscles in my right hand and arm are because of the thumb driven marble track ball mouse (Logitech) I have been using. If I just rest my hand on a table, it’s natural position is now as though the mouse is under my hand. Twisted to the right etc.

Take heed! She said they have seen all kinds of new wierd problems based on the various types of mice that have been invented.

So I’m going to change my mouse plus do a lot of specific exercises to get the balance back in the muscles in my arm and my hand. Additionally I have to be very aware of how I am using my hand and arm. The shakiness is just from weakness of particular muscles.

I went to Staples and looked at the mice and keyboards, too. I think I will wait to see if my MVP award is renewed and if so, use my bucks to buy a new microsoft mouse and maybe the natural keyboard. She did say the keyboard is almost a great idea except it would be much better if it was hinged so that you could adjust the angles to suit your own needs. Hey MS Research…have I got a job for you!

Phew! A small thing considering that I have been programming for almost 20 years.

Dell “FreeDOS” systems – buy a computer without an O/S

One of the drawbacks when buying a new computer is paying for an operating system that you already own. Dell has a series called the “N” series that they really devised for Linux, etc. users but is a great option for people who already own an OS. I just ordered an OptiPlex this way. I only ordered it with the base 128MB of RAM though since it is a lot cheaper to buy my memory from Crucial.com.

ADO.NET 2.0: DataView.ToTable DISTINCT!! Hooray Hooray!

Because I had to write a DistinctRows function last night, today I looked at the May bits of VS2005 to see if they had addressed this really obvious need, and indeed they did! Hooray hoorah!

OverLoads Public Function ToTable( _ ByVal distinct As Boolean, _ ByVal columnNames() As String _) As DataTable

Here’s the quick hack I wrote last night if you want to use it. It sorts the table on the keyfield then walks through it grabbing every row where the value of the key field changes and stuffing it into a new datatable that is returned. No rocket science. Just another one of those things I wonder why I had to write the code.

(note – the int32_key is in there as a reminder in case I need to create another one for non-int keys)

Public Function DistinctRows_Int32_Key(ByVal dt As DataTable, ByVal keyfield As String) As DataTable
  
Dim newTable As DataTable = dt.Clone
  
Dim keyval As Int32 = 0
  
Dim dv As DataView = dt.DefaultView
  
dv.Sort = keyfield
  
If dt.Rows.Count > 0 Then
    
For Each dr As DataRow In dt.Rows
     
If Not dr.Item(keyfield) = keyval Then
       
newTable.ImportRow(dr)
       
keyval = dr.Item(keyfield)
     
End If
   
Next
 
Else
   
newTable = dt.Clone
 
End If
 
Return newTable
End Function

The Great DataSet Debate

Speaking of Scott Hanselman, he started a fantastic discussion about datasets. His issue was returning datasets from webservices (public ones) that may have subscribers that are not .NET clients and don’t grok datasets. There are a bunch of discussions that spun off of this as well as a pointer to a February discussion and incredible debate in the comments on Barry Gervin’s site.

Being a database developer for a gazillion years, I love working with data in my apps so I thought I’d add my 2 cents into here of some of the things that crossed my mind while reading through some of this stuff.

For the last few years, .NET has defined a choice of web services vs. remoting. Basically the prescription was if you are using nothing but .NET in your solution (client and server), then go for remoting and use strongly defined objects (though there were still some interesting perf #s when it came to datasets..). If you were creating something public that could be subscribed to by non .NET clients, then use a web service. That definition also presumes that datasets might not be the thing to return from the web methods since you would be dealing with clients that need to do a lot of work to read the dataset. (by my read, this is Scott’s main point).

I should mention here that I use web services for a lot of applications that are strictly .NET based and I have never implemented remoting. This was not an explicit decision based on some deep investigation, rather because I learned web services first (since Microsoft marketing really forgot the remoting message for the first 6 months) and stuck with them.

With Indigo coming down the pipes, that prescription changes. Basically the message is that if you are creating something new, use web services. Period. Regardless of an unknown or a strictly .NET defined client. So now many more strictly .NET solutions will be using web services and returning datasets will not pose that particular problem (client not understanding datasets) and the question will come down to perf. As Scott Swigart points out “Hanselman lives in an arena where there’s no such thing as fast enough, but few applications live under this constraint.”

There is definitely a choice to be made, but I think the bigger problem is that many developers are not aware of the choice. The dataset has become their tofu – an all purpose, maleable tool that can be used as every data container. I wonder how many people know that you can even fill a datatable from a dataadapter? Or how about just using a dataset/datatable/datareader as a translator….to get data out of a database and then push it into another type of object.

Many developers do not understand the baggage that comes along with a dataset. It’s good/useful/handy/helpful baggage if you need that functionality. But it can be dead weight if you are not using it. 

ADO.NET 2.0 is going to help more too, of course, with the datatable becoming a first class citizen (readxml and writexml), dataset can now load data in from a datareader (though you can’t return a datatable or datareader from web services with the same simplicity of dataset), lots of new merging functionality and more.