Monthly Archives: May 2008

Compare and Delete Duplicate Images with DupliFinder [Digital Photos]Lifehacker

Windows only: DupliFinder, a free Windows utility, compares digital photos by their name, size, and actual image information to find duplicates you can delete without worrying about. Brought to you by the coder of Vista Battery Saver, DupliFinder has a slightly rough interface at this point—you have to drag and drop in a folder to search if it's not "My Pictures," for instance—but its comparison engine works just fine, giving percentage ratings and quick delete buttons for duplicates. Looks like a great tool for finally tackling that picture clean-up project you keep putting off. DupliFinder is a free download for Windows systems only.




Soothe Your Sunburn with Vinegar and Other Home Remedies [Clever Uses]Lifehacker

sunburn.pngIf a careless weekend in the sun has you red-faced and uncomfortably squirming in your chair, weblog Wise Bread rounds up a handful of cheap home remedies for your poor, sunburned skin. From vinegar to a crushed aspirin-and-water concoction, you can throw together most of the remedies using items you've already got in your pantry. Of course, a better solution is a good defense against the sun, but if you spent your weekend under a 97-degree springtime sun like I did, these tips—which don't include our previous oatmeal sunburn soother—could be just what your suffering skin needs. Photo by A. M. Kuchling.




Folder View Gets You Back to That Last Folder Quickly [Featured Windows Download]Lifehacker

folderview_cropped.jpgWindows only: If you’re anything like me, you’ve probably got an itchy trigger finger when your cursor is near the window-closing “X” button (or the Alt+F4 combination if you’re more the keyboard type), and spend a good chunk of change heading back to deep-nested folders later on. Free Explorer add-on Folder View adds a toolbar to your Windows Explorer windows that includes a really helpful “History” function, which lets you quickly head back to those folders buried deep in your system, stashed on a network, or are just a pain to type into the address bar again. You can also add commonly-visited locations to Folder View’s bookmark-like toolbar, but the History function alone is what really sells this little app. Folder View is a free download for Windows systems only.




Code snippets for some common operations with exceptions.NET Tip of The Day.org

Download and install these additional code snippets for common operations with exceptions. To use them type shortcut for the code snippet that you want to add to your code and then type Tab, Tab to invoke it.

  • thr – throw new
  • thra – throw new ApplicationException(“”);
  • thrni – throw new NotImplementedException(“”);

Bug Bash:Button.CausesValidation, ModalPopups and Validation ControlsMatt Berseth

The second entry in my BugBash series

The Bug

I recently wrote a post discussing how to implement a master-detail editing scenario using ASP.NET‘s GridView and DetailsView along with the AjaxControlToolkit’s ModalPopup control.  My example was pretty standard – each data row in the GridView has an Edit button that when clicked displays the selected row within a DetailsView.  My DetailsView uses RequiredFieldValidators for each of the input fields to make sure the user has provided the required information.

My sample seemed to work great – I certainly had no issues.  But, as Konstantin G posted in a comment – there is a bug hiding out in my example.  Here was what Konstantin G had to say:

Hi Matt,

Great example! Everything works fine, but when you leave blank required field, and hit Cancel button, you can’t display modal popup again. Any ideas how to solve this problem?

Thanks.

You can reproduce the problem Konstantin is describing using the following steps.

  1. Navigate to mattberseth2.com/master_details_II/
  2. Click the Edit hyperlink for row with ID = ‘GREAL’
  3. When the edit dialog is displayed, clear out the value of the Name textbox
  4. Click the Close hyperlink at the bottom right corner of the dialog
  5. Back on the main grid, try to click the edit hyperlink for any of the other rows -> BUG! The dialog is not shown

And here is the markup for my GridView’s row select command …


  
  
  

Did you spot the bug?  If not don’t feel bad, clearly I missed it too ;)

The problem is that because my LinkButton doesn’t explicitly set the CausesValidation attribute to false, each time one of the grid’s Edit buttons are clicked, validation is performed.  That is usually not going to hurt anything – except in the scenario Konstantin ran into.  In this case, the second time the Edit button is clicked validation fails because the Name textbox is empty from the first time the dialog was displayed.

You need to keep in mind that even though the modal popup panel is not visible, it controls (including the validators) are still part of the page.  That’s what fooled me.

The Fix

Set the CausesValidation property on the GridView’s edit buttons to false.

[cc lang="asp"]

ID="btnViewDetails" runat="server"
Text="Edit" CommandName="Select" CausesValidation="false"
/>

[/cc]

That’s it.  Enjoy!

Get Authentic Restaurant Reviews at OpenTable [Dining]Lifehacker

diners-choice.pngWeb site OpenTable—the long-running standard for restaurant reservations online—has added a new review system to the site, which aims to filter out fake reviews. We've all researched a restaurant and found that the glowing praise online didn't come close to the actual experience, and often that's a result of inauthentic reviews. OpenTable will only allow diners who ate at a restaurant and booked through their reservation system to rank it, which they hope will result in more accurate reviews. Even if the reviews aren't your cup of tea, we've never featured the very useful OpenTable before, and the free reservation service is a must-bookmark for any foodie.




Eliminate XP’s Unread Mail Count [How To]Lifehacker

xp_mail.jpgIf you're a veteran Windows XP user, you're familiar with the "helpful" count of your unread email messages you'll find at the login screen—which is usually wrong or overstated (my screenshot came from a fresh install of Thunderbird). The Online Tech Tips blog shows how to eliminate this stress-inducing reminder through a registry hack. Readers comfortable tweaking in regedit can find the values and instructions at the link below; those who don't mind installing a free (and very handy) power-user program can accomplish the same thing using TweakUI (here’s where to look once you’ve busted out this power tool).




Building a Bookcase Part II

ASP.NET AJAX Progress Bar ControlMatt Berseth

If you use AJAX in your web app's, you no doubt have made use of some sort of progress/status indicator that lets the user know that some operation is currently executing.  In the app I am currently working on we use an animated gif for this.  It works great, but sometimes you might find it nice to have more control over the indicator – i.e. interacting with it via JavaScript and styling it using CSS.

image

So I did a little research and found a nice example of one built using script.aculo.us.  The demo page looked great so I downloaded the source to get a feel for how it worked.  I liked what I saw so I thought I would create a new AjaxControlToolkit control based on this example.  My original goal was just to port it over to ASP.NET, but as I started playing around with it I thought I might make a few changes to it as well.  So during the process of porting it, I made the following tweaks

  • I added a mode that runs the progress bar from 0 to 100 continuously.  This mode would be useful for scenarios where you don't know how long an operations would run for (like a typical partial postback)
  • The original requires different images for progress indicators of different widths.  I chose to use a repeating background image instead so I could use a single progress image no matter the width of the control.
  • I add an updating CSS class to the control while the progress bar is running.  In my demo page I use this to darken the percentage while the indicator is running.  I was also thinking about adding the current percentage to the class as well so you could have a custom style applied depending upon what the current percentage is.  Then you could do something like .progress .100 {  } to control the styling when the indicator is displaying 100%.
  • I used a skinning approach that is very similar to the Toolkit's Tab control.  I went ahead and created a bunch of sample skins (shown above) just to make sure my skinning technique worked alright.

Below are some details on how the controls – including how to add one to your page, interacting with it from JavaScript and creating custom skins using CSS.  Read on if you are interested and don't forget to check out the live demo and download.  I built it using .Net 3.5 and Toolkit version 3.5.11119.0, but I think it could be ported back to .Net 2.0 without too many issues. 

Live Demo (IE6, IE7, FF and Opera) | Download

 

Using the Control

The download contains plenty of examples of how to interact with the control, but here is some sample markup that specifies the progress mode as well as the width …

   1:  <!-- Continuous Mode / 150px wide --> 
   2:  <mb:ProgressControl ID="ProgressControl1" runat="server" Mode="Continuous" Width="150px" />
   3:  <!-- Manual Mode / 70px wide --> 
   4:  <mb:ProgressControl ID="ProgressControl12" runat="server" Mode="Manual" Width="70px" /> 

 

When the control is in Continuous mode, you can start and stop the progress animation by using the play() and stop() JavaScript functions

   1:  //  start the indicator
   2:  $find('ProgressControl1').play();
   3:   
   4:  //  stop it
   5:  $find('ProgressControl1').stop();

 

And when the control is in Manual mode, you can use the set_percentage to manually change the percentage value.  You can either provide an absolute value like in the first example, or a value that is relative to what ever the current value is – like the second example.

   1:  //  set the percentage to 62
   2:  $find('ProgressControl1').set_percentage(62);
   3:   
   4:  //  increase the percentage by 15
   5:  $find('ProgressControl1').set_percentage('+15');

 

HTML Emitted by the Control

Below is the markup the control emits.  1 DIV for containing the progress image, 1 DIV for displaying the percentage text, 2 DIV's for applying a border and an outer DIV that wraps it all.

   1:  <div class="ajax__progress" class="ajax__progress" id="ProgressControl1">
   2:      <!-- outer and inner elements for creating a border -->
   3:      <div class="ajax__progress_outer" id="ProgressControl1_outer">
   4:          <div class="ajax__progress_inner" id="ProgressControl1_inner">
   5:              <!-- The background image for this element displays the indicator -->
   6:              <div class="ajax__progress_indicator" id="ProgressControl1_indicator" />
   7:          </div>
   8:      </div>
   9:      <!-- This element displays the percentage -->
  10:      <div class="ajax__progress_info" id="ProgressControl1_info">75%</div>
  11:  </div>

 

Skinning the Control

To skin the control, you need to set the CssClass property of the ProgressControl to the name of the CSS class that defines your custom skin.  For the skin portion of the demo page I have defined 6 custom themes.  Below is the sample markup for this section … 

   1:  <mb:ProgressControl ID="ProgressControl4" runat="server" CssClass="green" Mode="Manual" Width="200px" />            
   2:  <mb:ProgressControl ID="ProgressControl5" runat="server" CssClass="yelllow" Mode="Manual" Width="200px" />            
   3:  <mb:ProgressControl ID="ProgressControl6" runat="server" CssClass="orange" Mode="Manual" Width="200px" />            
   4:  <mb:ProgressControl ID="ProgressControl7" runat="server" CssClass="red" Mode="Manual" Width="200px" />            
   5:  <mb:ProgressControl ID="ProgressControl8" runat="server" CssClass="lightblue" Mode="Manual" Width="200px" />            
   6:  <mb:ProgressControl ID="ProgressControl11" runat="server" CssClass="solidblue" Mode="Manual" Width="200px" />            
 
 

And here are the CSS style rules that apply the styles for these skins

image

One of the sample skins I made is roughly based on the XP style progress indicator.  To create this custom skin, I first created the background image that I want to use for the indicator (I am using a 6 x 9 image)

image

then I use the .ajax__progress_indicator and .ajax__progress_inner classes to override the default skins height and progress image – Simple!

image

And here is how it looks …

image

Screen shots of the Control’s Features

Here are some static images that show off some of the control;s features …

Continuous Mode

Progress indicator continuously fills the region from left to right.

image

Fluid Width

Progress indicator continuously fills the region from left to right.

image

Manual Mode – Update Absolute Percentage

Use the JavaScript API to set the percentage an absolute value

image

Manual Mode – Update Relative Percentage

Use the JavaScript API to set the percentage to a relative value

image

Skins

Use CSS to control the progress indicators look and feel

image

AJAX Operations

Example of displaying the indicator for AJAX operations

image

Modal Popup

An example using the progress control with the Tookit’s ModalPopup control

image

That's it.  Enjoy!

Building a Bookcase Part IIWoodworkersResource

Part II of our Building a Bookcase video series covers the topic of face frames. We talk about ways to construct face frames (mortise and tenon, and pocket hole joinery) along with things to consider when figuring out what size your face frames need to be.

We’ll even show you how to make sure your face frames fit your bookcase perfectly every time.

For more information on woodworking and to be alerted to future videos podcasts, go to our website and sign up for our newsletter.

www.WoodworkersResource.com

Thanks for watching!

Craig Stevens

WP Like Button Plugin by Free WordPress Templates