Friday, November 28, 2008

This picture describes it all about webservices...

Or at least what you need to know to get started....


Thursday, November 13, 2008

Thursday, November 6, 2008

Visual Studio 2005 - Form Designer problem, project from source safe from other machines

The other day, I tried opening a project from source safe that
was originally created on another computer. After opening the project,
I tried to open the Form designer for one of the forms, and I got an
error message......

There is no editor available for C:\..\Form1.vb
Make sure the application for the file type (.vb) is installed

The fix was the build the project at least once. This allowed me
to then open up the form.

Wednesday, November 5, 2008

Get current time of the day, non-military

Say you wanted to get the current time of the day into a string in the format of something like 05:19 PM.

This is how you do it….

DateTime.Now.ToString("hh:mm tt")

Thursday, October 30, 2008

The metabase nightmare

My story on moving a visual studio project to another computer.
A little background. The project was originally created in visual
studio 2003. Then it was converted to 2005 with the wizard.

The story below is about moving that converted 2005 project
to a PC that does not have 2003. It only has 2005 and 2008.

The story begins...

I cut and copied the folder into the wwwroot of the new PC.
Cut and copied the project folder into the visual studio 2005 project folder on the new PC.

Opened solution in 2005, with no problems to report so far.

Created virtual directory to point to the root project folder located in the wwwroot path.

Tried to browse the main page from IIS, and recieved and error...
Cannot view XML input using XSL style sheet

Right clicked on the virtual directory in IIS, and selected properties, and selected it to use the ASP.NET 2.0 engine.

Again, I tried to browse the main page from IIS, and now I received a new error...
Failed to access IIS metabase.
The process account used to run ASP.NET must have read access to the IIS metabase

I went ahead and gave the ASPNET account read access to this folder...
C:\WINDOWS\system32\inetsrv

Still the same error showed up.
I checked out this article...
http://support.microsoft.com/?kbid=267904

Which asked me to download a tool. (MetaAcl)
It is a tool for modifying the metabase permissions on the IIS Admin
Objects.

But I read that to grant permission to not use the MetaAcl, rather use
the aspnet_regiis tool located in.. C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727

So I ran it for both the ASPNET account and for my account...

aspnet_regiis -ga mydomain.com\mylogin

aspnet_regiis -ga mydomain.com\ASPNET

Restarted IIS, and still no luck.

So out of things to try, I decided to try the MetaAcl tool, and ran
it for 2 different accounts...

MetaACL "IIS://Localhost/W3SVC" mydomain.com\mylogin RW

MetaACL "IIS://Localhost/W3SVC" mydomain.com\ASPNET RW

Restarted IIS, and still no luck.

Nagivated to..
http://localhost/localstart.asp

Still no luck.

I also tried...

aspnet_regiis -ga mymachinename\ASPNET

Still no luck

Then I tried to uninstall the .net framework 2.0...
Microsoft .NET Framework 2.0 Service Pack 1

because I read online that if you installed .net before
IIS, then you will have problems, bacause all the permissions
of ASPNET could not be set correctly.

But I could not uninstall the .net framework 2.0 Service Pack 1
either.

I got an error message...

Microsoft .NET Framewoek 2.0 Service Pack 1 cannot be uninstalled
because it will affect other applications that are installed. For
more information, see http://go.microsoft.com/fwlink/?LinkId=91126

Next, I converted the 2005 project to a 2008 project via visual
studios wizard, and I tried opening the main aspx page from
within the IDE, but the problem continues. I got the message...

Unable to start debuggin on the web server. The web server is not
configured correctly. See help for common configuration errors. Running
the web page outside of the debugger may provide further information.

This is the same error I was getting when it was in 2005.

Again, I tried to browse the main page from IIS, and I continued to received
the error...

Failed to access IIS metabase.
The process account used to run ASP.NET must have read access to the IIS metabase


As a last resort, I start removing all the .net frameworks that I could from
add remove programs..

I started with .net framework 3.5

The uninstall was successfull.

Next on the removing .net framework 3.0 Service Pack 1

The uninstall completed as well.

Next on to attempt .NET Framework 2.0 Service Pack 1 again.

Some progress...

I got a message that wanted me to close some applications before the uninstall.
I closed the apps and clicked on retry.

The uninstall completed. Finnally getting somewhere. I hope.

I noticed that I still had .net framework 2.0 sdk enu in the add/remove
programs, and a couple 1.1 frameworks. I decided to stop here and try to
install framework 2.0.

I went online and downloaded the .NET Framework Version 2.0 Redistributable.

Installed it, and because previously I had converted the project to use 3.5.
It still did not work, but this time I got a configuration error and not a
metabase error when trying to open it from IIS.

I went online and downloaded the .net framework 3.5 setup.
Ran it, and it downloaded the needed files and installed itself.

I got another error...

Microsoft .NET Framework 3.5 has encountered a problem during setup. Setup did not complete correctly.

I closed out to quickly before getting the error signature, but then I remembered another issue I had with another PC in which I needed to stop
IIS before installing 3.5

I went ahead and stopped IIS.

Started the 3.5 install again.

Got what I believed was the same error as last time...

EventType : visualstudio8setup P1 : 14001
P2 : 3.5.21022.08_orcas_x86_net P3 : gen P4 : inst P5 : f
P6 : dlmgr_bitserror P7 : -2147012867 P8 : 0
P9 : runtofinish()_failed to retrie P10

Because I saw that it made five attempts when trying to download, I thought, it's got to be a problem with it downloading what it needs.
I went back online and downloaded the 3.5 redistributble package instead.

Installed the framework 3.5 and problem fixed.

What a freaking mission.

I always knew about installing IIS before installing the .net framework, but
because I got used to VS 2005 and up, which ships it's own version if IIS,
I did not bother to even think about the order of my installations for a new
PC.

Long story short. Install IIS before you install any .net framework.
And if you do, and you get that silly metabase error, uninstall the .net
framework 2.0. If you have problem uninstalling the .net framework 2.0, it
might be that you have .net framework 3.0 and up on your machine, and it needs
to be uninstalled first.

Wednesday, October 29, 2008

Flowcharting - An annoying task

I always find that flowcharting can be a pain the butt, and very annoying if all you like to do is code, but I have found something that works for me.

I start the flowchart by writing it on paper first, and once I have a couple of loops, decisions, processes, etc, I go ahead and start up visio and add what I have so far. Then I print that flow-chart, and continue to write on the print out.

This creates more real estate space for more additions, plus it gives me the feel that I'm getting through this much faster.

Monday, October 20, 2008

Access methods after converting to another type - C#

So this below was not working because the compiler could not find the ToLower() method....

object myvalue;
// do other stuff here
myvalue = (string) value.ToLower();


But wrapping it up a little more exposes those methods.....

((string) value).ToLower();