Friday, March 23, 2007

A TODO list application for GNOME?

I use Tomboy to keep my todo list around, but it requires me checking the notes manually which makes it easy to actually forget to do something. So, my question is - does anyone know of a small, compact todo list application that supports date/time alerts, notifications, prioritizing and categorization of entries? Tomboy has some of it, but I'd rather use an app created specifically for the purpose of managing such a list. If you do know such a program - please let me know!

Wednesday, March 21, 2007

A cool un(der)documented feature of ASP.NET 2.0

A few days ago, by way of this bug report, I have learned about a cool ASP.NET 2.0 feature which allows one to extend the Page directive with custom attributes. It is briefly described in this blog entry, but I have investigated the matter a bit farther and discovered a few more details about the feature, see the description below.

Extended attributes are supported for both the Page and the Control directives. If your page inherits from a certain base type, by specifying the parent class name in the Inherits attribute, you can assign any public field or property in the base type by specifying its name in the directive attributes, like so:

<%@Page CustomAttribute="My text" Inherits="BasePage" %>
<%@Control CustomAttribute="My text" Inherits="BasePage" %>


The value of the attribute can be anything the field/property type can be converted to. The conversion is done using the TypeConverter class, with the help of TypeDescriptor class.

As of svn revision 74734, the support for all of the above is in Mono.

Thursday, March 15, 2007

ASP.NET 2.0 progress update

I've just been thinking about providing a periodical progress update on ASP.NET 2.0 support in Mono for users that don't track the svn commits and would like to know what will be coming with the next Mono release. So, from time to time (when something interesting/important changes in our ASP.NET implementation) I will blog a short summary of the changes here.

In the past 10 days there have been several significant changes committed to svn head, here's a summary:
  • Support for sitemap localization
  • Source code generated from the aspx and ascx files now implements the same split class model what MS.NET. It prevents problems with code-behind clashing with the generated class.
  • Application themes work properly for all controls now.
  • An initial support for asynchronous pages has been added
  • Fixes for the local resources (App_LocalResources) support. Mono now correctly handles local resource requests for custom controls. Resources are compiled on demand during the parsing phase.
  • XmlSiteMapProvider now supports custom site map providers for nodes.
  • App_Code support fixes. It is now possible to load custom providers, register tag prefixes whose implementations live in App_Code.

Friday, March 9, 2007

Personal Web Site Starter Kit fully functional now

Recently I blogged about the Personal Web Site starter kit (here and an update here) and mentioned that it was not fully functional due to problems with our implementation of the SqlClient (and, as it turned out, missing features in our Tds code). Since today this is no longer true - thanks to Andreia and Nagappan PWS is fully functional when running under  Mono now! Below are instructions on how to run the starter kit yourself.
  1. Download the kit
  2. Check out the InstallVST utility from Mono SVN (it's in mcs/tools/installvst) and compile it:
    gmcs installvst.cs
  3. Unpack the PWS zip file to some directory
  4. Run the following command:
    mono PATH_TO/installvst.exe PATH_TO_PWS_DIRECTORY/ PersonalWebSite.vstemplate PATH_TO_TARGET_DIRECTORY
  5. Go to the PATH_TO_TARGET_DIRECTORY/PersonalWebSite/ directory, edit the web.config file you find there find the Personal and LocalSqlServer connection strings and replace their connectionString attributes with, respectively, the following values:
    Data Source=XXX.YYY.VVV.ZZZ;Integrated Security=False;Database=startkit_personal;User ID=sktest;Password=sktest
    Data Source=XXX.YYY.VVV.ZZZ;Integrated Security=False;Database=aspnetdb;User ID=sktest;Password=sktest
    Substitute the XXX.YYY.VVV.ZZZ strings with the IP number of your SQL server
 
Having completed the above steps, you need to prepare your Microsoft SQL server (either the full version or SQLExpress) for use with the starter kit. Follow the instructions below:
  1. Make sure your SQL server uses mixed SQL + Windows authentication, allow connections over TCP/IP (server port 1433)
  2. Create an SQL user named 'sktest' with the password 'sktest'
  3. Create an empty database named aspnetdb, then fill it with required schema using the aspnet_regsql utility that comes with Microsoft .Net 2.0 SDK. This database can be shared among all the starter kits ported to Mono. Add the 'sktest' user to this database users and make it the database owner.
  4. Create an empty database named startkit_personal, then use personal-add.sql script found in the PWS zip archive to populate it with the necessary schema and data. Add the 'sktest' user to this database users and make it the database owner.
At this point you are ready to run the application. To do so, issue the following command on your mono machine:
MONO_IOMAP=all xsp2 --root PATH_TO_TARGET_DIRECTORY/PersonalWebSite/
and then point your browser to http://localhost:8080/ (replace 8080 with the port number your xsp is configured for).
If everything went well, here's what you should see in your browser:

The welcome screen



The welcome screen after logging in



One thing should be noted about the user registration with this starter kit. The application is configured so that every new user is created in the disabled state - that is, you will not be able to log in even though the user has been created successfully. To remedy that, you have two options:
  1. Edit the Register.aspx file and remove (or set to false) the DisableCreatedUser attribute to the <asp:CreateUserWizard> tag in that file
  2. On your Windows machine launch the SQL Server Management application, connect to the aspnetdb database and issue the following query:
    UPDATE dbo.aspnet_Membership SET IsApproved=1
    This query will approve all the users you have registered (if you want to do it for individual users, you need to consult the dbo.aspnet_Users table, look up your user, note its ID and append WHERE UserId=YOUR_USER_ID clause to the above query)

Monday, March 5, 2007

ASP.NET 2.0 page themes

It seems that until now the themes were broken under Mono. I've just committed a few changes that make them actually work. I suspect that there might be more breakage in there, and despite testing them on a few applicatins I'd like to ask anyone who uses/knows of any non-trivial ASP.NET 2.0 applications using themes to let me know where to download them. Also, if you encounter a bug - do fill a report with a test case to the Mono bug tracking system. Please make sure you test the application(s) with Mono compiled from svn head newer than revision 73707

Sunday, March 4, 2007

MojoPortal progress - it's really functional now

With the recent svn commit (revision 73669) Mono is now able to handle running MojoPortal with the menu enabled:



You can see the menu just above the Links section on the left. It is bound to a custom site map provider and accessed via a SiteMapDataSource control defined in the associated master page file.

The problem was with the way HierarchicalDataBoundControl looked for data source named by the DataSourceID property. It considered only the control's NamingContainer instead of working up the naming container chain and thus not reaching the associated master page.

Saturday, March 3, 2007

ASP.NET temporary directory cleanups

In the past weeks I've committed several changes in order to make the ASP.NET temporary directory a bit less of a space hog for those who restart their xsp/mod_mono often.
The old implementation used to generate random file/directory names for both per-application toplevel temporary directory and all the files below it (including shadow files which can occupy a lot of space on larger sites). The changes I made include, so far, the following:
  • Generate a toplevel temporary directory with predictable name. The hash calculation is based on the virtual and the physical paths of the application.
  • The shadow files no longer have fully randomized names (of the form shadow-XXXXX with the Xs being replaced by hex characters), instead they are put in a subdirectory of the temporary directory named assembly/shadow/XXXXXXXX/YYYYYYYY_VVVVVVVV/ which is different for every shadow-copied assembly.
The way the XXs, YYs and VVs above are generated is that the XXs are a hexadecimal hash of the assembly name (sans the path) - it groups files of the same name in the same subdirectory. VVs are hexadecimal hash of the assembly path (sans the name). YYs are an XOR of XXs and VVs.
The above scheme tries to mimic what MS .Net runtime does (except they use dl3 instead of shadow in the above path), but I can't guarantee that the hashes are computed the same way they do. The way we do it guarantees that no two different assemblies can end up in the same shadow directory and create a name clash - that's sufficient.

The new shadow scheme uses considerably less space, which is very good, and it also adds another benefit - the .mdb (debug data) and .config files that accompany the original assembly are copied together with the assembly.

The remaining temporary directory cleanup issue is how we should remove the old assemblies. If anyone has any information about how MS .Net does that (I haven't investigated the issue yet) - please let me know.

Big news - MojoPortal 2.x runs on Mono!

As in the title - I've just managed to run MojoPortal 2.x (svn head) under Mono's ASP.NET 2.0 (also svn head) for the first time ever! As a proof, here's a screenshot:

Attempt to register the user succeeds, but later on the portal throws an exception about a missing attribute. I will look into it tomorrow and post any updates here. I'm really glad it has finally happened... :)

Joe, congratulations on excellent job with the portal!

PersonalWebSite starter kit update

It is possible to register a user now with the PWS, but the attempt to log in fails miserably. It seems the problem is with the Mono implementation of the SqlClient - it does not process the stored procedure output parameters correctly.