Sunday, June 28, 2009
Interesting articles on Green Computing
http://www.environmentalleader.com/2008/05/08/cutting-the-internets-carbon-footprint/
http://technology.newscientist.com/channel/tech/dn13831-delaying-data-could-cut-nets-carbon-footprint.html
http://www.zdnetasia.com/news/business/0,39044229,62042955,00.htm
http://mashable.com/2007/08/14/green-toolbox/
http://www.triplepundit.com/pages/offsetting-your-websites-carbo-003500.php
http://orangecounty.craigslist.org/cps/877592813.html
http://software.intel.com/en-us/articles/creating-energy-efficient-software-part-4
http://www.processor.com/editorial/article.asp?article=articles%2Fp3032%2F23p32%2F23p32.asp
http://www.climatesaverscomputing.org/tools/applications/
http://cultureofchemistry.blogspot.com/2007/05/carbon-footprint-of-that-computer.html
http://www.viapc-1.com/index.php?option=com_content&task=view&id=526
http://blog.tmcnet.com/green-blog/2007/07/the-real-carbon-footprint-of-a-web-page.html
http://www.internetnews.com/reporters_notebook/article.php/3690411
Useful developer links for .NET
2. Copy Source as HTML for Visual Studio 2008
3. Smart Client Software Guidance
4. Microsoft Network Monitor
5. Team Foundation Power tools
6. Process Monitor
7. VSTO Power tools
Thursday, June 11, 2009
Relation between Excel Range Locked property and Sheet Protection.
Sheet/Workbook State | Range Locked Property | Result |
Protected | True (Default is true) | Range is read-only |
Protected | False | Range is editable. |
Unprotected | True | Range is editable. |
Unprotected | False | Range is editable. |
Thursday, May 21, 2009
Listing only directory or file names using the Dir command
The following command can be used from the DOS command prompt to only see the list of filenames/folders in a given directory.
Dir /d /b
Monday, May 4, 2009
Skipping strong name signature verification
I built a VSTO project on my dev box and received the following error when Excel opened up.
Customization could not be loaded because the application domain could not be created.
************** Exception Text **************
Microsoft.VisualStudio.Tools.Applications.Runtime.CannotCreateCustomizationDomainException: Customization could not be loaded because the application domain could not be created. ---> System.IO.FileLoadException: Could not load file or assembly or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key
One way to get around this exception is to use the sn.exe utility with the 'Vr' flag.
sn –Vr <assembly>
You can use the Vl flag to see the list of assemblies registered for strong name verification.
Monday, October 6, 2008
InfoCard download issue & response caching.
---------------------------
Windows Internet Explorer
---------------------------
Internet Explorer cannot download signin.aspx from localhost. Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later.
---------------------------
OK
---------------------------
This was happening because of the following statement in Page Load event
Response.Cache.SetCacheability(HttpCacheability.NoCache);
was causing the download of the infocard to fail.
What does this statement do?
With this statement in the code, the response sent back to the client has "Cache-Control: no-cache" in the header.
Why should this error occur on IE, but not firefox?
IE, probably, handles "no-cache" setting without errors when the response is "text/html" encoded. In my case, I was returning a "application/x-informationcardfile" in the response and I guess IE threw up the error message since it could not find how not to cache this response.
Firefox 3.0 just ignores the cache-control HTTP header.
I replaced the offending statement with
Response.Cache.SetNoStore();
and the file download works fine on both IE & Firefox.
References:
1. File download problem with Response.Cache.SetCacheability
2. Cache directives ignored by Firefox in ASP.NET caching.
CardSpace STS error: Certificate used has a trust chain that cannot be verified
The certificate used has a trust chain that cannot be verified. Replace the certificate or change the certificateValidationMode. The revocation function was unable to check revocation because the revocation server was offline.
On further investigation, I realized that the revocation server was set to http://www.adatum.com in the sample certificate. I had an entry for http://www.adatum.com in the Hosts file on my dev box. But it was not configured under IE Options > Connections > LAN Settings > Advanced > Proxy Settings > Exceptions. On adding the missing entry in the Exceptions text box, the error was fixed! Here is a list of commor errors when running cardspace samples.
Friday, October 3, 2008
SSL setup issue in Zermatt Beta.
C:\Program Files\Microsoft Code Name Zermatt\Samples\Utilities\Scripts\SetSSLCertificate.js(32, 1) (null): The system cannot find the path specified.
On having a look at the script, I found that the code was not able to find the path "/W3SVC/1" in the metabase.xml. The setup script assumes that the default web site is available at the path /W3SVC/1. On opening up metabase.xml, I found that the Default Web Site on my server was set to "/LM/W3SVC/998577302". I guess that the Default Web Site was probably deleted and reconfigured on this box. Hence, it had a different value for the Location attribute. :). As a fix for this, I have replaced the following line in SamplesPreReqCleanup.bat
cscript //nologo "%~dp0Scripts\SetSSLCertificate.js" /W3SVC/1 %localhostCERTHASH%
with the one below.
cscript //nologo "%~dp0Scripts\SetSSLCertificate.js" /W3SVC/998577302 %localhostCERTHASH%
How to fix "Theme cannot be found errors"
- Default Web Site
- vdir1
- App_Code
- App_Code
- App_Themes
- GlobalTheme
when I queried for a page http://localhost/vdir1/Test.aspx, I got the following error message "ConfigurationErrorsException: Theme 'GlobalTheme' cannot be found in the application or global theme directories". The fix for this was simple. I had to create a sub-folder named App_Themes under vdir1 as shown below.
- Default Web Site
- vdir1
- App_Code
- App_Themes
- GlobalTheme
- App_Code
- App_Themes
- GlobalTheme
Where is HttpCfg?
Windows XP users can download the support tools from here
Windows 2003 users can download support tools from here
Wednesday, October 1, 2008
Random page selection for Load Testing
SELECT TOP(1) 'http://localhost/' + [dbo].[Files].[FileName] AS [PageName] FROM [dbo].[Files] ORDER BY NEWID()
Thanks to Philipe for giving this tip!
The above query will return a random page Url like http://localhost/Page1.aspx which is bound to a request in the WebTest.
Then I associated this WebTest with the LoadTest and configured the LoadTest to start with 1 user and add a new user every 1 second till a maximum count which will be equal to the number of pages on my web server. By selecting a distribution model based on the number of virtual users, I expected that the load test will result in user's getting a random unique page in each iteration. However, I was baffled to see what the load test engine was actually doing. On running the load test, the Page Results section in the Summary showed me that only one page was requested during the entire execution!!! On further investigation, I noticed that the WebLoadTestRequestMap table in the Load Test Database had only 1 RequestUri corresponding to my LoadTestRunId.
To get over this issue, I found it best to execute the above SQL statement using SqlDataReader in the WebTest code and create a WebTestRequest instance with the Url returned. With this approach, I am now able to successfully load test the scenario I had in mind. :)
Tuesday, September 30, 2008
WebTest brings down Visual Studio.
This experience has made me wiser though. I have now kicked off the webtest using command line.
mstest /testcontainer:testproject2.dll /test:WebTest1Coded /runconfig:localtestrun.Testrunconfig /resultsfile:testResults.trx
The test has completed and I have a 639 MB trx file lying on my disk, which always brings down Visual Studio when I try to load it. So it is now as good as not having the file to analyze. Take this lesson from me (for free) - Do not try to run a WebTest that will generate a trx file of such a size that it cannot be opened later in VS for analysis. I could not find anything on msdn that tells me of the upper limit on size of trx file. Can we have that, Microsoft?
Instead of trying to find a fault with Microsoft, let me see what could have gone wrong in the code. The WebTest code was firing 200,000 requests in a for loop with each request getting a different aspx page. I think I should remove the for loop, parameterize the web page and create a load test based on this webtest. Let me check this. Will update this space in a few hours :)
Monday, September 29, 2008
Load testing Excel Data Transfer to SQL Server 2008
Just a thought before I hit the sack. Wouldn't it be cool, if an application like DTS Wizard, would tell you "I am going to take this much memory, this much time for completing this task. Are you willing to continue?" :). If I select not to continue, will it present me with a list of alternatives to do the same task and direct me to a site that gets me in touch with the smart minds @ MS. Any takers at Microsoft?
ASP.NET SQLCacheDependency challenging scenarios
Lets assume that the application has handled 1 million requests in a day. So there are 1 million subscriptions in the DB registered against the process id of w3wp.exe (pid:1018). Now lets take a look at the list of scenarios which must be considered by the development team.
Case 1: Application pool recycled and then Page is changed in the DB
The subscriber process w3 with pid 1018 disappears. SQL Server will attempt to send a change notification but will fail and log the error message. User is very likely to see an older version of the page. Disk space utilization will increase.
Case 2: SQL Server recycled.
SQL Server will attempt to send out 1 million change notifications to the w3wp.exe process with pid 1018. Memory utilization of SQL Server will shoot up. Users may experience slow applications response.
Case 3: SQL Server and App pool recycled.
SQL Server will error out when trying to send out change notifications to the w3wp.exe process. Memory utilization of SQL Server & disk space utilization will shoot up. Users may experience slow applications response.
All 3 cases present an interesting engineering problem to solve! Will blog more about the possible solutions. Keep watching this space.
IIS LogonMethod property
We associate credentials of a domain or local account with an application pool. Before a w3wp.exe process is started using the credentials of this account, the system calls the LogonUser function. This function accepts a parameter named "dwLogonType". I think that the value of this parameter is set based on the value assigned to the LogonMethod property in IIS Metabase. By default, IIS 6.0 uses NETWORK_CLEARTEXT as the value for the LogonMethod property. If the function succeeds in authenticating the user, it returns a handle to a token that represents the app pool account and a w3wp process is created to run in the context of this account. When using NETWORK_CLEARTEXT as the value for the LogonMethod property, the username and password of the app pool account are preserved in the DLL containing the authentication logic and used for establishing connections to other network resources during the process lifetime.
References:
1. David Wang's Post
2. MS Support article
IIS MaxBandWidth property
For quick reference, I have reproduced the calculation steps given by Chris. Thanks Chris!
In order to accurately simulate a 56K dial-up connection, we must convert Kbits into Kbytes, remembering also to account for modem sync information. Since there are eight bits in a byte, you’d think we’d simply divide 56 by eight to determine the number of kilobytes to set the throttle to. However, don’t forget that part of the 56K bandwidth is dedicated to keeping the connection up and not used for data. As such, we actually divide 56 by 12 to arrive at the correct number. We then multiply by 1,024 to turn Kbytes into bytes. This results in 4,778 and change. You can keep the change.
Saturday, September 27, 2008
Windows Ports and Services
Adding a few more references:
1. List of IIS 6.0 Metabase properties. You can find the same list on your server in C:\Windows\Help\iismmc.chm.
2. System Definition Model (SDM) types that differ from their counterparts in the IIS metabase
3. How to Modify the Cache-Control HTTP Header When You Use IIS
4. Evolution of IIS architecture
Friday, September 26, 2008
.NET Runtime versions.
Selective proxy setting in WebTests
Here is the code for the WebTestRequestPlugin.
public class ProxySetter : WebTestRequestPlugin
{
string proxy = null;
public string Proxy
{
get
{
return this.proxy;
}
set
{
this.proxy = value;
}
}
public override void PreRequest(object sender, PreRequestEventArgs e)
{
if (!String.IsNullOrEmpty(this.proxy))
{
e.WebTest.Proxy = this.proxy;
}
else
{
e.WebTest.Proxy = null;
}
}
}
Tuesday, July 22, 2008
Importance of specifying the right FileAccess option.
System.UnauthorizedAccessException: Access to the path 'C:\test.txt' is denied.
The line at which it failed was
FileStream fs = new FileStream(path, FileMode.Open);
I checked my access permissions on the file and everything was perfect. Except that I noticed that this file test.txt was marked Read Only. When I changed the above line to include the FileAccess option
FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);
the code executed successfully!
So moral of this is that wherever possible we should specify the FileAccess option for file operations.
What is success?
The journey of life takes us through varied experiences like landing an admission at a prestigious college, earning a degree, getting hired,...
-
Recently after a domain password change, I got the following error in trying to run the webrole. Can not log on locally to WebRole as us...
-
In trying to setup a site on a Windows 2008 server, I ran into the following error message Handler "PageHandlerFactory-Integrated"...
-
I was trying my hands at creating a .NET 2.0 component that can be consumed by a COM application. One of the errors I got in the process of...