Community for F#

Blog articles of Community for F#

0
comment
on 4/15/2012 7:48 PM
We have been working hard to bring you WebSharper 2.4 Q2 - and today we are happy to announce the availability of the the first beta (2.4.46).

We will be doing a detailed change log and announcement in the coming days, so stay tuned. One of the most significant changes in this release is dynamic templating - a feature that enables authoring template-based web applications whose template(s) can be changed runtime without requiring re-compilation.

Dynamic templates are not only flexible but also come with a couple significant enhancements over the static templating available in earlier releases. For instance, you can tune how and when your templates get served and instantiated, whether placeholders act as containers or direct content holes, and what type of content can go into them.

For instance, here is a dynamic template in F#:
        let TemplateLoadFrequency = Content.Template.PerRequest

        type Page =
            {
                Title : string
                Head : list<Content.HtmlElement>
                HeadStyles : list<Content.HtmlElement>
                Slider : list<Content.HtmlElement>
                Breadcrumbs : list<Content.HtmlElement>
                Main : list<Content.HtmlElement>
            }

        let MainTemplate =
            let path = HttpContext.Current.Server.MapPath("~/static/my-template.html")
            Content.Template<Page>(path, TemplateLoadFrequency)
                .With("title", fun x -> x.Title)
                .With("head", fun x -> x.Head)
                .With("headStyles", fun x -> x.HeadStyles)
                .With("slider", fun x -> x.Slider)
                .With("breadcrumbs", fun x -> x.Breadcrumbs)
                .With("main", fun x -> x.Main)
You can use this template to construct sitelet pages as follows:
    let Site =
        Sitelet.Content "/" Action.Home 
            <| (Content.WithTemplate MainTemplate <| fun ctx ->
                {
                    Page.Title = "My title"
                    Page.Head = []
                    Page.HeadStyles = []
                    Page.Slider = []
                    Page.Breadcrumbs = MyBreadcrumbsFor ctx action
                    Page.Main =
                        [
                            H1 [Text "This is where your main content goes"]
                        ]
                })
The beta release also ships support for .NET 4.5, and should work if you have Windows 8 and Visual Studio 2011 Beta.

If you find any bugs, please get in touch at the WebSharper contact page, post them in the public BitBucket issue tracker, or simply post them here.

Have fun!
.
0
comment
on 4/15/2012 3:10 PM
It wasn’t long after college that I found myself blogging about the technology I was using on a regular basis. I have pretty good writing skills and am damn good with the code so soon after I was easily breaking 10K hits per post. Having a platform to share my ideas and knowledge was exhilarating [...]
>> Read the full article
.
0
comment
on 4/12/2012 7:26 PM
The next F# New York City Meetup is now scheduled... Microsoft Offices, 6th floor, 1290 Avenue of the Americas, between 51st and 52nd Streets, New York, NY (map) Tomas Petricek on F# applications - From Domain Model to User Interface Wednesday, April 25, 2012, 6:30 PM between 51st and 52nd StreetsNew York, NY"> <div id="event-where-suggest" class="suggested-by">F# is a great language for developing business logic of an application, but it can be also used for elegantly expressing user interactions. In t[...]
>> Read the full article
.
0
comment
on 4/11/2012 11:55 PM
In this post we are going back to the primitive. No it’s not about the same named song by Soulfly, (which incidentally does contains F# notes) but a return to thread synchronisation primitives and their asynchronous counterparts. We are going to be looking at an asynchronous version of the ManualResetEvent. This was recently covered by Stephen Toub on the pfx team blog. We will be taking a slightly different view on this as we will be using asynchronous workflows which will give us nice idiomatic usage[...]
>> Read the full article
.
0
comment
on 4/11/2012 8:31 PM
Last year, my wonderful peers in Microsoft Research developed the first versions of TouchDevelop, a touch-based programming environment. You can now find out all about TouchDevelop at the one big URL: www.touchdevelop.com and follow them on Twitter at @touchdevelop. Well done to the whole TouchDevelop team, and to Microsoft Connections for supporting this project. I'm sure many great things are coming for TouchDevelop from here!
>> Read the full article
.
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us
Built with WebSharper