Archive Compendium

From Jimbojw.com

Jump to: navigation, search

A compendium of all archived blog entries - ever.

« back to Blog Archive

Contents

November 2007

Blog entries from October 2007.

« back to Blog Archive

Don't use GTalk Emoticons v0.1

From Don't use GTalk Emoticons v0.1:

When I recently wrote How to get your old fast Gmail back I had assumed that using the old UI would correct the slowness that I was seeing. And it did - to a limited extent, but it wasn't as fast as it used to be, and often crashed Firefox if left open too long.

After investigating, I found that disabling my very own GTalk Emoticons extension resolved the issue. It must be that even though Google preserved the original UI, it is incompatible in some way with my extension.

So my standing advice is to DISABLE OR REMOVE GTALK EMOTICONS if you are experiencing a slowdown in Gmail with it installed - I know I did.

I have no immediate plans to create an updated version of the extension - however, if there is enough public outcry, I just might.

Sorry for the inconvenience. :(

[read more ...] -or- [leave a comment ...]

--Jim R. Wilson 15:02, 14 November 2007 (MST)

No more slow Gmail!

From How to get your old fast Gmail back:

Update It's not Google's fault - it's mine. See Don't use GTalk Emoticons v0.1 for more details.


So, you're tired of how ridiculously SLOW the new Gmail UI is too, eh? Don't bother with Google's FAQ. Here's how to turn back the hands of time...

[read more ...] -or- [leave a comment ...]

--Jim R. Wilson 15:41, 13 November 2007 (MST)

Weekly Web Hack - Relative to What?

From Position absolute is really relative?:

In this edition of the Weekly Web Hack, I'll explain the difference between the four possible values for the 'position' CSS attribute, focusing on the meaning of position:absolute...

By the end of this article, you should be able to:

  1. Understand what static, relative, absolute and fixed positioning are,
  2. Subvert the rules of 'position:absolute' to achieve proper element placement.

[read more ...] -or- [leave a comment ...]

--Jim R. Wilson 22:55, 12 November 2007 (MST)

Yet Another MediaWiki Parser Grammar Debate

From Another Parser Grammar Debate:

In the last few days, the wikitech-l mailing list has seen a sizable amount of activity surrounding the "formalization" of the MediaWiki syntax by way of an established grammar. And as usual, the common arguments for and against are presented and a lot of points of view are espoused and defeated. Chances are that (as usual) nothing will come of this discussion besides perhaps a renewed commitment to revisit the issue later.

As I and at least one other contributor mentioned, all of this academic discourse is of limited real-world value. That is, arguing about whether or not the "problem" of formalizing the grammar is solvable using traditional tools (like EBNF) is patently pointless.

One assumption of the debate seems to be that wikitext is immutable. That is, that other than perhaps solidifying certain aspects by disambiguating edge cases, the current lexicon should not change. If this is strictly the case, then I have nothing further of value to add to the discussion. The existing PHP based MediaWiki Parser does a pretty good job of parsing and rendering MediaWiki syntax.

If, however, we assume that wikitext is *not* perfect, and that there could be better ways to meet the goals of the project, then we enter a realm where much more is possible.

For example, one "problem" that comes up quite often is the implementation of a proper WYSIWYG editor. In this context, "proper" usually refers to a round-trip proof schema whereby editing using either the WYSIWYG editor or a plain text editor has no effect on the other. Whenever this comes up, the usual community response is, "let's formalize the grammar first, then that'll be easy".

Personally, I think the following items are much easier to attain than formalizing wikitext, and have a much bigger immediate payout. I'd like to see:

  1. An unambiguous storage scheme (XML, light-markup, JSON, YAML - whatever)
  2. A method to allow lossy round-trips between this scheme and wikitext, Markdown, Textile, or whatever to allow experts to continue to edit in a standard <textarea>.
  3. A renderer that can output valid XHTML (and maybe someday FO or PDF)
  4. Alternative editors (Ajax, Flash/Flex, desktop apps - whatever).

All of this is probably not achievable maintaining full backwards compatibility with mediawiki syntax - so an initial setup script which does a decent job of converting wikitext to the unambiguous storage scheme would be necessary to convert existing articles. The Parser would have to be maintained in order to render old versions of articles prior to the advent of the new storage scheme.

Basically, rather than ask "what can we do to fix what we have?", I'd like to address the question of "given what we know, how would we do things differently?" Once an answer to that is established, then we can come up with an incremental game-plan to get there.

Anyway, those are just my two cents. As always, it's easy to throw tomatoes from up here in the cheap seats.

[read more ...] -or- [leave a comment ...]

--Jim R. Wilson 21:36, 12 November 2007 (MST)

Weekly Web Hack - Dynamic CSS Tag Filtering

From Dynamic CSS Tag Filtering:

In this Weekly Web Hack, I'll demonstrate how to use CSS classes for dynamic tag filtering. That is, showing and hiding page elements based on whether they've been tagged in a particular way...

By the end of this article, you should be able to:

  1. Understand how the browser's natural ability to filter elements can be used to your advantage,
  2. Implement a simple tag filtering mechanism using HTML/CSS and JavaScript.

[read more ...] -or- [leave a comment ...]

--Jim R. Wilson 23:29, 4 November 2007 (MST)

How to create Popup links in MediaWiki

From Popup links in MediaWiki to new window:

One recurring question I've seen with respect to MediaWiki is "How do I create popup links?" That is, have links which when clicked launch a new window or browser tab.

Although there are some very good reasons NOT to allow this on a site, the following is one solution which requires only sysop permissions on a wiki. No extensions or other filesystem access is required...

[read more ...] -or- [leave a comment ...]

--Jim R. Wilson 14:45, 2 November 2007 (MST)

October 2007

Blog entries from October 2007.

« back to Blog Archive

Weekly Web Hack - Sanitizing user inputs against XSS

From Sanitizing user input against XSS:

In this Weekly Web Hack, I'll explain why some popular user input sanitization schemes can be insufficient in stopping XSS vulnerabilities...

By the end of this article, you should be able to:

  1. Identify when HTML entity encoding is appropriate,
  2. Choose between several encoding schemes depending on use-case

[read more ...] -or- [leave a comment ...]

--Jim R. Wilson 23:28, 28 October 2007 (MST)

Weighted Companion Cube Pumpkin

From Weighted Companion Cube Pumpkin:

Like many of you, I too was disheartened when forced to euthanize my Weighted Companion Cube. To help cope with my grief, I have enshrined her memory in pumpkin form...

[read more ...] -or- [leave a comment ...]

--Jim R. Wilson 22:10, 28 October 2007 (MST)

Weekly Web Hack - Absolutely relative

From Absolutely relative HTML elements:

In this Weekly Web Hack, I'll demonstrate how to have semantically ordered HTML elements appear visually reordered static width, center floated, single column page...

By the end of this article, you should be able to:

  1. Make a centered single column layout in HTML/CSS (easy to do, and popular for blogs).
  2. Reorder the major elements, putting the most important info first (CSS).

[read more ...] -or- [leave a comment ...]

--Jim R. Wilson 23:43, 21 October 2007 (MST)

New Facebook App - Does nothing

From Does nothing:

"Does nothing" is my facebook app. It does nothing, seriously.

Get Does nothing today and tell all your friends!

[read more ...] -or- [leave a comment ...]

--Jim R. Wilson 11:27, 19 October 2007 (MST)

Weekly Web Hack - Data URIs and Inline Images

From Data URIs and Inline Images:

In this edition of the Weekly Web Hack, I'll explain how data URIs work and give some practical examples when you might want to use them in your own project...

By the end of this article, you should be able to:

  1. Determine whether a particular use-case is suitable for inline data,
  2. Understand the data: URI scheme and available encodings,
  3. Use data URIs to embed image (and other) data directly into an HTML or CSS file.

[read more ...] -or- [leave a comment ...]

--Jim R. Wilson 04:21, 15 October 2007 (MST)

Weekly Web Hack - What Would Google Suggest?

From What Would Google Suggest?:

In this first edition of the Weekly Web Hack, I'll explain how Google Suggest operates under the hood, and how you can leverage its architecture to place search suggestions into your own page...

By the end of this article, you should be able to:

  1. Understand Google Suggest's request URL structure and response body,
  2. Roll your own autocomplete implementation utilizing Google's suggest data.

[read more ...] -or- [leave a comment ...]

--Jim R. Wilson 01:28, 8 October 2007 (MST)

Announcing the Weekly Web Hack

From Announcing the Weekly Web Hack:

In January 2007, I mentioned that it was my goal of mine to put out at least one good article every week. I have been little lax in this duty of late, and so I am instituting a new recurring feature on the Jimbojw.com blog: the Weekly Web Hack. Each week at a regular time I will publish a new Web Hack, which may be a mashup, dissection of a web service or site, or maybe a tutorial on how to do something clever. I haven't completely decided yet.

There are a few things you can count on though: it will be something to do with the Web, it will be tricky or non-obvious, and hopefully it'll present a new way of using an existing piece of software or webrastucture in a novel way. So stay tuned!

[read more ...] -or- [leave a comment ...]

--Jim R. Wilson 23:32, 7 October 2007 (MST)

September 2007

Blog entries from September 2007.

« back to Blog Archive

Ext JS Licensing Concerns

From Ext JS Licensing Concerns:

In a recent article titled What JavaScript libraries do you use?, I mentioned that I was afraid of licensing structure surrounding the Ext JavaScript Library. Here, I'll describe in greater detail why I feel this way, and why you might want to think twice before utilizing this library.

Note: I am not a lawyer, and this is not legal advice.

Ext has three licensing modes as described on their license page: LGPL 3.0, Commercial and the nebulous OEM. In and of itself, LGPL 3.0 is not that terrifying. Using an LGPL'd library binds you to releasing any modified code under the same or compatible license, but makes no claims to tangential work. So say your JavaScript code simply used Ext, but you didn't touch their source, you *should* be in the clear.

The reason that LGPL is troubling has more to do with other JavaScript libraries than Ext itself. Consider this list of other popular JavaScript libraries and their licenses:

Library License
Prototype MIT-Style license
Scriptaculous MIT-Style license
jQuery MIT OR GPL licenses
Mootools MIT-Style license
dojo Academic Free License OR the modified BSD license
YUI BSD

You'll notice that they are all available under either MIT, AFL or BSD derived licenses. Due to their openness and low number of restrictive clauses, these license are commonly referred to as permissive free software licenses. GPL and its derivitives are (by contrast) not permissive, making restrictions on the manner the code can be used, distributed and modified. Whereas MIT-style and BSD derived licenses (barring an advertising clause) are GPL compatible, the converse is not true.

So while every other major JS framework is permissively licensed, and therefore easily redistributed, modified and packaged at the developer's whim, Ext is not - forcing the consumer to carefully plan out their usage of the library.

Adding to the confusion is the fact that the other option for Ext is a Commercial license. I have not seen the text of the commercial license, but it seems your choices with Ext are copyright or copyleft. All Ext's competitors are all copycenter.

Finally, the OEM clause of the Ext license page is concerning. Here's the important piece:

If you plan to distribute Ext in a product that will be packaged or sold as a software development library, toolkit or plug-in-based framework (LIBRARY), we require that you work with us to establish a specific license that is appropriate. Use of the open source license in a LIBRARY is not permitted without explicit permission.

What this seems to imply is that if you plan to distribute Ext to people who plan to distribute it themselves, you need to check with the project owners first. This introduces more complexity since it raises the question of whether you could be found in violation of their terms by including the library, then having the consumer redistribute it, without your consent or notification. It would seem that they (your users) are within their rights and the statutes of the LGPL in doing so, but does it put you in conflict with the OEM clause? I'm not sure.

Or what if your project's requirements change? Suppose you chose Ext initially thinking your customers would have no need to use it directly, but later you find that this was a faulty assumption, that your users would require Ext to do their work as well.

These open-ended questions are what keep me from condoning use of the framework as Mike Chambers (Principal Product Manager for developer relations for Adobe AIR) does:

Basically, if you want to build Apollo applications using HTML / JavaScript, then this is the library you should start with..

So there you have it. Use Ext if you like, but if you're like me and have a healthy distaste for ambiguity and contradiction, please think carefully about the possible litigious consequences of that choice.

Good luck! I hope this helps.

[read more ...] -or- [leave a comment ...]

--Jim R. Wilson 22:11, 16 September 2007 (MST)

EmbedVideo Ver 0.1.2 Released

From EmbedVideo Ver 0.1.2 Release Announcement:

Version 0.1.2 of the EmbedVideo Extension has been released and is available for download. This minor release includes the following:

  • Code cleanup - would previously cause 'Notice' level messages in PHP (strict mode).
  • Bug fix - now can be embedded in lists without breakage (see this previous article for a description of the problem and solution).

Enjoy! As always, I'll be happy to answer any questions.

[read more ...] -or- [leave a comment ...]

--Jim R. Wilson 23:20, 14 September 2007 (MST)

What JavaScript libraries do you use?

From What JavaScript libraries do you use?:

Recently, Jean-Lou Dupont asked me in an email the simple question: "What sort of AJAX framework are you using: jQuery, MooTools, YUI, prototype etc. ?"

The truth is, I'm currently in a state of flux between frameworks. Let me explain...

Prototype/Scriptaculous

For a long time I was partial to Prototype for cross-browser development/Ajax and Scriptaculous for effects. I find the documentation for these libraries to be for the most part thorough, using gotAPI and the scriptaculous wiki for info respectively.

Note: If you've never used gotAPI, I strongly suggest you start today. It is, quite simply, the fastest and easiest way to find API docs on a wide range of current web technologies and programming languages.

jQuery

Since it was created, I've always kept a place in my heart for jQuery because of its ingenious '$' method and English-like syntactical sugar. Unlike Prototype's $ which is basically a document.getElementById() wrapper, jQuery's function takes a string representation of a CSS3 compatible selector and returns a collection all matching elements. Prototype now has a similar method called $$, but, by their own admission, it's not as fast as it could be.

That said, I've never actually used jQuery in a project of mine as yet - though it's on my list of technologies to investigate further.

Ext/YUI

In the last few weeks I've been writing some small Adobe AIR applications, and consequently I've been researching JavaScript frameworks to make development easier. One that comes up a lot in the AIR world is Ext - which is fantastic at creating all manner of desktop-app-like widgetry. Whereas other frameworks force you to create your own images and CSS to back your JS magic, Ext comes prepackaged with several "themes" - each with its own set of icons, backgrounds, gradients and stylesheets. It also has out-of-the-box support for a number of common UI paradigms such as tabbed panels, menu bars and sliding frames.

Ext was originally built on the Yahoo! User Interface Library (YUI), but has since been decoupled. Ext can now be used standalone, or in conjunction with Prototype/Scriptaculous, jQuery or YUI. I have never used YUI.

Unfortunately, one aspect of Ext which scares me very much is its license, which is either LGPL 3.0 or Commercial. I personally fear the viral impact of LGPL 3.0, and I especially don't like the OEM clause of the aforementioned license page, which states:

If you plan to distribute Ext in a product that will be packaged or sold as a software development library, toolkit or plug-in-based framework (LIBRARY), we require that you work with us to establish a specific license that is appropriate. Use of the open source license in a LIBRARY is not permitted without explicit permission.

If something is open-source, I just want to use it - not worry about whether I'm meeting the vague clauses on some web page, nor do I wish to contact the owners to ask if my use case meets their particular definition of "library". That's why everything I release has a specifically permissive license (see my Clarification on the extent of my licensing terms).

Mootools

One library which has really caught my attention lately is Mootools, which has many of the capabilities of Prototype/Scriptaculous and more. It's also compact, utilizing the "pick features, pick compression type, and download" paradigm which jQuery pioneered. The result is that you can get a very small library with exactly those features that you actually need.

In the case of doing development in Adobe AIR, size doesn't really matter, so I just keep an uncompressed compendium of all features.

dojo

I've never actually used dojo, but I plan to very soon. It appears to have similar capabilities to Ext, but with a distribution and developer friendly license. This is probably because dojo is backed by a foundation rather than an LLC (but that's just wild speculation on my part)

Rico

I used Rico briefly because I needed an accordion effect that Scriptaculous didn't provide. I was researching alternatives when I came across Mootools and subsequently Ext. I ended up using Ext's ContentPanel concept instead.

Conclusions

So in summary, Prototype and Scriptaculous used to be my twin hammers of destruction for all things JavaScript, but right now I'm into Mootools and Ext, probably switching to Mootools and dojo soon. I'm not sure yet how jQuery will factor into my future developments, but it's something to keep an eye on.

What's your favorite JavaScript library? or if you don't have a favorite, which ones do you use?

[read more ...] -or- [leave a comment ...]

--Jim R. Wilson 12:59, 12 September 2007 (MST)

Open Failed: Administratively Prohibited

From Channel 5: Open Failed: Administratively Prohibited:

When I'm out-and-about using others' wireless services, I protect my packets by setting up a dynamic SOCKS 5 proxy over SSH. Usually everything works find, but lately I've been seeing some issues.

A full description of how to set up such a proxy server is outside the scope of this article, but for the sake of background info, the command I use from the client-side looks something like this:

ssh -D 23456 my-user@my-domain.com

The above uses the Dynamic proxy option (-D) to create a SOCKS 5 proxy on local port 23456.

Every so often, when using a browser which has been configured to use the tunnel, a request would fail and I'd see an error like the following in the terminal from which I had launched the ssh command:

channel X: open failed: administratively prohibited: open failed

Where X was an integer value, usually between 3 and 5.

After much confusion, I finally tracked down the issue - it has to do with domain resolution. My OpenSSH setup "administratively prohibits" using the dynamic proxy to resolve computer names lacking top-level domain extensions. So for example, if I tried to visit http://randomsite.com/, the request would succeed.

However, a request to http://randomstring/ would trigger the error since my browser (which is using the dynamic proxy) is trying to reach the computer named "randomstring".

Note that this doesn't happen when randomstring is localhost, since the browser is smart enough to blacklist this as a domain which requires DNS lookup.

It turns out that the way I was causing this was by relying on Firefox's automatic "I feel lucky" option when you type a non-url into the address bar. I would type "randomsite" expecting to be taken to "http://www.randomsite.com". However, since I am using a proxy, this was not utilizing Google, and instead attempting to resolve to "http://randomsite/" - triggering the error in the terminal as described above.

And that is a seemingly trivial point that should not be overlooked:

When using the "Manual proxy configuration" option in Mozialla Firefox, it becomes the proxy's responsibility to resolve non-url requests in the address bar. They are not resolved by Google's "I feel lucky" facility.

The unsettling thing was that when this occurs, in the browser there is no visible feedback. Nothing at all appears to happen. Typically in Firefox, when a server can't be reached, you get an informative message stating so in the content of the browser tab. In this case though, all you see is a blank white page with "(Unknown)" for a title.

In any case, this is what was causing my problem - if you're seeing a similar "administratively prohibited" error, it may or may not be this. Your mileage may vary. Good luck!

[read more ...] -or- [leave a comment ...]

--Jim R. Wilson 12:01, 10 September 2007 (MST)

August 2007

Blog entries from August 2007.

« back to Blog Archive

Testing an MP3 URL in Adobe AIR

From How to test an MP3 URL in Adobe AIR:

Lately I've been trying to learn how to write Adobe Integrated Runtime (AIR) applications using HTML and JavaScript. I ran into an issue whereby I couldn't trap an exception via JavaScript's try...catch statement.

Specifically, I wanted to be able to silently skip an MP3 URL if it was unloadable for any reason. I had hoped that this simple code would work:

var sound = new window.runtime.flash.media.Sound();
try {
    sound.load( new window.runtime.flash.net.URLRequest( mp3URL ) );
} catch(e) { return; }

Unfortunately, for bad URLs, this was throwing an error that wasn't being caught. It looked something like this (paths truncated for brevity):

Error #2044: Unhandled IOErrorEvent:. text=Error #2032: Stream Error.
  at flash.html::ResourceLoader/flash.html:ResourceLoader::nativeReceivedAllData()
  at flash.html::ResourceLoader/flash.html:ResourceLoader::receivedAllData()
    [...\Temp\aslibc-28157\HTMLResourceLoader.as:214]
  at flash.html::ResourceLoader/flash.html:ResourceLoader::onComplete()
    [...\Temp\aslibc-28157\HTMLResourceLoader.as:365]

Thanks to some help from the the apollocoders mailing list, I was able to get this code to work instead:

var goodLink = true, sound = new window.runtime.flash.media.Sound();
sound.addEventListener(
    window.runtime.flash.events.IOErrorEvent.IO_ERROR,
    function(error) { goodLink = false; }
);
sound.load( new window.runtime.flash.net.URLRequest( mp3URL  ) );
if (!goodLink) return;

It seems that adding an explicit event listener for errors is more effective for trapping ActionScript exceptions from JavaScript than merely using native try/catch blocks.

Hope this helps! As always I'll be happy to answer any questions.

[read more ...] -or- [leave a comment ...]

--Jim R. Wilson 22:01, 20 August 2007 (MST)

The Role of Software Architecture

From The Role of Software Architecture:

I've been known to refer to myself as an "anti-architect" in certain circles. This is not to say that I don't appreciate elegant code - I believe that it's possible for architecture to be good - however, the term "architecture" itself has come to symbolize a particular programmatic world-view that is in direct conflict with my thoughts on the matter, and indeed my actual experience.

It is never the role of Software Architecture to prevent developers from hurting themselves. Let me repeat that, because it bears repeating:

The role of Software Architecture is NEVER to prevent developers from hurting themselves.

To understand why this is, let's look at an analogous entity: the Manager. Some people believe that the role of a Manager is to keep his or her underlings in line - to prevent them from screwing around. Certainly this is a task that Managers may have to perform from time to time, but it isn't their role.

The role of Managers is to actually facilitate the effectiveness of their underlings by providing resources and removing obstacles - to reduce friction. Understood in this light, Management doesn't seem like such a bad thing.

If a Manager's job devolves into merely babysitting the employees under their command, then there's a bigger problem - that the employees need to go. An organization should strive to employ workers who want to work and to help the company succeed. Where this is the case, Managers are able to fulfill their role as facilitators, not dictators.

So in the same way:

The role of Software Architecture is ALWAYS to facilitate the effectiveness of the developers using that Architecture.

That is, it should make the developer's tasks easier to accomplish, not more difficult. Just as an organization should hire employees that want to succeed, a software shop should hire developers that know how to code - and like doing so.

Occasionally, a task of architecture is to restrict access to protected resources; but just as with a Manager's disciplinary duty, this is not its central purpose.

When you define Software Architecture as an entity that facilitates, it's possible to see how it might be a Good Thing. When you define the whole of Software Architecture by one small portion of itself, you miss the point entirely.

Unfortunately, with organizations perpetuating mediocre developers through the ranks, Architects become dictators. They spend their time keeping the developers in the kiddie pool rather than letting them learn how to swim in the deep end.

This is why I say I'm an anti-architect: because the colloquialism of Software Architecture has become a symbol for effectiveness prevention everywhere.

[read more ...] -or- [leave a comment ...]

--Jim R. Wilson 16:06, 16 August 2007 (MST)

July 2007

Blog entries from July 2007.

« back to Blog Archive

Raw HTML Output from a Parser Function

From Raw HTML Output from a MediaWiki Parser Function:

In a previous article I described how to get Raw HTML output from an extension tag. Here, I'll describe how to do the same for Parser Function.

Example Extension

Consider this simple parser function which provides a way to inject arbitrary raw HTML into a page.

$wgExtensionFunctions[] = 'setupRawHTML';
$wgHooks['LanguageGetMagic'][] = array( $this, 'setupRawHTMLMagic' );
 
function setupRawHTML( ) {
    global $wgParser;
    $wgParser->setFunctionHook( 'rawhtml', 'renderRawHTML' );
}
 
function setupRawHTMLMagic( &$magicWords, $langCode='en' ) {
    $magicWords['rawhtml'] = array( 0, 'rawhtml' );
}
 
function renderRawHTML( &$parser, $input='' ) {
    return $input;
}

It is intended to be called like this: {{#rawhtml:HTML}} where HTML is any markup to be passed straight through.

A seasoned extension developer will immediately notice that this won't work as written. When the output of a parser function's implementing method is a String, the resulting text is treated as wikimarkup and thus is subject to the same restrictions as regular text. So since renderRawHTML() returns a String, it will not be rendered as raw html.

First Attempt

Fortunately, the MediaWiki Parser has a workaround. If the return value of the implementing method is an Array, it can specify that the output is raw HTML and shouldn't be rendered further. Here's the updated method, returning an Array with the appropriate options:

function renderRawHTML( &$parser, $input='' ) {
    return array( $input, noparse => true, isHTML => true );
}

We can test this new version with the text '{{#rawhtml:<a href="http://mahalo.com/">Mahalo</a>}}', which renders:

<a href="http://mahalo.com/">Mahalo</a>

Exactly as expected!

New Problem

However, due to a hardcoded "\n\n" which is prepended to the HTML output of parser functions, using this option will break lists (which are processed later during the parse).

To demonstrate, consider this wiki markup:

# Check out this site: {{#rawhtml:<a href="http://mahalo.com/">Mahalo</a>}}
# It's really cool.

When rendered, the newlines force the above markup to be interpreted as this:

# Check out this site: 
<a href="http://mahalo.com/">Mahalo</a>
# It's really cool.

Which means that instead of getting a single list with two elements, we get two lists with one element each, separated by a link. Clearly this is not what was intended.

The Solution

Fortunately, since MediaWiki's codebase is so open and flexible, it is possible to bypass this newline insertion by doing some of the Parser's work ourselves.

Consider this new version of the renderRawHTML() method:

function renderRawHTML( &$parser, $input='' ) {
    return $parser->insertStripItem( $input, $parser->mStripState );
}

The Parser's insertStripItem() method adds a new raw HTML string ($input) to the strip state, then returns a unique string which will be replaced with the HTML during a later parsing step.

Now that the implementing method is returning a String again instead of an Array, the output is treated as wikitext, but it doesn't matter. The unique string is guaranteed to not contain any reserved wikitext characters, and thus will sail through subsequent parsing steps untouched.

Final Thoughts

In the final analysis, it was MediaWiki's hardcoding of the newline characters that caused the problem. In a less flexible architecture, this would have been an insurmountable failing-point, the only resolution to which would have been hacking the core (a very Bad Thing).

However, because MediaWiki passes many of its internal objects around by reference, and because the members and methods of those objects are public, many things that would otherwise be stopping points become merely inconveniences.

This is the true beauty of the MediaWiki architecture - not that it's a monolithic testament to software design principles, but that it contains the healthy balance of structure and pragmatism. It may not do exactly what you want out-of-the-box, but it's often easy to get it to do so (with enough time and cleverness, of course).

Enjoy! As always, I will be happy to answer any questions.

[read more ...] -or- [leave a comment ...]

--Jim R. Wilson 16:29, 30 July 2007 (MST)

Displaying MW Categories in a portlet

From How to display MediaWiki Categories in a portlet:

There was a question recently in the MediaWiki mailing list regarding how to manipulate the Categories during Skin development. That is, how to have them display in a list rather than as a simple string separated by pipe ("|") characters.

Here's one solution - it's similar to what I use on this site. It's not the architecturally "correct" way, but it's easy to drop into the execute() method of your skin without worrying about actually extending things the right way:

<?php
if($this->data['catlinks']) {
    $reps = array(
        '/<p class=["\']catlinks["\']>/' => '<div class="portlet" id="p-catlinks"><h5>',
        '/<a .*?>Categor(y|ies)<\\/a>: /' => 'Categor$1</h5><div class="pBody"><ul>',
        '/<\\/p>/' => '</ul></div></div>',
        '/<span dir=["\']ltr["\']>/' => '<li>',
        '/<\\/span>/' => '</li>',
        '/ \\| /' => '',
    );
    echo(preg_replace(
        array_keys($reps),
        array_values($reps),
        $this->data['catlinks'];
    ));
}
?>
Hope this helps! As always, I'll be happy to answer any questions.

[read more ...] -or- [leave a comment ...]

--Jim R. Wilson 13:18, 16 July 2007 (MST)

June 2007

Blog entries from June 2007.

« back to Blog Archive

Identifying bad PHP files

From How to find PHP files with trailing whitespace:

In a recent discussion on the #mediawiki IRC channel, a user came on with a common problem - there were leading empty lines in the recent changes RSS feed. Something like this (I've put underscores where the newlines are for readability):

_
_
_
<?xml version="1.0" encoding="utf-8"?>

When this happens, it's nearly always due to an extension with trailing whitespace at the end of the PHP file - like this (using underscores again for emphasis):

?>
_

Since this is a common problem, I crafted a solution the quickest way possible - using Ruby:

#!/usr/bin/ruby
 
Dir.glob( '**/*.php' ) do |file|
  puts file if IO.read(file).match( /\?>\s{2,}\Z/m)
end

To run this as a one-liner, cd to your MediaWiki (or other PHP) directory and paste this on the command line:

ruby -e 'Dir.glob( "**/*.php" ) { |file| puts file if IO.read(file).match( /\?>\s{2,}\Z/m) }'

When I mentioned this solution in IRC - I was scoffed at to the tune of "not everyone has Ruby". So here's an alternative version using PHP's command line interface (CLI):

<?php
foreach (glob('**/*.php') as $file){
  if (preg_match('/\\?'.'>\\s\\s+\\Z/m',file_get_contents($file)))
    echo("$file\n");
}
?>

Again, here's the same script as a one-liner, suitable for pasting into your shell.

echo '<?php foreach (glob("**/*.php") as $file){if (preg_match( "/\\?".">\\s\\s+\\Z/m", file_get_contents($file))) echo("$file\n");} ?>' | php

I'm tempted to throw together a patch which adds this in a new PHP file in MediaWiki's maintenance directory. That way admins have a resource at hand for finding out what's broken in their distribution.

Note: I only have my Ubuntu linux box available right now, so I haven't been able to test in Windows. If someone out there can confirm that either or both of these work in a Windows Command Prompt, please leave me a comment - I'd love to hear about it!

As always, I'll be happy to answer any questions. Enjoy!

Update!

I've created a file suitable for inclusion in maintenance - however it appears this will never be included in the core as there are plans to implement a comparable check during normal page-load operation. Oh well. Teaches me for being proactive :(

maintenance/findBadFiles.php:

<?php
/**
 * Simple script to identify 'bad' PHP files - those with trailing
 * whitespace which often break functionality.
 * 
 * @addtogroup Maintenance
 *
 * @author Jim R. Wilson (wilson.jim.r<at>gmail.com)
 * @copyright Copyright © Jim R. Wilson
 * @license http://www.opensource.org/licenses/mit-license.php MIT
 */
 
# This is a command line script
include('commandLine.inc');
 
# Find all those bad files and call them out!
foreach (glob($IP . '/**/*.php') as $file){
    if (preg_match('/\\?'.'>\\s\\s+\\Z/m',file_get_contents($file))) echo("$file\n");
}
?>

[read more ...] -or- [leave a comment ...]

--Jim R. Wilson 16:55, 28 June 2007 (MST)

XMMS, Gnome and global hotkeys

From XMMS, Gnome and global hokeys - setting up keybindings:

Using Winamp in Windows, it's pretty easy to set up "global hotkeys" which always control that application - regardless of what else is running. This article describes how to do the same with XMMS and Gnome using global keybindings.

Note: I use Ubuntu - your steps may vary slightly for different distros.

Key layout

On my keyboard, there is a set of buttons above the arrow keys that looks like this:

Insert Home Page Up
Delete End Page Down

Which we will map to these XMMS commands:

Play Pause Previous track
unused Stop Next track

Note: If you want to set up the buttons differently, adjust the global keybindgs (last step) to fit your needs.

Finding the configuration
  1. Open the Gnome configuration editor by executing the command 'gconf-editor' on the command line
  2. Navigate down the left-hand pane to /apps/metacity
Keybinding commands

The first configuration step is to establish the keybinding commands.

  1. Open keybinding_commands under /apps/metacity in the left hand pane.
  2. In the right-hand pane of key/value pairs, enter the values below:
Name Value
command_1 xmms --play
command_2 xmms --pause
command_3 xmms --stop
command_4 xmms --rew
command_5 xmms --fwd
Global keybindings

Lastly, we need to tell Gnome which keys to map to these actions.

  1. Open global_keybindings under /apps/metacity in the left hand pane.
  2. In the right hand pane, enter the values below:
Name Value
run_command_1 <Control><Alt>Insert
run_command_2 <Control><Alt>Home
run_command_3 <Control><Alt>End
run_command_4 <Control><Alt>Prior
run_command_5 <Control><Alt>Next

That's it! A restart of the X server shouldn't be required (but you never know with these things).

As always, I'll be happy to answer any questions. Enjoy! [read more ...] -or- [leave a comment ...]

--Jim R. Wilson 09:38, 14 June 2007 (MST)

Some extension licensing clarification

From Clarification on the extent of my licensing terms:

Recently I've been asked to clarify the licensing terms of my various extensions and bits of open source code - so here's my attempt.

Note: I am not a lawyer.

Unless otherwise noted in the source code, everything posted on this site is released under The MIT License - regardless of whether it appears as a snippet within an article, or as a full-fledged application, script or extension.

If you've found something useful upon which you'd like to extend, innovate or hack, great! The usual thing done in this case is to credit the original author (me) and then add your own name. For example, consider Joshua C. Lerner's MetaDescriptionTag Extension. It is based heavily my MetaKeywordsTag Extension. You'll notice in the copyright/license info at the top of his script that he has preserved my name as an "author" while adding his own.

This form of attribution is not strictly required however, since the MIT License is considered to be a "Permissive free software license".

This means (if I understand it correctly) that the copyright holder loses little if a court would find the source to qualify as being in the public domain even if that's not technically accurate.

So in summary, feel free to use whatever bits of code you like from what I've written and released. I have purposely chosen a permissive license so that others like you may gain from what I've written. It's a nicety to include a note in the comments somewhere that the work is based on my prior art - but it's nothing more than a nicety.

And if you're still not sure, I'll extend you the same courtesy that I gave to Joshua: if necessary, I'm willing to provide exclusivity over the derivative work should it really come to that.

As always, I'll be happy to answer any questions. Enjoy!

[read more ...] -or- [leave a comment ...]

--Jim R. Wilson 19:48, 11 June 2007 (MST)

Finally - a Word Doc to MediaWiki conversion service

From Meopedia document upload feature announcement:

For as long as I can remember, and probably since the beginning of MediaWiki as an open-source wiki solution, people have been asking for a Word Document to Wikitext conversion service.

I am very pleased to announce that Meopedia.com has such a service. If you'd like to be a beta tester, here's how:

  1. Log in to Meopedia or create an account if you don't have one already.
  2. Click the Document Upload link in the toolbox.
  3. Fill out the form and submit!

This will actually convert the contents of the Word doc into wikitext, transparently uploading embedded images and creating links appropriately.

Note: For help or more information on how it works, please see Help:Document Upload.

As always, I'll be happy to answer any questions. Enjoy!

[read more ...] -or- [leave a comment ...]

--Jim R. Wilson 19:46, 10 June 2007 (MST)

ArticleComments Version 0.4.1 Released

From ArticleComments Ver 0.4.1 Release Announcement:

Version 0.4.1 of the ArticleComments Extension has just been released and is available for download.

This very small change affects only the default spam filter. I have recently received a number of SPAM "feeler comments". Guests are setting their names to things like "<a href= />" and "<a href= ></a>" - presumably just to see whether such comments are accepted.

Now, if a commenter's Name contains "<a " anywhere, the comment is flagged as spam and rejected.

I've also begun seeing spammers who are clever enough not to try and use <a href> or [url ] syntax - they're just putting the spam links with no other markup. MediaWiki renders strings that appear to be URLs as links, so this is currently an effective spam vector.

So now I'm leaning towards integrating ArticleComments with some kind of URL/spamtext blacklist. A suitable blacklisting extension may or may not already exist (if you know of one, please tell me!)

As always, I'll be happy to answer any questions. Enjoy!

[read more ...] -or- [leave a comment ...]

--Jim R. Wilson 07:36, 5 June 2007 (MST)

AlternateSyntaxParser Extension Initial Release

From AlternateSyntaxParser Ver 0.1 Release Announcement:

Version 0.1 of the AlternateSyntaxParser Extension has just been released and is available for download.

This extension allows the use of alternate syntax engines in addition to traditional wikitext. This can be done on a page-by-page basis, or by setting a site-wide default.

To use the extension on a page basis, simply flag the page with a line at the top reading:

#MARKUP language

Where 'language' would be replaced with the name of the alternate markup language to use. For example, to mark a page as using Markdown syntax, you'd put '#MARKUP markdown' at the top of the page.

The extension comes with support for Markdown and Textile, and provides a new hook called 'AlternateSyntaxParser', which could be used by other extensions to add more languages.

The inspiration for AlternateSyntaxParser came from Simon Dorfman's MarkdownSyntax Extension.

As always, I'll be happy to answer any questions. Enjoy!

[read more ...] -or- [leave a comment ...]

--Jim R. Wilson 12:36, 3 June 2007 (MST)

ReturnToUserPage Extension Initial Release

From ReturnToUserPage Ver 0.1 Release Announcement:

Version 0.1 of the ReturnToUserPage Extension has just been released and is available for download.

This extension merely sends the user back to their own userpage after login or account creation. Pretty straight forward.

Currently there are no settings (such as whether to only send them on account creation rather than log in). If there's demand for such settings, I may incorporate them into a later release.

As always, I'll be happy to answer any questions. Enjoy!

[read more ...] -or- [leave a comment ...]

--Jim Wilson 09:19, 1 June 2007 (MST)

April 2007

Blog entries from April 2007.

« back to Blog Archive

MS Excel's CSV quote parsing GOTCHA

From How Microsoft Excel sees quotes in CSV files:

When creating a CSV file which is to be imported into Microsoft Excel, be sure that any values which are wrapped in quotes do not have leading or trailing whitespace (spaces, tabs, etc).

For example, here is a bad file:

"Column 1", "Column 2", "Column 3"
A, B, C

While this file would be just fine:

"Column 1","Column 2","Column 3"
A,B,C

(Notice that there are no spaces after the commas)

If you fail to do this, and leave whitespace where it shouldn't be, Excel will interpret the entire string as the "value" - quotes, whitespace and all. The unintended consequence of this is that if a quoted, whitespace wrapped value happens to contain a comma, that comma will be interpreted as a delimiter, cutting your value in two (with potentially disastrous consequences).

Hope this helps! [read more ...] -or- [leave a comment ...]

--Jim Wilson 15:10, 27 April 2007 (MST)

ArticleComments Unofficially Extended?

From ArticleComments extension unofficially extended:

A Toronto based coder named Eric Hartwell has created an extended version of my ArticleComments Extension which he calls ArticleComments (extended).

He has some interesting ideas that I may incorporate back into the original - specifically in the way of adding additional fields to the system messages (like the IP address of the comment submitter for example). He also does a good job of documenting those features that he has extended.

I'm somewhat disappointed that the page on his extension is somewhat a blatant ripoff of the MediaWiki article on my original extension, but c'est la vie.

Here's a short/medium-term todo list for features I should probably add to ArticleComments:

  • Additional fields (like IP address and an htmlspecialchar'd version of the submitted comment)
  • Better documentation around adding the comment form to all pages in a namespace.
  • Better documentation of the system messages, their default values and the meanings of all fields passed to them.

And here's a longer wishlist of items I'd like to add when I find the time:

  • Ajaxy interface with backwards-compatible mode (browsers with JS disabled).
  • Better summary comments (something more meaningful for the history).
  • Integration with Akismet for spam blocking.

If you have ideas, feature requests, bug reports, etc, I'd love to hear them! Feel free to leave a comment on the ArticleComments Talk page. I look forward to hearing from you!

[read more ...] -or- [leave a comment ...]

--Jim Wilson 14:11, 18 April 2007 (MST)

Enqueue playlists in XMMS

From Enqueue playlists in XMMS from Firefox:

Winamp has a preference option to "Enqueue by default" so new entries are appended to the current playlist rather than replacing it. I haven't been able to find an equivalent option in XMMS, so here is my alternative.

The script is called xmms-enqueue and simply contains the following.

#!/bin/bash
xmms -e "$1"

To install it:

  1. Create a file called xmms-enqueue containing the scriptlet above.
  2. Make sure it has global execute permissions (chmod 755 xmms-enqueue).
  3. Copy the file to a place in your PATH - good choices include:
    • ~/bin - the bin subdirectory of your home directory (if only you'll be using it)
    • /usr/local/bin - accessible by everyone (probably requires root privs to put it here)

Now, the next time you would download or open a PLS or M3U file, have your browser "Open with" your brand new xmms-enqueue script.

If you're using Firefox on Gnome, you may have to browse to the actual xmms-enqueue file created previously. Other browsers/desktops may be more forgiving.

I Hope this helps! It's working well for me so far on Jamendo and Shoutcast.

Note: If you haven't heard of jamendo, you should really check it out, seriously. It's a music site exclusively featuring Creative Commons licensed material. Great stuff, and totally free (gratis)! Feel free to invite me to be your friend - you know, if you're into that whole "social networking" thing. [read more ...] -or- [leave a comment ...]

--Jim Wilson 20:28, 9 April 2007 (MST)

Sort your files the easy way - with Ruby!

From Simple Ruby script for sorting files:

I recently ran into a problem many music fans have experienced. I had a whole bunch of miscellaneous music files (mp3, ogg) in a single directory and I needed them sorted into a series of subdirectories - one subdirectory for each letter in the alphabet plus a catchall directory for anything else.

Here's the ruby script I came up with for the task:

#!/usr/bin/ruby
 
Dir.glob("*") do |file| 
  letter = file[0..0].upcase
  if letter!=file then
    todir = '#'
    todir = letter if ('A'..'Z').include? letter
    Dir.mkdir todir unless File.exists? todir
    File.rename(file, todir + '/' + file)
  end
end

I haven't tested this in Windows, but it worked just fine in Linux against the mounted FAT32 partition of my mp3 player. Enjoy!

[read more ...] -or- [leave a comment ...]

--Jim Wilson 15:05, 6 April 2007 (MST)

Getting Raw HTML from your Tag Extension

From Raw HTML Output from a Parser Extension:

In a previous article, I described how to get unadulterated output from a MediaWiki tag extension using the OutputPageBeforeHTML hook. It turns out there are much better ways to achieve the same effect.

This article describes one such technique which I call 'hide-and-replace' where extension output is hidden in plain sight only to be revealed later in the parsing process.

[read more ...] -or- [leave a comment ...]

--Jim Wilson 12:11, 5 April 2007 (MST)

WikiArticleFeeds Version 0.6.1 Released

From WikiArticleFeeds Ver 0.6.1 Release Announcement:

Version 0.6.1 of the WikiArticleFeeds Extension has just been released and is available for download.

This version has just one fix - namely that changes to transcluded articles (Templates or otherwise) will invalidate the cache of any feeds generated from the parent article.

Previously, the only thing which would expire the cache for a feed was if a first-order change occurred to the article text. So although the extension has always supported transclusion of feeds for aggregation purposes, this hasn't really been effective since the feeds would be stale until a first order change occurred.

Hope all that makes sense. As always, I'll be happy to answer any questions. Enjoy!

[read more ...] -or- [leave a comment ...]

--Jim Wilson 20:40, 4 April 2007 (MST)

Why the Java community abuzz over Ruby (and not Python)

From Why the Java community is abuzz over Ruby, not Python:

I recently read an article called Why is the Java community so enchanted by Ruby?, which makes the assertion that Python is more suited to Java developers than Ruby. As a Ruby advocate, I can offer one HUGE reason why I don't consider Python to be Java alternative: Whitespace-awareness.<noinclude>

Java (like it's predecessor C++) is a whitespace agnostic language. It lets you write one-liners if you like. In this regard alone it's more flexible than Python from a code-authorship standpoint*.

Ruby is pseudo-agnostic towards whitespace. The "Ruby Way" to do things is to use end-of-line termination of commands, but you don't have to. In Ruby, you can use a semicolon and keep on going (just like Java). You also have the option of using curly braces { } to delimit blocks in most cases.

Python, on the other hand, is very whitespace aware - using whitespace as the sole delimiter of blocks. For example, whitespace determines what's inside a loop vs outside - the inside commands have to be indented one level deeper than the loop declaration.

My friends and colleagues think I'm crazy for writing off Python on this seemingly "trivial" point - but I like to be the judge of which constructs should be indented and which can get by as one-liners thankyouverymuch.

Rumor has it that the next version of Python may be more flexible regarding whitespace. I hope so. I'll be the first to repeal my boycott of the language if this comes to pass.

* Note: I obviously won't claim that Java is more flexible in general than Python, as the former is a statically type, class-based language while the latter is a dynamically typed, prototype-based language. [read more ...] -or- [leave a comment ...]

--Jim Wilson 08:27, 2 April 2007 (MST)

March 2007

Blog entries from March 2007.

« back to Blog Archive

What is two plus two?

From What is two plus two?:

Well, that depends on what language you're using! It's fun to say something is "as simple as 2 + 2", but as a developer I can tell you that 2 + 2 isn't as straightforward as you might think.

Here's a breakdown of how a seemingly trivial computation can differ on a language-by-language basis.

[read more ...] -or- [leave a comment ...]

--Jim Wilson 22:24, 30 March 2007 (MST)

ArticleComments Version 0.4 Released

From ArticleComments Ver 0.4 Release Announcement:

Recently I've been getting spammed on the comments to GTalk Emoticons - probably because this is the #1 traffic generator for my site.

So, here's a new version of the ArticleComments Extension (download) that has slightly better spam detection. Still rudimentary, but it should catch more spam now.

I've also abstracted out the spam checking out of the core code by adding a new hook called "ArticleCommentsSpamCheck". The extension provides a default implementation that hooks into this.

From here out, development of any additional spam filters should be easy without changes to the extension's core code. Maybe an Akismet wrapper would help.

[read more ...] -or- [leave a comment ...]

--Jim Wilson 12:53, 27 March 2007 (MST)

DZone Link Delisting Explained

From DZone link delisting explained:

In a recent post, I claimed that DZone had implemented a new Draconian policy regarding delisting of links based on complaints.

It turns out my conclusions were built on a number of faulty assumptions which I'm glad to point out here. [read more ...] -or- [leave a comment ...]

--Jim Wilson 14:40, 23 March 2007 (MST)

New Draconian Complaint Policy on dzone.com

From New Draconian Complaint Policy on dzone.com:

Previously, if someone lodged a complaint against an article submitted to dzone.com, the article would viable, still contending for that oh-so-precious front-paging.

No more. Now, a single complaint causes a submitted article to be permanently delisted - going so far as to return an HTTP 410 "page permanently removed" message. [read more ...] -or- [leave a comment ...]

--Jim Wilson 12:27, 23 March 2007 (MST)

Add Planet.Wikimedia to Google Homepage

Wondering how to add planet.wikimedia (or open.wikiblogplanet) to your Google Homepage or Google Reader?

Enjoy!

--Jim Wilson 09:46, 22 March 2007 (MST)

WikiArticleFeeds Version 0.6 Released

From WikiArticleFeeds Ver 0.6 Release Announcement:

Version 0.6 of the WikiArticleFeeds Extension has just been released and is available for download.

This version has the following enhancements:

  • Added support for "tagging" feed items by way of >itemTags> or {{itemTags}}
  • Added support for filtering generated feed based on item tags. Just specify '&tags=comma,separated,list' in the feed URL.
  • Added new global ($wgWikiArticleFeedsSkipCache) which, when set to true in LocalSettings, will bypasse the objectcache (good for debugging).
  • Fixed arbitrary namespace restriction - now works for namespaces other than NS_MAIN

Note: For reference, the feed you're reading now was generated using WikiArticleFeeds from a regular wiki article. Enjoy!

--Jim Wilson 15:40, 19 March 2007 (MST)

ArticleComments Version 0.3 Released

From ArticleComments Ver 0.3 Release Announcement:

Lately I've been getting more traffic, and as a consequence, more spam. This prompted me to release version 0.3 of the ArticleComments Extension (download), which now has rudimentary spam detection.

I say 'rudimentary' because all it does is check for spammy-looking regular expressions. Currently just these two:

%\\[url=(https?|ftp)://%smi
%<a +href=[\'"]?(https?|ftp)://%smi

The first weeds out [url] notation, and the latter catches direct <a href=""> instances.

In the future, I hope to implement a heuristic spam detection system - perhaps checking these dimensions:

  • link/text ratio,
  • markup/text ratio, or
  • consonant/vowel ratio.

Or perhaps something even more tricky, like a combination of the above, weighted by virulence.

Another thing I may add is anti-captchas (input fields that humans are instructed to ignore, or ideally hidden via CSS). This may stop the most generic kinds of spamming - which is what I appear to be getting so far.

The obvious problem of any heuristic spam detection method is that every time it changes, the spammers will change their tactics. Leaving only direct captchas as a continuously viable option. Of course, this is also on my todo list.

--Jim Wilson 03:35, 18 March 2007 (MST)

Doing more with MediaWiki parser extensions

Lately I've been spending a lot of time writing MediaWiki extensions, rather than writing real actual articles. Hopefully this will begin to even out that trend. Enjoy!

From Doing more with MediaWiki parser extensions:

The MediaWiki parser cache is a powerful thing. The processing it takes to render a page is formidable - so caching the output is important for performance. This means that extension tags and parser functions will be run only once, at render time (just after edit submission).

The question is, how do we trigger the execution of code on every page view, using information from a parser extension, without invalidating or disabling the cache?

This article presents one method for doing just that. [read more ...] -or- [leave a comment ...]

--Jim Wilson 01:21, 14 March 2007 (MST)

MetaKeywordsTag Version 0.1 Released

From MetaKeywordsTag Ver 0.1 Release Announcement:

Announcing the initial release of the MetaKeywordsTag Extension. Version 0.1 is available for download.

This parser extension provides a tag which is used to inject meta keywords into the document header of an article.

To use, simply add the following to any article:

<keywords content="ListOfKeywords" />

Where ListOfKeywords is a comma-separated list of keywords to inject.

--Jim Wilson 01:13, 14 March 2007 (MST)

UserPageStyles Version 0.1 Released

From UserPageStyles Ver 0.1 Release Announcement:

Announcing the initial release of the UserPageStyles Extension. Version 0.1 is available for download.

This extension provides a way for users to create custom styles which are applied to their user page and any subpages. Basically this allows users to hack the css to their liking for their own corner of the wiki.

To get started, simply edit:

User:Username/style.css

Where 'Username' is the name of your user. After saving, subsequent visits to your user page (or subpages) will show your custom styles.

The way this differs from the built-in user-css functionality is that while vanilla MediaWiki allows you to edit the CSS that you see, UserPageStyles allows you to edit the CSS that everyone sees.

Let me know what you think!

--Jim Wilson 03:18, 12 March 2007 (MST)

KeepYourHandsToYourself Version 0.1 Released

From KeepYourHandsToYourself Ver 0.1 Release Announcement:

Announcing the initial release of the KeepYourHandsToYourself Extension. Version 0.1 is available for download.

The sole purpose of this extension is to prevent users from editing other users' pages and subpages. Non-logged in users (guests) are also prevented from editing user pages. Sysops are immune from this restriction.

I'd love to hear from you if find this useful, and I'll be happy to troubleshoot any issues.

--Jim Wilson 23:10, 8 March 2007 (MST)

WikiArticleFeeds Version 0.5 Released

From WikiArticleFeeds Ver 0.5 Release Announcement:

Version 0.5 of the WikiArticleFeeds Extension has just been released and is now available for download.

This version contains minor cosmetic changes and one major enhancement: it supports offloading feeds to FeedBurner.com. This is great to reduce the amount bandwidth your feeds consume.

To use the new functionality, all you have to do is register your feed with FeedBurner, then add <feedBurner name="nameOfFeed" /> to your article text.

--Jim Wilson 23:37, 7 March 2007 (MST)

YouTubeTag Version 0.1 Released

From YouTubeTag Ver 0.1 Release Announcement:

After being unable to find a YouTube MediaWiki extension to my liking, I decided to write my own YouTubeTag Extension, which is available for download.

Here are the features of my extension:

  • Ridiculously simple syntax: <youtube v="aYouTubeId" />
  • Uses an extension tag parameter for the id rather than inner-text (reduces possibility of injection attacks)
  • Further avoids malicious input by html-encoding specialchars
  • Checks input for invalid YouTube id characters (only allows alphanumeric chars and '-' and '_')
  • Displays informative error message on bad id which is configurable by system message (for localization purposes).

Enjoy! As always, I'd love to hear from you if find this useful, and I'll be happy to troubleshoot any issues.

--Jim Wilson 01:59, 7 March 2007 (MST)

ShareThis Version 0.1 Released

From ShareThis Ver 0.1 Release Announcement:

You may have noticed the brand new "Share This!" portlet in the site's sidebar (underneath the Toolbox). This is provided by the ShareThis Extension, which has just been released.

Out of the box, ShareThis comes with a number of popular social bookmarking and news sites - and it's easy to add your own if need be.

Inserting a block of links into a page is also easy, all it takes is a <sharethis /> flag, and you get this:

Special thanks to my good friend Eric Redmond for coming up with some skeleton code and a list of popular sites to start off with.

--Jim Wilson 00:30, 5 March 2007 (MST)

A Bookmarklet to Remember Me by

From Remember Me Bookmarklet/Favelet:

A lot of websites have logins, and many of those have a "Remember Me" option (usually a checkbox) that lets you skip logging in on your next visit. But some sites don't.

Here is a bookmarklet that adds this functionality to any site. [read more ...] -or- [leave a comment ...]

--Jim Wilson 12:05, 1 March 2007 (MST)

February 2007

Blog entries from February 2007.

« back to Blog Archive

ArticleComments Version 0.2 Released

From ArticleComments Ver 0.2 Release Announcement:

Version 0.2 of the ArticleComments Extension has been released an is available for download.

With version 0.2 comes the following changes:

  • Fixed form post method to use localized version of "Special"
  • Added option for making the form automatically visible (no "Leave a comment..." link)
  • Added option of disabling the "Website" field
  • Added system message for prepopulating the comment box.
  • Added system message for structuring comment submission text.
  • Added abstracted method for form creation (for insertion into skins)
  • Added option to "Whitelist" Namespaces for comment submission (as by skin-level form).
  • Added check for user blocked status prior to comment submission.

Documentation for these new features has yet to be developed. [read more ...] -or- [leave a comment ...]

--Jim Wilson 22:50, 28 February 2007 (MST)

WikiArticleFeeds Version 0.4 Released

Sorry for those who just upgraded to 0.3, but I had to do it. Version 0.4 of the WikiArticleFeeds Extension has been released and is now available for download.

This version contains the following enhancements:

  • Added checking for a global ($wgForceArticleFeedSectionLinks) which, when set to true, will override default link behavior, forcing all item links to direct to the page and section from which they came.
  • Modified the feed generator to now follow Article redirects.

--Jim Wilson 10:13, 22 February 2007 (MST)

WikiArticleFeeds Version 0.3 Released

Version 0.3 of the WikiArticleFeeds Extension has been released and is available for download.

It contains the following modifications:

  • Fixed relative-links bug (all links in item descriptions are now fully qualified).
  • Fixed date-overwrite bug (previously, items with the exact same timestamp would be ignored).
  • Improved W3C validation. Feeds validate with fewer warnings.

--Jim Wilson 23:23, 19 February 2007 (MST)

ArticleComments Extension Initial Release

From ArticleComments Extension Initial Release:

I've just finished coding, testing and internationalizing ArticleComments, my latest MediaWiki Extension. It has already been installed on this site, and the source code is of course available for download.

In a nutshell, this extension allows editors to put <comments /> flags in articles, and the extension will replace them with blog-like comment forms at render time. [read more ...] -or- [leave a comment ...]

--Jim Wilson 03:35, 19 February 2007 (MST)

Keeping MediaWiki from Modifying Extension Output

From HowTo: Keep MediaWiki from Modifying Your Extension Output:

If you've ever written a MediaWiki tag extension, you've likely run into this problem. Due to the Parser's behavior regarding extension tags, some parsing still occurs after the extension has run - potentially mangling otherwise perfect output. The obvious question is:

"How can I avoid modification of my extension's HTML output?"

This article will demonstrate one solution. [read more ...] -or- [leave a comment ...]

--Jim Wilson 10:24, 14 February 2007 (MST)

Programming and the Cynical Optimist

From Programming and the Cynical Optimist:

When deciding whether to go into the field of Software Development, it's important to know not just whether one has the capacity to program, but also whether one will actually enjoy programming. Here I describe the personality traits of such an individual. [read more ...] -or- [leave a comment ...]

--Jim Wilson 23:41, 5 February 2007 (MST)

WikiFeeds is now WikiArticleFeeds

Due to a naming conflict, I had to rename my WikiFeeds extension to WikiArticleFeeds. With this change, I also took the time to expand the supported MediaWiki versions from just 1.6.8 to 1.6.x, 1.8.x and 1.9.x.

--Jim Wilson 12:39, 3 February 2007 (MST)

January 2007

Blog entries from January 2007.

« back to Blog Archive

Firefox Colspan Border-Collapse Bug

From Firefox Colspan Border-Collapse Bug:

In trying to create auto-expanding <td> elements, I found a bug in Gecko's rendering of table-cells when colspan is dynamically assigned and the table has its border-collapse style set to "collapse". [read more ...] -or- [leave a comment ...]

--Jim Wilson 16:27, 26 January 2007 (MST)

JavaScript to Create serialVersionUID

From JavaScript to Create serialVersionUID:

In Java, if your class implements the Serializable interface, it is good practice to explicitly specify a serialVersionUID. This short article shows how to use JavaScript to generate random Long numbers for this purpose. [read more ...] -or- [leave a comment ...]

--Jim Wilson 09:37, 18 January 2007 (MST)

SQL 2005 UDF Limitations

From SQL 2005 - Why You Can't EXEC() Inside a UDF:

In Microsoft SQL Server 2005, you can't use the EXEC() method inside a User Defined Function (UDF). If you attempt to do so, you'll end up with an error message reading:

Invalid use of side-effecting or time-dependent operator in 'EXECUTE STRING' within a function.

This article aims to explain why the limitation exists and what you can do about it. [read more ...] -or- [leave a comment ...]

--Jim Wilson 15:54, 11 January 2007 (MST)

GTalk Emoticons in the News

Looks like someone dugg my extension. It was also mentioned on Google Blogoscoped. Lots of good feedback in the comments sections.

The most popular request was for a way to disable all emoticons. This is certainly achievable, given time, and I hope to include this feature in version 0.2.

--Jim Wilson 23:16, 7 January 2007 (MST)

Open Source Software Killers

Have you ever wondered what factors kill OSS projects? In my new article, Open Source Software Killers, I explore some of the most deadly enemies of open source software and what steps can be taken to evade them.

--Jim Wilson 07:02, 3 January 2007 (MST)

New Year's Resolutions

Here are my new year's resolutions:

  • 1920 x 1200
  • 1280 x 1024
  • 1024 x 768

Oh, and also to compose a good article each week (on average) all year.

--Jim Wilson 08:36, 2 January 2007 (MST)

December 2006

Blog entries from December 2006.

« back to Blog Archive

GTalk Emoticons - Initial Release

Announcing the initial release of the GTalk Emoticons Firefox Extension. It adds support for nearly all MSN and Yahoo Messenger emoticons to in-browser GTalk.

Note: This doesn't affect the standalone Windows client in any way.

Download gtalk_emoticons-0.1.xpi

--Jim Wilson 09:15, 22 December 2006 (MST)

You On Notice

You On Notice
You On Notice

In response to Time Magazine's declaration that You are the person of the year.

Note: This satirical image was created using http://www.shipbrook.com/onnotice/

--Jim Wilson 13:08, 21 December 2006 (MST)

Initial Release - WikiFeeds Extension

The WikiFeeds Extension is now available for download. Check it out! Suitable for making a MediaWiki Blog (like the one you're reading now).

--Jim Wilson 02:03, 21 December 2006 (MST)

WikiBlog via WikiFeeds

Sorry for the delay - but I made some progress late this evening. I Just finished the alpha version of my WikiFeeds Extension. You'll notice the rss and atom links in the Toolbox.

Also, if your browser supports auto-detection of feeds, you should find both available.

I'll post details soon to invite beta testers, as well as this BlogLike skin that I made (now tweaked to look good in IE6 and IE7).

Still haven't made progress on the permissions yet, will get to it eventually.

--Jim Wilson 01:48, 19 December 2006 (MST)

Migration Progress

http://jimbojw.com/wiki/index.php?title=Blog#Migration_Progress I've migrated a number of articles from my old blogger.com blog. Here are some links:

--Jim Wilson 08:42, 4 December 2006 (MST)

Site Alive!

This site's alive! Finally finished my MW skin, now on to migrating old content and making new articles. Here's a rough TODO list:

  1. Configure (help, policies, notices, etc)
  2. Migrate old content from my old blog (Calamari Dynasty).
  3. Resolve permission bugs so users can make/edit talk pages.
  4. Clean up CSS to look good in IE 6 and 7.
  5. Develop a page-to-feed converter.
  6. Add "add this to feed of choice" links to sidebar.
  7. Content!

So, as you can see, there are still a number of things I need to do to get this site ready for prime time. Of course, this being my site, I'll update this page as I make progress.

--Jim Wilson 17:17, 2 December 2006 (MST)