m3rlin is a templating code generator that uses ASP.NET style <% %> syntax. It hosts the ASP.NET runtime to perform the code generation. It uses XML as it's source of meta-data. Complete source as well as a binary for framework 1.0 and 1.1 is included, as well as some documentation and a simple demo (generating ASP.NET from SQL Schema in VB). A command-line tool for turning your MS SQL Server 2000 database schema into an XML document is included. It demonstrates a number of techniques including the use of the windows forms property grid and various UITypeEditors, hosting the ASP.NET runtime, and remoting XML documents across appdomains. A command line version is also included.
Evolve is a generation tool developed to work with Microsoft SQL Server 2000 and greater. Evolve generates XML documents based on your SQL Server database schema, which you can then transform into different outputs such as
- Data Access Code
- Transact-SQL Code
- User Interface
- XML Schemas
In addition to performing XML generation Evolve has a very simple plugin framework. Plugins can be loaded at run-time to perform post processing of the XML document to create outputs like those mentioned above. The plugin framework also manages saving of plugin properties to a project file, allowing outputs such as code to be reliably re-generated. There are a number of simple plug-ins that have already been written, and more complicated ones are being added.
In search for a dialog box to browse for a computer or a folder, I found three solutions but none is perfect:
- The .NET Framework includes the FolderBrowserDialog class, but it cannot be configured to browse for a computer
- Genghis includes the FolderNameDialog class, but there is a bug that prevents it to be used to browse for a computer
- This sample on The Code Project by Rama Krishna is also available, and works for computers
Note that they all rely on the system SHBrowseForFolder API function, which seems buggy (at least on Windows 2000) because you can't mix the "browse for computer" option with the other ones (including the new look)! Better know this.
"I hadn't written in my blog for a while. I turned on the computer and wrote a new entry. I clicked the 'submit' button, thereby restarting my blog."
Paul Browning calls them TTW WYSIWYG Editors and delivers a detailed examination of all the solutions and flavours available (opensource, commercial, for IE, for Mozilla, java-based...).
A common need when building web sites is integrating the content in designed frames and not just in plain dumb gray panels. The difficulty with that is that we have to use HTML tables to enable the panels to be sizable according to their content, and link this HTML tags to CSS styles.
I created a new WebControl that greatly simplifies this task. This control's source code is actually quite simple and can be used as an example if you want to take a look at how WebControls work.
With a control like the StyledPanel (that's its name), the developer manipulates only the control and its properties through the Property Inspector, all the design is defined in a CSS file.
Having all the style exported to a CSS file, the only difference between the two controls below is just one property value! Also, only the CSS needs to be changed if you want to redesign the panels. Isn't that appealing to you?
Here is how to test this control:
- Open and build the solution
- Add the control to the Toolbox (right-click on the Toolbox, browse for Madgeek.dll and add it)
- Add a new Web project to the solution
- Copy the Samples directory to your Web project directory
- Add a link to the CSS in the WebForm (Format | Document Styles... then select Samples.css in the directory you just copied)
- Drop a StyledPanel onto the WebForm
- Set the CssSuffix of the StyledPanel to Sample1
- Drop another StyledPanel onto the WebForm
- Set the CssSuffix of the second StyledPanel to Sample2
- Run the Web application
- Change the first StyledPanel's CssSuffix property to Sample2 and save
- Reload the page in the browser
Note: you can change the CssSuffix without recompiling as the ASPX file gets reevaluated after the change.
Another Julien joins the party. Please welcome Julien Brunet and pay a visit to his weblog, which should be another source for good posts. Julien's JazBlog is about .NET, SOA and so on...
In Delphi there is a concept that is not exactly translated in C#: sets. For example you can define sets and work with them like this:
type TSetOfIntegers = set of 1..250;
type Abc = set of (A, B, C);
var Set1, Set2: TSetOfIntegers;
var CharacterSet: set of 'a'..'z';
Set1 := [1, 3, 5, 7, 9];
Set2 := [2, 4, 6, 8, 10];
CharacterSet := ['a','b','c'];
What's nice is that you can use the in keyword to test whether an element is part of the set. You can also do arithmetical operations on sets.
Just as a pretext, I tried to reproduce this behaviour in C#. We don't have templates (oops, generics!) yet, so I went with code generation with CodeSmith. The result is certainly not performant at all, but is an interesting use of operator overloading and code generation.
Note that the result here is merely a simple collection and so very different from Delphi's implementation of the concept!
I added however an implementation that works with flags enums (see the Flags attribute) which allow enumerations to be treated as bit fields. This is closer to what Delphi does and certainly more performant.
Here is an example of what I tried to reproduce:
type TAbc = set of (A, B, C);
procedure TForm1.Button1Click(Sender: TObject);
var abc: TAbc;
abc := [A, B];
ShowMessage(BoolToStr(A in abc, true));
ShowMessage(BoolToStr(C in abc, true));
abc := abc + [C];
ShowMessage(BoolToStr(C in abc, true));
abc := abc + [C];
You can take a look at the source code to see how it works. The interesting parts are:
- the Set.cst file which is a CodeSmith template file
- the two XML files which are CodeSmith property files which define specific implementations of the template
- the Form1.cs file which contains test code
In this sample you'll find code like
Great tip from Ashutosh Nilkanth to programatically change the title of an ASP.NET page:
As I learnt today, the title (browser window title) of an ASP.NET page can be changed programatically. Here how ...
In the HEAD section of the ASP.NET page (.aspx) define the title as a server side control:
... and in the code-behind (.aspx.vb) or inline code, define ...
Protected PageTitle As New HtmlGenericControl
... and set the title from anywhere in the code as ...
Me.PageTitle.InnerText = "Hello World"
A cool technique to implement for a template-driven UI.
I used to do this by other ways such as Master Pages or string replacements, but this is very clean.
This technique works well for CSS links too, you just have to close the LINK tag.
A must read! Spammers of all kinds are so pathetic. Kudos to Joseph Duemer for the cool writing.
[Seen on Luke Hutteman's MemoryStream]
BorCon, the Borland Conference brings a bunch of articles about Borland.
Two decades after flashy start, Borland plots a new course [Santa Cruz Sentinel, via Mest om delphi]
So, what's the future?