Tales from the Evil Empire
Bertrand Le Roy's blog
-
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
Please 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?
-
Indexing PDF: not so fast
In the last post, I showed how to index PDF using PdfSharp. Unfortunately, the library hasn’t been updated in years, nobody seems to have forked it, and it can’t read many recent files. That makes it unfortunately unsuitable for the task. Back to square 1.
-
Indexing PDF in Orchard (and elsewhere.NET)
Indexing custom contents in Orchard is really easy: write a new handler derived from ContentHandler, then write an event handler for OnIndexing:
-
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 ;)
-
The sideways stack trace
A common pattern in asynchronous programming is the callback pattern. Libraries such as async make use of that pattern to build asynchronous versions of common control flow structures. One unfortunate possible consequence of this is strange stack traces. For instance, here is code that executes five functions serially:
var functions = [
function one(done) {done();},
function two(done) {done();},
function three(done) {done();},
function four(done) {done();},
function five(done) {done();}
];
async.series(functions, function final() {
debugger;
});