Disk Cleanup Utility should delete temporary .Net files.

 

I noticed that one of our servers with low disk space had a lot of  security.config.cch files(or security.config.cch.number) in individual user folders, as well as in .Net.Framework config directories.

According to the thread 
http://www.pcreview.co.uk/forums/thread-1228604.php -it seems they are safe to delete.

But why they are located in config folder, not in some temporary directory, like
NETFramework{version}Temporary ASP.NET Files folders?



And they should be suggested for deletion by standard MS windows Disk cleanup utility.

I’ve submitted this suggestion to MS Connect

Links:How to save html file to PDF

I want  to save html file generated by ASP.NET to PDF.

I was pointed to itextsharp open source project.

I found a few links, discussing how to do it:

http://www.velocityreviews.com/forums/t72716-using-itextsharp-to-generate-pdf-from-aspnet.html

 iTextSharp Tutorial Chapter 7: XML and (X)HTML

 iTextSharp Demo(asp.net 2.0):http://rubypdf.com/itextsharp/tutorial01/ap07Chap0707.cs.html introduces HtmlParser.Parse.(see the source code here)

We tried to use it.

HtmlParser.Parse does NOT throw any error , but the pdf file generated from this could be blank/empty.
Debug output shows the messages from parser, if Html file has invalid structure.

This is a big problem: HtmlParser.Parse is very strict and any minor mistakes in HTML causes exceptions or almost silent creation of empty PDF file.

The post of Creating pdf in .NET from html has a lot of interesting comments, including suggestion  to use HTML Agility Pack.



We are going to try how HtmlParser.Parse will be tolerant to html, regenerated from HTML Agility Pack.

The thread   [ 1819614 ] Error parsing images in HTML files has description of the fix

Another option is always use XML complient HTML, verified by http://validator.w3.org/#validate_by_input ,but it could take some time to tidy up the HTML generated from ASP.NET  



 http://www.google.com.au/search?source=ig&hl=en&rlz=&q=HtmlParser.Parse&meta=

 Links to other products:  

Generate PDF from ASP.NET gives a few references to different products including iTextSharp

 Dynamically Generating PDFs in .NET : http://www.developerfusion.co.uk/show/6623/ 

 Another option is to try (and possibly buy) commercial product abcpdf 

 

I saw a suggestion to use http://www.htmldoc.org/ -the command line version of HTMLDoc to convert HTML to PDF, but it is not good for programmatic access.

 

Call Synchronous Web Services Methods Asynchronously

I need to asynchronously call a few web services at the same time.
VS 2005/2008 Web services proxy  generator creates several proxy class methods , including
synchronous MyWebMethod(parameters) and asynchronous pair BeginMyWebMethod(parameters) and EndMyWebMethod(parameters)
The way to use Begin/End methods is described in article “Calling Web Services Asynchronously ” 
 
Even if I am going to use asynchronous method in the real application, for unit testing(including TestHarness ) it is much easier to start with synchronous version. 
Correct population of all  input parameters and reading response can take some time for coding/debugging(if the web service method is not trivial).
Usually this code wrapper implemented as a separate function (e.g. CallMyWebMethod) in your client application.
 
If you want to use asynchronous pair , your will need to duplicate the wrapper functions as BeginCallMyWebMethod , that will filled request data and EndCallMyWebMethod function, to read and interprete response.
 
I found that it is simpler to use ability to call Synchronous Methods Asynchronously (using delegate invoke) directly in your code rater than use pre-generated Begin/End pair.
 
// call the service.

MyClass.ExecuteDelegate requestDelegate =new MyClass.ExecuteDelegate(myRequest.CallMyWebMethod);

MyAsyncState asyncState =new MyAsyncState (myData);

IAsyncResult asyncResult= requestDelegate.BeginInvoke(null, asyncState);

 //and when call will be completed

 AsyncResult asyncResult=(AsyncResult)ar;

MyClass.ExecuteDelegate requestDelegate = (MyClass.ExecuteDelegate)asyncResult.AsyncDelegate;

 MyResponseClass myResponse =(MyResponseClass )requestDelegate.EndInvoke(asyncResult); 

In this case the actual custom  application code of CallMyWebMethod function stays unmodified for both sync and async execution.

Similar approach was described in my old post Asynchronous long-running tasks in ASP.NET application

T-SQL not equal WHERE condition excludes records with null values.

I’ve had a query which expected to return all records except with specified value in the nullable column. 

Select  * FROM MyTbl where  (MyColumn<>‘ValueToExclude’)    

 But the query didn’t return any records with null values in the column.

 The correct query to include records with null should have explicit is Null condition like the following: 

Select  * FROM MyTbl where (MyColumn<>‘ValueToExclude’ or MyColumn is Null)

 

Update: I found, that it is a well known problem, discussed in many forums, e.g here and here.

Another workarounds are:

where (Coalesce(MyColumn,””)<>‘ValueToExclude’ ) or

where (IsNull(MyColumn,””)<>‘ValueToExclude’ )

 There is similar article here: http://www.devx.com/vb2themax/Tip/18541

Visual studio conversion wizard opens each time for converted 2008 solution

I have a big solution in VS 2005 that I converted to VS 2008. However each time when I closing and then re-opening solution, the Conversion Wizard opens again, runs for some time and shows that conversion completed successfully.

UPDATE: I finally found the reason of re-running of Conversion Wizard. My solution had some UNLOADED projects, that were in VS 2005 format and failed to be converted.  I expected that unloaded projetcs will be ignored , but Conversion Wizard each time tried to convert them. After I removed UNLOADED not-converted projects from the solution, Conversion Wizard is not ivoked any more.

It regenerates some DataSet.Designer.cs,  in generated file shows “Runtime Version:2.0.50727.1433″(which is good-compatible with 2005).
Conversion report doesn’t show designer.cs files as converted, and the parent project has status-no conversion required.

I couldn’t find any problems in the solution file.

 The solution has first line: 

Microsoft Visual Studio Solution File, Format Version 10.00

which should be sufficient according to How to use solutions and projects between Visual Studio 2005 and 2008

 The similar issue discussed in thread Confusion when opening VS 2005 project in VS 2008

 Related links (that do not help with my problem):

Don’t sweat migrating legacy .NET projects to Visual Studio 2008

 I hate and loath the Visual Studio Conversion Wizard

 The ProjectConverter application to convert back and forth between VS2005 and VS2008 is available at: http://home.hot.rr.com/graye/Articles/ProjectConverter.htm
It will be good if the converter be able to open individual project files, not solutions only.

 Rick Strahl‘s Moving Projects/Solutions between Orcas and Visual Studio 2005 

 and my own post Problems after Installing VS 2008 side-by-side with VS 2005

Find which MOM rules use a script.

In MOM 2000 there is no ability to quickly find which rules use the script.

I found a script in MOM/Rules/Advanced/Scripts/  ( or alternatively in DB one point Script table) and my question was which rules run the script.

Use [OnePoint].[dbo].[ProcessRuleToScript] table to find the rules.

 

select * from [OnePoint].[dbo].[ProcessRuleToScript]

where Idscript=‘5c4a58cf-709c-4a1f-895a-0aec79ff55a9′(this GUID is just example)

 

select * from [OnePoint].[dbo].[ProcessRule]

where idProcessRule in

(

select idProcessRule from [OnePoint].[dbo].[ProcessRuleToScript]

where Idscript=‘5c4a58cf-709c-4a1f-895a-0aec79ff55a9’

)

The SQL gives names of rules, but I wasn’t able to find where ProcessingRulePath is stored, so I had to manually expand rules tree to find rules in MOM MMC console

View Windows Workflow Tracked Data Tools

For some reasons, it took me a few google search attempts to find the following tools:

 MSDN includes  Workflow Monitor Sample -Windows executable to view details of tracked workflows.

When downloaded, copy EXE to your bin directory when custom workflow DLLs are located.
Ensure that tracking database doesn’t have too many instances, to avoid timeouts.

 

Jon Flanders put together the ASP.NET implementation of the Workflow Monitor SDK sample. 

 MSDN Tracking Samples mostly described how to store tracking data, but  ConsoleTrackingService Sample shows how to write the contents of tracked data to the console.
It is good for debugging, getting trace in Output window, but the records in the sample are too wordy. The similar class in Pro WF: Windows Workflow in .NET 3.5 is more brief- output one line per event. The issue with showing time of event in UTC can be fixed by calling  the method

        //the logged dateTimes are in UTC

        private DateTime GetDateInRequiredTimeZone(DateTime utcDate)

        {

            //TODO: if required, leave in UTC or change as configurable

            return utcDate.ToLocalTime();

        }

For configurartion tracking service see the answer in the thread Custom Tracking service in app.config, Web.config web service workflow

Related MSDN articles:Windows Workflow Foundation: Tracking Services Introduction“, Windows Workflow Foundation: Tracking Services Deep Dive