eWorld.UI - Matt Hawley

Ramblings of Matt

Configuration Error - Solved

August 24, 2004 23:04 by matthaw

For the last few days, I've been having the problem of "Configuration Error - Access is denied" in one of my web applications that I've been building. Well, today was the breaking point. After restarting my computer roughly 10 times in 45 minutes, I decided to google it. Alas, I found this KB article that explains why its happening and how to solve it.

The "quickie" fix for this is to go to Indexing Services and explicitly exclude the temporary ASP.NET folders from Index Services. Read the article to actually figure out how to do that, I'm assuming you can read more than 1 webpage since you're reading this.

I think this is going to be one of those "Must Do When Rebuild Machine" tasks that I'll forget to do, yes I did say forget. How often do you remember the peculiarities in your setup...



Categories: .NET
Actions: E-mail | Permalink | Comments (1) | Comment RSSRSS comment feed

Get OS Name and Version

August 24, 2004 00:26 by matthaw

Awhile ago, I had come across an article describing on how to get the current operating system version and name through .NET. While this article was great for Windows XP and prior OSes, it didn't really pan out too much for Windows 2003 Server and Longhorn. So after a bit of digging to determine the version numbers (thanks to Adam for getting me the current Longhorn version #) I was able to successfully map the correct versions/names. Here's my code:

private string GetOSName()
{
System.OperatingSystem os = System.Environment.OSVersion;
string osName = "Unknown";


switch(os.Platform)
{
case System.PlatformID.Win32Windows:
switch(os.Version.Minor)
{
case 0:
osName = "Windows 95";
break;
case 10:
osName = "Windows 98";
break;
case 90:
osName = "Windows ME";
break;
}
break;
case System.PlatformID.Win32NT:
switch(os.Version.Major)
{
case 3:
osName = "Windws NT 3.51";
break;
case 4:
osName = "Windows NT 4";
break;
case 5:
if(os.Version.Minor == 0)
osName = "Windows 2000";
else if(os.Version.Minor == 1)
osName = "Windows XP";
else if(os.Version.Minor == 2)
osName = "Windows Server 2003";
break;
case 6:
osName = "Longhorn";
break;
}
break;
}

return osName + ", " + os.Version.ToString();
}

Adam has also informed me that in Longhorn, or rather .NET 2.0, there is a new property that will return this for you, VersionString.



Categories: .NET
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

No More Stored Procs!

August 20, 2004 22:07 by matthaw
This method is way better than using stored procedures, oh yeah. You can change them on the fly, and not even have to acess the database. Now, how to do inserts/updates/deletes...

Categories: .NET
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

Reporting Services :: Page Breaks

August 11, 2004 00:40 by matthaw
I've been off at a client site today, which is why I've been a bit quite. Anyway, I've been working with SQL Reporting Services today, and I was wondering how in the world I could create page breaks between 4 different charts. Much to my amazement, if you just drop a "Rectangle" on the page layout, go to its properties, and check "Insert after Rectangle", you'll get a pagebreak. Easy as pie, a pie chart that is!

Categories: .NET
Actions: E-mail | Permalink | Comments (1) | Comment RSSRSS comment feed

Ampersands in XML

August 9, 2004 18:11 by matthaw

Alright, hopefully someone will have an answer for this, or just explain it to me...

I'm working on WebDeploy, specifically a single bug I identified while trying to use WebDeploy to deploy Community Server :: Forums last week. The problem is that the VS.NET project file that is used, has a few File elements that contain ampersands within an attribute. Now I realize that you can have ampersands, but they must be in the format of "&", whereas these are just straight "&" in the attribute values.

My initial problem was that the Xml Document I was loading the project file into, would throw a FormatException, and ultimately not allow me to process that file. So, I bypassed this by using an XmlTextReader. I am now able to get the data I want, but the problem of the ampersands still exist. Whenever I hit those nodes, whammo! exception.

My questions to MS or the blogosphere:

1. How in the world did those ampersands get into the project file without being converted so that the project file is valid?
2. How in the world does VS.NET successfully open these projects without complaining to the user?

As of right now, I'm putting in a bugfix for WebDeploy that will not hault deployment if it comes across such a problem, however it will skip over the invalid files. Maybe someone can answer my questions and give me a good solution so that those files with the ampersand will get deployed along with everything else.

Also, because of this issue, I also had to create a recursive call to make sure that it doesn't bomb out on the reading, the following code is how I bypassed this:

private bool ReadReader(XmlTextReader reader)
{
bool read = false;
try
{
read = reader.Read();
}
catch
{
read = ReadReader(reader);
}
return read;
}


Categories: .NET
Actions: E-mail | Permalink | Comments (1) | Comment RSSRSS comment feed

Minimizing Applications To Systray

August 5, 2004 22:46 by matthaw

This is just a heads up for those developers creating applications in which your app can minimize to the systray.

NEVER NEVER NEVER set the Visible property. Doing so can cause unexpected behavior when trying to restore the application from its minimized "systray" state.

Also, a side note - if your application needs to minimize to the systray, and dissapear from the taskbar, set FormBorderStyle to FixedToolWindow, then when it is restored, set it back to Fixed3D or FixedSingle, or Sizable. What this does is that it eliminates your application from being "alt-tabbed" to while in its minimized "systray" state.

Just a few helpful tips from your handy dandy .NET neighbor.



Categories: .NET
Actions: E-mail | Permalink | Comments (1) | Comment RSSRSS comment feed

ASP.NET Server Controls Presentation

August 5, 2004 16:52 by matthaw

Yesterday, I stated that I had to prepare a presentation for my .NET User Group, and after 3.5 hours of quickly throwing together a presentation and demos, I was done. Yay! I luckily only had enough time to leave work (yes late), drive to the Microsoft office, setup my laptop, and then go! Call that close? I would.

Onto the presentation, nay, discussion. I say this because I wasn't presenting, everyone in the room was having a discussion about ASP.NET Server Controls, and I was just leading it. I was amazed that my technical level that I put together enthused everyone in the room. Wow. So after 2 hours later we had to actually stop our discussion with content left to cover (using events). I tell you what, I've never been so psyched and tired at the same time, what a rush.

So, if you'd like to check out my presentation & demos, you can download them here. I do have to reiterate, that some of the content may not be as accurate as what it should be since I threw it together in 3.5 hours. Enjoy!



Async Call to WebService

July 16, 2004 23:53 by matthaw

So I ran into a bit of a problem this afternoon when calling WebServices asynchronously. It seems that if the process that calls the webservice ends right after you call the web service asynchrously, the process stops the async call and never makes that call.

I know this to be the case because I did several different tests, one calling the method async, then doing a wait on the IAsyncResult. I also did a long loop afterwards...both of which worked just fine. It seems that since the process ends, it cuts off the async call.

Anyone have any insight on this problem?



Categories: .NET
Actions: E-mail | Permalink | Comments (2) | Comment RSSRSS comment feed

Find Files with Mask

July 16, 2004 00:31 by matthaw

Preface: For my new version of WebDeploy, I wanted to disband the idea of using extensions. Now, don't freak out...I have a good reason why. One of the most pressing requests has been

"How can I copy config-prod1.config to my production server 1, config-prod2.config to my production server 2, but not deploy config-prod2.config to production server 1?"

Well, my normal answer was, use the "Files to be Copied" dialog to exclude them, as well as rename as you wish. So, do you see where I'm going? I sure hope so.

Post: My main problem, as you can see, has been, how do I implement this into WebDeploy without changing the focus of WebDeploy immensely. Well, the answer wasn't so simple until I was chatting with my good friend Ryan about this problem. His first suggestion was to use the overloaded method of GetFiles to include a mask instead of just retrieving all files.

As this point it seemed like a perfect solution. Oh, but as I started to look into it more, I determined that this just wasn't going to work, primarily for when a source is a VS.NET project file. There's no way of using GetFiles with the mask overload against that, so we went back to the drawing board.

What we came up next was a meeting of the minds that only the statement "Great minds think alike" can explain (which I might add was noted after we both posted the same idea). Well, this idea, of course, was to use Regular Expressions to match the mask. Great idea, huh...did you think of it too?

So, I then proceeded with "how am I going to convert the mask supplied to WebDeploy into a regex that will match file names." Oh, the answer was so simple yet ungodly weird. So, we had to go from something like:

config-*.config

and have it converted into a regex that will match my examples in the preface. It seemed all too simple, but I realized that * isn't a wild card character, rather . (period) was...and so I transgressed into a regex formula that will need to take place:

1) Convert any non alpha-numeric char's (aside from *) into \[char]
2) Convert any *'s into .*
3) Prepend ^
4) Append $

which, after the logic processes takes the mask and creates:

^config-.*\.config$

running the regex through a matcher matches both file names noted in the preface without a hitch.

Now, I'm not really sure what the wildcard logic to match files or folders looks like in [enter wildcard matcher here], but I think this is a pretty good solution. If you find anything wrong, please let me know as this logic will be put into WebDeploy. If you find some better method, please let me know as well, any and all help will be greatly appreciated.

Conclusion: Both Ryan and I feel that this new "masking" concept will make WebDeploy a much more powerful tool, allowing you to copy matched files instead of just files with that extension.

"Let the beast roar with great functionality. Because only then can you find out if its worth your time." - Matt Hawley



Categories: .NET | Unleash It
Actions: E-mail | Permalink | Comments (1) | Comment RSSRSS comment feed

Check out Before Find & Replace

July 14, 2004 19:45 by matthaw

So I had to make a change to a demo at work today, which is checked into VSS. This change basically was to modify the color of an element in CSS (which happens to be on every page, thats about 250 demo HTML pages).

Ohh, stupid me...I didn't check the files out before doing the Find & Replace, so now I'm having to click "Check Out" 250+ times everytime this value is found and replaced.

Word of the wise, make sure you do a check out of all files if doing this type of find & replace.

Well, back to it, about another 15 min of hitting "Check Out"...

Update: After 5 min. I just realized that I should open up VSS manually and check out the files there...ahh much better. BTW - it was 553 files, not 250...I would have been doing this for 30 min.

Update 2: Another good way to render VS.NET useless is to have 550 documents open at 1 time. Also, closing the windows takes about 5 minutes.



Categories: .NET | General
Actions: E-mail | Permalink | Comments (4) | Comment RSSRSS comment feed


Copyright © 2000 - 2025 , Excentrics World