Category Archive: Web

No escape

At first glance, it seemed that everything worked ok in my migration of this blog from one machine to another. But, there does seem to be one thing that didn’t make the transition well. Most of my \ characters disappeared. I’ve gone back and fixed a few obvious places where they should have been. But there may be some uncompilable TeX left here and there.

Blech

The Lingtech blog has taken on a whole new look, and it’s not really intentional. It is being hosted on entirely new hardware running a newer version of both Linux and WordPress, so there are bugs left to work out. I think at least most of the old URLs should still point where they are supposed to, and I’ll work on the theme and so forth later. I’m mainly posting this now to (a) test MarsEdit and (b) point out that the change of look was not exactly intended.

Addendum: I’ve now done a little bit of fiddling, and the current theme is better. So, the comments above referred to the theme I got by default. This one isn’t so bad.

Syntax highlighting in WordPress

There doesn’t seem to be anything built in to WordPress that does syntax highlighting, but there are a lot of plugins that can help with this. After looking around a bit, I opted for SyntaxHighlighter Evolved by “Viper007Bond.”

It was an easy install with WP 3.0.1, and it includes support for LaTeX (a third-party addon to the SyntaxHighlighter by Alex Gorbatchev that all of these plugins use). But it didn’t include support for AppleScript, which I do occasionally want to exhibit.

There is an add-on “brush” for AppleScript by David Chambers that can be added, but in order for it not to break whenever SyntaxHighlighter Evolved is updated, it needed to be constructed as its own dependent WordPress plugin. Fortunately, Viper007Bond left instructions on how to do this, and it is pretty straightforward.

What I did is create the following file in the directory syntaxhighlighter-applescript within my WordPress plugins directory, calling the file syntaxhighlighter-applescript.php:

<?php
/*
Plugin Name: SyntaxHighlighter Evolved: AppleScript Brush
Description: Adds support for the AppleScript language to the SyntaxHighlighter Evolved plugin.
Author: Paul Hagstrom
Version: 1.0.0
Author URI: http://ug.bu.edu/blog/lingtech/
*/

// SyntaxHighlighter Evolved doesn't do anything until early in the init hook, so best to wait until after that
add_action( 'init', 'syntaxhighlighter_applescript_regscript' );

// Tell SyntaxHighlighter Evolved about this new language/brush
add_filter( 'syntaxhighlighter_brushes', 'syntaxhighlighter_applescript_addlang' );

// Register the brush file with WordPress
function syntaxhighlighter_applescript_regscript() {
  wp_register_script( 'syntaxhighlighter-brush-applescript', plugins_url( 'shBrushAppleScript.js', __FILE__ ), array('syntaxhighlighter-core'), '1.2.3' );
  wp_enqueue_style(  'syntaxhighlighter-style-applescript', plugins_url('shThemeAppleScript.css', __FILE__), array('syntaxhighlighter-core'), '1.2.3' );
}

// Filter SyntaxHighlighter Evolved's language array
function syntaxhighlighter_applescript_addlang( $brushes ) {
  $brushes['applescript'] = 'applescript';
  return $brushes;
}

?>

I then downloaded the AppleScript brush, AppleScript theme, and background image from David Chambers’ site and put them in the same directory.

Back in WordPress, I activated this new plugin, and then styled the AppleScript (on, for example, this post) using the following markup:

;

Note that it requires the addition of the classname="applescript" part in order to pick up the CSS in the additional stylesheet.

For LaTeX, I ran into a different problem, specifically in connection with pstricks code and jTree (e.g., on this post), because there is sometimes need for code that includes the left and right angled brackets, which were being turned into &lt; and &gt;. To solve that, I had to use the “<script> method” for code embedding, like so:

<script type="syntaxhighlighter" class="brush:latex"><![CDATA[
\jtree
...
\endjtree
]]</script>;

Reading papers on an iPad

The iPad is a pretty good platform for reading Linguistics papers, not just novels. I actually did all of my grading on the iPad, using a program called iAnnotate, which I would recommend. It lets you add highlights, text notes, drawings to PDFs. It’s a more sophisticated version of Aji Annotate for the iPhone. Getting PDFs in and out requires running a server on your computer to sync a folder over WiFi, and the annotations are all saved not into the original file, but into a copy marked as annotated. But it works pretty well, and it has so far been a nice way to grade and to read journal articles and so forth.

If you’re not trying to annotate, but just to read, I think I like GoodReader best of the PDF readers (universal for iPad and iPhone). Reading with iAnnotate is not bad, but it’s a bit better with GoodReader, and GoodReader has lots of ways of getting documents onto the device (including direct access to your Dropbox folder). It will also read Office and iWork documents, and even works as a video player.

LimeSurvey and LimeService

We’ve been using an online survey package called LimeSurvey, which is pretty easy to install, configure, and use. I’d been hosting a private copy on a couple of servers I administer, but it turns out that there is a nice alternative: LimeService. They will host your LimeSurvey installation for you, and it seems to have all of the same configurability as my privately hosted one did.

Right now at least, it is free for up to 25 responses (per month), and you pay after that for the ability to record additional responses. So, for little questionnaire studies, it’s perfect. And it should be nice and headache-free even for larger ones, even if it costs a bit.

I’ve been pretty happy with LimeSurvey as a platform for questionnaire studies, and I’d recommend it, and by extension LimeService, as something to check out.

Too many Twitter clients + password change = lockout

Thinking I was doing a good thing, I changed my pretty weak Twitter account password to a stronger one (since even if I can’t remember it, 1Password will do that for me). Problem is, I have many Twitter clients running (Tweetie on my laptop, and SimplyTweet, TweetDeck, and Tweetie on my iPhone). And, bang. Now I’m locked out due to too many invalid login attempts (as all of the clients kept trying to connect with my old password). I don’t know how long this will last, but I’ve waited a while and I still can’t get in via the web interface. I shut down my Mac client, I’ve moved my iPhone into airplane mode. But what a pain.

What’s worse, several of these clients don’t seem to have the option to start up without immediately pinging the API, before I get a chance to change the password it will use. I think I may have solved this using Keychain Access to update my password for each Twitter client that saved it there, but not all of the iPhone apps have the account settings available via Settings.

According to Twitter help, the lockout period is an hour. Neat.

Now running on WordPress MU

I’ve just moved the blog over to a WordPress MU installation; it used to be running on Lyceum, but as John Joseph Bachir himself acknowledges, it’s a bit hard to keep up with WPMU, which the WordPress team participates in. There’s a difference in the database structure that doesn’t really concern me, I’m more interested in being up to date.

I’m not 100% sure that everything is going to have moved over smoothly. But we’ll see.

For the record, I did this: Exported each Lyceum site to a file, then imported it back into WPMU. I had to re-enter all the links and link categories by hand. Plus, I did what might have been a dumb thing and set up the WPMU install at a temporary URL, then tried to switch it back over by changing the Apache config file to point the /blog directory to the WPMU install. Of course, 404s were everywhere. I hand-edited wp-config.php to get /blog in there, and then from the default blog deactivated each of the two blogs and reactivated them. I also switched the theme away from the one I wanted to use and then back. Most of this seemed to repair the damage, probably due to something having been cached.

Addendum: Actually, another thing that did not go smoothly is moving all of the uploads. Lyceum had stored everything in links that looked like /blog/wp-content/blogs/2/uploads/xxx.yyy, but WPMU stores things in /blog/blogname/files/xxx.yyy. I had to manually copy everything over and then go through the posts and replace the URLs within the text. Fortunately, I didn’t have a lot (though if you find a broken link, please let me know). I also told WPMU to not use month-based directories for the files, but to just throw them all together, since that’s how I had the previous blog set up.

Getting Ecto to work with WordPress MU

Here’s another “tech” post, not really directly about Linguistics.

I am using WordPress MU as my CMS for courses. I used it last Spring, but there have been some updates since then, so I moved to v. 2.8.4a. There is a longstanding problem with the XML-RPC code (or, rather, I think there is a problem in the API) and Ecto doesn’t know what to make of the things that WPMU sends it. The result is that if I add a specific course’s blog as an XML-RPC endpoint, I get back all the blogs that the user has access to, yet only the posts/pages come back from the first blog. (By the way, Ecto can handle WPMU pages, which is a big win over the other options).

In order to rectify this, I intentionally crippled getUsersBlogs to ignore the multiblog setup and return only the blog whose XML-RPC endpoint I’m actually using. The relevant change was in the xmlrpc.php file, in the top level of the WPMU installation. For 2.8.4a, it is in lines 439 and 441. All I did is comment out those lines. The lines contain a conditional that checks to see if this is a WPMU install, and if it is not, it uses the getUsersBlogs from the Blogger API. By commenting out the conditional, I force it to use the Blogger version of getUsersBlogs regardless of the fact that it is actually a WPMU install. The four lines of xmlrpc.php look like this once I’m done.

//PH if( !function_exists( 'is_site_admin' ) ) {
array_unshift( $args, 1 );
return $this-&gt;blogger_getUsersBlogs( $args );
//PH }