Brian Mains

Catch me on linked in at: http://linkedin.com/in/brianmains, or follow me on twitter at: @brianmains.

February 2009 - Posts

SlickEdit Backup Diff

SlickEdit has a nice backup tool that captures backups of files on a regular basis.  Whenever you need to restore a backup of a file, simply go to the backup explorer tool window (on the same side as the solution explorer) and select one of the backups to compare your file against its.  This editor is very handy to have; you can select the entire file and bring over the past backup, or you can select individual lines to bring over, depending on the type of backup restore you need.

The diff is pretty easy to use, and it will even highlight the new additions (or spaces) so you know what's been added or what is completely different.

Resharper's Feedback

Attached to this blog post is an image of the product Resharper, a refactoring tool for the .NET 3.5 framework and Visual Studio 2008 (not including the backward compatibility).  The image labels three sections that illustrate some of the highlighting.  The first section I'll discuss is the "Field Highlighting" section.  Notice the green squigglies underneath the field.  These indicate that a refactoring can take place and is highly recommended.  This is a visual cue from resharper.  As I mouse over the tool, Resharper lets me know what the refactoring is, plus provides a light bulb - a way to quickly enable the refactoring.

Resharper also spotted some suggestions for my property; these suggestions are potential refactorings that can be done.  In this case, it's telling me that I could convert the property to an auto property, where the compiler generates the getter/setter for a property.  This is a suggestion, and is shown using the underline.  Note that every suggestion type can have its severity change, with each severity having a different highlighting mechanism.  More crucial refactorings have a gray background with black text.

Lastly are the class indicators; these indicators appear to the right of the class file scrollbar.  They indicate certain things about the class.  The green indicators state that an exception is being thrown in these places; this isn't an error condition, but just something to make you aware of.  A yellow condition indicates a potential refactoring, but one that's not overly critical to the process.  The last color, red, indicates an actual error in the file that results in a compile error when compiled.

Note that all of these settings are configurable in the Resharper options menu.

Third Party Controls Poses Complications with JQuery

The point of this article is not to point out how hard it is to use JQuery or anything like that; rather, JQuery is very easy and efficient to use.  However, as with any third-party JS library (I happen to be using JQuery at the moment), using this library with third-party .NET controls is difficult.  The reason is because what you may assume a control actually is made up of isn't really what it is.  For instance, suppose you want to tap into the RadComboBox from the Telerik framework; you'd assume that it's a variation of the <SELECT> element, but it's not.  Actually, it uses a varying set of tables and divs to makeup the structure.

So a JQuery statement to access something within one of these controls may actually look like:

$("controlid > table > tbody > tr > td > div")

and so on.  It could be pretty big.  In order to figure out what to tap into, it's helpful to have FireFox and FireBug installed, which easily allows you view the DOM and figure out what you need to tap into.

Book Review: Practical JavaScript, DOM Scripting, and Ajax Projects by apress

The goal of the book "Practical JavaScript, DOM Scripting, and AJAX projects" illustrates what it takes to create an application solely in JavaScript.  This book discusses projects in different genres: using mashups to pull external data, creating a calculator, creating and playing a game, creating widgets, setting up a custom validation scheme, setting up a drag and drop shopping cart, and more.

Each chapter sets up the application from scratch, so each chapter isn't building upon itself to create one large application.  For each project, the author provides the CSS details, the JavaScript architecture and HTML markup, and the third-party JavaScript library information.  Every project has a new library, such as the following: Dojo, Rico, Prototype, YUI, MooTools, script.aculo.us and a few others.  When discussing these libraries, the author gives a brief overview, something I found beneficial, but an understanding of these libraries is where I wanted more.  Of course, a book can only cover so many topics, and thus I found myself exploring these libraries on my own.

Most chapters in the book setup each project in a common fashion: explanation of the project, overview of the script library that will be used for the chapter, listing of the CSS styles used, followed by walking through the HTML markup and JavaScript code associated with the project.  Overall, the author conveyed the details of the project well, though not always covering contents in the order a reader may expect.  The author had a unique style to his writing, and each chapter in the book was easy to read.  The author is into pop culture and included statements and taglines from various pop culture sources, including reference markers explaining where the pop culture reference came from.

My favorite chapter was creating the AJAX mashups.  This was a topic that was somewhat foreign to me; I didn't quite understand how they worked, and the book illuminated it magnificently.  The chapter used Yahoo Maps and Google Base to setup a zip code/hotel lookup.  I also enjoyed the drag and drop shopping cart using YUI, and how simple it is to provide the drag and drop ability for dragging items into the shopping cart.

One disappointment I had was that each chapter didn't build upon itself to show you something new, with the exception of the JavaScript libraries.  Each chapter focused on what it needed to do to get the problem solved.  Furthermore, the books didn't get into any complicated design patterns to solve any of the problems, which is a hot topic these days.  This would have been helpful to illustrate to the readers.  A lot of the same techniques are used throughout each project, which I would have like to seen him build upon the techniques used and have the book increase in complexity of application design have to offer.

Overall, the book is good, especially for those new to JavaScript.  The techniques learned you will be able to apply to your own projects.

Posted: Sun, Feb 22 2009 20:42 by bmains | with 1 comment(s)
Filed under:
Accessing a PageView on the client

I didn't find any documentation on this, so I thought I'd throw something out there.  When using the Telerik RadMultiPage, each page view can be accessed on teh client like so:

var multiPage = $find("<%= mp.ClientID %>");
var views = multiPage.get_pageViews();

But I couldn't find anything on getting an individual view.  So I did some digging around and found that you use the getPageView method, which takes an index like so:

var view = multiPage.get_pageViews().getPageView(0);

This works well in the RadTabStrip TabSelected client event, which you can get the tab index like:

function rts_ts(sender, e) {
   var multiPage = $find("<%= mp.ClientID %>");
   var view = multiPage.get_pageViews().getPageView(e.get_tab().get_index());

}

The e.get_tab() is the selected tab, and each tab has an index.

VSS 6 and VSS 2005 Side-by-Side Compatibility

It was stated by someone that I know that VSS 6 and VSS 2005 aren't compatible on the same machine, and I'd like to refute that.  Actually, these two software products are compatible; I've been running both on my machine (not simultaneously) for a while with no repercussions.  But one problem I came across is when you attempt to uninstall one.  Because my machine needed space, I decided to remove VSS 6, as I really didn't need it.

The only problem was it removed my VS integration!  My first thought was to try to repair VSS 2005, but I got the error that it couldn't find dotnetfx.exe, even though I pointed it to the exact location that it needed.  The only choice I had was to uninstall VSS 2005, and reinstall it, bypassing the repair option.  This solved the problem.

FYI, when I tried to run the install, I got the error: A problem has been encountered while loading the setup components. Canceling setup.  The solution I found was on this thread:  http://social.msdn.microsoft.com/forums/en-US/Vsexpressinstall/thread/588c15f1-8a4d-48f6-87db-faeee1219bb2/

I was using ISOBuster, a free (and there is a pay version) utility to extract ISO data to your computer, so you can run software directly without the need of burning the ISO to a CD or DVD.  The option I used truncated names to 8 + 3 format, where I needed long names.  That's why I ended up getting that error; make sure if you use an ISO utility, it doesn't give you that problem.

For ISO buster, selecting the files in the right pane and using the Extract Objects option didn't truncate names.

Posted: Mon, Feb 9 2009 13:38 by bmains | with no comments
Filed under: