Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts

2020-10-09

Concurrent .Net code testing framework: Coyote

 "Coyote is a set of .NET libraries and tools designed to help ensure that your code is free of bugs. Too often developers are drowning in the complexity of their own code and many hours are wasted trying to track down impossible-to-find bugs, especially when dealing with concurrent code or various other sources of non-determinism (like message ordering, failures, timeouts and so on)."

Link to Coyote homepage

2011-12-29

"Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed." error

After creating a new MVC3 web application in Visual Studio 2010, running it and trying to log in (or do any operation that needs MembershipProvider access) throws the following exception/error:

Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.

If everything worked fine an aspnetdb.mdf file would have been created in the App_Data folder with the necessary structure.

I do not know why but the solution is deleting the
c:\Users\[Username]\AppData\Local\Microsoft\Microsoft SQL Server Data\ 
folder entirely.

2010-10-07

OnRowCommand does not fire in ASP.Net gridview

All of a sudden all the command buttons stopped working in a gridview in my project. The OnRowCommand event did not fire.
Turns out last week I set the EnableViewState property of the grid to false. Never disable the ViewState of a gridview!

Short:
If all of a sudden the OnRowCommand stops firing in your ASP.Net GridView make sure that the EnableViewState property of the grid is set to true.

2010-08-30

Floating Point / Single to Hexadecimal (IEEE 754)

public string FloatToHex(float valueToConvert)
{
   byte[] byteArray = BitConverter.GetBytes(valueToConvert);
   Array.Reverse(byteArray);
 
   return BitConverter.ToString(byteArray).Replace("-""");
}

Output example: 12345.6 -> 4640E666

Solution came from VB.NET Hexadecimal to Floating Point / Single (IEEE 754)
What is IEEE 754 Floating-Point Arithmetic Standard?

2010-05-11

2010-05-09

Performance counters

Found a nice article about performance counters that also describes class generation at compile time
also

2009-12-23

2009-04-09

Double page load/postback

I have spent 3 days once to figure out why an ASPX page does a double page postback when it shouldn't. The first request was OK, then immediately a second postback followed without the post data. This strange behavior occurred only in Firefox.

I discovered what the issue was:
I had an image control on the page with it's src attribute empty. Firefox uses the current page's URL as the src of the image. Hence the second postback.

This guy explains it better than me:

Programmer goodie

2009-01-16

99 Bottles of Beer

I found this (IMHO) awesome, original and creative site which holds a collection of the Song 99 Bottles of Beer programmed in more than 1200 programming languages.
My favorite was the LOLCODE.

2008-12-18

If programming languages were religions

I do not agree with this, but for the sake of you geeks, here is a forced funny article:

2008-10-28

CSS hacks & browser detection

A very nice article about browser detection in CSS, that helped me a lot.

2008-09-17

How to add spaces to ASP ListBox control

Problem:

When trying to indent some elements of the ListBox or DropDownList ASP controls with multiple spaces the browser only renders one space. Trying to add   instead of a space character renders the letters "&", "n", "b", "s", "p".

Solution:

Add Server.HtmlDecode(" ") instead of a simple space and everything should look fine.

private void FillList()
{
    listBox.Items.Add("Root");
    listBox.Items.Add(Server.HtmlDecode(" ") + "First level");
    listBox.Items.Add(Server.HtmlDecode("  ") + "Second level");
    listBox.Items.Add(Server.HtmlDecode("  ") + "Also second level");           
}

2008-06-25

Test tool for web applications: Selenium

selenium-rc

"Selenium is a test tool for web applications. Selenium tests run directly in a browser, just like real users do. It runs in Internet Explorer, Mozilla and Firefox on Windows, Linux, and Macintosh, Safari on the Mac.

The quickest way to learn Selenium is via a Firefox plugin called Selenium IDE. It is quite compelling for developing tests in and quickly trying out Selenium before choosing Selenium for your project.

There are two modes of operation for Selenium - Core and Remote Control (RC).  Remote Control mode also has a related capability called Selenium Grid that allows you to throw hardware at tests to make it all faster."

2008-05-13

ASP.NET Development Server problems under Vista (maybe Windows 7)

Problem
When hitting Ctrl-F5 in Visual Studio 2005/2008 to run a web application in Vista, the Development Server gets started, Internet Explorer opened but nothing happens, although the web application is set to run with Development Server, ASP, ISS and everything required is installed.

Solution
Go to c:\Windows\System32\drivers\etc\ and open the file named hosts with a text editor
Search for the line containing "::1" mapped to "localhost"
Change "::1" to ":::1" by adding an extra ":"
Save the file and everything should be running fine

2008-04-13

Failed to access IIS metabase error while trying to access ASP page on localhost

When trying to open a website on my localhost I received the following error message:

"Failed to access IIS metabase.
Description: [...]
Exception Details: System.Web.Hosting.HostingEnvironmentException: Failed to access IIS metabase.

The process account used to run ASP.NET must have read access to the IIS metabase (e.g. IIS://servername/W3SVC). For information on modifying metabase permissions, please see http://support.microsoft.com/?kbid=267904."

After some digging I discovered that the cause of the problem is that I installed Visual Studio 2008 before installing IIS.
The problem can be fixed by running aspnet_regiis.exe /i (I think it's called aspnet_iisreg.exe in older versions of VS) from the Visual Studio 2008 Command Prompt or from the C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727> folder.