Sunday, July 25, 2010
Saturday, June 26, 2010
UML Sequence Diagrams - Activation Blocks - steps
Start by drawing the actor initiating the activity and the participating classes and objects
Once you have added all of the messages you want to show, finish off your activation blocks. Waiting until the end is easier, because you know how long they need to be.
Monday, June 21, 2010
UML Sequence Diagrams - Activation blocks - foreach statements
UML Sequence Diagrams - Activation blocks
Activation blocks are usually only necessary once you start sequencing multiple calls within the same object or class.
If a sequence starts in an asp.net web page, such as Page_Load(...), and then a call is made to a method called InitializeVariables(), and then one to GetLogonUser(), as in Fig 1. Did Page_Load(...) call GetLogonUser(), or did InitializeVariables()?
We don't know unless we use activation blocks (See Fig 2 and Fig 3, showing each way).
Fig 2 shows that InitializeVariables() called GetLogonUser(),
Sunday, June 20, 2010
Sequence Diagram - If statement
Friday, June 18, 2010
If you can, turn viewstate off
HierarchyLoadMode="ServerOnDemand"
Do your data load for the top level parent table in The NeedDataSource Event
if (!e.IsFromDetailTable)
{
grd.DataSource = DAL.Practice.Catalog.GetMasterCatalogSuppliers();
}
Load the child table data in the _OnDetailTableDataBind event
//Get the id of the parent item
GridDataItem gridParentDataItem = e.DetailTableView.ParentItem as GridDataItem;
int brandID = gridParentDataItem.GetColumnInt32("BrandID");
//Note that the GetColumnInt32 is an Extension Method I wrote, you won't have it
// bind the detail grid
grd.MasterTableView.DetailTables[0].DataSource = Get...(brandID);
Friday, June 11, 2010
Tuesday, June 8, 2010
How can I make query to find "ClientID = 2660" in all tables in The Database?
in Sql , set Results to Text
Run this query
SELECT 'Select * from ' + dbo.sysobjects.Name + ' where ClientID = 2660' FROM dbo.syscolumns
INNER JOIN dbo.sysobjects ON dbo.syscolumns.id = dbo.sysobjects.ID
WHERE dbo.syscolumns.Name = 'ClientID'
Then copy the queries it makes, past them into a query window, and run them
A better Property Macro Snippet
'Make sure we are dealing with selected text in the form of:
'Variable_Name Type Default_Value
Dim Words() As String = line.Trim().Split()
If Words.Length < 2 Then
Return "Input in invalid format! Use PropName Type Default_Value"
Else
Return "public " & Words(0) & " " & Words(1) & Words(0) & vbNewLine & _
vbTab & vbTab & "{" & vbNewLine & _
vbTab & vbTab & vbTab & "get { return " & Words(1) & "; }" & vbNewLine & _
vbTab & vbTab & "}"
End If
End Function
Public Sub CreateSimplePropertyVB()
Dim TS As TextSelection = DTE.ActiveDocument.Selection
Dim Insertion As String, Line As String
Dim Lines() As String = TS.Text.Split(vbNewLine)
For Each Line In Lines
Insertion &= MakePropertyGet(Line)
Next
TS.Delete()
TS.Insert(Insertion)
End Sub
Shared View Desktop monitor sharing
https://connect.microsoft.com/site/sitehome.aspx?SiteID=94&wa=wsignin1.0
Snippet Public Properties for Controls
xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>propGetControlTitle>
<Shortcut>propGetControlShortcut>
<Description>Code snippet for propGetControlDescription>
<Author>Mike SneenAuthor>
<SnippetTypes>
<SnippetType>ExpansionSnippetType>
<SnippetType>SurroundsWithSnippetType>
SnippetTypes>
Header>
<Snippet>
<Declarations>
<Literal>
<ID>typeID>
<Default>LabelDefault>
Literal>
Declarations>
<Code Language="csharp">
public $type$ $end$$type$
{
get{ return $selected$; }
}]]>
Code>
Snippet>
CodeSnippet>
CodeSnippets>
Monday, June 7, 2010
Visual Studio 2008 app_offline.htm
1. Make an external tool definition
Tools... External Tools...
Add...
Title - 'Delete
App_Offline'
Command -
'cmd.exe'
Arguments - '/K "del
app_offline.htm'
Initial directory -
'$(ProjectDir)'
Use Output Window =
checked
2. put an entry on the toolbar to call it
Click on the down arrow of the toolbar... Add or
Remove Buttons... Customize
Categories - 'Tools'
Commands - External Tools 3
(Instead of 3, the 1 based index of your External Tool above)
Drag the command to the toolbar
Click on it and rename it
general db search
Declare @Search varchar(255)set @Search = 'IsThirdPartyProduct' --Set the search text hereDECLARE @SearchTxt varchar(255)SET @SearchTxt = '%' + @Search + '%'SELECT o.[name],
CASE
o.xtype
WHEN 'TR' THEN 'Trigger'
WHEN
'U' THEN 'User Table'
WHEN 'F' THEN 'Foreign Key'
WHEN 'C' THEN
'Check
Constraint'
WHEN 'UQ' THEN
'Index'
WHEN 'S' THEN 'System
Table'
WHEN 'D' THEN 'User Defined Data
Type'
WHEN 'PK' THEN 'Primary
Key'
WHEN 'FN' THEN 'Function'
WHEN 'TF' THEN
'Table Function'
WHEN 'V' THEN
'View'
WHEN 'P' THEN 'Stored
Procedure'
ELSE 'Other'
END
ObjType,
(SELECT TOP 1 SUBSTRING([Text],PATINDEX(@SearchTxt,
[Text]) - 25, 100) + '...'
FROM dbo.syscomments
WHERE [id] = c.[id]
AND
PATINDEX(@SearchTxt, [Text]) > 0) ObjText
FROM dbo.sysobjects
o
INNER JOIN dbo.syscomments c
ON o.[id] =
c.[id]
WHERE c.encrypted = 0
AND c.colid =
1
AND EXISTS( SELECT [id]
FROM dbo.syscomments
WHERE [text] LIKE
@SearchTxt
AND [id] =
c.[id])
ORDER BY ObjType, o.[name]
Search for a column name in sql db
SELECT dbo.sysobjects.Name FROM dbo.syscolumnsINNER JOIN dbo.sysobjects ON dbo.syscolumns.id = dbo.sysobjects.IDWHERE dbo.syscolumns.Name = 'UserID' --and dbo.syscolumns.xtype = 175--AND dbo.sysobjects.type = 'U'
Update 2 tables in a transaction
ALTER PROCEDURE [dbo].[usp_PracticeBillingAddress_Update]
(
@PracticeID
INT, @AddressID INT, @AttentionOf VARCHAR(50) , @AddressLine1 VARCHAR(50), @AddressLine2 VARCHAR(50), @City VARCHAR(50), @State CHAR(2), @ZipCode CHAR(5), @ZipCodePlus4 CHAR(4), @ModifiedUserID INT)
AS
BEGIN
DECLARE @TransactionCountOnEntry INT -- Transaction Count before the transaction begins, @Err INT -- holds the @@Error code returned by SQL ServerSELECT @Err = @@ERRORSET TRANSACTION ISOLATION LEVEL READ UNCOMMITTEDIF @Err = 0BEGIN SELECT @TransactionCountOnEntry = @@TRANCOUNTBEGIN TRANSACTIONEND IF @Err = 0BEGIN UPDATE dbo.AddressSETAddressLine1
= @AddressLine1, AddressLine2 = @AddressLine2, City = @City, State = @State, ZipCode = @ZipCode, ZipCodePlus4 = @ZipCodePlus4, ModifiedUserID = @ModifiedUserID, ModifiedDate = GETDATE()WHEREAddressID
= @AddressIDSET @Err = @@ERRORENDIF @Err = 0BEGINUPDATE dbo.PracticeBillingAddressSETAttentionOf
= @AttentionOf, ModifiedUserID = @ModifiedUserID, ModifiedDate = GETDATE()WHEREPracticeID
= @PracticeID AND AddressID = @AddressIDSET @Err = @@ERRORENDExec usp_PracticeBillingAddress_UpdateCentralDecentral @practiceID, @ModifiedUserIDIF @@TranCount > @TransactionCountOnEntryBEGINIF @Err = 0COMMIT TRANSACTIONELSEROLLBACK TRANSACTION-- Add any database logging here ENDRETURN @ErrEND