Skip to main content

Posts

Showing posts from 2011

UML Use Case

Do not try to make sense of it as an English word. Use of Case, Case of Use.. no no. Use Case title is the statement of the actor's goal in a verb phrase. e.g. “Admit Patient” Actor : Someone who has a goal in using the system. “Nurse”

Regular Expression for Numerics (Integer and Decimal)

Sometimes you need to validate your ASP.net web form user input for numeric values.. The following works for me Any integer, positive or negative ^[-+]?[0-9]*$ Validates -9 9 12 1352345234 –3434134 +34 Does not validate -9.6 +89.9 Any decimal/float value Being: positive or negative, specified maximum length, limited number of decimals ^[-+]?\d{0,12}(\.\d{1,2})?$ Validates 123456789012.34 -123456789012.34 +123.45 D0es not validate 1234567890123 1234.123

Reversing Yakov Smirnoff

Truncate LOG files of SQL Server

USE tmssmall GO DBCC SHRINKFILE(tmssmall_log, 1) BACKUP LOG tmssmall WITH TRUNCATE_ONLY DBCC SHRINKFILE(tmssmall_log, 1) GO   tmssmall is name of database So… copy the above text entirely to Notepad Ctr+H Find what is ‘tmssmall’ Replace with is ‘yourdatabasename’ OK. Copy the new text and execute query Save space!!

Datatable Grouping in .Net 2.0

This functionality is missing in the GridView control. There are various ways to go about it. I thought I will do it without Ajax or other overheads. The following code takes in a Datatable as input and returns the grouped Datatable as output. Make the output datatable the source of any gridview! The parameters allow multi column grouping and sorting becomes -----------------------------------------------------------------------   Public Shared Function GroupDataTable(ByVal T1 As DataTable, ByVal GroupByColumns As String(), _     Optional ByVal SortOrder As Boolean() = Nothing, _     Optional ByVal SumColumns As String() = Nothing, _     Optional ByVal HeaderCell As Integer = 0 _     ) As DataTable         Dim T2 As New DataTable         Dim sortStr As String = ""         Dim i, j, N, T, m As Integer         Dim dR1 As DataRow         Dim drSum As DataRow         Dim xS As Double         Try             Dim dView As DataVie