.NET and Open Source: better together

RTur.net

  • Join Us on Facebook!
  • Follow Us on Twitter!
  • LinkedIn
  • Subcribe to Our RSS Feed

State of Extension Manager

First of all, Mads asked me to join BlogEngine team and contribute by implementing Extension Manager as a part of BE core functionality, and I’ve agreed. If you downloaded latest bits you’ve probably noticed that it already has Extension Manager in it, although you might run into issues using it. It is very early in development and there been lots of small changes and playing around at this stage. One issue Mads pointed at was the fact that, when edit source code, IIS also reloads worker process, not only the application. More...

Update on mp3player and other things

Quick update: for those using mp3player, I noticed that it throws NullReferenceException in the latest BlogEngine builds. To fix it, go to extension source code (/App_Code/Extensions/mp3player.cs) and change from: More...

Let Extension Manager manage settings

By now we have simple and functional admin interface for extension management. Let’s go beyond basics, how about default settings page that extension writers can take advantage of? Let me explain what I mean. Suppose, you wrote BBCode extension (hope Mads won’t be mad at me:). It let people use XHTML in their comments without compromising security. The way it works: you define a square bracket syntax that people can use and extension converts it into real markup on comment serve. This is what code looks like: More...

Editing extension source code

You might say – editing source code is easy. Just open Visual Studio and start typing. Not so fast – what if I want to do it online, the way WordPress plug-in manager does it? Let’s say I uploaded extension and it seems to have a bug or I want to make a quick change and I don’t have access to do it over FTP. Is this even possible remotely change code for compiled assembly, save your changes and make application use new code? Let’ try it.

I added new “Edit” link to each extension in the list (if you don’t know what I’m talking about see previous post on Extension Manager). Then I created user control inside “User controls/xmanager” folder named “SourceEditor.ascx”. This is a simple control that have a multi-line text box and a save button. When “Edit” link clicked, page will load this control and fill it up from the source file. It will look inside “~/App_code/extensions” for the file with the same name as extension name. It is not required to put your extensions there, but it is a common convention. If source for extension in some other place – we won’t bother, just show relevant message and disable save button.

When source file found, it will show up in the text box and you can edit it and click save button. One catch here is that you need to disable validation on the page; otherwise ASP will not let you submit control to prevent code injection. Once validation knows that we are good guys and not sending evil things to the server, it all works as a charm. Here is entire code for control that let you easily edit source code for extension from admin panel. It is pretty short and self-explanatory. And you don’t even have to reload application this time; because we changed file in the app_code folder, IIS automatically will kick in jitter to re-compile assembly and start using modified extension. More...

Extension Manager for BlogEngine

BlogEngine has excellent extensibility model, core libraries expose any significant event you can think of to the outside world and you can subscribe to this events from your code and get access to the posts, pages, comments, files etc. And it does not take a lot to write extension – all you need is to decorate your class with [Extension] attribute. On application load BlogEngine uses reflection to lookup types in the compiled assembly and, if class decorated as extension, BE creates instance of this class. Here is a code from Global.asax that does just that: More...

Mp3 Player - the new release is coming

Since BlogEngine finally got its extensions section up and running on the project’s home page, I put my Mp3 Player extension up there. Also I’ve been pointed on a small glitch this player has – in IE you have to click once to activate it and only after second click it will play. Not a big deal and I did not pay a lot of attention to it, mostly because pretty much every flash player I used so far has this same problem (see the picture). After short investigation I found out that reason Microsoft can’t fix this glitch is a legal one – there is a dispute over a patent going on. But MS (and Flash people) do provide works around “click to activate” problem, most of which comes down to writing “object” tag by JavaSript rather than embedding it directly into HTML code. Can be done in variety of ways for different situations and I think I found one that will work in my case. Needs a bit more testing, but looks like it should work just fine. More...

Keeping track on your downloads

When you provide downloadable content on your blog, you might want to keep track on downloads. With BlogEngine, it is incredibly easy to do – all you need is subscribe to one of the events exposed by core framework and log download information to any medium you like. For example, you want to log it in the tab delimited flat file so it is easy to export to Excel and do whatever kind of reporting you want to do.

First thing, we need More...

New extension for BlogEngine.net

OOk, I'm not much of a blogger, but I did try several blog engines on Microsoft platform and beyond before settling my mind on BlgogEngine.net. I like it a lot for simplicity and elegancy of the code base. May be I'm an old school, but I do prefer applications which code I can comprehend in it's (almost) entirety - it gives me (false) sense of security. The other thing that I like about it is support for extensibility - so you can make that simple elegant code base bloated with tons of stuff that you can package so that it pretends to be an "extension". One problem though is that BlogEngine is relatively new player and there are not too many extensions yet present. So I decided to fix it a bit…

Jokes aside, one thing that BlogEngine is missing is multimedia support. Sure, it's not a core feature and it does belong somewhere in plug-ins directory. And I really needed audio support for one of my projects. After some looking around I found that there quiet a few free flash players you can use in HTML pages (may be Microsoft will come up with knocking-your-socks-off free SilverLight player some day and it will take over the world?). By far, the most popular and slim in-line player I came across is the one used in WordPress blogs. I decided that this is the best candidate for adoption and wrote a little wrapper around this flash player to hook it up with BlogEngine. Extension that I resourcefully named "mp3player" you can download here. There are also some instructions on how to install and use it, and all code is available for you to use and change at will. I intend to maintain and enhance it over the time so any feedback on bugs/issues or suggestions for improvement are greatly appreciated.

Below is an example what it looks like – most likely you’ve already familiar with the picture, which is another advantage of using this particular player. Just click an arrow to test it: