After publishing the How To Get Free Disk Space And Other WMI Stuff (.NET) article, I learned two new things. One is about a better way to get free disk space and the other is about a better and easier way to use WMI in general. This is what is good about blogging, you share your knowledge and then learn from others.

 

Better Method For Getting Free Disk Space

Karl Agius left the following comment:

“I agree that WMI is extremely powerful, and that it lets you get to details that are not otherwise available in managed code. In this case though, the free drive space can be derived through the AvailableFreeSpace method in DriveInfo. What are the arguments for using WMI instead of this?

Great article, by the way :D That WMI object browser looks handy … sure beats trawling through MSDN looking for stuff ;) Thanks!”


Continue Reading...

I am currently working on a SaveAs feature to some special file formats, those files are very very big. Before actually saving the file, I need to compute its anticipated size and compare it with the free disk space to see if there is enough storage for that operation. After searching a bit about how to get the free disk space, I came across the solution which uses the System.Management namespace. This namespace provides access to a rich set of management information about the system, devices, and applications instrumented to the WMI infrastructure. But, what the hell is WMI?

wmi

WMI is Windows Management Instrumentation and is part of the Windows operating system that provides management information and control. WMI provides extensive instrumentation to accomplish almost any management task and help us obtain information about our system. Applications and services can query for interesting management information such as how much free space is left on the disk, what is the current CPU utilization, which database a certain application is connected to, and much more, using classes from the System.Management namespace. Here is the MSDN page about the Windows Management Instrumentation.

Let me show you how to query the free disk space using WMI:


Continue Reading...

small_flagsUntil a couple of years ago, most software applications were released in English. Unfortunately for us the developers, nowadays, many customers require that that the product they purchased, will be localized to a specific language (other than English). I know, for instance, that there is a European law which requires healthcare products to be localized to the European market (starting from 2009 or 2010). Because this article is about how to localize your application using string tables, I recommend you to first read about a free tool which helps you extract hard coded strings to string tables. Don’t go any further before you also read about how to generate public properties for string tables, you must read it.

Setting up a String Table

I assume that you already have some user interface which needs to be localized, I will demonstrate this process with…


Continue Reading...

If you are a .NET developer, you should probably know the .NET Reflector which is a great tool for viewing, navigating and searching through the class hierarchies of .NET assemblies (even if you don’t have the code for them). I am using this tool a lot but here is something I only recently discovered: one can export an assembly and let the Reflector generate its source code. The output of this process is a directory with a project file and all of the source files.

Lets deep dive into this process. The first thing to do is to drag the assembly you’re interested in into the Reflector. I want to show my case on the XHTML sitemap validation tool dll, which can be downloaded from our Freebies page. The next step is to right click on this assembly and choose the Export menu option:

exportreflector


Continue Reading...

This is a guest post by Ryan Lanciaux.

Hi my name is Ryan Lanciaux. I want the thank the guys at Dev102 for giving me the opportunity to write about a topic I find very interesting — jQuery and the ASP.NET MVC Framework.

With WebForms, integrating with Ajax libraries other than ASP.NET AJAX was slightly painful. With the new ASP.NET MVC Framework, however, you can use jQuery without these additional headaches. We’re going to take a quick look at how the Frickinsweet.com Theme Generator uses some of the built in ASP.NET MVC utilities combined w/ jQuery to give the user an update with out reloading the page. The example we’re going to look at is a little simplified but the concepts are still there.

The first thing we’re going to do is create an ASP.NET MVC (Preview 4) Project. Create a new view and controller action under your Home controller and add the following line to the view.


Continue Reading...

Here is something nice I have found while wandering around the Internet. We all know jQuery, jQuery is a Framework written in JavaScript which makes client side and DOM work much easier and faster. If you don’t know it yet, be sure to check it out, it makes Web Developers life easy on the web. Shahar wrote a great article about Calling ASP.NET WebMethod with jQuery so check it out.


Continue Reading...

This is a simple hello world example with ASP.NET MVC, to help you build your first application step by step. I will not explain the ASP.NET MVC here, you can find plenty of excellent resources on the web for that, you can try one of these: Kigg – Building a Digg Clone with ASP.NET MVC, ASP.NET MVC Framework, An Architectural View of the ASP.NET MVC Framework . We’ll create a web application with two additional views – the first will ask for your name, and when you submit it you’ll get a greeting message in the 2nd view. Lets start:

1. Download and install ASP.NET MVC Preview 3.

2. Create a new ASP.NET MVC Web Application, Call it MVCHelloWorld

MVCNewProj


Continue Reading...

ASP.NET provides mechanisms for storing information for a single user session or across multiple sessions. This is done using the HttpSessionState and HttpApplicationState classes. The Page class has Application and Session attributes to provide access to current objects. The simple way to access them is as following:

if (Session["FirstName"] == null) 
{ 
    LabelFirstName.Text = "FirstName"; 
} 
else 
{ 
    LabelFirstName.Text = (string)Session["FirstName"]; 
} 
if (Session["LastName"] == null) 
{ 
    LabelLastName.Text = "LastName"; 
} 
else 
{ 
    LabelLastName.Text = (string)Session["LastName"]; 
}

Continue Reading...

I’ve read about jQuery in this great post Five recommendations for starting a startup with ASP.NET and wanted to play with it and see how easy it is to call a WebMethod from sQuery. I Started by reading some of the great Tutorials and downloaded the code from here. I Created a test web project, […]


Continue Reading...

A few days ago I was working on a web application and when I added a ScriptManager and a ScriptManagerProxy  to the Master Page and Although the compilation was successful. I got the following error on the designer: ‘ScriptManager’ is ambiguous in the namespace ‘System.Web.UI’, I said to my self: ah, probably another one of […]


Continue Reading...