Posts Tagged jQuery

My favorite Visual Studio 2010 Extensions

I’ve recently been spending a fair amount of time working with js and css files inside Visual Studio 2010, and while I generally like Visual Studio as an IDE, it does lack a few things in this area. As a result, I spent some time looking through the available extensions on the MSDN Visual Studio Gallery site. Here’s my list of favorites so far and a little bit about them.

  1. devColor – This extension gives you some cool color managing features in css files. Have you ever found yourself looking at something like #E5234A in a css file and wondered exactly what color was being represented? Well, this tool gives that information to you at a glance, right in the css file by including a color-specific underline directly under the color value. This tool also provides a nice visual color-picker, a color anagram feature, and lists all colors used in the css file.

  2. Jscript Editor Extensions – This is actually a pack of extensions that makes working with JavaScript much nicer. It adds brace-matching, code outlining/folding, current word-highlighting, and extra support for para elements for JavaScript intellisense. They also provide a vsdocs files for jQuery with para info, which is better than the vsdocs file MS puts out on their CDN.

  3. JavaScript Parser – This extension provides a number of code-navigation features for JavaScript, but the one I find most helpful is the tree view of functions for your given js file. It provides similar functionality to the Class View window in Visual Studio, but for JavaScript files. The tree can be sorted in alphabetical order, or in source-file-location order, where each node appears in the same order as in the js file.

  4. VSCommands 2010 – This is another grab-bag of enhancements (a lot actually), but there is one feature I really like in this pack and it is the sole reason I have it on my list. In fact, if I could find an extension that provided just this feature, I’d probably do away with VSCommands. It is the ability to use Visual Studio’s file group/ungroup feature directly in the solution explorer. This allows you to link related files together into a tree of items, exactly how the code behind is “nested” under the aspx file for example. You can do this manually without this tool, by simply editing the project file, but this tool makes it very convenient to do it right in the solution explorer.

    As I work on Ajax-rich sites, I’m often finding each web page has a need for it’s own js file. Rather than put all these into a separate scripts folder, I prefer to keep them in the same location as the web page for which they are related, but this can result in a lot of nodes in the solution explorer. Where I have found this a very useful feature is in organizing those page-level js files by grouping them under their related web page file. For example, the MyPage.js file can now be grouped under MyPage.aspx, keeping all related code together. Even better, I can also group minimized versions under the non-minimized versions.

  5. Spell Checker – Nothing fancy, just does exactly what you would think. For me it’s been a great tool, though, because I’m quite bad about mistyping and/or misspelling words. Rather than having to copy-paste sections of comments, code, or text into another tool to do my spell checking – and have to weed through code in the process – this allows the spelling to be checked right in Visual Studio. It provides automatic spell checking of your documents, taking into account code formats, and provides red-squiggles under any misspelled words. Simply click-to-correct, add word to custom dictionary, or ignore the word. My only complaint is that there isn’t a “correct all” feature, but over-all I find it very helpful.

So there is my list of favorite Visual Studio Extensions so far. Want to share your experiences and/or favorites? Drop me a quick comment.

, , ,

2 Comments

Web Services for both AJAX Based and Silverlight Based Clients – Part I

Back in the nineties, I did some development on the old Palm Pilot devices and later tinkered with some Windows CE development as well as .Net development on Windows Mobile 5.x devices, but the experience always left me feeling a little underwhelmed. However the recent popularity of touch screen based mobile devices such as the iPhone, iPad, various Android based devices, and now the new Windows Phone 7 launch has inspired me to investigate mobile software development again.

In that pursuit, I decided to attend the local Microsoft Presents — Windows Phone 7 Unleashed event put on by the South Colorado .NET User Group in Colorado Springs. The event turned out to be a good time and provided some good hands on labs to experience what development on a Windows Phone 7 device entails. Let me just say that nearly two years ago I had heard that bringing Silverlight development to the mobile market was in the works at Microsoft and the potential prospects that could provide was a factor in my decision to invest time in learning Silverlight on the desktop. Microsoft has done a good job of ensuring those skills transfer to the mobile development experience on Windows Phone 7. I was amazed at how easily a colleague and I were able to put together a Silverlight and WCF Service enabled Windows Phone 7 application during our hands-on labs.

Given my positive experience with Windows Phone 7 mobile application development, I began wondering how I might tailor the design and architecture of the web applications I’m building today to be ready for mobile integration in the near future. The web applications I build today are generally done as ASP.Net and/or Silverlight clients and frequently make use of AJAX and/or Web Services to access server-side systems and data. Additionally, I’ve been making a strong push to leverage jQuery in my solutions so being able to work with jQuery’s AJAX services would be a huge plus.

Service Categories

For the purpose of this discussion, let me start by defining two general categories of web services, each targeted at solving different problems. The first are what I’d call private application services, where the client-side and server-side components of the system are generally controlled by the same developing party. Their interfaces and features are often purpose-specific and aren’t necessarily intended for general public consumption. These types of services are well suited to JSON and AJAX implementations.

The second type of service category could be described as public services, where the service itself is the application and its purpose is to expose data and features to any number of clients both known and unknown. Often these are implemented as RESTful services because of their discoverable nature and cross-platform compatibility. It’s the first category of services that I plan to discuss today.

Private application services generally fall into two groups that differ primarily in intended consumption scope – local or application wide. For those who follow the MVC or MVVM design patterns, local scope web services can be thought of as view-specific callbacks with very limited scope such as a specific page or component on a page. In standard ASP.Net web applications they are often implemented as a WebMethod on an ASPX page or using traditional web services (.ASMX files). Application wide services, where the reuse of the service is unlikely to extend beyond multiple pages in an application or maybe a set of related applications, are often implemented as standard web services using ASMX files or using WCF.

A number of projects I’m currently working on have a need for both local and application wide services which can be called using jQuery’s AJAX features. I also have a desire to share the application wide services with Silverlight clients and want to leverage the binary XML serialization that was made available starting with Silverlight 3 when accessing WCF services. This requirement falls right in line with Windows Phone 7 requirements and would allow me to work with these same services when doing mobile development on that platform.

So to cut short what is turning out to be a fairly long blog post, I believe I’ve come up with a project configuration that meets all my requirements.

  1. I am able to easily make JSON formatted AJAX calls, using jQuery, to page-level Web Methods, traditional ASMX Web Service methods, and WCF service methods using the same client-side syntax. This will allow me to organize my services into functional groups and scope their reuse as appropriate (page, in-application, or cross-application).
  2. I’ve also figured out a way to configure WCF services so that they are simultaneously accessible as JSON based services for AJAX clients as well as binary XML based services for Silverlight and Windows Phone 7 clients. This simply requires specific web.config file settings.

Stay tuned for a follow-up post on this subject, where I will walk you through samples of this configuration using Visual Studio 2010, jQuery and the new templating plug-in, WCF, and Silverlight 4.

, , , , , ,

Leave a comment

%d bloggers like this: