Monthly Archives: May 2008

Ophcrack Live CD Cracks Windows Passwords [Password Recovery]

ophcrack-1.pngAll systems with access to a Windows partition: The free, open source Windows password cracker, Ophcrack Live CD, has updated to version 3.0 with faster cracking, a better interface, and an all-new Vista version. We’ve walked you through how to crack a Windows password with Ophcrack in the past (and offered tips for securing your password against Ophcrack), but the new and improved version has been rebuilt to beef up the already impressive tool. The Ophcrack source code is free to download and also available as a Windows installer, but the live CD .ISO file is the quickest and easiest way to get cracking. If you give it a try, let’s hear how your passwords fared in the comments.

Ophcrack [Sourceforge]

Weblog Tools Collection: Removing Width/Height from the Image Uploader

Reader Vivien writes in:

Is there a way to prevent WordPress from inserting the width and the height for images in the new 2.5 media manager?

In short, yes, but it requires you to insert some code into your theme’s functions.php file.

Fortunately, there is a WordPress filter we can use called image_downsize, which takes in three arguments (a boolean, an attachment ID, and a size string).

add_filter('image_downsize', 'my_image_downsize',1,3); 

All I’m doing in the above filter is setting the filter name, the function to call (my_image_downsize), what priority I want the filter, and how many arguments the function takes.

From there, I mimic the function image_downsize in the ‘wp-includes/media.php’ file, but do not return a width or a height. As a result, when the image is sent to the editor, no width or height is present.

function my_image_downsize($value = false,$id = 0, $size = "medium") { 	if ( !wp_attachment_is_image($id) ) 		return false; 	$img_url = wp_get_attachment_url($id); 	//Mimic functionality in image_downsize function in wp-includes/media.php 	if ( $intermediate = image_get_intermediate_size($id, $size) ) { 		$img_url = str_replace(basename($img_url), $intermediate['file'], $img_url); 	} 	elseif ( $size == 'thumbnail' ) { 		// fall back to the old thumbnail 		if ( $thumb_file = wp_get_attachment_thumb_file() && $info = getimagesize($thumb_file) ) { 			$img_url = str_replace(basename($img_url), basename($thumb_file), $img_url); 		} 	} 	if ( $img_url) 		return array($img_url, 0, 0); 	return false; } 

Download the Code

Here is a sample functions.php file of the code presented in this article.

I also used Andrew’s plugin generator to quickly put together a plugin that I will creatively call No Image Width or Height (download link). It will accomplish the same thing for those not comfortable with code. Just unzip, place in your WordPress plugin’s folder, and activate.

Thanks Vivien for the interesting question.

Using jQuery to directly call ASP.NET AJAX page methodsEncosia

When it comes to lightweight client-side communication, I’ve noticed that many of you prefer ASP.NET AJAX’s page methods to full ASMX web services. In fact, page methods came up in the very first comment on my article about using jQuery to consume ASMX web services.

Given their popularity, I’d like to give them their due attention. As a result of Justin’s question in those comments, I discovered that you can call page methods via jQuery. In fact, it turns out that you can even do it without involving the ScriptManager at all.

In this post, I will clarify exactly what is and isn’t necessary in order to use page methods. Then, I’ll show you how to use jQuery to call a page method without using the ScriptManager.

Creating a page method for testing purposes.

Writing a page method is easy. They must be declared as static, and they must be decorated with the [WebMethod] attribute. Beyond that, ASP.NET AJAX takes care of the rest on the server side.

This will be our page method for the example:

public partial class _Default : Page {   [WebMethod]   public static string GetDate()   {     return DateTime.Now.ToString();   } }

What about the ScriptManager and EnablePageMethods?

Traditionally, one of your first steps when utilizing page methods is to set the ScriptManager’s EnablePageMethods property to true.

Luckily, that property is a bit of a misnomer. It doesn’t enable page methods at all, but simply generates an inline JavaScript proxy for all of the appropriate methods in your page’s code-behind.

For example, if a ScriptManager is added to the above example’s corresponding Default.aspx and its EnablePageMethods property is set to true, this JavaScript will be injected into the page:

var PageMethods = function() {  PageMethods.initializeBase(this);  this._timeout = 0;  this._userContext = null;  this._succeeded = null;  this._failed = null; }  PageMethods.prototype = { _get_path:function() {  var p = this.get_path();  if (p) return p;  else return PageMethods._staticInstance.get_path();}, GetDate:function(succeededCallback, failedCallback, userContext) { return this._invoke(this._get_path(), 'GetDate',false,{},   succeededCallback,failedCallback,userContext); }} PageMethods.registerClass('PageMethods',Sys.Net.WebServiceProxy); PageMethods._staticInstance = new PageMethods();  // Generic initialization code omitted for brevity.  PageMethods.set_path("/jQuery-Page-Method/Default.aspx"); PageMethods.GetDate = function(onSuccess,onFailed,userContext) {  PageMethods._staticInstance.GetDate(onSuccess,onFailed,userContext); }

Don’t worry if you don’t understand this code. You don’t need to understand how it works. Just understand that this JavaScript proxy is what allows you to call page methods via the PageMethods.MethodName syntax.

The important takeaway here is that the PageMethods proxy object boils down to a fancy wrapper for a regular ASP.NET service call.

Calling the page method with jQuery instead.

Knowing that a page method is consumed in the same way as a web service, consuming it with jQuery isn’t difficult. For more detailed information, see my previous article about making jQuery work with ASP.NET AJAX’s JSON serialized web services.

Using the jQuery.ajax method, this is all there is to it:

$.ajax({   type: "POST",   url: "PageName.aspx/MethodName",   beforeSend: function(xhr) {     xhr.setRequestHeader("Content-type",                          "application/json; charset=utf-8");   },   dataType: "json",   success: function(msg) {     // Do something interesting here.   } });

Putting it all together.

Corresponding to the example page method above, here’s our Default.aspx:

Click here for the time.

As you can see, there’s no ScriptManager required, much less EnablePageMethods.

As referenced in Default.aspx, this is Default.js:

$(document).ready(function() {   // Add the page method call as an onclick handler for the div.   $("#Result").click(function() {     $.ajax({       type: "POST",       url: "Default.aspx/GetDate",       beforeSend: function(xhr) {         xhr.setRequestHeader("Content-type",                              "application/json; charset=utf-8");       },       dataType: "json",       success: function(msg) {         // Replace the div's content with the page method's return.         $("#Result").text(msg.d);       }     });   }); });

The end result is that when our result div is clicked, jQuery makes an AJAX call to the GetDate page method and replaces the div’s text with its result.


Page methods are much more openly accessible than it may seem at first. The relative unimportance of EnablePageMethods is a nice surprise.

To demonstrate the mechanism with minimal complications, this example has purposely been a minimal one. If you’d like to see a real-world example, take a look at Moses’ great example of using this technique to implement a master-detail drill down in a GridView.

If you’re already using the ScriptManager for other purposes, there’s no harm in using its JavaScript proxy to call your page methods. However, if you aren’t using a ScriptManager or have already included jQuery on your page, I think it makes sense to use the more efficient jQuery method.

Originally posted at: Encosia.

Search and Grab Icon Files at ICONlook [Icons]Lifehacker

iconlook_scaled.jpgICONlook offers a pretty handy interface for searching and downloading icon files, whether for replacing out-of-place icons on your system or adding some graphical polish to a site. The engine’s reach is somewhat limited at this point, but it helpfully provides a link to the license type for each result, when known, and seems to lean toward free and Creative Commons sources to begin with. Until Google adds icon files to their filetype:x capabilities, ICONlook is a good bet for designing your desktop.

Free eBook – Best of Simple Talk ASP.NETDan Wahlin’s WebLog


I wrote a few articles for the Simple Talk Website (run by RedGate Software) over the past year and was honored to be included in the "Best of Simple Talk ASP.NET" eBook they just released.  The book is a free PDF that covers a lot of different topics including:

  • ASP.NET Master Pages Tips and Tricks
  • Web Parts in ASP.NET 2.0
  • Implementing Waiting Pages in ASP.NET
  • Token Replacement in ASP.NET
  • Regular Expression Based Token Replacement in ASP.NET
  • A Complete URL Rewriting Solution for ASP.NET 2.0
  • Take Row-Level Control of Your GridView
  • Enhance Your Website with ASP.NET AJAX Extensions
  • Calling Cross-Domain Web Services in AJAX
  • Using Web Services with ASP.NET
  • Gathering RSS Feeds using Visual Studio and RSS.NET
  • Getting Started with XAML
  • Silverlight Skinnable User Interfaces

You can download the free eBook here.  On a side note, definitely check out RedGate’s tools if you get a chance.  They have a lot of great stuff.

My ASP.NET Demo Gallery ( Berseth

Well, I finally found some time over the long weekend to sit down and organize my 'live demo' links into a single, browsable site.  You can check it our here:  It is far from perfect, but in my opinion it is much better than having all of my demo links scattered through out my blog posts.  The live demo's for all of my new work will be hooked into this page – so feel free to bookmark it.

You can filter the demo links using the 'Filter' drop down list.  So if you only want to see my GridView demo’s, just select that option from the drop down list and the ‘Live Demos’ links will only include links to my GridView articles.  Once an item from the 'Live Demos' section is selected, the content area of the page fills with the title of the post, a short description of what the demo is showing (too short, I need to improve these descriptions), as well as a link to my original blog post and the location of where the code can be donwloaded from.  I have a few demo's that require a little more screen space than the others – for these examples you can click the Demo hyperlink and open the demo page in a new browser window.

I load the demo page into an IFRAME within the main page.  I have noticed that every once in a while this seems to cause an issue (JavaScript errors).  I will get this fixed once I track it down, but in the mean time I added a Refresh Demo link that will refresh the IFRAME. 

If you have any suggestions for the page, send me an email or post a comment.


Besides the new site, I also took care of a few other blog housekeeping items …

  • I the 'Popular' links section based according to what Google Analytics says are my most popular posts.  I cheated a bit and added a link to the gallery page to the top of the list – I figured it was pretty safe to assume most folks would dig the new site.
  • I got rid of the 'Recent Posts' section on the right hand pane.  My home page ( is already configured to show my 10 most recent posts, so I replaced this section with a Recent Posts link under the 'Popular' section
  • I moved the RSS, Atom and Email Me links to the title bar.  I thought this was a better use of real estate than the right hand pane.
  • I added 2 advertising sections to each of my pages.  One is located in the right hand pane between the Popular an Topics sections, and the other is at the footer of each of my pages.  I took some time styling them to make sure it matched the rest of my sites theme, but I still don't really care for how it looks.  I am going to give it a month to see what kind of return these ads give me.  Then I will decide if I am going to keep them or not.
  • I added the ‘Topics’ section to my archive pages so you can see what Topics an entry is filed under.


That's it.  Enjoy!

Shrink Firefox 3’s Supersized Back Button [Firefox 3]Lifehacker

fx3btncompare.png Most Firefox 3 testers agree that the preview release of the new browser promises faster and all-around better surfing—but one of the most noticeable interface changes, the big Back button, has gotten mixed reviews. If you're not a fan of Firefox 3's large back button, you don't have to wrangle with CSS or themes to adjust its size. Simply right-click on Firefox's toolbar, and choose Customize. In the dialog box, select "Use small icons"—and voila! Your back button will be the same size as reload. Thanks, zaxour!

SQL Server 2005 Configuration Manager – Cannot Connect to WMI Provider ErrorDan Wahlin’s WebLog

I was trying to use the SQL Server 2005 Configuration Manager tool tonight and kept getting a "Cannot connect to WMI provider" error.  Very frustrating because the error message didn't give the slightest clue how to fix the problem.  After doing a few searches, I came across the following post by Eric Charran that solved the problem.  Apparently there are some "mof" files that must not have been installed incorrectly on my system or got corrupted.   I would've never figured out the solution in a 1,000 years but fortunately Eric blogged about the following command that fixed the problem instantly:

C:Program FilesMicrosoft SQL Server90Shared>mofcomp "C:Program FilesMicrosoft SQL Server90Sharedsqlmgmproviderxpsp2up.mof"

Set Firefox 3 to Launch Gmail for mailto Links [Firefox 3]Lifehacker

In today’s earlier list of five extensions you won’t need in Firefox 3, we said you won’t need any special toolbars, third-party apps, Greasemonkey scripts, or extensions to get Firefox to use webapps to open certain types of links. This means that when you click on an email address that uses the standard mailto: email protocol, Firefox 3 itself can launch Gmail instead of a desktop app. By default, the Firefox RC 1 only comes with Yahoo! Mail as a possible mailto: link handler, which leaves Gmail users out in the cold—unless you know how to set it up by hand. Here's how to configure Firefox 3 to use Gmail as your default mailto: application handler.

Ready to set up Gmail? Roll up those sleeves.

  1. Type about:config into Firefox 3’s address bar. Firefox 3 will issue a warning about voiding your non-existent warranty. (Cute!) Click the “I’ll be careful, I promise!” button to proceed.
  2. Type gecko.handlerService into the search box until you locate the gecko.handlerService.allowRegisterFromDifferentHost key/value pair. Set it to true.
    Warning: This configuration change disables a security feature that ships with Firefox 3, which prevents your browser from registering link protocol handlers from a domain other than the one it’s registering. Read more about what gecko.handlerService.allowRegisterFromDifferent Host does, and only proceed if you understand the risk. Don’t worry, you can set the value right back to false when we’re done.
  3. Copy and paste the following snippet of Javascript into your address bar:

    If you are a Google Apps user, use this code instead, but replace with your domain name:

  4. Firefox 3 will ask permission to add Gmail as default mailto handler. Click the Add Application button, as shown.

Now, if you click a mailto: link—try the tips link on Lifehacker's sidebar—Firefox 3 will ask which application you want to use. Choose Gmail, and select "Remember my choice for mailto links" to set the preference permanently.


To be on the safe side, head back into about:config and set gecko.handlerService.allowRegisterFromDifferentHost back to false.

Firefox 3’s new ability to register webapps as link handlers has lots of potential usage, for everything from fax and telephone numbers to IM buddy name links. Setting up your mailto handler is just the beginning. Read more about Firefox 3 web protocol handler possibilities. Thanks, readme!

Using mirror mounts to get a better /net

One problem with the automounter is that when you use the /net mount points to mount a server if the admin on that server adds a share then you client won’t see that share until the automounter timesout the mount. This obviously requires that the mounts are unused which for a large nfs server could never happen.

So given an NFS server host called which is sharing a directory /newpool/cjg on a client you can do:

#  ls /net/ cjg #  ls /net/ SPImage         ipmiLog         ppcenv          sel.bin         tmp SPValueAdd      mcCpu0Core0Log  processLog      summaryLog evLog           mcCpu1Core0Log  prsLog          swLog hwLog           mcCpu2Core0Log  pstore          tdulog.tar # cd  /net/ # ls SPImage         ipmiLog         ppcenv          sel.bin         tmp SPValueAdd      mcCpu0Core0Log  processLog      summaryLog evLog           mcCpu1Core0Log  prsLog          swLog hwLog           mcCpu2Core0Log  pstore          tdulog.tar

However if at this point on the server you create and share a new file system:

# zfs create -o sharenfs=rw newpool/cjg2 # share -@newpool/cjg   /newpool/cjg   rw   "" -@newpool/cjg2  /newpool/cjg2   rw   "" # echo foo > /newpool/cjg2/file #

You can’t now directly access it on the client:

# ls /net/ /net/ No such file or directory #

Now we all know you can work around this by using aliases for the server or even different capitalization:

# ls /net/ file #

however lots of users just won’t buy that and I don’t blame them.

With the advent or mirror mounts to NFSv4 you can do a lot better and there is an RFE (4107375) for the automounter to do this for you, which looks like it would be simple on a client that can do mirror mounts but until that is done here is a work-around. Create a file “/etc/auto_mirror “that contains this line:

* &:/

Then add this line to auto_master:

/mirror auto_mirror  -nosuid,nobrowse,vers=4

or add a new key to an existing automount table:

: TS 50 $; nismatch mirror auto_share mirror / -fstype=autofs,nosuid,nobrowse  : TS 51 $;

Now if we do the same test this time replacing the “/net” path with the “/mirror” path you get:

# ls /mirror/ cjg # ls /mirror/ SPImage         ipmiLog         ppcenv          sel.bin         tmp SPValueAdd      mcCpu0Core0Log  processLog      summaryLog evLog           mcCpu1Core0Log  prsLog          swLog hwLog           mcCpu2Core0Log  pstore          tdulog.tar # (cd /mirror/ ; sleep 1000000) & [1]     10455 # ls /mirror/ /mirror/ No such file or directory

Here I created the new file system on the server and put the file in.

# ls /mirror/ file #

If you are an entirely NFSv4 shop then you could change the “/net” mount point to use this.

WP Like Button Plugin by Free WordPress Templates