I needed to implement a dialog that could be used to stop from displaying over and over again. We've all seen countless variations on this theme. I also didn't want to go to the extent of using hooks to accomplish this.
I came across the SHMessageBoxCheck function, and it appears to give me what I need. Granted, it is far from perfect, but it works for me. I used the declaration from PInvoke.net, but I received a PInvokeStackImbalance exception from MDA. I modified the DllImport to use PreserveSig to true, and the error is gone. I did update the wiki to mention this finding, so hopefully others will be able to verify.
All in all, this function works well. But, by trying to be lazy and use a pre-existing solution, it definitely took longer than it would have had I written my own custom dialog. I'm sure that won't be the last time that happens.
I've been looking all over the place for a fairly simple file-sharing application. My needs are pretty simple: Have 2 users share a file repository where changed files get pushed to the other person over the Internet automatically. Like I said, simple, no? I'm not asking for an enterprise-level application, a generic solution like version control, or a tool to cure cancer. I came across a very promising application called Tubes.
Tubes has a nice web site, a good overview video, blogs, a community forum, and other nice touches. However, the application is absolutely dreadful. To start, they FORCE you to store all of the files in a "Documents and Settings" subdirectory. So if you use partitioning, or even would just like to store your files in another location or drive, you're just plain out of luck. I reported this deficiency months ago. They just released a new Beta 4 download of their tool, but this feature didn't make the cut. Tubes is written in .NET. Addressing this feature would taken all of about 1 hour of coding and testing. It's a shame, because I like the concept, and I like the supporting community artifacts. But I guess that's why the feature didn't make it - this product is all about hype, concept, and promise, and not little things like shipping with a feature set that actually is usable.
With that rant out of the way, what are your suggestions for a pretty simplistic file sharing tool? I don't want to take on yet another side project to do in my "spare time".
I read Scott Hanselman's well-written article HOW TO: Debug into a .NET XmlSerializer Generated Assembly. I can add a few more little (and most likely obvious) things to his article:
- This still works in .NET 2.0.
- If you just do an Add New Item to add a new Application Configuration File to your project in VS, you can just paste the debugging flags in, and the config file will get deployed to the application directory automatically.
- You can just Step Into (F11) the call to x.Serialize, and you will be taken into the proper generated file. You may want to open the file manually as Scott mentioned, but I find it to be faster to press F11, and then go to the place in the file I want to debug.
In the end, we ended up writing our own serialization for .NET CF due to one too many bugs.
I've been listening to more podcasts lately (e.g. .NET Rocks, Hanselminutes, etc.), and they certainly contain good information. When listening to podcasts on my PC via Windows Media Player, I tend to set the playback rate to a higher rate in order to compress time.
When playing back audio files on an iPod, you can do the same type of thing, but you have to know the secret. You need to have a 4th generation iPod, have your audiobook/podcast encoded as an AAC file, and change the Settings > Audiobooks setting in the iPod to Faster. After doing that, I am now traveling through time around 25% faster.
The following code assigns DateTime.MaxValue to a parameter. When trying to run this code against the Northwind databse, it will produce the error, "An overflow occurred while converting to datetime".
SqlCeConnection conn = new SqlCeConnection(connStr); conn.Open(); SqlCeCommand cmd = new SqlCeCommand("select * from employees where [Hire Date] < @paramDate", conn); SqlCeParameter paramDate = cmd.CreateParameter(); paramDate.ParameterName = "@paramDate"; paramDate.DbType = DbType.DateTime; paramDate.Value = DateTime.MaxValue; cmd.Parameters.Add(paramDate); SqlCeDataAdapter da = new SqlCeDataAdapter(cmd); DataTable tbl = new DataTable(); da.Fill(tbl); dataGridView1.DataSource = tbl; conn.Close();
Note that this fails when using MSSQL Compact Edition (MSSQLCE) under a standard WinForm application and a Pocket PPC platform. The same code against a standard desktop MSSQL version will work fine.
The workaround is simple. Just get away from the MaxValue. Of course, this is a workaround, so it's not perfect, but it certainly works for my needs.
paramDate.Value = DateTime.MaxValue.AddMilliseconds(-1);
Sorry for the changing plans, but I just received word that CodeGear won't be able to make it out here for the 2/27 meeting so the DUG meeting will be cancelled. They may be able to reschedule in April, so that will give us some more lead time, but for now, things are off. Thanks for your understanding.
I was banging through some quick and dirty sample applications today, in preparation for a talk on LINQ tonight. One of my old LINQ to SQL demos shows how to use the external xml mapping file. I also blogged about this before. Today, I kept getting the following error whenever I would run with an external xml mapping file: The type 'Order' is not an entity.
I was using the following command line to generate the xml mapping file:
SqlMetal /server:(local) /database:Northwind /map:Northwind.xml /code:Northwind.cs /pluralize
Looking at the resulting xml file, I finally noticed this section:
<Table Name="Orders">
<Type Name=".Order">
Notice the leading dot before the type name attribute. That's the problem. So I went back and added the /namespace switch to the sqlMetal command line, and now all is well with the world again. Granted, this problem is the result of me doing demo work, and not production work, but it's still a little bit irritating. Then again, I'm still running the May 2006 CTP on VS2005, so for all I know, MS has already fixed all of this with a subsequent release of a build in Orcas.
|