Digging Into The FireQuery Add-on for jQuery

Yesterday I posted my first short Screenr screencast

Today I decided to record another screencast, and I decided to dig into the FireQuery add-on for Firebug.

FireQuery adds extra functionality to the HTML tab and allows you to visually see embedded data elements and event handlers that were added via jQuery. Also, the familiar jQuerify Bookmarklet has been built into Firebug allowing you to inject jQuery into pages that didn’t have it installed previously. This enables you to play around with jQuery or extract information for a webpage that might not previously have jQuery installed.

 

Yet again, I hope this was beneficial to you. If you enjoyed the presentation I would appreciate either a comment to this blog &| a tweet about it to share with others.

"Digging into the FireQuery Add-on for jQuery" by @elijahmanor #tech #nettuts #jquery #screencast http://j.mp/1T9RKE

Also, if you have any suggestions that you have to help become a better presenter I would appreciate that as well. If you have a minute, please add a comment with your thoughts.

Read More »

Firefinder for Firebug for Firefox for Fiddling with jQuery

Tonight I created my first Screenr screencast showcasing the Firefinder Add-on for the popular Firebug Add-on for the even more popular Firefox browser :) Whew, that was a mouth full!

Firefinder is a helpful tool when creating a selector for jQuery, which is usually where you start for most jQuery work. In the following screencast I show how to use Firefinder in conjunction with the Firebug console window in order to add some animation effects to my blog on the mouse over and mouse out events.

 

I hope you found this screencast helpful. There are many Firebug Add-ons that are useful for web development and I hope to extend this series to include several of the others.

If you enjoyed the above screencast I would appreciate it if you could retweet it by clicking the following and posted it to your Twitter account… thanks :)

"Firefinder for Firebug for Firefox for Fiddling with jQuery" by @elijahmanor #tech #nettuts #jquery #screencast http://j.mp/ZKtTT

Read More »

Maintain Scroll Position On Page Refresh Using ASP.NET or jQuery

There is a feature of ASP.NET that isn't widely known called MaintainScrollPositionOnPostback, which is a common way of maintaining the scroll position after a Postback. Behind the scenes ASP.NET passes a hidden variable with the page location and resets it with JavaScript after the page re-renders.

<%@ Page 
Title="Page Title Here"
MaintainScrollPositionOnPostback="true"
Language="C#"
MasterPageFile="~/YourMasterPage.master"
AutoEventWireup="true"
CodeBehind="YourCodeBehind.aspx.cs"
Inherits="YourCodeBehind" %>

However, this method will not work if the Postback does a Redirect on the server.

If the Postback does a Redirect instead of re-rendering the same page, then you could use the ScrollSaver jQuery script. All you have to do is include the script on the page and before a Postback occurs it will save the location of each element in a cookie and then restore it when the page re-renders. This will work for both a Postback and a Redirect.

All you have to do is include the jQuery plugin into your page. You don’t have to actually call any jQuery methods… it just does everything for you!

I would recommend only adding this script to the page you are interested in maintaining position in order to minimize any risk of affecting other pages in your project. The overhead of the minimized plugin is only 1.63K and when you consider it will get cached on the client that is pretty good :)

Read More »

ASP.NET MVC 1.0 TDD Book Review

AspNetMvcTdd I recently finished reading Emad Ibrahim’s ASP.NET MVC 1.0 Test Driven Development book and I thought I would do a detailed review and share my thoughts and findings.
Before I get into the details of the book, it is important to know that the audience of this book is not for novice programmers or experience non ASP.NET developers. To really get value from this book, you should have some decent exposure to ASP.NET under your belt.
With that said, this book is a very good overview of both ASP.NET MVC and Test Driven Development (TDD). It takes the reader through the process of developing a whole application using the Test First methodology. I found this interesting in that some decisions Emad made initially were later refactored in the book as the application evolved and changed, which is a great way to see the value of TDD and its approach.
This book covers quite a few advanced programming concepts that may be new to you such as various Design Patterns (Strategy, Null Objects, Repository, etc…), Design Principles (Open-Closed Principle, YAGNI, DRY, Inversion of Control, Single Responsibility, Convention Over Configuration, etc…). Emad does a good job about explaining these concepts as he approaches them in the application.
About the same time that I was reading this book, I was in the process of evaluating various tools and frameworks to use for a new ASP.NET MVC v2 project I am working on. I found it interesting that Emad ended up choosing most of the same tools that I had at the time such as: MbUnit, Ninject, Moq, and jQuery. If you are familiar with tools other than the ones he chose at the time of writing this book, you should be able to easily substitute your favorite tool instead. Most of the competitors for these tools have basically the same features.
Since this is a new book, I did run across numerous typos, references to code that wasn’t displayed, refactored code that wasn’t indicated in the text, and several other minor issues, but all in all I knew what Emad was getting at and it wasn’t hard to follow his train of thought. I submitted these inconsistencies to the Errata to hopefully clean up these small issues for future printings of this book. I posted my findings and you can review them online.
I highly recommend downloading the source code from this book (which you can do for free). It is one of the few projects that I’ve seen that has a plethora of Unit Tests to look at and get an idea of how to test your ASP.NET MVC project. I’ve seen numerous other ASP.NET MVC projects that only have a minimal number of Unit Tests and don’t really give you a good idea of how you could get good Code Coverage.
If you are interested in getting a jumpstart into both ASP.NET MVC and Test Driven Development, then I think this is a great book for you to get. However, if you aren’t so sure about TDD and you just want to get up to speed on ASP.NET MVC, then I might recommend you get one of the other beginning ASP.NET MVC books such as:
<ul><li>ASP.NET MVC 1.0 Quickly by Maarten Balliauw </li><li>ASP.NET MVC 1.0 Website Programming by Nick Berardi, Al Katawazi, Marco Bellinaso </li><li>ASP.NET MVC Framework Unleashed by Stephen Walther </li><li>ASP.NET MVC In Action by Jeffrey Palermo, Benn Scheirman, Jimmy Bogard </li><li>Beginning ASP.NET MVC 1.0 by Simone Chiaretta, Keyvan Nayyeri </li><li>Pro ASP.NET MVC Framework by Steven Sanderson </li><li>Professional ASP.NET MVC by Rob Conery, Scott Hanselman, Phil Haack, Scott Guthrie </li><li>Programming ASP.NET MVC by Chris Sutton, Tim Barcz, Derik Whittaker </li></ul><ul>Note: A danger of listing books is that I may have missed one ;) If so, please leave a comment listing any of another ASP.NET MVC book published as of the date of this blog post and I will be happy to add it to the list.</ul>I haven’t read any of the above books yet, but I do hope to in the near future and as I do I plan to perform book reviews for those as well.
Thank you Emad for all of your hard work on your book. I enjoyed reading it over my extended Labor Day weekend :)
Updated: You can view the Errata document I put together listing all the inconsistencies, typos, minor issues, etc… online.

Read More »

Recursively Unblock Assemblies with Streams

MvcContribEver since my recent blog post Unblocking Assembly Due to AspNetHostingPermission Security Exception I have been pretty careful about unblocking Assemblies after downloading them from the internet.

However, today I decided to download the MVCContrib.Extras.release.zip which has over 100 assemblies, pdbs, and xml files of which ALL are blocked by Windows 7!

Since there is no way to multi-select and unblock the files at once, I shuttered at the thought of right-clicking each file and unblocking them one by one. There has to be a better way… and to my fortune there is :)

The answer is yet another useful too from Sysinternals called Streams.

Streams is a command line tool that lets you unblock one or more files at a time and you can even recursively perform unblocks! Yippee

Immediately I started to look for a feature to right-click folder option to open a command prompt at that location (like I used to with the Open Command Window Here Microsoft Power Tool for Windows XP).

ShiftRightClick

I didn’t see an Open Command Window Here context menu for Windows 7 when I initially right-clicked on a folder, so I decided to do some quick research to see what is the best way to do this in Windows 7.

I was pleased to find that the feature is native in Windows 7, but I had just missed it.

It turns out that if you Shift-Right-Click on a folder then an "Open Command Window Here” context menu will appear! Apparently, this was a feature of Windows Vista too, but as I mentioned in a previous post… I upgraded immediately from Windows XP to Windows 7.

So, (after downloading Streams and registering it in my System Path Variable) I quickly typed in the following command to save the day.

streams –s *.*

Using Streams

Usage: streams [-s] [-d] </strong></p>

-s
Recurse subdirectories.

-d
Delete streams.
Streams takes wildcards e.g. 'streams *.txt'.

</blockquote>

 

Anyway, I didn’t know about either the Streams command line too or the Shift-Right-Click “Open command window here” feature of Windows 7 and thought I would share them with you. Hopefully, they help someone ;) If not, it will help me remember them in the future. 

Read More »