Fabrice's weblog

Tools and Source

News

My .NET Toolbox
An error occured. See the script errors signaled by your web browser.
No tools selected yet
.NET tools by SharpToolbox.com

Read sample chapters or buy LINQ in Action now!
Our LINQ book is also available on AMAZON

.NET jobs

Emplois .NET

Tuneo

ASP.NET Hosting transatlantys

Contact

Me

Others

Selected content

Archives

February 2003 - Posts

Querying objects with XPath

Mads writes:

Maintaining complete object hierarchy in-memory

The alternative would be to load all objects into memory at startup or first use. This way, using stateful session beans, each client could make requests on references to real objects directly, with these references placed in their state on the application layer.

The big "how" in this scenario is search. How to do an effective complex search in large object hierarchies? If I have 4000 contacts of different types with sub-contacts and aggregated objects etc. it would probably take ages to do what a simple SQL SELECT could do in seconds.

Maybe you should give a look at XPath for objects. An example of this for Java is JXPath.
Note: I should have a prototype for .NET any time soon.

Think about Mono for source code

Tim writes:

If you haven't already, though, I would recommend checking out Anakrino, an awesome open-source C# decompiler. It can be very useful to get insight into a .NET assembly, either to extend / specialize functionality or to debug weird issues. And sure, the source code generated isn't quite as good as the original - for example, MSIL doesn't keep local variable names, so you lose those - but it still does the trick.

I know for me it has proved useful on more than a few occasions.

[Loosely Coupled]

A great resource for the source code of the standard components of .NET is Mono. They've already done the reverse engineering for us.
Check the Mono Class Libraries, a valuable resource for component writers!

DropDownList with custom attributes on the items

I've created a custom DropDownList web control that enables the use of custom attributes on its items. This is just a rather simple improvement over the standard .NET web control, but a useful one in my opinion.

For example, this control can be used as follows:

<mad:DropDownList id="ddlTest" runat="server">
  <asp:ListItem Value="">An
</asp:ListItem>
  <asp:ListItem Value="" style="color:red;font-weight:bold;text-align:center">invalid
</asp:ListItem>
  <asp:ListItem Value="">item
</asp:ListItem>
  <asp:ListItem Value="">is in here
</asp:ListItem>
</mad:DropDownList>

The result being this:

The source code is available of course.
Warning: not all CSS attributes work with Internet Explorer. This screenshot comes from Phoenix, but at least the color attribute works with IE.

Custom TreeView without behavior

On a project I have worked on, we needed to display a tree view in an ASPX page. The client needed the ability to print the page through IE print command. We started to use the TreeView control coming with the IE Web Controls released by the ASP.NET team. Then we realized that the tree view was not printing correctly due to the use of a client behavior coming with the TreeView server control. The client behavior is automatically activated on IE 5.5+, and deactivated for previous or non IE browsers. ...But, the client behavior cannot be deactivated on up-level browsers!

I was not panicked as luckily MS had released the source code of the IE Web Controls not long before. After some investigation in the existing code, I found a way to create a custom TreeView control that would allow the client behavior to be deactivated. My TreeView is just an extension of the base TreeView with an added BehaviorUsage property which values can be Default, Deactivated or Forced. The source code is available for your curiosity or use.

This case is just an other example of the advantages of releasing source code...

Stored procedures versioning with SQL Server and Visual SourceSafe

Here is a quick summary of the steps to add Stored Procedures to the .NET IDE:

  1. Install VS.NET on client machine
  2. Install VSS on client machine
  3. Open the VS.NET IDE and make sure to enable "version control" on the "Tools | Options | Database tools" tab. The option is "Enable version control"
  4. Install VSS on server machine
  5. Make sure SQL is running as a domain account and that that account has been added to the VSS database on the server
  6. Run the VS.NET install on the server machine, deselecting everything but "Server components/VS 6 Stored Procedure Version Control"
  7. Open the VS.NET IDE and create a connection to that SQL database
  8. Right click on the "stored procedureS" node and select "Add to Source Control". This creates the initial project structure in VSS
  9. You must now still add the individual SP's. You can click on the top one, hold down shift, and click on the last one. This will highlight all the SP's allowing you to right click and add to Source Control

I do not remember where I found this information, but more information can be found on MSDN.

Update: Thanks to Dominic Fenton, here is an official Microsoft reference document on this subject: HOW TO: Add SQL Server 2000 Stored Procedures to Visual SourceSafe by Using Visual Studio .NET

Visual Studio: missing a keyboard shortcut

I've been struggling with CTRL+TAB since the first day I started working with VS. Till today, I still do not know how to jump to the next (visually speaking) tab in the editor. CTRL+TAB does not make it as it jumps to the next (randomly speaking) tab. I don't understand the logic behind it, and it's not working as I wish it would.

Does someone know of a working solution to jump between tabs without having to use the mouse?

Search page

I've put a search page for dotnetweblogs.com on my weblog. Thank you goes to Google.
(Scott, I included aspnetweblog.com too :-) )

Update: forgot to mention that I've added a link (Search) on my main page to make the search page easier to find.

Visual Studio Tips

While showing-off the previous tip to a mate I was eagerly pointed in the direction of this link:

http://www.sellsbrothers.com/spout/default.aspx?content=archive.htm#vs.netfunfacts

Chris Sells does it yet again!

[Darren Neimke]

Two I like and didn't know about:

  • Let the IDE implement the stubs of an interface function in a class (not a struct):

    1. Type the name of the interface after the name of the class, e.g. "class Foo : IDisposable".
    2. In the Class View (Ctrl-Shift-C), navigate to the class, e.g. Foo, and choose the interface you'd like stubs for under Bases and Interfaces for that class.
    3. In the context menu (Shift-F10), choose Add->Implement Interface.
    4. Bask in the glory of Don Box (who showed me this trick).
  • Let the IDE implement the stub of an virtual function override:

    1. In the Class View (Ctrl-Shift-C), navigate to the class, e.g. Foo, and choose the method on the base class you'd like to override under Bases and Interfaces for that class.
    2. In the context menu (Shift-F10), choose Add->Override.
    3. Bask in the glory of me, who found this all by myself. I found this digging through the .VSZ files on my system. It looks like you can add your own context items to the menus, which sounds like fun...

I recommend to use this with "Synchronize Class View" from the editor context menu.

Update: The two tips above seem to work only for C#.

HTML Toggle Borders

A nice little tool useful if you are working with HTML tables.

Posted: Feb 20 2003, 11:32 AM by Fabrice Marguerie | with no comments
Filed under:
Speech by Senator Robert Byrd on war on Iraq

Escaping from our .NET world for a second (as we are leaving in a real world too...):

Slavomir Furman wrote:

Keith Ballinger wrote:

Floor speech by Senator Robert Byrd. A brilliant articulation of how I feel.

[Floor speech by Senator Robert Byrd. A brilliant articulation of how I feel.

+1

Although I never heard about Senator Robert Byrd before and although I'm not an U.S. citizen, I think that this speech articulate also my feelings about all this Iraq thing we heard in news every night everywhere. Great speech!

Very good. A must read.
Good to see these opinions clearly expressed!

More Posts Next page »