C# (RSS)

C#

PDF in .NET

PDF in .NET

A newer and a good utility assembly, which I found, which could manage and generate PDF documents on the fly with simple code in C# and .NET. Check out http://itextsharp.sourceforge.net/ . It just contains a simple DLL that need to referenced from your solution, which does all the magic.

with 0 Comments

ConnectionString Manager

ConnectionString Manager

Most of us, who are using multiple SQLServer connections from our applications need to remember the connectionstring to be replaced in web.config to test the application with the different SQLServers. Either each and every time, we need to type the connectionstring parts. I just thought, I could start out writing a simple web application which could create the connectionstring from the Microsoft-provided DataLinks tool and then it can save the connectiongstring to a text file with a specific extension like .scn (Saved Connection Strings). Currently it saves one connectionstring per file, since I felt that would be easy. The other flexible options could be save all bunch in an XML file or as an Registry Entry.

Currently I have included the following basic options in the utility:

  1. Creates a new connection string, sets the item in the system clipboard and prompts to save it to a location.
  2. Edits an existing connection string , sets the item in the system clipboard and prompts to save it to a location.
  3. Double-clicking the .SCN file automatically launches the Edit action for the connectionstring and then the control flow resumes normally.

TODO:

  1. Optionally, keep all connectionstrings in Registry.
  2. As an addon, encrypt the connectionstring and save it, to enable secure saving of confidential database login credentials.

I would try to upload the utility tonight to my Daffodilnet workspace and then update the URL here.

with 0 Comments

Dr. IIS -- Clear Cache, Restart IIS Processes etc.

Dr. IIS

Any developer using ASP.NET and VS.NET IDE would have experienced issues with Cache Folder of ASP.NET, VSWebCache having mismatched versions and hence breakpoint not getting hit. We normally use tricks like clearing it manually

This weekend, I was relatively free and thought I would get some practice on Windows Forms in .NET. I made a small application in Windows Forms and nicknamed it Dr. IIS.

I have tried addressing the following issues:

  • Recycle ASPNET Worker Process (currently it detects aspnet_wp as processname. We need to generalize it to w3wp for Windows 2003)
  • Restart W3SVC Service
  • Purges IDE Cache (VsWebCache)
    • Detects first any Visual Studio .NET instances are running. If yes, this option is disabled and a button appears to close existing Visual Studio Instances and then the checkbox gets enabled.
  • Purges Temporary ASP.NET Files from the default version of .NET Framework
  • Pause Indexing Service
  • Also checks whether the logged on user is Administrator. If the user does not have administrator privileges, then the application exits.

I understand that there are lot of scope of improvements to this. Perhaps my next TODO in this would be:

  • Generalize Detection of Worker Process (ASPNET for IIS 5.1 or lower and W3WP for IIS 6)
  • Threaded Application Model
  • CommandLine or Silent Mode
  • Detect and Customize the application to the configured .NET Framework (in case multiple versions exist)
  • Selectively add the required folders to Indexing Service Catalog for exclusion from Indexing.

I would keep updating it in my personal workspace and would publish the URL here. Please do send me your suggestions and improvements for the same.

The current download URL is http://www45.brinkster.com/daffodilnet/tools/driis.aspx 

with 3 Comments

Automated EventLog Clearing and Backup Tool

Automated EventLog Clearing and Backup Tool

Developers writing Windows Services would normally heavily use Windows EventsLog to log messages from the application to System,Application, Security etc builtin logs or to custom log sources too. During development the amount of messages getting logged would be enormous and sometimes during development and testing, we normally and frequently right click clear individual logs before re-running the service again.

I just thought instead of repeatedly doing this, let us put a small Windows Application, enumerate all the available System Logs. The user has to simply run the application, select the logs he wants to clear, and hit clear button.

Out of my own interest, I wanted to get some feel of GUI tricks in Windows Forms like ProgressBar and have used some tricks like ThreadPool to update the parent thread to update it.  Tonight I would try to upload to DaffodilNet page at

http://www45.brinkster.com/daffodilnet/eventlogmanager.aspx

TODO:

There are lot of scope of improvement of this tool. Perhaps significant points to improve upon are:

  1. Backup target to EVT (EventLog Native File). I am trying to explore the feasibility with WMI Api in .NET like the ones in System.Management namespace.
  2. Security Checks. If a non-administrative user loads, then instead of attempting the thread and crashing it can proactively say 'Not all sections of the application are executable by the logged on user, since it needs additional administrative privileges'. Remember, when you run Disk Administrator in Control Panel -> Administrative Tools -> Computer Manager, you see this alert.
  3. Perhaps if you have some suggestion, do send me. I would try to incorporate it.
with 0 Comments

QueryExpress -- Generic Tool to Database Updates

QueryExpress -- Tool for Database Updates

A little neat tool from http://www.albahari.com/ which facilitates you to connect to SQLServer, Oracle or any OLEDB Compliant databases. Furthermore, it comes with its source code availability. Its salient features being Threading and Async QueryExecution, plain vanilla XML serializing of connection details and introducing developers to use TypedDataSet.

It was an interesting coincidence that I got to know of QueryExpress sometime about 3 years ago, when we were in  a small organization in Chennai executing a portfolio management project for a client based in California. The database was IBM DB2 and there were no friendly database connector tools and the then ignorance of us in DB2 made us very desparate and discouraging.

A brief search in Google revealed this nice tool. This has enthralled me so much. Even me, nowadays try to update the source, to keep it as a supreme product.

Here are the links to QueryExpress:

  1. QueryExpress home on http://www.albahari.com/ : http://www.albahari.com/query express.html
  2. QueryExpress with ODBC Support: http://www45.brinkster.com/daffodilnet/queryexpress.aspx

Do send us suggestions on what you would like to see in QueryExpress...

with 0 Comments

SC.EXE

Windows Services -- Breeze to develop in C#

Developing Windows Services is no longer a nightmare, thanks to friendly .NET BCLs, beloved VS.NET Intellisense. But during development, due to errors, we might need to manage the SCM database directly like deleting the Windows Service and that too, without having the assembly on hand, which is impossible using InstallUtil.exe.

I have developing a Scheduler Service for our application and this was a hurdle for me. Fortunately, I came across this tool called SC.EXE available from Microsoft itself.

It comes with nice documentation at: http://msdn.microsoft.com/library/en-us/dndllpro/html/msdn_scmslite.asp?frame=true

Somewhere else, I got a nice downloadable Word document also. I would search again and try to update the same too here.

with 0 Comments

Encryption Wrapper in .NET

Rich Encryption Wrapper for .NET

.NET provides rich support for Encryption in its System.Security.Cryptography namespace.

Of late, I was searching for some info when I came across this XCrypt Component for Encryption in .NET.

Check it out @ http://www.codeproject.com/csharp/XCrypt.asp 

It supports almost all Encryption types in .NET and provides an elegant wrapper for the same. It supports both hashing and non-hashing algorithms within it.

with 0 Comments

Cool Assembly Viewer for .NET

Cool Assembly Viewer for .NET

Just browsing for some info and I came across this nice tool. Check out:

http://www.jbrowse.com/products/asmex/

It is quite similar to ILDASM tool that ships with .NET. It also comes with sourcecode. The animation in Help About is also really nice.

For beginners in .NET, the source can be very much useful for learning GDI+ in .NET.

with 0 Comments

An IDE that you can customize to your needs...

Visual Studio .NET Extensibility API

Just I was searching for some Runtime.InteropServices examples and I came across some Visual Studio .NET automation examples. Perhaps sometime back, I have been discussing with you through my other weblog at http://deepak.blogdrive.com/ regarding a automated build tool called BuildIt.

Perhaps the following URL would throw more light and give more examples on Visual Studio .NET Extensibility API:

http://www.microsoft.com/downloads/details.aspx?familyid=3ff9c915-30e5-430e-95b3-621dccd25150&displaylang=en

with 0 Comments