To get width and height of an image we can use System.Drawing.Image class. This code snippet shows how to retrieve width and height of an image.
string filePath = @"c:\deepak\MeeGo.jpg"; Image img = Image.FromFile(filePath); Console.WriteLine(string.Format("Height: {0}",img.Size.Height)); Console.WriteLine(string.Format("Width: {0}",img.Size.Width));
Windows Registry Size can be retrieved using WMI objects. This code snippet shows you how to get current size and maximum size for Windows registry.
ManagementObjectSearcher mgmtObjects = new ManagementObjectSearcher("Select * from Win32_Registry"); foreach (var item in mgmtObjects.Get()) { Console.WriteLine(string.Format("Current Size: {0}MB", item["CurrentSize"])); Console.WriteLine(string.Format("Maximum Size: {0}MB", item["MaximumSize"])); }
The output.
Conficker worm which strikes on April 1st is already being labelled as one of the most dangerous cyber attacks ever. The way this worm works is that it sets up what are known as botnets on computers around the world. The worm goes active on April 1st when it can be used by its [...]
In .Net Framework reversing array elements can be done by using Reverse method on Array type. This code snippet shows you how this method can be used to reverse an array.
// Declare an array with 10 elements int[] numbers = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 [...]
To convert a Hexadecimal to a number we can use an overload of Convert.ToInt32 method.
Using the overload I can convert for example hex string “BB” to a number.
int number = Convert.ToInt32("BB", 16);
And the number variable gets assigned value of 187.
To get free disk space for all physical drives on a machine we can use xp_fixeddrives extended stored procedure. An interesting this about this procedure is that it is not documented in books online.
EXEC xp_fixeddrives
Here is output on my machine.
You’ve got to love sys views in SQL Server. While learning about performance tuning on SQL Server 2008 I wanted to get a list of all Indexes on my database and the answer was as simple as it can be. Here i a statement which can be used to get a list of all indexes [...]
I was recently helping Nosh with a LINQ To SQL query where he wanted the resulting T-SQL query to have CASE statements. Having CASE statements in T-SQL queries is a common scenario but how do we it in LINQ To SQL .After some investigation I found the solution which I am presenting here using [...]
This is where reflection comes in handy. The following code snippet shows you how to get the name of executing assembly.
string assemblyName; assemblyName = System.Reflection.Assembly.GetExecutingAssembly().FullName; Console.WriteLine(assemblyName);
Output for the above code returns the fully qualified name as shown below
To just get the Assembly name we can use [...]
I’ll be honest that I was not much excited about Internet Explorer 8 until it went RTM. There is only so much beta software one can take. But today when IE8 went RTM I decided to install it on my main machine. This post talks about my first experience with the browser.
Installation of [...]
To find out the space used by a table we can use sp_spaceused procedure. Most of the times sp_spaceused will give correct information. Why do I say most of the time? Well consider this example. I just inserted a large amount of data in Orders table in Northwind database and ran sp_spaceused.
EXEC sp_spaceused ‘Orders’ [...]
The title says it all.
Here is the Link.
Top Posts
- LINQ To SQL Tutorial
- LINQ To SQL Join On Multiple Conditions
- Code Sample: Programmatically Download File Using C#
- Windows 7 Control Panel In Classic Mode
- More Details Emerge On Microsoft Master Certification
- Use SqlConnection With LINQ To SQL
- Free Icons And Images With Visual Studio 2008
- Capture XML In WCF Service
- Dynamic Sort With LINQ
- StyleCop Tutorial
Tags
.Net 2010 ADO.NET ASP.NET Azure Blogging Books Browsers C# Certification Cloud Computing Code Snippets Community Data Services Eclipse Entity Framework Google IDE Java LINQ Mac Microsoft Museum NetBeans Office Oracle REST SharePoint Silverlight SQL Server T-SQL Tips Tools Training Visual Studio Visual Studio 2010 WCF Web Windows Windows 7 Windows Forms Windows Live WMI WPF XAML

