July 2, 2009, 11:56 pm
Ever wonder where all of the space on your hard drive has gone? I certainly do from time to time, and for years I’ve been using a great tool called TreeSize Free from JAM Software to find out. TreeSize Free is a lightweight program (~1.55MB) that hooks itself into the context menu in Windows Explorer.
Once it’s installed, you can just right click on any directory or drive and select “TreeSize Free” from the context menu. TreeSize will then scan the selected directory or drive and give you a summary of all the space taken up by the files and subdirectories.
TreeSize Free has a variety of options that let you customize the display. You can choose the units (KB, MB, GB, or mixed) to use in the display or instead you can view by percentage of space occupied. You can even tell it to show you the number of files in each directory. Overall, it’s a very useful tool that’s simple to use.
So that’s where my hard drive space went!
If you need some serious hard drive analysis and reporting, they have a professional version available.
July 1, 2009, 9:52 pm
As it turns out, hooking up Javascript to XUL so that an addon can actually do something is remarkably similar to linking HTML and Javascript together when doing web development. The first step is to create a Javascript file and include it it in the XUL file much like you would include a Javascript file in an HTML file:
<overlay id="ehow_earnings_tracker_overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript" src="chrome://ehow_earnings_tracker/content/browser_overlay.js" />
<statusbar id="status-bar">
<statusbarpanel id="ehow_earnings_tracker_statusbar" label="" />
</statusbar>
</overlay>
Now we can add code in browser_overlay.js to actually do something. In this case, we will update the status bar text with the URL of HTML page that was loaded:
// Creates a global variable called "ehow_earnings_tracker"
var ehow_earnings_tracker =
{
init:
function()
{
// Grab the contents of the browser
var appcontent = document.getElementById("appcontent");
if(appcontent)
{
// Get notified when the page is done loading
appcontent.addEventListener("DOMContentLoaded", ehow_earnings_tracker.onPageLoad, true);
}
},
onPageLoad:
function(aEvent)
{
var doc = aEvent.originalTarget; // doc is document that triggered "onload" event
var statusBar = document.getElementById("ehow_earnings_tracker_statusbar");
if(!statusBar)
{
return;
}
statusBar.setAttribute("label", doc.location.href);
}
};
// Hook into the window load event
window.addEventListener("load", ehow_earnings_tracker.init, false)
Now, when I run Firefox with my plugin enabled it dynamically updates the status bar with the URL of the loaded page: