|
|
|
Posted
almost 5 years
ago
by
Steven Harman
Plenty of other folks have already announced that the Subtext 2.0 bits finally dropped this past Sunday afternoon, hot off the CI server. And by finally, I mean – over a year after the last official release, and four months after we said it was
... [More]
just around the corner.
Good things come to those who wait At least that’s what the Heinz company says. Or maybe they just had a brilliant marketing department.
Anyhow, Simone Chiaretta and several other folks have already hit the release highlights, so I’ll just steal their summaries:
Top notch support for Windows Live Writer thanks to some patches and check-ins from Tim Heuer New CSS-based admin design that makes better use of apace Support for mobile skins (and a default mobile skin if your favorite skin doesn’t have mobile support built in) Streamlined installation Process Support for Enclosures CSS and JS optimizations Setting a date in the future for publishing posts Login to your blog using OpenID, as well as use your blog as an OpenID Delegate Ch-ch-cha-changes! As you can see, the new bits are packed with a metric crap-load of bug fixes, new features, and patches. And yes, metric-crap load is a technical term and a real unit of measure… or not, whatever.
But hey, you don’t have to take my word for it. You can get a full list of the changes here:
Bug Fixes Delivered Feature Requests Accepted Patches Go get you some Oh yeah, and I should probably link to the new bits: DOWNLOAD
Technorati Tags: subtext, open source, openid [Less]
|
|
Posted
almost 5 years
ago
by
Simone Chiaretta
As I already anticipated a few days ago, Subtext was on its way to be released. And today Phil just announced it: Subtext 2.0 has been released, one year and a few months after the previous version 1.9.5. I already explained a some of the
... [More]
new features of Subtext 2.0:
Publish in the future JS and CSS performance optimization Enclosures but Subtext 2.0 also brings to the table:
Enhanced MetaWeblog API implementation Enhanced WLW implementation new CSS-based admin layout Mobile-skin support OpenID support, both to login to the admin and to use you blog as OpenID delegate and many bug fixes Read Phil blog for more details on the release notes and for the future plans for Subtext (MVC anyone?).
And, you want to upgrade you blog, or give Subtext a try, here is the url for the download: Subtext 2.0 of SourceForge.
Technorati Tags: Subtext [Less]
|
|
Posted
almost 5 years
ago
by
Simone Chiaretta
In the last two days I wrote about two new feature of Subtext 2.0: Enclosures and performance optimizations for skins. Today I’ll talk about another new feature of Subtext 2.0: Future Posting. I already anticipated this feature
... [More]
while I was testing it last week: posting in the future allows the blog’s author to write a post either with the post editor online or with any offline blogging application (like Windows Live Writer), set the date and time, save it on the server as published (not as draft), and have it automatically published both on the blog and the RSS feed at the specified moment.
This is useful when writing series of posts: you write all your posts at once, and then schedule them to appear online one per week or per day or every couple of days. (Which is what I’ve been doing with this series of posts.)
It’s also useful when you go on holiday but you still want to publish something on your blog: you can write some posts before your leave and set the publish date in the future while you are relaxing on some Maldivian beach.
How to set the publishing date of post? If you are using the online post editor, you have to set the Post Date (in en-US format mm/dd/yyyy hh:mm:ss AM/PM) in the Advanced Options panel. The time must be in the blog’s time zone. Expect some enhancements in a future release of Subtext, like an Ajax datetime picker, or similar UI elements.
If you are using Windows Live Writer, you can set the date of the post with the date picker on the bottom toolbar.
How do I know that a post will be published in the future? A post published in the future will not be accessible online till the publish date has been reached, but you can see the scheduled posts looking at the list of posts in the admin. If the post is scheduled for future publishing, the list will tell you when this will happen.
How dates relate to URLs Subtext stores 3 different dates for each post:
the date in which the post created the last modify date and the publish date
Till Subtext 2.0 the permalink of the post was generated using the date of creation, but now that it’s possible to post in the future this will not make sense anymore: if you write 10 posts and schedule for future publishing they will appear as created all at the same day.
So now the permalink will be generated using the publish date, so that also the url shows the real publish date.
But to keep the backward compatibility, and don’t change the url of past posts, the upgrade procedure to Subtext 2.0 includes also a little update scripts that copies the date of creation into the publish date.
Feedback? Questions? As usual, if you have questions, bug reports and feedback just write on the forums and report bugs.
It’s done with the features I implemented in Subtext 2.0: tomorrow I’ll write about how the frontend performance optimization works behind the scenes. Please subscribe to the feed if you want to get it automatically in your feedreader.
Technorati Tags: subtext,future post [Less]
|
|
Posted
almost 5 years
ago
by
Simone Chiaretta
Yesterday I wrote about the support for enclusures that has been introduced with Subtext 2.0. Today I’m going to talk about the improvements we introduced to our skinning engine in order to reduce the number and the size of HTTP
... [More]
requests. And we added support for mobile browsers as well.
Web Performance Optimization It all started last year, when Yahoo released YSlow, an add-on for Firebug that measures the performance of a web page based on the best practices evangelized by the Yahoo’s team for Exceptional Performance. Pushed by Mads Kristensen I improved the performances of my own blog with some manual tweaks to the style sheets and to the javascript files and introducing a handler for compressing the contents. This made my blog improve from 36 points to 64 points.
After this proof of concept I ported the optimizations to Subtext, so that all the users could benefit from them.
The optimization consists in:
Minification of all styles and script (remove all useless space, new lines, tabs and so on) Merging all styles into one file Merging all scripts into one file Gzipping the contents sent to the browser
All the skins bundled with Subtext have already been updated to take advantage of these optimizations. Let’s see now how to enable these optimizations in custom skins.
How to update your skin to take advantage of the new optimizations If you are running your blog with a custom skin, there are some steps that you have to make to take advantage of this new feature.
But just relax, everything is backward compatible: this means that if you don’t do anything, your skin will work as before, without the performances optimizations.
Step 1: Minify your files The first step of the optimization is done at build time by our build server: all the javascript and css files provided in the installation package are already minified using YUI Compressor. But if your skin uses some custom styesheets or custom javascript files, in order get the most out of the optimization, you have to minify them as well.
If you are using some javascript loaders to load other modules (like in script.aculo.us) make sure you can load the modules also by themselves without using the loader script (with script.aculo.us it is possible).
And before you go on with the next step, please test you skin after the minification of the scripts: if the scripts are not written properly (with all the ; and } at the right place) it’s very likely that the minification breaks something.
Step 2: Change the skin configuration file Are you sure our skin is still rendering fine after step 1? If it is, the next step is to enable the merging of CSS and scripts. To do this you have to update the skin definition which is inside the \admin\Skins.User.config file.
The new skin optimizations are enabled by 4 new attributes (in bold in the following code sample) in the skin definition:
1: <SkinTemplate 2: Name="GreenBook" 3: TemplateFolder="RedBook" 4: StyleSheet="Green.css" 5: MobileSupport="Supported" 6: StyleMergeMode="MergedAfter" 7: ScriptMergeMode="Merge" 8: ExcludeDefaultStyle="true" 9: > 10: <Scripts> 11: ... 12: </Scripts> 13: <Styles> 14: <Style href="~/scripts/lightbox.css" /> 15: <Style href="IEHacks.css" conditional="if IE" /> 16: <Style title="elastic" href="piyo-elastic.css" media="screen"/> 17: <Style href="print.css" media="print" /> 18: </Styles> 19: </SkinTemplate>
The first 3 attributes are the ones that always existed since .Text:
Name: is the name of the skin (the one that is in the dropdown list in the admin) TemplateFolder: is the name of the folder where the skin is saved StyleSheet: is the name of file that contains a different variation of the main skin available inside the TemplateFolder
And till here nothing new. The next 4 attributes are the new ones, so let’s review them one by one.
MobileSupport This is not strictly related to the performance optimization, but is used to specify the level of support of the skin for mobile browsers. It accepts one of the 3 following values:
None, the default if not specified, means that this skin doesn’t work with mobile browsers Supported, means that this skin works well both with desktop and mobile browsers MobileOnly, means that this is a skin specific for mobile browsers
ScriptMergeMode This one enable the merging of javascript files.
DontMerge, the default one, tells Subtext not to merge all the scripts into one Merge, means that all the JS files are merged into one
The scripts will be merged in the order they are listed in the skin definition. If you specify “Merge” the skinning engine will play safe to ensure that your skin always works fine. So if one of your scripts is a remote one (maybe you want to use the version of jQuery hosted by Google) the scripts will not be merged. The same will happen if one of your scripts is specified with a query string parameter (as in scriptaculous.js?load=effects)
StyleMergeMode When it comes to styles things get a bit more complicated: we have 3 different attributes instead of 2.
None means that no merging will happen (default) MergedAfter: all css files that can be merged will be included in the page after the ones that cannot be merged MergedFirst: all css files that can be merged will be included in the page before the ones that cannot be merged
I know this sounds a little bit cryptic: I’ll come to this after the next attribute.
ExcludeDefaultStyle This is a boolean (possible values true or false) that instructs the skinning engine whether to use the default style.css file or not.
Step 3: Upload and enjoy Well… only two steps, not a complicate procedure, isn’t it?
Now just upload the modified skin configuration file and enjoy the improved performances of the frontend of your blog.
How styles are evaluated in a Subtext skin A Subtext skin is composed by 5 different kind of stylesheets.
style.css: this is the default CSS file, the one that contains all the layout specific for the skin. secondary stylesheet: the one whose name is specified with the StyleSheet attribute of the skin template. This is usually used to provide a variation over the main CSS, like a different color schema or right sidebar vs left sidebar and things like that. custom css: the css rules for this stylesheet are specified by the blog author in the admin section of the blog. Used to add the styles for personal badges or for styles specific to the contents of posts. the css files specified without any attribute: usually used for the system styles or for CSS frameworks (as in line 14 of the snippet above) the css files specified with some attributes: stylesheets with the title attribute (line 16) or with a conditional comment in order to be used only with specific version of IE (line 15) and with a media attribute so that they are applied only when printing or only in screen mode (like 17). Needless to say that these files cannot be merged with the others otherwise they will loose their “attributes”, so these are the “non mergeable” css.
Let’s see now the order in which all these files are included into the page in the 3 different StyleMergeMode:
None With this value the merging doesn’t take place, so the usual order is used:
all the css as specified in the skin definition (4 and 5) the default style (1) the secondary style (2) the custom css (3)
MergedAfter All css files that can be merged will be included in the page after the ones that cannot be merged:
All non mergeable files in separate files (5) The merged file with:
All mergeable styles (4) the default style (1) the secondary style (2)
the custom css (3)
MergedFirst All css files that can be merged will be included in the page before the ones that cannot be merged:
The merged file with:
All mergeable styles (4) the default style (1) the secondary style (2)
All non mergeable files in separate files (5) the custom css (3)
Feedback? Questions? As usual, if you have questions, bug reports and feedback just write on the forums and report bugs.
Tomorrow I’ll talk about another cool new feature of Subtext: Future Posting. Please subscribe to the feed if you want to get it automatically in your feedreader.
Technorati Tags: Subtext,skin,css,YSlow [Less]
|
|
Posted
almost 5 years
ago
by
Simone Chiaretta
One of the cool new features of the latest version of Subtext is the support for enclosures. What can a enclosure do for you? You can use it to: host a podcast host a webcast/screencast to have photoblog or just to
... [More]
include a downloadable file to your post, like a code archive, a pdf file or a PowerPoint presentation How to add a enclosure
At the bottom of the post page you’ll find a new section. Just enter the following data:
the url of the enclosure: it must be the absolute URL of the file of the enclosure (absolute even if on the same domain as the blog) mime type: it’s automatically selected when you enter the url, but you can change it in case you have a strange mimetype. This is used by most client to show a icon of the enclosure size of the enclosure: the size in bytes. Again, used only by clients to display the size of the file. the title of the enclosure: this is used only in the web frontend of the blog (no use in RSS), to display a link to the enclosure from the post page as last thing you can decide whether to show the enclosure from the blog or syndicated with RSS, or both. How the enclosure is rendered in the browser Once you added the enclosure to the post, it will show up in different ways depending on how you are looking at it.
Directly from the blog, if the skin you are using supports it, you will see a link to the enclosure at the end of the post.
If your skin doesn’t support this, it’s just a matter of adding a <asp:Label> control to a few ascx files. I’ll explain how to do it at the end of this post.
Here on the left you see how it is rendered in the post view page, with the title and the size of the enclosure. The same will be displayed in the homepage.
If you read the RSS feed syndicated by your blog directly within the browser, Firefox and IE will format it in different ways.
Firefox
Internet Explorer
How the enclosure shows up in feedreaders RSS feeds are not displayed only inside the browser but also and mainly from feed readers. Here is how my feedreader FeedDemon renders the enclosure:
Subtext-powered podcast on iTunes Probably most of the people are going to enclosures for doing podcasts. The most used podcast downloader is iTunes, and here is how the enclosure from Subtext are displayed:
Subtext doesn’t have a full support for iTunes yet (there are many custom rss elements needed to provide to iTunes all the information it needs) but it’s already in the works and will be released in the next version of Subtext.
How to add enclosure support to your skin As I said earlier it’s quite a trivial fix. All you need to do is add the following lines in the Day.ascx and ViewPost.ascx user controls.
<p class="enclosure"> <asp:Label id="Enclosure" runat="server" DisplaySize="True" /> </p>
Day.ascx is the control that renders the posts in the homepage while ViewPost.ascx is the one that is rendered in the single post page.
If you set DisplaySize to false, the size of the enclosure will not be rendered on the page.
Tomorrow I’ll talk about another cool new feature of Subtext: frontend performance optimization. Please subscribe to the feed if you want to get it automatically in your feedreader.
Technorati Tags: Subtext,Enclosure,iTunes,RSS [Less]
|
|
Posted
almost 5 years
ago
by
Simone Chiaretta
As you might have noticed, a few weeks ago Subtext entered the QA phase of the development process, and the new version, v2.0, is going to be released in a short time. In the next days I’m going to write a few posts about the features I
... [More]
implemented for this new release, with the description of the features, and a little bit of “internals” how they were implemented.
Check my blog during the weekend, or subscribe to the feed to get the new posts with the new features of Subtext delivered automatically to your feedreader.
Technorati Tags: subtext [Less]
|
|
Posted
almost 5 years
ago
by
Simone Chiaretta
As I did last week, this evening I upgraded my blog to the latest interim version of Subtext. As you might see, the time of this post is 5:00AM. No, I didn’t stay up till late, but I’m using one of the new features of the soon to be
... [More]
release 2.0: the ability to post in the future.
So, if this post popped up in your RSS reader at 5:00AM it means the new feature is working… otherwise, it means we have a bug to fix before we do the release.
We also created a custom manifest for Windows Live Writer in order to make it aware of this new feature, and to allow the creation of “future posts” also from WLW.
The ability to write a post now, and have it appear only at a specified time and date is very useful now that the holidays are coming: I can write some posts in advance and have them appear twice or three times a week.
Technorati Tags: Subtext [Less]
|
|
Posted
almost 5 years
ago
by
Simone Chiaretta
You might have noticed a short period of downtime at 8:30 this morning (CET): that’s because I woke up and decided to test on my own blog the soon to be released next version of Subtext. As usual the upgrade was pretty simple, and just a
... [More]
matter of changing the values that need to be customized in the web.config file (connectionstring, email addresses, and gravatar url), copying all the new directory tree over the old one, and running the upgrade wizard that appears the first time you reload the site after the files have been changed.
And here I am, running on Subtext 2.0.0.22:
And the version on the footer in the admin section of the site:
If you find some problem while browsing the site, please tweet me, comment on this post or contact me.
And when this release is out I’ll try and change a bit my own skin.
Technorati Tags: subtext,dogfood [Less]
|
|
Posted
almost 5 years
ago
by
Simone Chiaretta
Just found via Twitter thanks to Matt Hawley: SubversionFeed. This service takes any SVN repository with anonymous access enabled and transforms it into a RSS feed with the latest 10 changes. I just subscribed to Subtext SVN RSS
... [More]
feed: http://svnfeed.com/convert?url=https://subtext.svn.sourceforge.net/svnroot/subtext
Technorati Tags: RSS,SVN,Subtext [Less]
|
|
Posted
about 5 years
ago
by
Simone Chiaretta
Validators are a great part of the ASP.NET framework: they provide a standardized and easy way to add validation to form fields. But even if the framework provides different kinds of validators, there are so many different validations patterns that
... [More]
sometimes you have to write custom code to match your specific requirements.
I wrote a post a few months ago about how to write a custom validator for a Checkbox list, but I was dealing with a completely new validation pattern. But what if I only want to enable the validation of certain field based on certain conditions? Or if I want to validate based on an event that is not the OnChange event of the form field? And all of this while keeping the standard validation logic?
If the condition can be determined in the code-behind it's easy:
//Disable server side validation myRequiredFieldValidator.Enabled = false; //Disable client side validation myRequiredFieldValidator.EnableClientScript = false;
But what if I want to enable the validator from javascript? I didn't find anything online about this so I debugged the ASP.NET js validation library to look for the method that enables the validation, and for the one that forces the validation check.
Enable a validator via javascript
The method to enable or disable a validator is:
function ValidatorEnable(val, enable)
where val is the reference to the <span> element that the validator uses to render the error message, and enable is a boolean to tell the method whether to enable or disable the validation.
Force a validation via javascript
In case you want to ask to a validator to do his job:
function ValidatorValidate(val, validationGroup, event)
val is again the reference to the validator <span>, validationGroup is the name of the validation group of the element that is triggering the validation, event is the reference to the event that triggered the validation. But only the first parameter is useful when you want to force the validation, since the others are used only by the standard validation of ASP.NET.
A real life example
Let's see a example from the code I'm writing for one of the new features of Subtext.
Imagine you have this snippet of HTML code:
<asp:DropDownList ID="ddlMimeType" runat="server"> <asp:ListItem Value="mp3">audio/mpeg</asp:ListItem> <asp:ListItem Value="wma">audio/wma</asp:ListItem> <asp:ListItem Value="other">Other</asp:ListItem> </asp:DropDownList> <asp:TextBox id="txbOtherMimetype" runat="server" /> <asp:RequiredFieldValidator id="valOtherMimetypeRequired" runat="server" ControlToValidate="txbOtherMimetype" ForeColor="#990066" ErrorMessage="You have to specify a custom mimetype." />
And you want to enable the valOtherMimeTypeRequired validator only when the option selected in the drop down is "other".
Using jQuery here is the javascript code to do the job:
<script type="text/javascript"> $(document).ready(function() { $("#<%= ddlMimeType.ClientID %>").change(function() { toggleOtherMimeType(this); }); }
function toggleOtherMimeType(elem) { if(elem!=undefined) { if(elem.value=="other") { $("#<%= txbEnclosureOtherMimetype.ClientID %>").show(); ValidatorEnable($("#<%= valEncOtherMimetypeRequired.ClientID %>")[0], true); } else { $("#<%= txbEnclosureOtherMimetype.ClientID %>").hide(); ValidatorEnable($("#<%= valEncOtherMimetypeRequired.ClientID %>")[0], false); } } } </script>
Notice the <%= ddlMimeType.ClientID %> to select a server-side control using the automatically generated client ID and the $("#elemendId")[0] to get the real DOM element and not the jQuery wrapper around it.
And in case I wanted to force the validation I should have written:
ValidatorValidate($("#<%= valEncOtherMimeTypeRequired.ClientID %>")[0]);
It took me a while to find out this method name. I hope this will save you a bit of the time I spent hunting down the names using Firebug.
Technorati Tag: ASP.NET,validator,jQuery [Less]
|