Subscribe to Feed

Archive for the ‘Visual Studio’ Category

It is very easy to convert a string to stream and vice versa in .Net.
Converting String to Stream:
MemoryStream stream = new MemoryStream();
StreamWriter writer = new StreamWriter(stream);
writer.Write(myString);
writer.Flush();
 
if you already know the encoding of your string, you can also use
 
byte[] tempByteArray = Encoding.ASCII.GetBytes(myString);
MemoryStream stream = new MemoryStream(tempByteArray);
 
Converting Stream to String:
 
StreamReader reader = new StreamReader(stream);
stream.Position = 0;
string [...]

 
When running a PowerShell script using a RunSpace in .Net there might be several occasions where you need to import a module to run your script. They are two different ways to achieve this. Simplest way is to include the “Import-Module” statement as a part of your command. For example..

Collection<PSObject> RunPowerShellScript()
[...]

You may run into a situation on several occasions where in you have to generate a object file (like .cs file) from a XML file. For example, you may have a XML/SOAP response from a web service that need to be de-serialized and consumed in your application etc..
Luckily because of the tools shipped with Visual [...]

You can download the Windows Phone Developer tools from http://create.msdn.com/en-us/home/getting_started By default, only Windows Vista and Windows 7 are support. When you try to install the developer tools package you will receive an error similar to

This is because the bootstrapper included with the package is rigged to block install on the server OS’es. To [...]

There usually are several occasions where you might want to loop through all the controls in a container like a panel or a form etc.. looking for a particular type of control. For example, lets say you have a panel on your form which has several CheckBoxes in it, and you wish to find out [...]

It is very simple to get the name of the application pool current worker process is associated with in Asp.NET. You can simple use the server variables for that. For example, to display the app pool name on your web page you can simply use the below code snippet.
<%= Request.ServerVariables("APP_POOL_ID") %>
 
This is usually helpful when [...]

On some occasions you might want to deploy the Asp.Net MVC application to avoid compiling it yourself etc. You can achieve this by following the below steps

Create an ASP.NET website project in Visual Studio
Add a reference to the System.Web.Mvc.dll (and any other DLLs that your application might need)
Copy the web.config from regular ASP.NET MVC project [...]

10Aug

31 Days of Refactoring

Posted by admin as Random, Visual Studio

Take a look at this very interesting blog post series - 31 days of refactoring
http://www.lostechies.com/blogs/sean_chambers/archive/2009/07/31/31-days-of-refactoring.aspx
The various refactoring “methods” are getting more complex and interesting as the series continues.
IMHO, This is must read for all developers.

You can determine the Name or ID of hosting IIS application from with in the ASP.Net web site or Web application by using “HostingEnvironment” class.
HostingEnvironment class is defined in the System.Web.Hosting namespace.
He is how you get the name of the application and its physical path.
HostingEnvironment.SiteName
HostingEnvironment.ApplicationPhysicalPath
 
And to get the unique identifier for the Web application,
HostingEnvironment.ApplicationID

The 2007 Microsoft Office System - Learning Portal Clinic 5046: Inside Look at Building and Developing Solutions with Microsoft Office SharePoint Servers 2007 Get help incorporating Microsoft Office SharePoint Server 2007 into your portal-based solution development and integrating it into your existing enterprise application infrastructure. This e-learning [...]