Friday, May 28, 2004

Neowin Interview : Ben Goodger from the Mozilla Foundation

An interview with the chief Mozilla Firefox developer. Looks like 0.9 will be very good when it comes out. I wonder if a lot of people will switch when version 1.0 comes out? The future may be looking good for Mozilla. Will Internet Explorer be improved and the competition be renewed like in the Netscape days?

Tuesday, May 25, 2004

ASP.NET DataGrid Template

My MyGeneration template, ASP.NET DataGrid has been added to the Template Library at the MyGeneration website.

Friday, May 21, 2004

Microsoft SQL Web Data Administrator

A way to access your SQL Server MSDE Database via the Web: Microsoft SQL Web Data Administrator. There is also a third party tool that works a bit like Enterprise Manager called ASP.Net Enterprise Manager. Both are probably best only used on development databases rather than production ones, but can be useful if you wish to administrate when you don't have Enterprise Manager installed - i.e. so you can admin the server on any PC.

Thursday, May 20, 2004

MyGeneration SharpDevelop Project Template

Template for MyGeneration that generates a project file for SharpDevelop, to be placed in the same directory as the generated dOOdads business entities. Also MyGeneration.dOOdads.dll has to be placed in the bin\Release subfolder - i.e. My Documents\SharpDevelop Projects\My Project\bin\Release

Interface Code:

Dim cmbDatabases
Dim lstTables

Sub setup()

 If Not input.Contains("lstTables") Or Not input.Contains("txtPath") Then

  ui.Title = "Generate SharpDevelop Project"
  ui.Width  = 330
  ui.Height = 400

  ' Grab default output path
  Dim sOutputPath
  sOutputPath = ""
  If input.Contains("defaultOutputPath") Then 
   sOutputPath = input.Item("defaultOutputPath")
  End If

  ui.AddLabel "lblPath", "Output file path: ",  "Select the output path."
  ui.AddTextBox "txtPath", sOutputPath, "Select the Output Path."
  ui.AddFilePicker "btnPath", "Select Path", "Select the Output Path.", "txtPath", true

  ' List Databases in a ComboBox
  ui.AddLabel "lblDatabases", "Select a database:", "Select a database in the dropdown below."
  Set cmbDatabases = ui.AddComboBox("cmbDatabase", "Select a database.")

  ' List Tables in a listbox
  ui.AddLabel "lblTables", "Select tables:", "Select tables from the listbox below."
  Set lstTables = ui.AddListBox ("lstTables", "Select tables:")
  lstTables.Height = 150

  ' Attach the onchange event to the cmbDatabases control.
  setupDatabaseDropdown cmbDatabases
  cmbDatabases.AttachEvent "onchange", "cmbDatabases_onchange"
  
  ui.ShowGUI = true
 Else 
  ui.ShowGUI = false
 End if

End Sub

Sub setupDatabaseDropdown(cmbDatabases)
 cmbDatabases.BindData MyMeta.Databases

 If Not MyMeta.DefaultDatabase Is Nothing Then
  cmbDatabases.SelectedValue = MyMeta.DefaultDatabase.Name
  bindTables cmbDatabases.SelectedValue
 End If
End Sub

Sub bindTables(sDatabase)
 Set db = MyMeta.Databases.Item(sDatabase)
 lstTables.BindData(db.Tables)
End Sub

' Event Handler
Sub cmbDatabases_onchange(control)
 Set cmbDatabases = ui.item("cmbDatabase")
 bindTables cmbDatabases.SelectedText
End Sub

Template Code:

<%
'------------------------------------------------------------------------------
' SharpDevelop.vbgen
' Last Updated: 13 May 2004
' Author: Sam Collett
' Creates SharpDevelop project file. Save to same directory as generated business entities
' Place MyGeneration.dOOdads.dll to bin\Release sub folder
'
'------------------------------------------------------------------------------

Dim objTable
Dim objColumn
Dim intLp
Dim bInFirst
Dim tableNames
Dim tableName
Dim buffer

Dim databaseName 
databaseName  = input.Item("cmbDatabase")
Set database = MyMeta.Databases.Item(databaseName)

Set tableNames = input.Item("lstTables")
%>
<Project name="<%=database.Alias%>" standardNamespace="<%=TrimSpaces(database.Alias)%>" description="" newfilesearch="OnLoadAutoInsert" enableviewstate="True" version="1.1" projecttype="VBNET">
 <Contents><%
' Loop through tables in db
For intLp = 0 To tableNames.Count - 1
 tableName = tableNames(intLp)
 Set objTable = database.Tables.Item(tableName)
 If objTable.Name = tableName Then
%>
  <File name=".\<%=objTable.Alias%>.vb" subtype="Code" buildaction="Compile" dependson="" data="" /><%
 End If
Next
%>
  <File name=".\AssemblyInfo.vb" subtype="Code" buildaction="Compile" dependson="" data="" />
 </Contents>
 <References>
  <Reference type="Assembly" refto=".\bin\Release\MyGeneration.dOOdads.dll" localcopy="True" />
 </References>
 <DeploymentInformation target="" script="" strategy="File" />
 <Configuration runwithwarnings="True" name="Release">
  <CodeGeneration includedebuginformation="False" optimize="True" generateoverflowchecks="False" rootnamespace="" mainclass="" target="Library" definesymbols="" generatexmldocumentation="False" win32Icon="" imports="" />
  <VBDOC outputfile="" enablevbdoc="False" filestoparse="" commentprefix="" />
  <Execution consolepause="True" commandlineparameters="" />
  <Output directory=".\bin\Release" assembly="<%=database.Alias%>" executeScript="" executeBeforeBuild="" executeAfterBuild="" />
 </Configuration>
 <Configurations active="Debug">
  <Configuration runwithwarnings="False" name="Debug">
   <CodeGeneration includedebuginformation="True" optimize="True" generateoverflowchecks="True" rootnamespace="" mainclass="" target="Library" definesymbols="" generatexmldocumentation="False" win32Icon="" imports="" />
   <VBDOC outputfile="" enablevbdoc="False" filestoparse="" commentprefix="" />
   <Execution consolepause="True" commandlineparameters="" />
   <Output directory=".\bin\Debug" assembly="<%=database.Alias%>" executeScript="" executeBeforeBuild="" executeAfterBuild="" />
  </Configuration>
  <Configuration runwithwarnings="True" name="Release">
   <CodeGeneration includedebuginformation="False" optimize="True" generateoverflowchecks="False" rootnamespace="" mainclass="" target="Library" definesymbols="" generatexmldocumentation="False" win32Icon="" imports="" />
   <VBDOC outputfile="" enablevbdoc="False" filestoparse="" commentprefix="" />
   <Execution consolepause="True" commandlineparameters="" />
   <Output directory=".\bin\Release" assembly="<%=database.Alias%>" executeScript="" executeBeforeBuild="" executeAfterBuild="" />
  </Configuration>
 </Configurations>
</Project>
<% 
' save project file
SaveOutput database.Alias, "prjx"
' assembly file %>
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices

' General Information about an assembly is controlled through the following 
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.

' Review the values of the assembly attributes

<Assembly: AssemblyTitle("<%=database.Alias%>")> 
<Assembly: AssemblyDescription("VB.NET Class Library")> 
<Assembly: AssemblyCompany("")> 
<Assembly: AssemblyProduct("")> 
<Assembly: AssemblyCopyright("")> 
<Assembly: AssemblyTrademark("")> 
' Version information for an assembly consists of the following four values:
'
'      Major Version
'      Minor Version 
'      Build Number
'      Revision
'
' You can specify all the values or you can default the Build and Revision Numbers 
' by using the '*' as shown below:

<Assembly: AssemblyVersion("1.0.*")> 
<%
SaveOutput "AssemblyInfo", "vb"
' this function saves the output to disk
Function SaveOutput(filename, ext)
 ' Save the output file for this Table
 Dim filepath
 filepath = input.item("txtPath")
 ' length of file path
 Dim length
 ' position of last  Dim pos
 ' get length from input
 length = Len(filepath)
 ' get position of last  pos = InStrRev(filepath, "\")
 ' if last \ is not at the end of the file path, it needs adding
 If Not pos = length Then
  ' append \ to path
  filepath = filepath & "\"
 End If
 ' filename is generated from table alias, removing invalid filename characters
 filename = filepath & filename & "." & ext
 ' save output to file
 output.save filename, false
 buffer = buffer & output.text
 output.clear
End Function

output.write buffer

 %>

<%

Function TrimSpaces(str)

 Dim tname
 Dim name
 Dim char
 Dim l

 name = ""
 tname = str
 l = Len(tname)

 For j = 1 To l
  char = Mid(tname, j, 1)
  If Not char = " " Then
   name = name & char
  End If
 Next

 TrimSpaces = name
End Function
%>

Wednesday, May 19, 2004

SnippetCompiler / SharpDevelop

SnippetCompiler App - a useful application for compiling .NET code snippets, can import VS.NET projects. Has Intellisense and snippets can be exported to RTF or HTML format. Easier than using the command prompt for compiling.

SharpDevelop is a useful Open Source IDE for .NET, so allows you develop without Visual Studio. Unfortunately it is not so good a doing AS.NET projects and is more focused on WinForms development. Currently in Beta 1 status.

FileZilla / Notepad2

Very good tools I have been using for a while. FileZilla is a excellent FTP client which is Open Source. The current version (2.2.6) is for Windows only (may work on Linux via Wine though). Apparently there will be no more development done on this version, but a version 3 is in the works - it should work cross platform when it is release. Progress can be followed on the Development Forum on the site.

Notepad2 is a very good Notepad replacement and offers features like syntax highlighting, regular expression search, brace matching, auto indenting and more. The replace Notepad batch file script I posted earlier can be used to replace Notepad with this program. There is another batch file that can do this, but it cannot be use as a generic replacement program for notepad. Here is another method to do it - for XP only. Also mentioned on the PowerToys WebLog.