Archives / 2015
  • Liberté, Égalité, Fraternité

    They hate joy.

    They hate freedom.

    They hate peace.

    They hate life.

    They hate what we are: joyful, free, peaceful, and alive.

    So they scream, they enslave, they wage war, and they kill.

    They can kill us, but they won’t kill joy, freedom, peace, or life.

    We’re stronger.

    We stand together.

    We are the Human Family.

  • Sprinkling some C#6 fairy dust on FluentPath

    I moved my FluentPath library’s source code from CodePlex to GitHub, and while I was at it, I vacuumed a bit, removed the cobwebs, and decided to see what applying some C#6 goodness would do to my code. Usually, I would not advise anyone to touch existing, working code that way just for the sake of using the new features: if it ain’t broke… But I wanted to kick the tires, you know? Just don’t start sending people pull request with that sort of crap, that would just be rude ;)

  • Orchard Harvest 2015 – ASP.NET MVC 6 Tag Helpers

    Taylor Mullen was here to introduce the tag helpers that are going to be added to ASP.NET MVC 6, basically to replace HTML helpers. Tag helpers are html tag-like bits of C# code. Because they are essentially C#, you can get all the benefits of the IDE, such as IntelliSense and refactoring.

  • Orchard Harvest 2015 - VNext

    Nick Mayne is presenting this session on not the next minor version of Orchard, but the real, actual 2.0 that’s going to happen. One of the things we’re trying to access is the coupling of subsystems in the Orchard framework. Another is making it run on ASP.NET 5. To address those, a complete rewrite of the framework is in order.

  • Orchard Harvest 2015 – .NET Foundation, Future of .NET and C#

    This was my second presentation for this Orchard Harvest, so I won’t be able to exactly live-blog it, but like yesterday, I can at least post the slides. The first third of the presentation was given by Martin Woodward from the .NET Foundation, then I presented on .NET Framework and Core, then on C#6 and C#7. Most of the C# slides were provided by Mads Torgersen, so thanks a lot to him for that. And without further ado, here are the slides...

  • Orchard Harvest 2015 – Keynote: The CMS of the future

    Yes, well, if you feel that I haven’t blogged enough today, this post is for you. There is one session that I missed in that frantic blogfest, and for good reason: I was giving it, with my friends Nick and Sébastien. I won’t detail the contents of what we said (you’ll have to wait for the video to make it to YouTube, sorry), but I can definitely share our slides. So here goes… Enjoy…

  • Orchard Harvest 2015 – Layouts

    Sipke made a new demo of Orchard Layouts, which have in my opinion dethroned workflows (and taxonomies before that) as Orchard’s crown jewel. He started by showing simple layout elements such as HTML and Markdown, then quickly switched into Orchardy extension and reusability mode.

  • Orchard Harvest 2015 – Theming at Onestop

    Onestop has been using Orchard for a few years now, and it’s one of the largest players in the community. They are delivering a complete e-commerce stack that is largely built on Orchard. And when I talk about a stack, this even includes product photoshoots and shipping from a huge warehouse in Los Angeles. They just handle everything end-to-end.

  • Orchard Harvest is happening October 5-6 in beautiful Alicante, Spain

    The fourth Harvest conference, where the Orchard CMS community gathers to share experiences, talk about the future of the platform, and generally have a great time together, is happening October 5-6 in Alicante. We have a fantastic line-up of speakers, if I may say so myself, including the following fine people from Microsoft: Sébastien Ros, lead developer and Benevolent Dictator of Orchard, and N. Taylor Mullen, developer extraordinaire and super-fun speaker.

  • Building elements for Orchard layouts 1

    Orchard layouts are great, and they’re extensible. In this series of posts, I’ll show how to write your own layout elements. Custom elements are a great way to encapsulate and re-use common bits of layout. Instead of having to build everything from grids, rows, cells, text and media, you can build your layouts from higher-level semantic constructs that make sense for your particular site. In this first post, we’ll build a very simple element: an “subscription” section that is made of a title, two lines of information, a monthly price, and a yearly price.

  • A quick helper to work on JSON streams

    Newtonsoft’s JSON library provides lots of different ways to read JSON documents, including a SAX-like way to work with the document by reading it forward-only: JsonTextReader. This is very advantageous if you’re working with very large documents, especially if they are being streamed from a remote source. Using this kind of API, there is no need to have the whole document loaded in memory at once. The downside is that those API are usually quite unfriendly and low-level: you usually have to move a cursor and read values manually. This is not just tedious, it’s also brittle and typically creates excessive coupling with the structure of the JSON document. Last week, I had to read a large JSON document, and I wanted to explore better ways to perform such tasks, which led me to write a small set of helper methods that make it a lot easier to walk JSON documents using Newtonsoft’s JsonTextReader.

  • Many ways to relate Orchard things, part 6: enumerations

    Enumeration fields are not exactly relationships, but they implement a very similar scenario. Therefore, it's useful to know about them, so that you can use them when they are relevant.

    Enumeration fields are fields that present a set of predefined values, of which one or several can be selected, depending on the field configuration. The values are defined per field, which means that those values can’t be re-used across different content parts. If you have a scenario for re-use of values, then you probably need to use a taxonomy instead.

  • The Evil Empire Strikes Back

    A little more than three years ago, I left Microsoft, and co-founded Nwazet, a hardware company that built cool products for makers. At the end of 2014, we sold our intellectual property to ModMyPi. Since then, I’ve been doing freelance consulting and development under the name Decent Consulting, and I’ve also been building a new CMS based on Node.js: DecentCMS… And today was my first day back at Microsoft as a Senior Program Manager.

  • Many ways to relate Orchard things, part 5: media

    Today’s way of relating Orchard contents is less universal than any of the ones I’ve talked about so far in this series: it will only enable you to attach media, such as images, videos, and audio, to your content items. Still, media have been real content items for a few versions of Orchard, and the media library picker is a very efficient way to add single or multiple media, so this most definitely deserves a post…

  • Many ways to relate Orchard things, part 4: taxonomies

    Taxonomies in Orchard can be seen as glorified tags, and in a way, that’s what they are: you can define multiple classifications for your content items, and assign any number of these classifications to your types. For example, a song could be tagged with a “genre” taxonomy, that defines terms such as “rock”, “blues”, “metal”, “progressive”, or “electro”. The same songs could be tagged with a “mood” taxonomy, with terms such as “epic”, “soft”, “spooky”, or “trashy”. Each song may be tagged with any number of terms from each taxonomy. In other words, there are n-n relationships between songs and taxonomy terms.

    What makes Orchard taxonomies so much better than simple tags is that taxonomy terms are content items, and as such can be extended with additional parts and fields. Our genres and moods, for example, can be enriched with a body part, in order to give them a rich-text description.

  • Many ways to relate Orchard things, part 3: lists

    The list feature, once deprecated, is back, entirely re-done, and now a great way to build parent-child relationships between content items. It’s so good we’ve even considered rebuilding the blogging feature entirely with it. The feature is actually admin UI around a single little thing that’s been in Orchard from the start: the Container property of the Common part. That’s right: all Orchard content items have the ability to point to another item to contain it. List is just exposing it, with some help from the Containable part, which adds the notion of order under the container.

  • Keeping a project’s public Git or Mercurial remote safe from your private stuff

    So you’re a committer on an open-source project, and you also use the same project to build non-public projects for your customers. You set-up your customer’s repository so that it has remotes that point to the public project’s repo on one side, and the customer’s private repo on the other. You pull from the public remote, and only ever push to the private one. Everything works fine, until one day, you make one small mistake and push all of your customer’s proprietary code to the public repo for all to see. Oops.

    Before you ask, no, I did not just do that. I did it once a long time ago with some proprietary code of my own, not customer code, thankfully. It was embarrassing enough however, and I had to ask for some help zapping the code before it was on too many people’s clones. This post is not about fixing the mess, it’s about preventing it from happening.

  • Many ways to relate Orchard things, part 1: database relations

    A long time ago, I wrote a documentation topic on how to implement 1-n and n-n relationships in Orchard using database relations. It was much needed at the time, as this was still a difficult topic. Between spotty mapping mechanisms for relationships, and specific Orchard conventions, it wasn’t something you could expect just anybody to figure out on their own. It is still the way to go under some conditions, but those conditions are arguably very uncommon, and there are now much better solutions for more common cases.

    In this series of posts, I’ll show one technique per post, with pros and cons, and use cases for each. Today, we begin with database-bound relationships.

  • Node dependency injection library extracted from DecentCMS

    There are quite a few DI libraries for Node, I know, and I evaluated many of them before building my own. It’s not that the others are bad, it’s just that I needed a few unique features that I couldn’t find together in a single library. My library, Decent Injection, is exactly what I needed for DecentCMS, because it was built as its foundation, with no other requirement than to be useful to me. My goal by extracting it as its own project is to help those users who have told me that they would like to use it in their own projects. Often, when building exactly the library you need, you end up with something that others will find useful too. It’s pretty cool when it happens.

  • CMS as a service with DecentCMS

    No web site should be a silo. A CMS should be great at organizing, syndicating, and presenting your content, but it should also communicate with arbitrary applications outside the CMS. In particular, mobile applications should be able to use the data from the CMS. In DecentCMS, you can enable the content-api feature to expose all content items as JSON documents.

    Content items are then available under two endpoints: src and shapes.

  • Querying DecentCMS, part 1: building an index

    DecentCMS’s search module provides the infrastructure to build and query search indexes, as well as a file-based implementation that is suitable for small sites. Querying in DecentCMS is based on a simple JavaScript API that is loosely based on the map/reduce pattern. The basic idea is that you first build an index, and then you can run queries on that index. The architecture ensures that querying can scale to very large content stores. It also enables querying to work in a unified way across heterogeneous storage mechanisms. Effectively, storage and querying are entirely separated.

  • Reducing friction

    Great libraries don’t just package useful functionality in a re-usable package, they do so while reducing friction. Low friction means that the answer to “hey, wouldn’t it be great if you could just do X?”, is “yes, it would, and you can.” Doing something simple is never complicated, and the way to do it is easily found, if not plainly obvious. Using such libraries is a joy, never a struggle. Of course, getting results like those is far from being easy, and requires smart designs and clean implementations. Most of all, it requires the library author to put himself in the shoes of his users.

  • The Orchard Way

    An order for an electric conversion of a vintage Porsche  just arrived at Greg’s workshop. He follows a script that will implement the transformation of the car.  He looks at the order, and sees that the customer bought the 70kWh battery. He picks up the right number of cells, and re-orders more to refill the stock. The batteries are secured in the trunk. Then, he removes the car’s engine, and disposes of it. He fits the electric motor in its place, and proceeds to route wires from the trunk to the engine’s compartment. The control system is then assembled. All these operations are done sequentially by Greg. In a few weeks, the car is ready.

    Meanwhile, a few kilometers away, another order for a brand new electric car arrives at Elon’s factory. It should be an obsidian black metallic all-wheel drive with a 85kWh battery, panoramic roof, silver cyclone wheels, black leather seats, carbon fiber décor, black alcantara headliner, autopilot, and subzero weather package. That’s a lot of little independent details.

  • Visual Studio Code first impressions

    This morning, Microsoft made a surprise announcement (or two): a new cross-platform code editor named Visual Studio Code. It runs on Mac, Linux, and of course Windows. It’s lean, fast, it has IntelliSense, supports multiple languages and dev platforms, has debugging and git built-in. You can get it from the following link:

    Linux and Mac, yes.

  • The widget layer file in a DecentCMS site

    The widgets layer file can be found under /sites/name-of-the-site/widget/index.json. The index.json file describes the layers of widgets for the site. Layers are collections of widgets that can be turned on or off by an expression that is associated with each layer and that gets evaluated for each request against an environment that can be contributed to by modules, and that can use extension rules also contributed by modules. More than one layer can be active on any given page of the site.

  • DecentCMS placement files

    Placement files describe how to dispatch shapes into zones. They are necessary in order to decouple UI composition from individual templates. Templates can focus on what to render, while placement determine what to render where. In yesterday’s post, I’ve shown one rudimentary example of placement. There can be a placement file at the root of each module and theme. A placement file can either be a placement.json file, or aplacement.js file if the format for JSON placement files is not sufficiently flexible for the problem at hand.

    Placement works in a relative manner: more than one content item can appear on any given page, for example through lists of content items, or as widgets. Placement can dispatch the shapes created by the parts of a content item into the local zones under a given root shape that is usually the main shape for the content item.

  • Writing a DecentCMS content part

    A content part is a reusable piece of content that can be composed with other parts into a content type. For example, a blog post content type could be built by composing a title part, a text part for the post's body, a tags part, and a list of comments. DecentCMS comes with a few parts built-in, such as title and text, but it's easy to write your own.

    Creating your own content type can be done by adding it to the configuration of the "content" feature in the site's settings.jsonfile. You may also alter an existing content type and add new parts to it.

    In this post, I'll use the example of a rudimentary tags part. The part will expose a list of tags, which are simple strings.

  • Writing a DecentCMS service

    In previous posts, I’ve shown the structure of a DecentCMS module, and how to describe such a module through its manifest. In this post, I’ll go into the meat of the matter by showing how to write an actual service. DecentCMS services are just classes that fulfill a specific named contract. Services can consume other services, using existing or new contracts, thus providing a generic mechanism for extensibility, where extensions to core services can expose their own extensibility points.

  • DecentCMS module manifests

    In the previous post, I showed the basic structure of a DecentCMS module. In this post, I’ll start digging into the details by showing how a module can declare metadata about itself. The package.json file, also called "module manifest", is where DecentCMS module authors can declare what their module consists of. It is a standard NPM manifest file, with a few additional properties that DecentCMS understands.

  • Writing DecentCMS modules

    Modules are made of all the files under a subdirectory of the /modules directory. A module may be put directly under the/modulesdirectory, or it can be part of a "module area".

    Module areas are groups of modules that have a common origin, and make sense being together. An example of a module area is the "core" area, that groups all the core modules that come standard with DecentCMS. They provide essential features that are likely to be useful to any DecentCMS web site. Another advantage of module areas is that they make it easier to manage a whole group of modules under a single Git repository.

    Module areas are simply subdirectories of the /modules directory that do not have a package.json file directly under it, but has one or more modules under it. You may not put areas under areas.

  • Building navigation menus in DecentCMS

    The navigation files that can be found in a site's "navigation" directory describe the menus that are available to the system. The default.json file in particular describes the default menu for the site. By editing this file, you can modify the menu's hierarchical structure and its contents.

  • How I learned to stop worrying and love IE8

    After an IE6-induced era of stagnation, the Web has adopted a steady pace of serious innovation and progress these last few years. Regular browser updates, collaboration on open standards, and some polyfill libraries make the Web a much more viable development platform than it used to be. Or does it? An exploration of the site paints a more depressing picture: Internet Explorer 8 is dragging us all behind with its market share of up to 20% (depending where you get your statistics). 20%! Are you going to leave 20% of your users behind? Should you still care that much? I’ll be arguing in this post that you shouldn’t, in many situations.

  • Creating a DecentCMS content type

    A content item in DecentCMS is an aggregate of parts, as defined by the content type of the item. For example, an item of type “page” is the combination of a title part, and a body part. This definition of which parts constitute a given type is configuration data that is defined at the level of the site.

  • What’s in a DecentCMS site’s folder?

    The default mechanism to store content items in Decent CMS is to use files under the /sites directory. This can be replaced with database storage, of course (the first provider I’ll implement after the file-based one will be CouchDB), but the file storage has some unique advantages. While it’s obviously not something you’d use on a big site, being able to xcopy contents, and deploy contents with a simple ftp client is very powerful. Being able to look into folders and find content items as single files that can be modified with a simple text editor is extremely comfortable.

  • Content item identity in Orchard and DecentCMS

    Identity is a funny thing. It’s one of those concepts that we use all the time, but that are tremendously difficult to pin down precisely. To keep things “simple”, in philosophy and in physics, it’s about equivalence relations. In computer science, I’d say it’s more like a bijection between two categories of objects. The difficulty is that you can only approximate real identity this way: by definition, an object is only identical to itself. What we call identity in code really is a proxy for identity, a substitute for it that usually takes less bits to represent than the object itself. The difficulty when building an identity algorithm is twofold: you need to be able to deterministically extract an id from an object, and the id needs to be different when the objects are different. In other words, same yield same ids, and distinct yield distinct ids. Of course, this can be made more complicated with mutable objects. The constraints are in fact very close to those of a good hashing algorithm.

  • The DecentCMS and Orchard content type systems compared

    The content type system in Orchard is one of the reasons for its great flexibility. The ability to build your own content types from building blocks that are just the right size is essential to building a great CMS. Orchard has content types that are made of content parts, that can have properties and fields. Parts are aspects of a type, such as title, comments, or body, that there can be only one of per type. Fields are named, and there can be any number of each type of field per content type. Confused yet? There’s a reason for all this, of course, but in DecentCMS, I’ve opted for a simplified version.

  • But this property is defined as undefined…

    After all these years, JavaScript still occasionally trips me up. Today, I built a test that was failing mysteriously. I use Chai to write my assertions, and that particular test was failing to agree that the array I had constructed was deeply equal to its theoretical value. WebStorm’s test tooling has a diff visualization for deep object or array equality, and this was showing the arrays as equal:Which is it, WebStorm?

  • What’s up with Raspberry Pi 2?

    I’ve been asked what my take was on the new Raspberry Pi 2, in particular about the newly announced Windows 10 support. The previous versions of the Raspberry Pi have been tremendously successful, and sold close to 5 million units, which is not surprising considering how capable this little board is for only $35. The new iteration is basically a much welcome upgrade of the CPU and memory over the original specifications from three years ago. The rest of the board is unchanged from this summer’s B+ model, which means that almost all accessories, including cases, should work. It’s a little disappointing that the hardware upgrade would be so limited: USB3 and/or SATA would have taken care of the problem that an SD card is not the reliable storage solution that’s needed for write-intensive data acquisition applications. The price is unchanged, however, so it remains one of the most inexpensive boards on the market.

  • Just forget that Repository<T> exists, please.

    If there’s a class that’s caused Orchard users more confusion, bugs, and disappointment than Repository<T>, I’d like to know about it… Generic repositories are a well-known anti-pattern, something that the designers of the Orchard data layer were fully aware of, but decided to use anyway as helpers in the implementation of this piece of code that bridges Orchard’s runtime dynamic type system to nHibernate’s database mappings. The class should arguably have been made internal or private (which is something you won’t hear me say every day), but it wasn’t, and now we’re stuck with it until we get to redesign that part of the platform.

  • Get your modules ready for Orchard 1.9

    Orchard 1.9 is just around the corner (don’t ask me exactly when it will be out, instead go and help with the remaining high priority bugs), and if you own existing Orchard modules, now is a really good time to test them against the latest 1.x build. You should be mostly fine as the new version doesn’t introduce significant breaking changes (that we know of), but there is one thing that you may have to do nonetheless to build a compatible version of your code. Orchard 1.9 will bump up its .NET Framework dependency to 4.5.1. As a consequence, if your modules are compiled against an earlier version of the framework, and take dependencies on assemblies such as Orchard.Core or Orchard.Framework, which are now built on the updated framework, Visual Studio will refuse to build your module.

  • Automatic deployment of multiple repositories to Azure

    The scenario is the following: a first repository contains the application code, and a second repository contains data files for the application contents. Azure, like some of the other best hosters, has the capability to automatically deploy new versions of your site when a new changeset is pushed onto a repository. When you have only one repository to deploy, the process is deliciously easy: when creating your web site, you can give it the URL of the repository on Github, and Azure will take care of everything, including of creating a web hook on Github so that new pushes can trigger the deployment scripts on Azure. If, like in the scenario above, your site is composed of multiple repositories, things are not that simple.

  • Snippable: a human-writable multipart document format

    More and more projects are managing their documentation as a bunch of Markdown files in a repository. Sites such as Github make that really easy and convenient, by providing an easy web interface around viewing and editing Markdown files, creating and integrating pull requests, viewing changesets, etc. It seems to provide all the advantages of a wiki, and more, while using a standard and easy set of tools.

  • Je suis Charlie

    Je suis CharliePlease allow me to make an exception to my rule of only publishing technical articles on this blog. I’m French, I grew up watching those guys on TV, they were close friends in many ways. Every time I’m in France, Charlie is one of the first things I buy. They were the recipients and defenders of a rich tradition of irreverence, political caricature, anti-clericalism, and provocation that goes all the way back to the French Revolution. In the words of Jon Stewart, going into comedy “shouldn’t be an act of courage, it should be taken as established law”. As a student, I was writing in a satirical web site, in that spirit, trying clumsily to follow the lead from Charlie, Hara-Kiri and others. We would write and laugh about anything and everything, without fearing for our lives or even for any consequences beyond flame mail (and that we did get). That is the way it should be, but it’s not. The people who were killed at Charlie are martyrs and heroes of free speech. I’m mourning. I just can’t get it off my mind.

  • Indexing PDF: once again with a big red nose

    A commenter pointed me to an oddly-named library that I didn’t know about: PdfClown. This is a library that is built by the same author both for Java and .NET, and the .NET version actually looks pretty nice, with not too many Java-isms beyond the namespaces. The license is a nice LGPL 3, the author Stefano Chizzolini seems to be available for advice and consulting, and there’s quite a lot of blog posts and quality documentation and samples. Sounds like a dream, doesn’t it?

  • MVP Award 2015

    Happy new year to you all! For me, it’s starting quite nicely, as I received my first MVP award this morning, in recognition for my open source work, in particular on Orchard. It’s a great honor, and I want to thank Microsoft and all the people who made this happen. Thanks to all of you for reading me, as well, and for encouraging me over the years with your great feedback, and for some of you, with paid work ;)