Suddenelfilio’s Weblog

Icon

Passionate about .net

TFSProxy Visual Studio .net 2005 Add-in

I’m currently developing an add-in for visual studio that allows you to switch fast between different Team Foundation Proxy Servers or disable the proxy servers without the need of going in the options of visual studio .net.

In the first release the user will be able to switch and disable proxy servers. It will also be possible to add new configurations, edit and delete existing configurations.

As a plus I also developed a web service through which the user can get predefined configurations. The user will not be able to change or remove these settings directly. This might be handy in an enterprise scenario where different proxy servers are used and they are controlled by System Operations.

For more information go to my Codeplex Project

Filed under: .net 2.0, TFSProxy, Visual Studio .Net 2005

New SDK’s available for download for sharepoint developers

I saw these downloads passing by when I was checking my mails.

  Windows
SharePoint Services 3.0 SDK

This SDK contains conceptual overviews, programming tasks,
samples, and references to guide you in developing solutions based on
Microsoft Windows SharePoint Services 3.0.

  Microsoft
Office SharePoint Server 2007 SDK

This SDK contains conceptual overviews, programming tasks,
code samples, references, and an Enterprise Content Management starter kit to
guide you in developing solutions based on Microsoft Office SharePoint Server
2007.

Filed under: .net 2.0, Sharepoint

My first virtualization attempt

Today I needed to virtual a physical server using the beta software VmWare Converter. The machine was a test server for some software we use internally. It has a Windows 2000 Advanced Server OS. After I installed I got an error that the UFAD service was not started. I went to the services snap-in only to discover no such service existed.

After some googling I found that it’s the executable vmware-ufad.exe that needs to be started. However you can’t just start this executable because it needs some parameters. When I took a look in the folder I found a batch file named startup-ufad.bat. I executed this one, but still no luck…

Okay tried to google some more, but couldn’t find any helpful information. Accidently I found another file in the vmware folder called bootrunsetup.bat, executed this one and finally this seemed to work. So the virtualization could begin.

The next steps where pretty straightforward.

I choose which physical machine to virtualize, the sizes of the HDD and the location of the newly created virtual version and off we were.

I you want more information about the Vmware Converter go to the website here

Filed under: VMWare

WPF: draggable windowless windows

I’m currently trying out the Microsoft Expression Blend designer (formerly known as Microsoft Expression Interactive Designer). I must say it’s already very nice, the only I still can’t seem to get working is the integration with visual studio .net 2005 to edit the code behind files… Anyway that’s not what I wanted to talk about.

We probably know that you can do marvelous things with WPF it’s like a Flash designer but for .Net developers : Not sure Adobe is going to like that. So why should you constrain yourself to the old looking windows? Why not try something more different.

The image below shows you the kind of application I mean.

As you can see the image has something extra stick out in the left upper corner. To achieve this you just set the WindowStyle to None, Background to “transparent” and AllowTransparancy to “True”.

This will give you a borderless and transparent window. In this example I’ve set the background of the grid using an ImageBrush that will allow me to use a customized background image



….

Next is the actual image that represents the out-of-border network drive. This is nothing more than an image placed in that particular position. Okay the application is ready to run.When you run the application you’ll see that you can’t drag the application to another location on the screen…

To solve this problem you need to add a Thumb. A Thumb is a WPF Control that can be dragged around. You can declare a thumb that has the same size as your window. When you do this the application will kind of funny because all you see is a light gray area. To prevent this overlay set the Opacity property of the Thumb to 0.

Next thing to do is to implement the DragDelta event of the thumb. It’s this code that will actually move the entire window. The code for this is pretty simple:

Public Sub onDragDelta(ByVal sender As Object, ByVal e As Primitives.DragDeltaEventArgs)
Canvas.SetLeft(Me, Canvas.GetLeft(Me) + e.HorizontalChange)
Canvas.SetTop(Me, Canvas.GetTop(Me) + e.VerticalChange)
End Sub

That’s it… you can now drag the window around.

Filed under: .net 3.0, WPF

VMware hard disk partition resizing

I’m currently doing some tests with TFS (yes team foundation server). So I installed a VM using vmware. I use this regularly for testing purposes, that’s why I have a small VM library containing various images with pre-installed operating systems. Since I’m installing TFS I at least need windows 2003 SP1 so I took my base image which was only 5 GB.

I started installing everything that I needed like IIS, SQL Server 2005, TFS itself and then I wanted to install the TFS Service Pack, but I ran into the problem of having not enough space on the disk.

Normally I would just reinstall the whole thing, but today I didn’t want to do that. So I started looking for alternatives. The first good help I found was vmware-vdiskmanager.exe. This is a command line tool delivered with Vmware Workstation. It allows you perform various tasks on the virtual hard disks.

Using the following command I was able to grow the disk with an extra 5 GB:

vmware-vdiskmanager.exe -x 10GB “c:\Image.vmd”

Doing this I hoped my problem would be solved. So I rebooted the VM only to note that the disk actually grew by 5GB but the partition did not. So I was still left with the same problem only now I had other options.

I searched for my PartitionMagic software, but for some reason (not enough space perhaps :-p) it didn’t install in the VM OS. My next step was to install partitionmagic on my own PC and mount the VM hard disk with the VMware Disk Mounting program. Again no luck, My partition magic didn’t recognize the mounted disk…

Already a bit annoyed by this stupid problem I finally found that VMware currently have the successor of P2V (Physical 2 Virtual) in beta. The new version will be free and is called VMware Converter. The real purpose of this tool is to convert physical machines to virtual machines. Although it also provides to convert existing vmware images. An interesting feature of this is that you can expand or shrink the partition sizes of the virtual hard disks. This was the solution!

Okay it took me a lot of time to figure this out but in the end I’ve learned something new ;-)

Filed under: VMWare

Exception serialization & WCF

I was helping a colleague of mine this week with some exception handling in WCF. The problem we were facing was that when we send a faultexception we lost important information about the original exception like the innerexceptions. Although it may not be best practice to send all of the exception information to the client we still wanted to find a way to get this done.

We tried various possibilities and ended up with the binary serialization of the original exception. To send it to the client we converted the serialized exception to a base64 string which is ideal for this sort of scenario’s. Then on the client side we just deserialize the base64 string back into an exception. We still use the WCF faultexception but we use the reason property to store the base64 string for transport.

We also tried the XML serialization but this gave to much trouble on the data property of the exception class because it was marked not-serializable due to the IDictionary interface it implements.

Another thing we looked at was using reflection to rebuilt the exception, but this was too complex and can cause a performance overhead.

Below you can see a sample of the ExceptionFormatter class that we created. Actually it’s nothing more than regular binary serialization with the constraint that the serialized object must implement the ISerializable interface. Oh yes mind the line breaks !

Imports System.Runtime.Serialization.Formatters.Binary

Public Class ExceptionFormatter

Public Sub New()
End Sub

Public Function Serialize(ByVal objectToSerialize As     Runtime.Serialization.ISerializable) As String
Dim formatter As New BinaryFormatter
Dim mem As New IO.MemoryStream
formatter.Serialize(mem, objectToSerialize)
Return Convert.ToBase64String(mem.ToArray)
End Function

Public Function Deserialize(ByVal base64String As String)     As Runtime.Serialization.ISerializable
Dim formatter As New BinaryFormatter
Return formatter.Deserialize(New IO.MemoryStream(        Convert.FromBase64String(base64String)))
End Function
End Class

Filed under: .net 3.0, WCF

Invocation & Anonymous Methods

Every programmer that has used multi-threaded programming knows the problem that you’ll run into when you try to access properties or methods of a control from within a thread other than the control was created on. To solve this problem you have to check wether an invoke is required and if so call the invoke method. Calling this invoke method is ok when you want to call a method or function on the control, but when you have to set some property you’ll need delegates. So you need to declare a delegate signature and provide an implementation for the delegate. At this point you can call the invoke method on the control passing the delegate and possible arguments.

In C# 2.0 you can now facilitate this further by using anonymous methods. These will allow you to pass a code block as a delegate parameter. It also allows for lesser code because you don’t need to write any named methods anymore.

Below you can see the code to set a Text propery on a TextBox control. The anonymous method is marked in bold.

delegate void setresponse(string envelope);

private void button1_Click(object sender, EventArgs e)
{
if (txtResponse.InvokeRequired)
{
setresponse settext =
delegate(string envelope) { txtResponse.Text =
envelope; };
txtResponse.Invoke(settext, new object[] { “Hello !” });
}
else
{
txtResponse.Text = “Hello !”
}
}

As you can see there are 3 steps to take into account:

  1. declare a delegate signature (delegate void setresponse(string envelope);)
  2. check to see if an invoke is required (txtResponse.InvokeRequired)
  3. create an anonymous method and call the delegate.

Filed under: .net 2.0

IE developer toolbar beta 3.0

Most of you probably already know the developer toolbar add-in for firefox. But this alsoe exists for Internet Explorer and actually is very handy when you do a lot of web design or programming. My first impression was that there were many features that you can also find in the firefox version. Don’t get me wrong it’s not the same developers team that created this, this really comes from microsoft.

If you already have beta 2 installed remove it first because there seemed to be some issue’s in this install scenario.

Download here

Source: IEBlog

Filed under: IE

Microsoft Visual Studio Code Name “Orcas” – January 2007 CTP

Okay Microsoft has released it’s Jan ‘07 CTP for the VS.Net “Orcas”. Below you can see a copy/paste of the download overview ;-) (just to be lazy but score yet another post)

Overview

Visual Studio code name
“Orcas” delivers on Microsoft’s vision of smart client applications by enabling
developers to rapidly create connected applications that deliver the highest
quality rich user experiences. This new version enables any size organization to
rapidly create more secure, manageable, and more reliable applications that take
advantage of Windows Vista and the 2007 Office System. By building these new
types of applications, organizations will find it easier than ever before to
capture and analyze information so that they can make effective business
decisions.

This download is the January 2007 Community Technology
Preview of Microsoft Visual Studio Code-Named “Orcas”. This CTP is available in
English only.

Note: This CTP is available as a Virtual PC image
or as a self-extracting
install
. If you wish to use the Virtual PC image you will need Virtual PC or
Virtual Server to run this image. If you wish to use the self extracting
install, we advise that you do not install this on a production machine.
Depending on your hardware the download files make take between 30-60 minutes to
decompress.

This CTP targets early adopters of the Microsoft
technology, platform, and tools offerings. It enables developers to experience
the upcoming toolset and underlying platform improvements. We designed this
release to enable developers try out new technology and product changes, but not
to build production systems. This limitation is fully covered in the EULA that
accompanies this CTP.

The highlights of this CTP include:

  • Extended, more powerful data APIs with the ADO.NET Entity Framework and LINQ
    to ADO.NET

    • With the ADO.NET Entity Framework developers will be able to model the view
      of the data that is appropriate for each one of the applications they are
      building, independently of the structure of the data in the underlying database.
      The use of the Entity Data Model (EDM) enables developers to design models that
      follow the concepts built into the application, instead of having to map them to
      constructs available in relational stores. Once the model is in place, the
      powerful ADO.NET Entity Framework API is used to access and manipulate the data
      as .NET classes or as rows and columns, whatever is appropriate for each
      application.
    • ADO.NET is fully integrated with LINQ and offers many options for using LINQ
      in various scenarios: LINQ to SQL provides direct access to database tables from
      the programming environment, LINQ to Entities enables developers to use LINQ
      over EDM models, and LINQ to DataSet allows the full expressivity of LINQ to be
      used over DataSets.
  • C# 3.0 Language Support: This CTP implements all of the C#3.0 language
    features from the May LINQ CTP including:

    • Query Expressions
    • Object and Collection Initializers
    • Extension Methods
    • Local Variable Type Inference and Anonymous Types
    • Lambdas bound to Delegates and Expression trees
  • VB 9.0 Language Support: This CTP implements all of the VB 9.0 language
    features from the May LINQ CTP including:

    • Query Expressions
    • Object Initializers
    • Extension Methods
    • Local Variable Type Inference
    • Anonymous Types
  • LINQ to Objects API

    • The LINQ to Objects API supports queries over any .NET collection, such as
      arrays and Generic Lists. This API is defined in the System.Linq namespaces
      inside System.Core.dll. Click here for more details about
      LINQ.
  • ClickOnce improvements

    • This CTP delivers ClickOnce improvements for the deployment of Windows
      Presentation Foundation applications, alternative browser support and ISV
      rebranding.
  • Managed classes for Elliptic Curve Diffie Hellman and Elliptic Curve Digital
    Signature Algorithm cryptographic functionality

    • With the addition of these classes, cryptographic developers now have
      managed classes for Elliptic Curve Diffie Hellman secret agreement and Elliptic
      Curve Digital Signature Algorithm signing. These classes are built on the new
      CNG cryptographic libraries in Windows Vista, but still follow the familiar
      patterns of the cryptographic classes in .NET Framework 2.0.
  • Runtime and design-time support for Office 2007 (including Outlook 2007)

    • Customers can build managed code add-ins with a consistent development
      experience, regardless of which version of Office they target, which Office
      application(s) they target, and which programming language they choose. Managed
      code add-ins enable developers to use strongly-typed class members, with the
      help of modern development tools, including intellisense and auto-complete.
      Additionally add-ins can potentially run in multiple versions of Office, enabled
      by abstracting version-specific code and supported by a version-resilient
      infrastructure.
  • Support for advanced lifetime management of add-ins and their AppDomains

    • We’ve added the helper classes that manage the lifetime of add-ins, the
      objects passed between the host and add-ins, and even of the AppDomains the
      add-ins live in. By using the ContractBase and LifetimeToken handle, pipeline
      developer can let the hosts and add-ins act as if everything, including the
      AppDomain the add-in was activated in, was controlled by the garbage collector
      even though .Net Remoting would normally make that impossible.
  • Client service support for Login/Logout, Role management and Profiles

    • ASP.NET 2.0 shipped with new application services for authentication,
      authorization and personalization. Most of these services are not tied to
      ASP.NET and can work in non-web applications. This CTP enables the use of these
      services in smart client applications for Logon/Logoff, Role management and
      profiles.
  • A trace listener that logs event to ETW, event tracing for Windows in Vista

    • Event tracing for windows is greatly improved in Vista and the most
      performant loggings facility available in Windows. The
      System.Diagnostics.EventProviderTraceListener allows managed tracing to provide
      events to the Vista’s ETW infrastructure. This is a highly performant,
      thread-safe listener.
  • Jscript Intellisense support

    • Jscript code formatting and Intellisense support provide developers with a
      richer editing experience. These improvements enable the IDE to provide
      statement completion, color syntax highlighting and in-place documentation to
      Jscript and associated script models such as ASP.NET AJAX.
  • A new numeric type that provides support for very large numbers (Beyond the
    range of In64)

    • All existing numeric types in the Framework have a limited range. This is
      the first type that supports arbitrary range and will extend to accommodate any
      large number as needed. This type lives in the new System.Numeric namespace
      where all new numeric and arithmetic features are going to reside. It supports
      all the basic arithmetic operations including things like Pow, DivRem and
      GreatestCommonDivisor. It implements the following interfaces: IFormattable,
      IComparable, IComparable<BigInteger> and IEquatable<BigInteger>. It
      is serliazable and immutable. It has implicit casts from all basic integral
      types and explicit casts to/from all numeric type. To learn more about this type
      – please visit the BCL team blog.
  • LINQ over XML (XLinq)

    • Enable further LINQ over XML feature support (in addition to the
      functionality available in the Oct 2006 CTP) such as the ability to apply XLST
      to transform into and out of XLinq trees, support for System.XML reader/writer
      interfaces for improved XML sharing with DOM applications and System.XML schema
      validation for XLinq nodes.
  • SQL Server Compact Edition (SSCE)

    • SQL Server Compact Edition (SSCE) provides a local relational data store for
      occasionally connected client applications from desktops to devices. SSCE is
      light weight, embeddable and is easy to deploy with your client applications
      without requiring complex administration work from users. Timestamp (row version
      id) data type, improved table designer, Query processor enhancements and support
      for local transaction scope are some of the new features you find in this
      version of SSCE.

Existing CTPs: As Visual
Studio code name “Orcas” CTPs are released on a predefined cadence, existing
CTPs (such as the LINQ May 2006 CTP) may not yet have been integrated into a
given “Orcas” CTP release (This should not be taken as a change in commitment to
any existing technology that has been made available as a CTP but instead is
just a real world example of how large applications, with many technology areas,
are built. We will be integrating this existing functionality into future CTP
builds.

Developers using a VPC image can run the CTP on a machine
without impacting any existing software installations. The CTP can be removed by
deleting the folder and using the Virtual PC application to remove the
configuration information.

This image ships with networking set to
“local”. This setting enables the virtual machine to think it is connected to a
network without actually connecting and exposing the machine to the Internet. We
recommend that customers do not modify the networking settings. Customers who
wish to turn networking “on” to connect the image to a physical network are
advised that they will need to ensure the security of the virtual machine as
well as apply any security updates that may have become available since the
release of this image.

Download here

Filed under: General

MS ASP.NET Ajax Cheat Sheets

On Aspnetresources.com you can now download cheat sheets for ASP.NET Ajax on the topics of MS Ajax Array Extensions, MS Ajax Date and Boolean Extensions, MS Ajax Number and Error Extensions and the MS Ajax String and Object Extensions.

Download sheets

 

Filed under: General