.NET Blog

Tony Cavaliere

 
My Favourite Albums
  And the Grappa wins.
E-mail me Send mail
Add to Technorati Favorites AddThis Feed Button

Subscribe to Cynot Why Not


Recent posts

Disclaimer

Hey unlike other bloggers I stand by what I say but just in case. The opinions expressed herein are my own except on Tuesday when the second card is not turned up otherwise it ain't worth squat.

© Copyright 2010

Why I like Windows Server 2008 R2

Windows Server 2008 R2 was recently released on October 22, 2009. I have already used Windows Server 2008 and enjoyed many of it’s new features but this latest release has got me excited and all for one new feature, Remote Desktop multi-monitor support.

Currently I am remoting  to a Windows Server 2008 computer, my local computer runs Windows 7. Remote Desktop Connection available on Windows 7 has support for multiple monitors however the computer you are remoting must also supports multiple monitors remotely. Both Windows 7 and Windows Server 2008 R2 have this build-in capability. All you need to do is enable it from your local machine and remote to the destination computer and sit back and enjoy. I’ve tried it (Windows 7 local and Windows Server 2008 R2 remote) and it work without any issues.

So all you remote users out there rejoice and celebrate your productivity has just increased.

 

image

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by cynotwhynot on Saturday, October 24, 2009 10:19 AM
Permalink | Comments (63) | Post RSSRSS comment feed

Where’s the MDF?

I’ve always wondered why the ASP.NET folks have always had (or at least since VS2005) the ability to add a detached SQL Express file, or commonly referred to as an MDF file, whereas, project types like console application and windows forms do not.

When you add a new item to an ASP.NET application you will see the following dialog.

image

Notice the SQL Server Database option. Selecting this will cause an MDF file to be added to the ASP.NET application. Very convenient. However, no such option exists for either the console or windows forms project types.

I have seen developers add MDF files by starting SQL Server Management Studio, creating a database, detaching it and then coping the file to the project. I have also seen developers create an ASP.NET project, add a MDF file and then copy the MDF to the desired project. Neither are optimal.

One great way to automate this, is to create an Item Template. To do this create an ASP.NET project and then add an MDF file by selecting Add New Item menu option and selecting SQL Server Database. This will add a detached SQLExpress database file to the project. The next step is to delete the LDF (log) file from the project.

Now we are ready to create the Item Template. Select the File->Export Template menu. This causes the Export Template Wizard to appear,a s shown below.

image  

Select the Item template radio button and click the Next > button. The Select Item To Export dialog appears from which you select the MDF file.

image

The next dialog to appear after selecting the Next > button is the Select Item References dialog. In this situation there is no need to include any references so just click the Next > button. The Select Template Options dialog appears from which you specific the name of the template. When done select Finish and that’s it you have created a item template that can be used just about everywhere.

Try it out, create a console application and then select the Add->New Item menu item. If all goes well you should see the Add New Item dialog and under the My Templates you should see the new Item Template. Selecting this Item Template will add a SQLExpress MDF file to the project.

image

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by cynotwhynot on Wednesday, October 07, 2009 4:36 PM
Permalink | Comments (68) | Post RSSRSS comment feed

Expression 3 Screen Capture – Dual Monitor

I’ve been playing around with Expression 3 Encoder and Screen Capture and I must say, pretty impressive. The screen capture is extremely easily to use and has build-in support for overlays. In fact, the PIP webcam feature is automatically overlayed onto the video. This makes it easy to include the presenter in a small window, the location of which can be configured.

One thing that surprised me was the recognition that I was running dual monitor and that Expression Screen Capture was able to capture both screens. Wow!

Below are two videos, hosted on Silverlight Streaming, I capture using Expression 3. The video on the left shows the capture of the dual monitors, while the second contains a capture of a high definition video. Unfortunately, Expression 3 Encoder does not support the Publish To Silverlight Streaming option. I had to manually upload the videos to the Silverlight Streaming Service. Hopefully that plug-in will be made available shortly.

To enter full screen mode double click. Likewise, to exit full screen double click again.

Expression 3 has taken video to the next level!

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: Expression | Silverlight
Posted by CynotWhyNot on Wednesday, September 02, 2009 10:27 PM
Permalink | Comments (8) | Post RSSRSS comment feed

Installing CodeRush XPress on Windows 7 RTM

Windows 7 RTM was recently released to MSDN subscribes and I decided to install it last week. I had already tried RC and was impressed but did not spend as much time using it as I would have liked. This time I decided, let’s go for it and install Windows 7 RTM with all my developer applications and tools. The installation of Windows 7 RTM went smoothly with no hick ups at all. The next step was to create a VHD from the Windows 7 install DVD, natively from Windows 7. That’s right for those of you that haven’t heard Windows 7 has native support for VHD (only Ultimate and Enterprise version have this). In fact, Windows 7 boot manager will boot a VHD and it will run natively and with the exception of the hard drive the hardware used by the booted VHD is physical. Scott Hansleman has posted on this subject and has instructions on how to setup and boot a VHD.

After creating a VHD and adding it to the boot manager, I proceeded to install all my developer applications. here is the list of applications I installed.

  1. Visual Studio 2008
  2. Visual Studio 2008 SP1
  3. NUnit
  4. RhinoMocks
  5. TortoiseSVN
  6. ASP.NET MVC
  7. Silverlight SDK
  8. testDriven.NET
  9. Reflector
  10. Firefox and Firebug
  11. Fiddler
  12. AnkhSVN

If you are not familiar with some of these tools and want a description then please visit my toolbox site.

Afterwards I took some of my applications namely, My Site (ASP.NET MVC), My Silverlight Gallery, and GTANETCC (asp.net), compiled and ran them and they all behaved as expected.

Needless to say, the experience was great!

Next came CodeRush Xpress a great refactoring tool available for free from Developer Express. I installed the tool and then noticed that the refactoring was not available when I ran Visual Studio 2008. The product was installed but did not load. Selecting the DevExpress menu item and then the Load option caused the Invalid index. (Exception form HRESULT:0x800200B (DISP_E_BDAINDEX)).

CodeRush Bad Index

It turns out that the DevExpressToolsOrcas.Addin file is not installed in the correct location. The fix was rather simple, copy C:\ProgramData\Microsoft\MSEnvShared\DevExpressToolsOrcas.Addin to C:\Users\(USER)\AppData\Roaming\Microsoft\MSEnvShared\Addins\DevExpressToolsOrcas.Addin

After that all the refactoring tools from CodeRush Xpress worked fine.

I have been using Windows 7 RTM for 5 days now and I have nothing bad to say about it and plenty good to say. This native support for VHD is wonderful. Windows 7 rocks!

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by CynotWhyNot on Monday, August 17, 2009 2:34 PM
Permalink | Comments (72) | Post RSSRSS comment feed

My first jQuery plug-in

I’ve been using jQuery for quite some time and eventually after enough time you will end up writing your own custom plug-in. Fortunately, the mechanics of writing a jQuery plug-in is rather simple. Perhaps that is why we see so many plug-ins for jQuery. The jQuery site alone has some 1500+ of them.

Recently, I decided to redo my site using ASP.NET MVC and decided to use rounded corners for the resume module. I found an excellent CSS implementation and so realized that surrounding existing tag with the necessary mark-up to implement rounded corners was cumbersome and problematic. Custom jQuery plug-in to the rescue.

The CSS rounded corner implementation can be found at the following site http://www.schillmania.com/projects/dialog/png/ Basically, the technique wraps the following mark-up around the desired content you want add rounded corners to.

<div class="rounded-corners">
  <div class="hd"><div class="c"></div></div>
  <div class="bd">
    <div class="c">
      <div class="s">
         <!-- Your content goes here -->
      </div>
    </div>
  </div>
  <div class="ft"><div class="c"></div></div>
</div>

Basically, this mark-up along with some CSS and images will render rounded corner container around your content. This works fine for the odd content that you want rounded corners for. But what if you have dozens of places where you want rounded corners? Do you really want to pollute the mark-up with all those div tags. In my case I decided that a jQuery plug-in would solve the problem. Rather than manually add all the above div tags why not write a jQuery plug-in that will wrap an element with the rounded corner div tags. The jQuery call would look like $(selector).roundedCorners(); This plug-in would take the DOM elements that are matched by the selector and dynamically add these div tags.

Creating a jQuery plug-in is as simple as creating a function;

$.fn.roundeCorners = function() {
  //your code goes here
}

One problem with this approach is it assumes that $ is an alias for jQuery. What if a call is made to $.noConflict(); which removes the $ alias. You could use the jQuery function directly jQuery programmers are so use to to using the $ alias. To get around this the following code is used

(function($) {
    $.fn.roundeCorners = function() {
        //your code goes here
    }
})(jQuery);

This syntax is difficult to get your head around but what it does is call an anonymous function with a parameter $ and passes jQuery to the function, that is, for the duration of the function $ represents the function jQuery.

That’s all there is to creating a jQuery plug-in. Now let’s write a jQuery plug-in that dynamically adds the rounded corner div tags.

    1 (function($) {

    2 

    3     $.fn.roundedCorners = function() {

    4 

    5         //wrap the element with div tags required to round the corners

    6        $(this)

    7       .wrap("<div class='rounded-corners'></div>")

    8       .wrap("<div class='rounded-corners-bd'></div>")

    9       .wrap("<div class='rounded-corners-c'></div>")

   10       .wrap("<div class='rounded-corners-s'></div>");

   11 

   12        //need to add header and footer div tags before and after the body div tag

   13        var selector = '.rounded-corners ' + this.selector;

   14        var bd = $(selector).parents('.rounded-corners-bd');

   15        $("<div class='rounded-corners-hd'><div class='rounded-corners-c'></div></div>").insertBefore(bd);

   16        $("<div class='rounded-corners-ft'><div class='rounded-corners-c'></div></div>").insertAfter(bd);

   17 

   18        return this;

   19     }

   20 

   21 })(jQuery);

The above code wraps all matched DOM elements with the rounded corner div tags.  The following shows how to make use of this plug-in

    5 <script type="text/javascript">

    6   $(function() {

    7     $('#foo").roundedCorners();

    8     $('.moo").roundedCorners();

    9   });

   10 </script>

   11 

   12 <div id="foo">Hello foo</div>

   13 

   14 <div class="moo">Hello moo 1</div>

   15 

   16 <div class="moo">Hello moo 2</div>

All three div tags will be wrapped with the rounded corner div tags and will be rendered with rounded corners.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Posted by CynotWhyNot on Wednesday, August 05, 2009 8:18 AM
Permalink | Comments (66) | Post RSSRSS comment feed