Thursday, June 15, 2006

Microsoft Technical Preview in Cleveland

Microsoft Technical Preview
Featuring Vista, Office and Exchange

Microsoft® is making a special appearance in Cleveland, OH on Wendesday, June 21, 2006, to give a presentation to Greater Cleveland PC User Group members (and guests) about technical details of the upcoming releases of Vista, Exchange and Office. Microsoft experts will be giving in-depth technical presentations and demos and there will be Q&A time. In addition, they will be providing refreshments and raffle prizes. As with all GCPCUG meetings, this is free and open to the public. GCPCUG requests that each attendee be included in an RSVP email to me@RLCoppedge.com to insure that there is enough seating and food. Please include the number of people attending in the RSVP.

Event Information
Wendesday, June 21, 2006, 5:00 to 9:30 PM
Cleveland Renaissance Hotel
Ballroom B
24 Public Square
Cleveland, OH 44113
(216) 696-5600
Free and open to the public

Subject Content
Microsoft Vista - This presentation will serve as a deep dive into an IT Pro’s workflow centering on the day to day activities that are typical in desktop management. We will illustrate the deployment tools, management interfaces, GPO, and additional features. Our goal it to represent a real “day in the life” approach for IT Pros, highlighting how Windows Vista will make your day more productive with topics such as Booting and Resuming Windows, Recovering from System Errors, New Event Viewer, Forwarding Events & Subscriptions, Scheduling Tasks and Diagnosing Performance Issues.Microsoft Office has evolved from a suite of personal productivity products to a more comprehensive and integrated system. This session, will provide a look into the new components around enterprise content management, collaboration, and business intelligence, and how the new, but familiar results-orientated user interface will help you and your organization produce better results faster.Exchange Server 2007, the next major version of Exchange, will be a leap forward in enhancing the information worker's access to larger mailboxes while giving the email administrator a more manageable and secure email infrastructure. This session will provide an overview of the product direction and provide a sneak peak at some of the new features that will be included in the product.
To RSVP, send an email, with the all attendees included, to Bob Coppedge.
For other Microsoft-related events in June, see the blog entry from June 6th.

Wednesday, June 14, 2006

Web Part Debugging Tip

Here's a little tip on SharePoint that I wanted to share with everyone. When debugging a web part on a SharePooint site and there are problems bringing up the page, try the following. Manually enter the URL of the page in question and add "?contents=1" to the end of the URL. Once you press enter, the page returned is the "Manage Web Part Page".

This will list all web parts on that page, including their title, type, display on page, and personalized properties. This will help identify if other web parts on the page are causing problems with opening the page.

Friday, June 9, 2006

File Access in VB.Net

Listed below is an example of file access in VB.Net, utilizing many of the I/O functions. First the routine creates a file, then deletes it. This routine is used only for demonstration purposes.


Sub FilePurge()

Static dtLastPurgeTime As DateTime
Dim dtNow As DateTime
Dim intCounter As Integer
Dim Files() As String
Dim strGUID As String, strTXTName As String

While True
strGUID = System.Guid.NewGuid.ToString
strTXTName = "C:\Temp\STB_" & strGUID & ".TXT"

'Create a uniquely named .TXT file
Dim swTXT As StreamWriter
swTXT = File.AppendText(strTXTName)
swTXT.WriteLine(strGUID)
swTXT.Close()

'Wait 2 seconds before proceeding
System.Threading.Thread.Sleep(2000)

dtNow = Now
Dim lTimeDiff As Long = DateDiff(DateInterval.Hour, dtLastPurgeTime, dtNow)

If lTimeDiff > 24 And Now.Hour = 22 Then 'Check if last purge was more then 24 hours ago and current hour is 10PM

'Purge *.TXT files
Files = Directory.GetFiles("C:\Temp", "STB_*.TXT")
For intCounter = Files.GetLowerBound(0) To Files.GetUpperBound(0)
If DateDiff(DateInterval.Minute, File.GetCreationTime(Files(intCounter)), dtNow) > 30 Then 'Purge only if file is older than 30 minutes
File.Delete(Files(intCounter))
End If
Next intCounter

'Update Purge Time
dtLastPurgeTime = Now()

End If

End While

Error_Handler:
Resume Next 'If an error occured while deleting a file, skip it this iteration and move to the next file

End Sub

Tuesday, June 6, 2006

Upcoming .Net related events

Listed below are upcoming events in the Cleveland area pertaining to .Net development:
If you have any questions about these events, please e-mail me at sam@clevelanddotnet.info.

Friday, June 2, 2006

The LINQ Project & SQL Prompt

Microsoft has begun work on the next version of .Net. One of the key features is integrated SQL commands. T-SQL keywords and commands will now be part of intellisense, elimating spelling errors. In addition, table and field names will also be incorporated in intellisense. This project is named LINQ (Language Integrated Query). To read more about LINQ, please visit The LINQ Project.

For those that can't wait for the next release of .Net to use this feature, Red Gate Software has introduced SQL Prompt. This product provides SQL Intellisense in Microsoft Query Analyzer, SQL Server 2005 Management Studio, Visual Studio 2005, Visual Studio .NET 2003, SQL Server 2000 Enterprise Manager, and UltraEdit32. To read more about this product or to download a free version, please visit the SQL Prompt web site.

Wednesday, May 31, 2006

Detecting a user's group in SharePoint 2003

Listed below is a C# example of programmatically querying the group(s) a user belongs to on a SharePoint 2003 site:

using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;

private boolean IsContributor()
{
boolean bContributor = false;
SPWeb currentWeb = SPControl.GetContextWeb(this.Context);
SPRoleCollection currentRoles = currentWeb.CurrentUser.Roles;

foreach(SPRole myRole in currentRoles)
{
strRoles = myRole.Name.ToString();

if (strRoles == "Contributor")
{
bContributor = true;
break;
}
}

return bContributor;

}

"File or assembly name Microsoft.VisualBasic.Compatibility, or one of its dependencies, was not found."

I had an windows application that was converted from Visual Basic 6.0 to VB.Net 2003. After it ran fine in development, I moved to production where I received the following error "File or assembly name Microsoft.VisualBasic.Compatibility, or one of its dependencies, was not found."

Since the application was converted from an older version of VB and uses some legacy functions, it requires "Microsoft.VisualBasic.Compatibility.dll". This library was originally found on the development machine in C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322, but was not found on the production server.

The easiest way to resolve this is simply to copy the .DLL into the working directory of the application. The .DLL can also be packaged with the project installation to avoid the same issue from repeating with future installs.

Preventing Timeout while debugging XML Web Services

When debugging XML Web Services, an exception appears indicating the operation has timed out. To resolve this problem, set the TimeOut property on the XML web service object to -1. This will set it to infinite timeout.

This tip was found in "Debugging Applications For Microsoft .Net and Microsoft Windows"

Friday, May 26, 2006

"It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual"

Q: I have an ASP.Net application that when launched produces the following error:

It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.

What can I do to resolve it?

A: This could be do to the virtual directory not being configured as an application.
To create an Application using a Virtual Directory, use the following procedure.
  1. Open the IIS Manager (inetmgr.exe)
  2. Right click on "Virtual Directory" and select "Properties".
  3. Click on the "Create" button.

The Virtual Directory is now configured as an Application and the ASP.Net should work as expected. If not there maybe a conflict with the settings in the Machine.config file.

Wednesday, May 17, 2006

Microsoft Expression Products

Microsoft has released a new product line called Expression, targeting web designers and developers. The product line up consists of 3 products:
  1. Expression Graphic Designer: used for creating vector or pixel-based rich graphics with texture and dimensions
  2. Expression Interactive Designer: for creating an engaging and interactive interface using multi-media.
  3. Expression Web Designer: used for building optimal web sites using a visual designer and leveraging ASP.Net, XML, and XHTML.
Web designers can incorporate elements from each product into a single web site. In addition, all these products can be used in conjunction with Visual Studio 2005 to leverage the capabilities of programming languages such as C# and VB.Net. Projects can then be built and deployed from Visual Studio.

For more information or to download a trial version, visit the Expression home page at http://www.microsoft.com/products/expression/en/default.mspx

Tuesday, May 16, 2006

Microsoft Expression Web Designer

Today Microsoft has released the beta version of Expression Web Designer. It is intended to replace Frontpage, which is being phased out of the product lineup.

In addition, Expression Web Designer will also offer reporting tools for web developers to help identify sites where Cascading Style Sheets are causing errors, accessibility of the site to handicapped Web users, and how many errors users of older Web browsers are encountering when viewing the site.

To download the CTP (Community Technology Preview) beta version, go to http://www.microsoft.com/products/expression/en/web_designer/wd_free_trial.aspx

Thursday, May 11, 2006

Generating a GUID

Q: How can I create a unique value without using a counter?

A: The .Net framework provides a method for generating a universally unique identifier or GUID and can be accessed as shown below:

Dim strGUID as String = System.GUID.NewGuid().ToString()

GUID is short for Globaly Unique Identifier. This number is
based on IP address, MAC address, and date/time. It's represented as a series of alpha-numeric characters in the format {8-4-4-4-12}.

Using the NewGuid() method allows unique numbers to be generated by one function call, without concern for repeating identifiers or counters.

Wednesday, May 10, 2006

C# in SQL Server 2005 Reporting Services

Q: I know that VB.Net functions are available in SQL Server 2005 RS (Reporting Services), but does it also accept C# commands?

A: The expression language for Reporting Services is VB.Net only. You can call an assembly that contains functions written in C#. This is a very valid option, but the call from within the report will be with the VB.Net syntax.

Thanks to Mike Shelton (Microsoft) for answering this question.