ShowUsYour<Blog>
Irregular expressions regularly
-
Kickstarter.net
Recently I've been trialling a product called Kickstarter [ Kickstarter website ] with a view to using it for:
- Stored Procudure generation
- Data Access Layer code generation
- Business Objects code generation
- Web Forms Creation
-
Windows development by a Web developer
Man, is it just me or what? Everytime I decide to stray from my territory (Web) into other precincts (Windows) I get lost.
-
MarkItUp.com
If you'd like to be able to post colorized Html snippets, you can use this page:
-
dotNetSnippets
If you'd like to enable Tips-n-Hints on your site try this. Save the following file as C:\Inetpub\WwwRoot\TestWidget.html Then fire up a browser and point it at http://localhost/TestWidget.html '''''''''''''''''''''' ' TestWidget.html '''''''''''''''''''''' <html> <head> <script language="javascript" src="http://www.flws.com.au/Snippets/Snippets.asp"></script> </head> <body> <a href="javascript: showTips() ;" class="SnippetHyperlink">Display Tips</a><br /> <a href="javascript: hideTips() ;" class="SnippetHyperlink">Hide Tips</a> </body> </html>
-
Blog your Messenger conversations :-)
For anyone else that likes to archive or post MSN messenger conversations to their 'blog, here's a little RegEx that I wrote to convert the messages into Html. To use it just save your message as a text file and open in VisualStudio .NET:
-
ASP Context Module - Framework
<% '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Module: MarkItUp_BeginRequest.asp ' Author: Darren Neimke ' Created: 23-May-2002 ' Purpose: Refer notes: AuthenticationArchitecture.txt ' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''' 'Public Module Level Variables ''''''''''''''''''''''''''''' Public Current ' As CurrentSession Public CurrentPage ' As Page Public CurrentUser ' As User Public FormsAuthentication ' As AuthenticationProvider ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Sub BeginRequest() ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Dim curPage ' As Page Dim curUser ' As User Dim curSession ' As CurrentSession Set curPage = New Page Set curUser = New User Set curSession = New CurrentSession Set FormsAuthentication = New AuthenticationProvider Set CurrentUser = curUser.FromString( Session( "CURRENT_USER" ) ) Set CurrentPage = curPage Call curSession.SetEnvironment( CurrentUser, CurrentPage ) Call curSession.Authorize() Set Current = curSession End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Sub OnAuthenticate() ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Session( "CURRENT_USER" ) = CurrentUser.ToString() End Sub ' Fire the init event Call BeginRequest() ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Class CurrentSession ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public User ' As User Public Page ' As Page ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Sub SetEnvironment( user, page ) ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Set Me.User = user Set Me.Page = page End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Sub Authorize() ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' If Not ( Me.Page.IsAuthenticationPage ) And ( Me.Page.RequiresAuthentication ) Then If Not Me.User.IsAuthenticated() Then 'Response.Write Me.Page.IsAuthenticationPage & "<BR>" 'Response.Write Me.Page.RequiresAuthentication & "<BR>" 'Response.Write Me.User.IsAuthenticated() & "<BR>" 'Response.Write Session( "CURRENT_USER" ) & "<BR>" 'Response.End FormsAuthentication.RedirectToLoginPage() ' TODO: Add logic to allow for role based checking End If ElseIf Me.Page.IsAuthenticationPage And Not Me.User.IsAuthenticated() Then FormsAuthentication.RedirectUrl = Request.QueryString( "RedirectUrl" ) End If End Sub End Class ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Class Page ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public RequiresAuthentication ' As Boolean Public IsAuthenticationPage ' As Boolean ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub Class_Initialize() ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Dim bRequires Dim i Dim arrSecured bRequires = False arrSecured = Split( Application( "MIU_PAGES_TO_SECURE" ), "," ) For i = 0 To UBound( arrSecured ) If Request.ServerVariables( "PATH_INFO" ) = arrSecured( i ) Then bRequires = True Exit For End If Next Me.RequiresAuthentication = bRequires If Request.ServerVariables( "PATH_INFO" ) = Application( "MIU_LOGIN_PATH" ) Then Me.IsAuthenticationPage = True Else Me.IsAuthenticationPage = False End If End Sub End Class ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Class AuthenticationProvider ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private pRedirectUrl ' As String ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Sub Logout() ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Session( "CURRENT_USER" ) = "" Response.Redirect( Application( "MIU_DEFAULT_ENTRY_PATH" ) ) End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Property Let RedirectUrl( vnt ) ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' If Len( Trim( vnt ) ) > 0 Then pRedirectUrl = vnt End If End Property ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Property Get RedirectUrl() ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' If Len( Trim( pRedirectUrl ) ) > 0 Then RedirectUrl = pRedirectUrl Else RedirectUrl = Application( "MIU_DEFAULT_ENTRY_PATH" ) End If End Property ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Sub RedirectFromLoginPage() ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' If Len( Trim( Me.RedirectUrl ) ) > 0 Then Response.Redirect( Me.RedirectUrl ) End If End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Sub RedirectToLoginPage() ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Response.Redirect( Application( "MIU_LOGIN_PATH" ) & "?RedirectUrl=" & Request.ServerVariables( "URL" ) ) End Sub End Class ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Class User ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' TODO: implement as private vars with public accessors Public ID ' As Int Public Email ' As String Public Roles ' As Int() ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' construct a user instance from a userID Public Sub Init( ByVal userID ) ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Me.ID = userID Me.Email = DBLookup( "[User]", "[ID]", userID, "[Email]", False ) Me.Roles = DBLookup( "[User]", "[ID]", userID, "[UserTypeID]", False ) End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Function Authenticate( sEmail, sPassword, bPersistCookie ) 'As Boolean ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' If Len( Trim( sEmail ) ) > 0 And Len( Trim( sPassword ) ) > 0 Then Dim pwd, iId, ut iId = Nz( DBLookup( "[User]", "[Email]", sEmail, "[ID]", True ) ) pwd = DBLookup( "[User]", "[ID]", iId, "[Password]", False ) ut = DBLookup( "[User]", "[ID]", iId, "[UserTypeID]", False ) If sPassword = pwd Then Dim sql sql = "UPDATE [User] Set [LastLoginDate] = Now(), CountOfLogins = (CountOfLogins+1) WHERE [ID]=" & iId Call OpenDB() conn.Execute( sql ) Call CloseDB() Me.ID = iId Me.Roles = ut Me.Email = sEmail Call OnAuthenticate() Authenticate = True Else Authenticate = False End If Else Authenticate = False End If End Function ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Function IsAuthenticated() ' As Boolean ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Dim authString Dim userID, userType If InStr( 1, Session( "CURRENT_USER" ), "!!" ) <> 0 Then On Error Resume Next authString = Split( Session( "CURRENT_USER" ), "!!" ) userID = Split( authString( 0 ), "=" )( 1 ) userType = Split( authString( 0 ), "=" )( 1 ) On Error Goto 0 End If If Len( Trim( userType ) ) > 0 And IsNumeric( userType ) Then IsAuthenticated = True Else IsAuthenticated = False End If End Function ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Function IsAdministrator() ' As Boolean ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' If Len( Trim( Me.Roles ) ) > 0 Then Dim dbIsAdminRole dbIsAdminRole = Trim( DBLookup( "UserType", "[ID]", Me.Roles, "[IsAdministrator]", False ) ) IsAdministrator = CBool( dbIsAdminRole ) Else IsAdministrator = False End If End Function ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Function IsInRole( sRole ) ' As Boolean ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Dim dbRoleID, arrRoles, bFound, i bFound = False dbRoleID = Trim( DBLookup( "UserType", "[Description]", sRole, "[ID]", True ) ) arrRoles = Split( Me.Roles, "," ) If IsNumeric( dbRoleID ) And dbRoleID > 0 Then For i = 0 To UBound( arrRoles ) If arrRoles( i ) = dbRoleID Then bFound = True Exit For End If Next End If IsInRole = bFound End Function ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Function IsInRoles( sRoles ) ' As Boolean ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Dim arrRoles, i, bResult arrRoles = Split( sRoles, "," ) For i = 0 To UBound( arrRoles ) bResult = IsInRole( arrRoles( i ) ) If bResult = True Then Exit For Next IsInRoles = bResult End Function ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Function ToString() ' As String() ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ToString = "Id=" & Me.ID & "!!Roles=" & Me.Roles & "!!Email=" & Me.Email & "!!" End Function ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Function FromString( sUser ) ' As User ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Dim authString Dim userID, userType If InStr( 1, Session( "CURRENT_USER" ), "!!" ) <> 0 Then authString = Split( Session( "CURRENT_USER" ), "!!" ) On Error Resume Next Me.ID = Split( authString( 0 ), "=" )( 1 ) Me.Roles = Split( authString( 1 ), "=" )( 1 ) Me.Email = Split( authString( 2 ), "=" )( 1 ) On Error Goto 0 End If Set FromString = Me End Function ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Private Sub SetCookieExpires( dDate ) ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' End Sub End Class %>
-
Developer tutorials
-
Sledging
I discovered today that the term "sledging" is not widely known outside of Australia! Basically - in my own words - it's a term that means: saying things to or about an opponent that are derogatory.
-
New remoting resource
I see that Ingo Rammer [ Ingo's blog ] is creating a new weekly'ish newsletter to advise of Web Services (i.e.: Remoting) tips-n-tricks. You can go here to subscribe:
-
Bob from sysadmin
Error message: