Archive for the '.NET' Category

Connecting to blogs with .NET

Posted in Programming, .NET, Collaboration on October 3rd, 2005

Outlook example

MSDN has an article on using .NET to connect to blogs, either to read or to post articles. The example shows how to create an Outlook add-in to read RSS feeds. This is for the next version of .NET, so it requires Visual Studio 2005.

My.Blogs is a collection of sample code that will show you how you can easily provide programmatic access to weblogs in the applications you build. Full source code is provided along with Windows Forms, ASP.NET 2.0 and a Visual Studio 2005 Tools for Office Outlook Add-In.

Read the getting started article for more ideas on using My.Blogs.

SQL Server 2005 Roadshow

Posted in Programming, .NET, Software, Databases on September 24th, 2005

SQL Server 2005 Roadshow I got a chance to attend the SQL Server 2005 Roadshow when it visited Cincinnati this week. They had 9 presentations, 3 each for administration, programming, and business intelligence. In case you missed it, the presentation slides are available for download.

SQLServerBible.com has links to SQL Server 2005 webcasts, presentations, and What’s New in T-SQL.

Microsoft has free (for now) E-Learning for SQL Server 2005.

Tasktime 3.0

Posted in Programming, .NET, Software, Open Source on September 22nd, 2005

Listed on sourceforge.net
What is Tasktime?  It is software that will allow you to track time spent on a given task.  It sits idlely in the taskbar.  The data is stored in XML format so you can import it into any data source or use the existing XSLT file to get a basic report on it.

I updated Tasktime because I was working on a project in .NET that required XML processing (I was experimenting with different solutions) and because it was long over due. Yes this is a very simple app, in fact I made it even simplier. One thing I didn’t like about Tasktime 2.0 is that it stored data in the registry. Tasktime 3.0 uses only it’s own XML document. Another thing I did with 3.0 is embed all the resource files into the Tasktime.exe. So now Tasktime is USB key safe.

Tasktime 3.0 was part of my experiment with working with XML files in a Dataset. Now I prefer to use the XML data objects built into .NET that I used in my next project. Which I will post later.

Tastime 3.0 also makes use of resource files. If you want to see examples of embedding XML, XSLT or Icon files check out the source code.

#Region ” Resource File Functions ”

Public Shared Function GetEmbeddedIcon(ByVal strName As String) As Icon
‘The following is one line, broken down for formating reasons.
Return New Icon( _
System.Reflection.Assembly.GetManifestResourceStream( _
strName))
End Function

Public Shared Function GetEmbeddedXSL(ByVal strName As String) As Xml.XmlTextReader
‘The following is one line, broken down for formating reasons.
Return New Xml.XmlTextReader( _
System.Reflection.Assembly.GetExecutingAssembly._
GetManifestResourceStream( _
strName))
End Function

#End Region

    Potential Updates:

  • Write back to a database, possibly through a web service.
  • Included report is plain, would like to allow users to use their own XSLT file.

You can download Tasktime 3.0 at sourceforge.net or get the files here.

Tasktime Binaries
Tasktime Source

Ajax.NET - Free Ajax library for .NET

Posted in Programming, .NET, ASP.NET on July 27th, 2005

Ajax, is not necessarily new technology, in fact it’s not a single technology, but a group of technologies. Which allow you to build interactive web applications. The recently released Ajax.NET, a free and Open Source library for the .NET framework, will allow you easily include Ajax functionality in ASP.NET. You can read more about it on the Ajax.NET blog.

New Version of Enterprise Library Ready

Posted in Programming, .NET on July 8th, 2005

Microsoft has released an updated version of the Enterprise Library for download. For those that don’t know, “[the Enterprise Library] is a library of application blocks designed to assist [.NET] developers with common enterprise development challenges.”

The June 2005 release of Enterprise Library is a minor update of the original January 2005 release. This release contains the same seven Microsoft patterns & practices application blocks, and it incorporates the patches and extensions previously released to the Enterprise Library Community site. In addition, it includes several minor fixes and improvements.

If you are using the January 2005 release of Enterprise Library, and you are worried about the impact of upgrading to this new version, you should not consider this a mandatory upgrade provided you have installed Patch 1475. All of the changes in the June version should help improve the experience of using Enterprise Library, but since most of the fixes only apply to a small number of usage scenarios, you may find that the benefits of the new version do not outweigh the impact of upgrading to the new release. However, for new development, you should use the June 2005 release.

Read more in the Change Log.

It also seems that it will be a while before we see EL for .NET 2.0.

I recently attended a free first looks seminar for Visual Studio.NET 2005 here in Cincinnati. And while there are a number of improvements, nothing compares the Enterprise Library. This collection is worth it just for the data access and logging improvements. Greatly speeds up development time when building data-driven applications.

There are seven total application blocks, including the data access. The Enterprise Library replaces the individual application blocks that Microsoft was distributing. And it is much easier to implement into your solution.

The application blocks that comprise the Enterprise Library are the following:

  • Caching Application Block. This application block allows developers to incorporate a local cache in their applications.
  • Configuration Application Block. This application block allows applications to read and write configuration information.
  • Data Access Application Block. This application block allows developers to incorporate standard database functionality in their applications.
  • Cryptography Application Block. This application block allows developers to include encryption and hashing functionality in their applications.
  • Exception Handling Application Block. This application block allows developers and policy makers to create a consistent strategy for processing exceptions that occur throughout the architectural layers of enterprise applications.
  • Logging and Instrumentation Application Block. This application block allows developers to incorporate standard logging and instrumentation functionality in their applications.
  • Security Application Block. This application block allows developers to incorporate security functionality in their applications. Applications can use the application block in a variety of situations, such as authenticating and authorizing users against a database, retrieving role and profile information, and caching user profile information.

Free VB 2005 Book from Microsoft

Posted in Programming, .NET, Deals on June 22nd, 2005

VB 2005 Book CoverMicrosoft has been good at giving away some really good books lately. This latest is trying to prepare developers for Whidbey, namely Visual Basic 2005. Introducing Visual Basic 2005 for Developers is not an overly technical book by any means, but seeks to prepare VB 6 and VB.NET developers for VB 2005. I think Microsoft has hit a wall trying to get VB 6 developers to move to .NET.

But anyone who thinks they will be moving to Visual Studio 2005 might want to check out this free download. My only complaint is that each chapter is a separate PDF file, instead of being one PDF file.

From the site:

Get a focused, first look at the features and capabilities in Microsoft Visual Basic 2005, Visual Studio 2005, and .NET Framework 2.0. If you currently work with Visual Basic 6, these authors fully understand the adoption and code migration issues you’ll encounter. They’ll step you through a quick primer on .NET Framework programming, offering guidance for a productive transition. If you already work with .NET, you’ll jump directly into what’s new, learning how to extend your existing skills. From the innovations in rapid application development, debugging, and deployment, to new data access, desktop, and Web programming capabilities, you get the prerelease insights and code walkthroughs you need to get productive right away.

Chapter List:

  • Chapter 1 - Microsoft .NET Framework Primer for the Visual Basic Developer
  • Chapter 2 - Language Enhancements for Visual Basic 2005
  • Chapter 3 - Visual Studio 2005 Integrated Development Environment
  • Chapter 4 - Building Datacentric Applications
  • Chapter 5 - Constructing User Interfaces
  • Chapter 6 - Building Web Applications
  • Chapter 7 - Microsoft .NET Framework Enhancements
  • Chapter 8 - Deploying Applications

Lotus Notes .NET Integration News

Posted in Programming, .NET, Technology Trends, Software, Links on June 16th, 2005

I don’t know what it is. But there appears to be a revival in Lotus Notes. I am not sure if it because Lotus Notes 7 beta 3 is out or because there is already talk of version 8? But my bloglines had three, yes three, links referring to Lotus Notes today.

First Microsoft has two new webcasts related to Lotus Notes:
Optimizing Sharepoint for the Lotus Notes Customer
Integrating MS Office 2003 with Lotus Notes/Domino

I also found a Lotus Notes .NET Integration Page which features a Lotus Notes .NET Integration Toolkit, a Domino web service demo, and many more examples.

That’s all for now.

UPDATE: Make that four links today for Lotus Notes.
GTD ToDo List for Lotus Notes

OpenDoubleListBox, I knew I was forgetting something

Posted in Programming, .NET, Software, ASP.NET, Open Source on May 31st, 2005

I apologize, I setup a new site and didn’t move over the OpenDoubleListBox files. I didn’t even realize it until I received an email today. Thanks for the reminder Noah.

Current files for the OpenDoubleListBox:
DoubleListBox Example Project
OpenDoubleListBox binary
OpenDoubleListBox Source Code

If you don’t know, the OpenDoubleListBox is a open source implementation of a .NET server control for a double list box . Written in C#. See an image here.

I have also received several requests for additional functionality. I hope to be releasing a new version when I get the time. You can read more about the control at ASP.NET.

Multi-threaded Applications: Making Asynchronous calls to a .NET web service

Posted in Programming, .NET, Web Service on May 26th, 2005

The Business Case
I am currently designing a Customer Inquiry screen for our customer support personnel. I built a Windows application in VB.NET to retrieve and view large amounts customer data from different areas of the enterprise. Business requirements stated to return customer information, such as address and tax information, purchase history, and open orders.

I decided to create a Web Service to handle the functionality of retrieving customer details from the SQL Server. This way I could create a Windows application or a web application and use the same components. Even if a remote user wants to use a Windows application, the web service can retrieve customer data from the home office.

I will assume you are already familiar with the creation of a web service, if not this article maybe difficult to understand. I completed the functionality of my web service, what I call SEER services. The SEER services will forever be my one stop shop for customer information. Currently it performs five functions, including, searching by customer name or number, retrieve past invoice history, calculate customer spending by fiscal year, and retrieving open orders.

Creating and Calling a Multi-threaded Web Service
You don’t have to do anything special to create a multi-threaded web service. The .NET framework already handles this. For each of your WebMethods, .NET creates several more methods; giving your web service that asynchronous touch. Ok, let’s say I have a function called getInvoiceHistory, .NET has also created a method called BegingetInvoiceHistory and EndgetInvoiceHistory. Only calling this method is slightly different from calling the method normally. Let’s look at the differences.

I have previously declared a Dataset as dstDataSet, my web service as seerservices, and selectedCustomer is a string containing the customer ID who I am retrieving the data for. In my single threaded days, I would have simply retrieved customer data in this fashion.

dstDataSet = seerservices.getInvoiceHistory(selectedCustomer)

But in the asynchronous world that same method call would look something like this.

seerservices.BegingetInvoiceHistory(selectedCustomer, acCustomerRecords1, 0)

As you can see more parameters needs to be passed to our asynchronous method than the synchronous method. The first value is a string with the customer ID, same as before. But the next value is another object called AsyncCallback. I used the following declaration to create that object.

Private acCustomerRecords1 As AsyncCallback

        acCustomerRecords1 = New AsyncCallback(AddressOf Me.onCompletedCustomerRecords1)

This will allow a local function onCompletedCustomerRecords1 to handle the returning data. In order to complete the threaded call you will need to call EndgetInvoiceHistory, or Endxxxxxx where xxxxxx is your function name.

Private Sub onCompletedCustomerRecords1(ByVal asyncResult As IAsyncResult)
             'Declare the web service
            Dim seerservices As New SeerServices.seer
            Try
                'Returns the dataset to a class variable (why is explained later)
                _dstDataSet1 = seerservices.EndgetInvoiceHistory(asyncResult)
                'Bind the dataset to my datagrid
                Me.BeginInvoke(CallDataBindToDataGrid)
            Catch ex As Exception
                MsgBox(ex.Message, MsgBoxStyle.Critical, "Error!")
            End Try
        End Sub

Notice the function declares the web service and then calls the EndgetInvoiceHistory function. This will retrieve the return value from the function.

Summary
That’s it; to call an asynchronous web service you just follow a few steps. And before I tie up some loose ends, let’s go through these steps again.

1. Declare a AsyncCallback object

Private acCustomerRecords1 As AsyncCallback
acCustomerRecords1 = New AsyncCallback(AddressOf Me.onCompletedCustomerRecords1)

2. Call the thread friendly version of your web service function. Again you don’t have to do anything to your web service. This function is created automatically by .NET.

seerservices.BegingetInvoiceHistory(selectedCustomer, acCustomerRecords1, 0)

3. Create a function to handle the thread after completion.

Private Sub onCompletedCustomerRecords1(ByVal asyncResult As IAsyncResult)
        Dim seerservices As New SeerServices.seer
            Try
                _dstDataSet1 = seerservices.EndgetInvoiceHistory(asyncResult)
                Me.BeginInvoke(CallDataBindToDataGrid)
            Catch ex As Exception
                MsgBox(ex.Message, MsgBoxStyle.Critical, "Error!")
            End Try
      End Sub

Calling out of thread objects
Ok, now your probably wondering what Me.BeginInvoke means. This is a little off topic but I will through it briefly. DataBindToDataGrid is a method that will bind the class property _dstDataSet1 to a datagrid on my form. Now CallDataBindToDataGrid is a previously declared MethodInvoker object that will call the aforementioned function.

Dim CallDataBindToDataGrid As New MethodInvoker(AddressOf Me.DataBindToDataGrid)

The reason for this is, a datagrid is a single instance object and it’s methods cannot be accesses while in a thread. The BeginInvoke method will call the datagrid databinding properties and assign _dstDataSet1 as its data source. Try binding the dataset directly to the datagrid in this function, or even calling DataBindToDataGrid function directly and an exception will be thrown. The gist of the error is, “Controls created on one thread cannot be parented to controls created on another thread” or you can’t call methods of a single-threaded object outside your thread.

Public Sub DataBindToDataGrid()
        dgHistoryDetail.DataSource = _dstDataSet1
        dgHistoryDetail.DataMember = "invoiceheaders"
        _dstDataSet1 = Nothing
    End Sub

Conclusion
The main reason I chose this approach to data retrieval is it speeds up database access. Instead of each function retrieving and binding the data in order, each function is done simultaneously. And the fact that the UI is still responsive while the data is loading will make it easier on the user. You will be amazed by the fact you can still manuever around the user interface while your application is working in the background.

References
Griffiths, Ian. Give Your .NET-based Application a Fast and Responsive UI with Multiple Threads. MSDN. Feb 2003. Aug 9, 2004. http://msdn.microsoft.com/msdnmag/issues/03/02/Multithreading/

Meier, J.D., Srinath Vasireddy, Ashish Babbar, Alex Mackman. Improving Web Services Performance. Improving .NET Application Performance and Scalability. May 2004. Aug 9, 2004. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/scalenetchapt10.asp

Must have .NET Developer Tools

Posted in Programming, .NET, Software, Open Source on July 27th, 2004

MSDN Magazine had a good article on a number of .NET developer tools; all free, some open source. Check out the article here. I personally use half of this tools already.