Monday, February 11, 2008

Parse .net find windows output and create code!

The following bit of code saved me many hours of drudgery.
I do a find all in .net for the open database connection code,
copy it into my little app and create corresponding close connection code.
All of our asp pages need these lines of code at the end since
connections were no longer being closed automatically in our new db environment.
It not elegant or pretty but it did the job. The next logical progression would be to create a .net add-in that did this from within the IDE. Maybe next time.

Its a windows app with 2 multiline text boxes and a button.

Option Explicit On
Imports System.IO
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub TxtIn_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TxtIn.TextChanged
End Sub
Private Sub btnProcess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProcess.Click
process()
End Sub
Sub process()
Dim str As String
Try
txtOut.Clear()
str = "lessthanpercentsignhere" + Environment.NewLine
For Each s As String In TxtIn.Lines
Dim strOut As String
If s.IndexOf("()") > 0 Then
strOut = s.Substring(s.IndexOf("_init") + 5, s.IndexOf("()") - s.IndexOf("_init") - 5)
str = str + strOut + ".close" + Environment.NewLine
End If
Next
str = str + "percentgreaterthansignhere " + Environment.NewLine
txtOut.Text = str
Clipboard.SetText(str)
TxtIn.Clear()
Catch ex As Exception
End Try
End Sub
End Class

Saturday, November 24, 2007

Improve you LCD onscreen text viewing experience with Cleartype Tuning!

Improve your LCD viewing and reading experience.

Most of your probably know about cleartype and have it turned on, but
you may not know about the cleartype powertoy tuning applet.
Get this from Microsoft download and install it.
It greatly improves the appearance and readability of on screen text.
Don't wait another minute. get this NOW!

Monday, October 22, 2007

First blog. Debugging aspx custom controls in VS2005.

Wow! This is my very first Blog.

This is so usefull that I needed to capture it since I might never find it again.

Here's how to debug a .net aspx custom control in real time



Here's how i debug ALL my custom controls in real time.

In Order to debug a Custom Control you need to Start ANOTHER copy of Visual Studio along side your existing one,and pointing it to a test website.

This can be done byGoing To The Controls Project Properties and Selecting The Debug Tab then set the start action to `Start External Program` and set the box next to it to the location of devenv.exe from the correct folder of program files.i am using orcas beta2 here and this path is: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe

Now set the Command Line Arguments to: /Command File.OpenWebsite TheTestingWebSite.sln

Now The Final Step Is To Enter The FULL Path of Your SOLUTION FILE in the Working Directory text box.

Just press F5 to start your debugging Adventure.