c# code 128 barcode generator Exploring the VM details in Visual C#

Drawing Code 128 Code Set A in Visual C# Exploring the VM details

Exploring the VM details
Code 128C Generator In Visual C#
Using Barcode creation for VS .NET Control to generate, create Code 128B image in Visual Studio .NET applications.
www.OnBarcode.com
Recognize USS Code 128 In Visual C#
Using Barcode scanner for Visual Studio .NET Control to read, scan read, scan image in .NET applications.
www.OnBarcode.com
You can use the power of native code execution to see some of the juicy details about the VM that your web role runs on. Figure 3.12 shows an ASP.NET web page that shows some of the internal details, including the machine name, domain name, and the user name that the code is running under. If you want, you can easily generate the web page shown in figure 3.12 by creating a simple ASPX page with some labels that represent the text, as follows:
Drawing QR Code JIS X 0510 In C#
Using Barcode drawer for .NET framework Control to generate, create QR Code image in .NET applications.
www.OnBarcode.com
Creating Barcode In Visual C#.NET
Using Barcode drawer for .NET Control to generate, create Barcode image in VS .NET applications.
www.OnBarcode.com
<div> ProcessorCount: <asp:Label ID="lblProcessorCount" runat="server" /> </div>
Drawing GTIN - 128 In Visual C#.NET
Using Barcode generation for .NET Control to generate, create EAN 128 image in VS .NET applications.
www.OnBarcode.com
Generating PDF-417 2d Barcode In Visual C#
Using Barcode maker for .NET framework Control to generate, create PDF-417 2d barcode image in Visual Studio .NET applications.
www.OnBarcode.com
Figure 3.12 Using native code, you can see some of the machine details of a web role in Windows Azure. In this example, Microsoft is using Windows Server 2008 Enterprise x64. Notice that the user name that the process is running as is a GUID.
Linear Printer In Visual C#
Using Barcode drawer for VS .NET Control to generate, create Linear image in Visual Studio .NET applications.
www.OnBarcode.com
2 Of 7 Code Drawer In C#.NET
Using Barcode creator for VS .NET Control to generate, create Code-27 image in Visual Studio .NET applications.
www.OnBarcode.com
Finally, you can display the internal details of the VM using the code-behind in the following listing.
Scan Code 128B In None
Using Barcode decoder for Software Control to read, scan read, scan image in Software applications.
www.OnBarcode.com
Reading Code 128A In .NET
Using Barcode scanner for .NET framework Control to read, scan read, scan image in .NET framework applications.
www.OnBarcode.com
Listing 3.1 Using code behind to display machine details
PDF-417 2d Barcode Generator In Java
Using Barcode creator for Java Control to generate, create PDF417 image in Java applications.
www.OnBarcode.com
Decoding QR-Code In VB.NET
Using Barcode recognizer for .NET Control to read, scan read, scan image in VS .NET applications.
www.OnBarcode.com
using System.Management; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) {
Scanning Code 128 Code Set C In Java
Using Barcode reader for Java Control to read, scan read, scan image in Java applications.
www.OnBarcode.com
Generate Code128 In None
Using Barcode encoder for Font Control to generate, create Code 128 Code Set C image in Font applications.
www.OnBarcode.com
Class fetches information about server
Reading UPC - 13 In None
Using Barcode recognizer for Software Control to read, scan read, scan image in Software applications.
www.OnBarcode.com
QR Code Generation In None
Using Barcode printer for Online Control to generate, create Denso QR Bar Code image in Online applications.
www.OnBarcode.com
// Initialize var computer = new Microsoft.VisualBasic.Devices.Computer(); lblMachineName.Text = computer.Name;
PDF-417 2d Barcode Generator In Java
Using Barcode encoder for BIRT reports Control to generate, create PDF-417 2d barcode image in BIRT reports applications.
www.OnBarcode.com
Encode EAN / UCC - 13 In Java
Using Barcode encoder for Java Control to generate, create GS1-128 image in Java applications.
www.OnBarcode.com
The innards of the web role VM
Make Code 128 In None
Using Barcode creation for Online Control to generate, create Code 128B image in Online applications.
www.OnBarcode.com
Code-128 Creation In None
Using Barcode maker for Office Word Control to generate, create Code 128 Code Set C image in Microsoft Word applications.
www.OnBarcode.com
// OS Details lblOSName.Text = computer.Info.OSFullName; lblOSVersion.Text = computer.Info.OSVersion; lblMachineName.Text = computer.Name;
Gets length of time server has been running // Computer System Details lblProcessorCount.Text = System.Environment.ProcessorCount.ToString(); lblCLRVersion.Text = System.Environment.Version.ToString(); lblCurrentDirectory.Text = GetCurrentDirectory(); lblTimeSinceLastRestart.Text = GetTimeSinceLastRestart(); lblDomainName.Text = System.Environment.UserDomainName; lblUserName.Text = System.Environment.UserName; lblCPUName.Text = GetCPUName(); Gets user lblArchitecture.Text = GetArchitecture();
name service is running as Gets domain name server is running on
private string GetCurrentDirectory() { try { return System.Environment.CurrentDirectory; } catch { return "unavailable"; } } private string GetTimeSinceLastRestart() { try { TimeSpan time = new TimeSpan(0, 0, 0, 0, System.Environment.TickCount); return time.ToString(); } catch { return "unavailable"; } }
private string GetCPUName() { try { using (ManagementObject Mo = new ManagementObject("Win32_Processor.DeviceID='CPU0'")) { return (string)(Mo["Name"]); } } catch { return "unavailable";
How Windows Azure works
private string GetArchitecture() { try { using (ManagementObject Mo = new ManagementObject("Win32_Processor.DeviceID='CPU0'")) { ushort result = (ushort)(Mo["Architecture"]); switch (result) { case 0: return "x86"; case 9: return "x64"; default: return "other"; } } } catch { return "unavailable"; } } }
You can now, of course, deploy your web page to Windows Azure and see the inner details of your web role, which were shown in figure 3.12. These machine details provide you with some interesting facts: Web roles run on Windows 2008 Enterprise Edition x64 They run quad core AMD processors and one core is assigned The domain name of the web role is CIS This VM has been running for an hour The Windows directory lives on the D:\ drive The web application lives on the E:\ drive This is just the beginning; feel free to experiment and discover whatever information you need to satisfy your curiosity about the internals of Windows Azure by using calls similar to those shown in listing 3.1.
The process list
Now that we re rummaging around the VM, it might be worth having a look at what processes are actually running on the VM. To do that, you ll build an ASP.NET web page that ll return all the processes in a pretty little grid, as shown in figure 3.13. To generate the list shown in figure 3.13, create a new web page in your web role with a GridView component called processGridView:
The innards of the web role VM
Figure 3.13 The process list of a Windows Azure VM. The RDAgent process is related to Red Dog, which was the code name for Azure while it was being developed. <asp:GridView ID="processGridView" runat="server"/>
Next, add a using System.Diagnostics statement at the top of the code-behind and then add the following code to the Page_Load event:
var processes = Process.GetProcesses();
processGridView.DataSource = from process in processes orderby process.ProcessName select new { Name = process.ProcessName, Id = process.Id.ToString() }; } processGridView.DataBind(); Binds query result to
Copyright © OnBarcode.com . All rights reserved.