Archives

Archives / 2008 / October
  • jQuery IntelliSense documentation file available

    IntelliSense documentation files for jQuery just got published on jquery.com. This enables great IntelliSense at design-time for jQuery in Visual Studio 2008. It goes without saying that this file should only be used at design-time and never at runtime. For the moment, in order to ensure that, you can include the file from an “if (false)” server code block. We’re also working on a much better solution.

    Many, many thanks to John Resig, Scott Cate and Jeff King for making that possible.

    1.2.6:
    http://code.jquery.com/jquery-1.2.6-vsdoc.js
    Latest release (currently just a copy of 1.2.6):
    http://code.jquery.com/jquery-latest-vsdoc.js

    UPDATE: Jeff King wrote a great post explaining how to use the IntelliSense file now and once Visual Studio has been patched (patch will sonn be released).
    http://blogs.msdn.com/webdevtools/archive/2008/10/28/rich-intellisense-for-jquery.aspx

    Read more...

  • We need Rock Band / Guitar Hero song compatibility

    In this post, the Penny Arcade guys make the point that beyond instrument capability, what we really need is song compatibility between the two. Beyond the licensing nightmare that would probably represent for both games publishers, this resonated really well for me. Here’s why and why it makes perfectly good business sense below the apparent “yeah, right, you wish” appearances.

    Guitar Hero -and Rock Band even more so- are the ultimate party games. I can’t seem to go to a party these days that doesn’t have a Rock Band game running. Perfect fun. Now here’s the reason why I’ll probably pass on the next Guitar Hero: there can be only one. What are the chances that in the middle of the party, somebody will say “I want to play song X, let’s swap disks and go through the process of getting the band back together”? Let me think… yes, zero. So well, I’ll stick to what I have and what constitutes the better choice in my opinion, Rock Band. Guitar Hero World Tour just lost a customer.

    Now let’s imagine for just a second that songs work on both games. If Guitar Hero has a good selection of songs, I’ll just buy it for the songs even if I never play the actual game (or just once, for the achievements :) ).

    So to recap, in one case many people will only buy one of the games, in the other those same people might buy both (and play only one but who cares). Which one makes the best business sense? I believe the second one but I have no illusion that both editors will prefer to stick to the iTunes “I want it all” mindset…

    Read more...

  • Going to California

    I’m flying to San Jose tonight for tomorrow’s OpenAjax Alliance face to face meeting, which Microsoft is hosting. On Friday, we are also hosting a new event that aims at establishing a dialogue between JavaScript library developers and Microsoft. We’ll have talks from the IE, Visual Studio and ASP.NET teams, as well as talks from members of the community. This should be very interesting.

    Read more...

  • Hack: using live bindings outside templates

    A comment on this post is asking whether it is possible to create bindings outside of a template. The point of doing that is that you don’t necessarily want to render a template just to set-up a few bindings.

    Well, bindings are really implemented by a component, Sys.Binding, and a markup extension, which instantiates that component through the convenient {binding foo} syntax.

    While the markup extension is only understood by the template engine, the component can be instantiated like any other component, through $create or declaratively (thanks to Dave for pointing me to how this can be done).

    Here is a sample page where two bindings are created (imperatively and declaratively) to bind a span’s text (imperatively) and an input’s value (declaratively) to the same plain JavaScript data object. Modifying the value in the input changes the data object, which in turn changes the span that is also listening to it.

    <%@ Page Language="C#" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Binding</title>
        <script type="text/javascript">
            var data = { answer: 42 };
    
            function pageLoad() {
                $create(Sys.Binding, {
                    target: $get('answerDisplay'),
                    targetProperty: 'innerText',
                    source: data,
                    path: 'answer',
                    mode: Sys.BindingMode.oneWay
                });
            }
        </script>
    </head>
    <body xmlns:sys="javascript:Sys"
          xmlns:binding="javascript:Sys.Binding"
          sys:activate="*">
        <form id="form1" runat="server">
        <asp:ScriptManager runat="server" ID="SM1">
            <Scripts>
                <asp:ScriptReference
                    Path="~/Script/MicrosoftAjaxTemplates.js" />
            </Scripts>
        </asp:ScriptManager>
        <div>
            <span id="answerDisplay"></span><br />
            <input type="text" id="answer"
                sys:attach="binding"
                binding:target="{{ $get('answer') }}"
                binding:targetproperty="value"
                binding:source="{{ data }}"
                binding:path="answer"
                binding:mode="{{ Sys.BindingMode.twoWay }}" />
        </div>
        </form>
    </body>
    </html>

    Not quite as convenient as being able to directly use the markup extension but it gets the job done. Please also be aware that the overhead in rendering a template is very small and the convenience of the markup extension may be preferred over this. Here is the same page using a DataView:

    <%@ Page Language="C#" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Binding</title>
        <script type="text/javascript">
            var data = { answer: 42 };
        </script>
    </head>
    <body xmlns:sys="javascript:Sys"
          xmlns:dataview="javascript:Sys.UI.DataView"
          sys:activate="*">
        <form id="form1" runat="server">
        <asp:ScriptManager runat="server" ID="SM1">
            <Scripts>
                <asp:ScriptReference
                    Path="~/Script/MicrosoftAjaxTemplates.js" />
            </Scripts>
        </asp:ScriptManager>
        <div sys:attach="dataview" dataview:data="{{ data }}">
            <span id="answerDisplay">{binding answer }</span><br />
            <input type="text" id="answer" value="{binding answer}"/>
        </div>
        </form>
    </body>
    </html>
    

    Read more...