Way for localizing MessageBox in Windows Forms

Very good article in code project, where you can see how the buttons of MessageBox can use custom text labels. The natural language of .NET platform will be overridden and only your labels will be shown.


Actually if you use MessageBoxOptions in the parameters of MessageBox.Show(..) only the original labels are shown. But I don't think this is big problem.

How to map an extension for server side scripting - html to php

Sometimes we need including some functionality or server includes into static web files - html. But changing the extension can lose current search engine index and rank. That is why leaving the fiels with the same name is the better way. Easy html files can be mapped to be parsed as php file.

IIS 7.0:
1. Open IIS Management Console
2. Open Web-site node
3. Open Handler Mapping
4. Add the extension as request path (*.html)
5. Set the handler application/library: something like C:\Program Files\PHP\php5isapi.dll
6. Name it and click OK

Just add the following row in the .htaccess file:
AddType application/x-httpd-php .html

SQL Server 2005 - Out Of Memory exceptions connected to its RAM usage

After the allocated RAM for SQL Server exceeds the System memory unexpected behavior of the server is present.

Here is a quick guide for configuring Sql server.


And remember: Never allocate less then 1 GB of RAM to SQL Server :)

VB.NET: General Exception Handling in Windows Forms


My.Application.UnhandledException Event is the way for handling all unhandled exceptions in an windows forms application. The application raises this event when it encounters unhandled exception.
For using the event editing ApplicationEvents.vb file is needed. By default ApplicationEvents.vb is hidden. For openning (unhiding) it use Project Properties -> Application tab -> View Appication Events.
Then the handler can be added/edited as in the example below:

Private Sub MyApplication_UnhandledException( _
ByVal sender As Object, _
ByVal e As Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs _
) Handles Me.UnhandledException

//write log, which is nessted in Application Data folder
My.Application.Log.WriteException( _
e.Exception, _
TraceEventType.Critical, _
"Unhandled Exception!")

//check up if the Event folder exists.
//if not - create new one
If Not EventLog.SourceExists("My software") Then
EventLog.CreateEventSource("My software", "My Software")
End If

//write event log, can be seen by Event Viewer
EventLog.WriteEntry("My software", _
e.Exception.ToString(), _
Catch ex As Exception

End Try

// code for notifying the user with user friendly message

//set the default application action (closing) not to be performed.
e.ExitApplication = False
End Sub
And from now on all unhandled exception in the application will be stored as exception information and stack trace in the application log file or in the Windows Event log and the user will receive friendly message.


Of course most of my posts give examples with VB and C# when they are different. Now I will give up this pleasure to R. Newman with his great post "Top-level Exception Handling in Windows Forms Applications"