Category: Snippets

Movable Type: How to emulate an MTEntryIfNotExtended tag

Movable Type has a built in container tag  

<MTEntryIfExtended>

which is often used to show the “More” part of a long entry, or anything else that should be displayed only if the entry is extended:

<MTEntryIfExtended>
    <$MTEntryMore$>
   <div>Special text or page elements for Extended Entries go here</div>
</MTEntryIfExtended> 

But what if you want something to show up only if the entry is NOT extended? There is no corresponding <MTEntryIfNotExtended> tag. 

Fortunately that functionality is simple to replicate using Movable Type variables.

Continue reading
Wordpress logo

WordPress: SimpleLDAP plugin updated to work with v3.5

The SimpleLDAP plugin by Cliff Griffin is exactly what I needed for a proof-of-concept WordPress site I’m working on, but it hasn’t been officially updated in a while and was not entirely compatible with WordPress v.3.5.

I’ve updated the plugin to eliminate the errors I was getting, and it now works fine on my site, but it could probably use some TLC from someone more experienced with working with WordPress.

The original version of the plugin I used as a basis is v1.4.0.5.1, available at http://wordpress.org/plugins/simple-ldap-login/.

Continue reading

Use BBEdit to replace the entire contents of multiple files

A few months ago, I needed to revise an HTML file that is used many times across a large website. Most of the key code associated with this file is contained in centrally-located includes, but as luck would have it, this time the entire file needed to be revised – even the user-customized bits. That meant that almost a thousand files would have to be replaced. Worse, they were not entirely the same, since they were customized by the users to some extent.

After checking a few of them, I found there were enough commonalities to serve as the basis of a regular expression search. They always started with a comment, like this:

<!--/ *v

Continue reading

JW FLV player with Javascript playlist

Screen shot 2009-12-17 at 1.06.07 PM.jpg

This is an example of how to create a javascript-based Playlist selector for a JW FLV player. The playlist selector menu has 3 sections that toggle open and closed when you click on them. This allows the user to switch playlists, choosing from various topics.

The source code has not been cleaned up, but you should be able to get an idea of how to set this up from it.

Continue reading

.htaccess: allow anyone from one IP but require password from everywhere else

If you want your linux-hosted site to be accessible by anyone coming from a particular IP address, as say from within a corporate firewall, but also accessible from anywhere else as long as they authenticate with username and password, use this formula in the .htaccess file for the directory:

#this section may need to be modified to suit your password authentication setup:
AuthUserFile "/home/pathTo/.htpasswds/directory_name/passwd"
AuthType Basic
AuthName "webroot"
require valid-user
# allow users from inside firewall
Allow from 111.222.33
Satisfy Any
Continue reading

JW FLV Player and Red5 apparent buffering bug

Update 12-18-09: Longtailvideo has apparently resolved this bug with its player v.4.7beta. At this time v. 5 does NOT have the fix in it. The code changes that fixed the bug can be seen here: [Changes to RTMPModel.as]

A few months ago, we installed Red5 0.7.0 on a Windows server to stream Flash video inside the firewall. This server is used mainly to stream short clips that are embedded in learning modules.

The JW FLV player v. 4.6 is included in the learning module template and enables us to display the videos with a high degree of flexibility.

Picture 41.jpeg

Example of a player that contains multiple short video clips.
The player generates a navigation listing on the right from the XML playlist.


Continue reading