Categories
Geeky/Programming

VS2005 Unit Testing HttpContext Cache

been searching for a while on how to test HttpContext and Cache in VS2005 Unit Tests, using the built in unit testing suite. Found this today..just add

TextWriter tw = new StringWriter();
HttpWorkerRequest
wr = new SimpleWorkerRequest(“/webapp”, “c:inetpubwwwrootwebapp”, “default.aspx”, “”, tw);
HttpContext
.Current = new HttpContext(wr);

to you test method and the correct “using” statements, and boom – it works – up goes your code coverage % 🙂

Categories
Geeky/Programming

VS2005 ASP.NET 2.0 "Ambiguous Match Found"

Sounds like some dating gameshow, where you are of the winner..and the date you get is someone you just aren’t sure of. Anyways, if you see this error in VS2005 (asp.net), what I have seen it means is: you have some control variables decalred in your codebehind file, and they are also declared in the designer.cs file. To fix, just remove them from the codebehind file and it should build. If you are using Web Application Projects, I have also seen that using “CodeFile=” instead of “CodeBehind=” doesn’t work when you goto deploy. It seems that CodeFile wants the .cs file to be present, and I am guessing most people dont want to deploy their source code along with their aspx files. Happy Coding 🙂

Categories
Geeky/Programming

Visual Studio 2005 Web Application Projects

If you are using VS2005, and using the add on for Web Application Projects, you probably have hit Scott Guthrie’s tutorial One tip I can share: turn off optimizations in your VS2003 project before upgrading, or before you try debugging once you have upgraded, it will throw up an error. Other than that, most of the issues you will see will be from Namespace conflicts, or file naming conflicts (Profile, Roles, etc).

Categories
Geeky/Programming

Visual Studio Loading Slow?

Dang, today at work loading up Visual Studio was taking like 5 minutes at 100% cpu. I rebooted, looked at task mgr, etc, nothing unusual. I turned off realtime virus scanning and boom! – it loads so fast its crazy. Just something that hasn’t been an issue, but creeped up and up on me, making it load slower.

Categories
Geeky/Programming

Visual Studio .NET 2005 Beta 2

I have been playing with VS.NET 2005 Beta 2 all night, the Personal Web Site Starter Kit. I have been modifying it and playing with all the new controls. Pretty sweet so far. Easy to consume RSS feeds, and get data from SQL. The master-detail page relationship is really cool, especially if you use templates for pages.

Categories
Geeky/Programming

VS.NET 2005 and SQL 2005 and Webhosting

Well, I finally installed SQL Server 2005 Beta 2 and VS.NET Beta 1 on a VMWare Image. Maybe I can start to play with it a little bit and check out the cool new features I have read about and seen in demos. Nothing like geekin out to get over post election blues? I also did some researching into some cheap web hosting tonight because a coworker and I are making a webpage for someone. We dontated it as a silent auction item in Aug. I had a hoster that was like 2 bux a month, but lost the address. The cheapest one I have found is like $6.95 a month.

Categories
Geeky/Programming

MSDN Event: Visual Studio "Whidbey" 2005

We got to preview Whidbey, which is slated for release in 2005. We went over some of the cool new features. For one thing, it loads faster than VS.NET 2003. Some highlights:

1) IDE Interface: The design is little nicer, and when you move a “docked” box, it is translucent and there are some options that come up for docking, which looks nice. It also doesn’t load every toolbar by default, so that is why it loads faster. They want to streamline development for a developers own needs.

2) Form Layout: Some cool things with the form layout, like auto-rulers that line up buttons, labels, textboxes etc. This will make it easier and faster to design a good looking form.

3) “My” Object: VB.NET will introduce the My object. This is pretty much a shortcut for useful namespaces that already exist, like event log, computer information, network functions. This will be nice, because unless you know or stumble upon a namespace, you end up writing custom code to do something that could be done in one line. An example is “pinging” an computer. To do this, you usually have to have a separate assembly or class with like hundreds of lines of code. With the My object you can ping a computer in one line of code!

4) Code Snippets: Many common coding snippets are set up so you can insert them into your program and change a few minor things to get it to work, for example, reading a text file, or writing to a database.

5) Refactoring: This is the process of procedurealizing code. The example they gave was taking over someone else’s program, and you discover it is all one big function. Refactoring allows you make procedures easily and it takes care of the details for you. I don’t see using this that much, but when it does get used, it would be a HUGE timesaver.

6) Line Revision Marks: This looks cool because it shows on the sidebar colors for different states of code revision. Like things that have been saved are green, and things that have been changed are yellow, so you can see what you have changed exactly before you save it.
7) Edit and Continue: In Visual Basic 6.0, you could put in a line break, and then when the program hit that point it would pause, and you could edit some code, and start the execution again from the same spot. In VB.NET 2002, 2003, they took this feature out. Developers must have complained and they added it back in. This is a huge timesaver, especially if it takes 20 minutes to get to a certain point in the execution of a program. Currently you have to wait 20 minutes, make one change, and then re-run the program for 20 minutes to see if it worked.

Visual Studio “Whidbey”

Categories
Geeky/Programming

MSDN Event : Application Code Blocks

Application Code Blocks are little “parts” of programs that Microsoft has created that you can install, and then include the assemblies in your program. The code has been tested and was created with best practices in mind.

We went over:
1) Configuration Management Block : Allows you to set up app.config files easily and encrypt and sign them. This is really cool so you can have settings in a file for your program and keep them secure, while not having tons of code to manage

2) Application Updater Block : Have you ever ran an application that popped up with a box that said there was a new version and that you could click yes to update it? This code block makes this about 100 times easier. You can include the code block, and set up a manifest on a web server, and your program will auto update!

Microsoft Application Code Blocks