Blog entries from April 2007.
Contents |
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)
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:
And here's a longer wishlist of items I'd like to add when I find the time:
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)
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:
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)
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)
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)
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)
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)