I have nothing to say

, , No Comments »

I feel like I should post something, but honestly I can’t think of a topic.

Nothing really to say about Spark. Don’t feel like doing a year in review. I try to avoid talking politics (though it has been an interesting year) and all of the current events are too awful.

I guess I could provide a video of Piggy, the Lord of Terror.

Created and uploaded by Alex. :)

Update: Ah – one thing I should mention is the Spark Visual Studio integration package preview 2.

Spark Language Package – Preview 1

, 10 Comments »

This is a very early copy of a msi which installs a Spark language package for Visual Studio 2008. It will put dlls into a Program Files\Spark directory and add just enough registry keys to add color and intellisense to files with a .spark extension.

Download Now Update: This link is obsolete – please visit the download page for the latest release bits.

I’ve tested installing and uninstalling which will remove the files and registry entries.

Eventually there may be a single installer that contains the VSIP files in addition to the things currently in the zip download – but for now they’re entirely separate. The copy of Spark.dll installed by the msi is used used by the language service for parsing and colorizing. It won’t conflict with the Spark.dll in the zip download, and that’s the file you should continue to use as an assembly reference in your projects.

As always feedback is welcomed.

Update: There’s been a report of “no effect” on XP sp2. I should also mention the installer has no user interface, so it’s normal for it for a small dialog box to show a progress bar move back and forth a bit then disappear without confirmation.

Also the spark file will need to be “Open With…” the “Source Code (Text) Editor” in case you’re using the xml or html editor.

Further Update: If you’re adding namespaces in the web.config or as code in global.asax they won’t be seen. Until that’s fixed try adding a Views\Shared\_global.spark file to hold things like:

<use namespace="System.Collections.Generic"/>
<use namespace="System.Linq"/>
<use namespace="System.Web.Mvc.Html"/>
<use namespace="MyApp.Models"/>

Using Spark as a general purpose template engine

, 14 Comments »

There was a question in the discussion group about using Spark as a simple text templating engine for creating email bodies like you can do with Velocity. Maybe they meant NVelocity?

In any case I put together a small console sample to verify the use case that I thought I would share here. It shows a few of the ways you can micro-manage how the Spark engine works by providing a specific base page and replacing the IViewFolder abstraction.

using System;
using Spark;
using Spark.FileSystem;

public class User
{
    public int Id { get; set; }
    public string Name { get; set; }
}

public abstract class EmailView : AbstractSparkView
{
    public User user { get; set; }
}

class Program
{
    static void Main(string[] args)
    {
        // following are one-time steps

        // create engine
        var settings = new SparkSettings()
            .SetPageBaseType(typeof(EmailView));

        var templates = new InMemoryViewFolder();
        var engine = new SparkViewEngine(settings)
                     {
                         ViewFolder = templates
                     };

        // add templates
        templates.Add("sample.spark", @"
Dear ${user.Name},

This is an email.

Sincerely,
Spark View Engine

http://constanto.org/unsubscribe/${user.Id}

");

        // following are per-render steps

        // render template
        var descriptor = new SparkViewDescriptor()
            .AddTemplate("sample.spark");

        var view = (EmailView)engine.CreateInstance(descriptor);
        view.user = new User { Id = 655321, Name = "Alex" };
        view.RenderView(Console.Out);
        Console.ReadLine();
    }
}

It’s alive! And it tells me what to do!

, , 28 Comments »

A while ago I took a moment to reflect on the functionality Spark had accumulated. It seems like the discussion group has been pretty quiet lately. I mentioned that to Tim and he reminded me of something I’d said earlier, “a view engine really only needs to do a handful of things – so much of the work is in framework.” So it might have hit that point where it does what it needs to do and you can call it version 1.

On the other hand if you look at the feedback from people who wouldn’t consider it a viable alternative there’s a definite theme surrounding Visual Studio integration in general and Intellisense in particular. So I decided a few weeks ago to muster up my courage and take another pass at the task of making a Visual Studio integration package to provide a Spark language service.

In an earlier post there was a comment from Pablo Blamirez that provided a really interesting lead with a few of the contained language interfaces. Then earlier last week I had some invaluable assistance from Phil Haack in tracking down some reference material on the subject. And I’m delighted to say all of the ingredients have finally come together, at least in a preliminary fashion.
Read the rest of this entry »

I’ve been Haacked

, , No Comments »

I mentioned in an earlier post I’d had a chance to meet Phil Haack when I was at the PDC a little while ago. One of the things that came up at the Asp.Net Mvc special interest table was the subject of third party view engines, and I’m happy he took me up on my request to take a closer look at Spark. It sounds like he liked what he saw and it has shown up in his blog posts about Rendering A Single View Using Multiple ViewEngines and ASP.NET MVC Northwind Demo Using the Spark View Engine.

The feedback in the comments are really great, too. Some people seem to get the benefits behind a simple text- and xml-editor-friendly view engine, while others point to the lack of intellisense or have a general sort of “it ain’t broke” attitude towards the webforms view engine.

Which is perfectly fine of course! The purpose was never to provide a superset of the aspx functionality as a feature-parity replacement. That would be insane. Rather it’s a syntax that’s optimized for a particular style of development and developer: someone that know what’s in their viewdata, knows what their html should look like, and doesn’t want the code to get in the way as the two come together. Plus some tricks to keep the templates nice and clean looking.

Although I suspect you can guess from the last post that the next thing for Spark could be a Visual Studio Integration Package for colorization and intellisense. Tricky! Probably have more on that later.

IVsIntellisenseless

, , , 1 Comment »

Just dropping in a quick post about what might be coming next… Still hunting down the holy grail of intellisense.

And as far as the Visual Studio SDK goes? You’ll never see a more wretched hive of undocumented interfaces and secret behaviors. I’ve down-shifted all the way to ATL C++ on this one to see eye-to-eye with the components the language service is integrating with, and it’s still a massive undertaking of black-box reverse engineering.

It’s not the VS SDK’s fault really. It’s the nature of the beast when you’re talking COM and OLE integration style. Lots of reasons for that.
Read the rest of this entry »

Design by j david macor.com.Original WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in