ColdFusion UDF to get meta-info on podcast files
In order to automatically generate a podcast based on a couple of audio- or video-files, you'll have to get some meta-information on those, like format, bitrate or duration. This function acts as a wrapper around FFmpeg which will make that information available to you from within your ColdFusion application. Most Linux distros will provide some ready-made binaries for FFmpeg from their package manager. On Debian you'd just do aptitude install ffmpeg and you're set.
What if HTMLEditFormat() don’t cut it?
You know of course that you need to HTMLEditFormat() any user input that you intend to display somewhere on your page to avoid racing down the road to XSS hell; to save on processing resources the best time to do this would obviously be before the data goes to your persistance layer (be it some physical file or most likely a database).
If all you want to do is allow your users to store some plain old text, maybe seasoned with some kind of BB-code markup to allow for some limited text formatting, this method is just fine. If that is not enough and you actually need to allow a limited amount of good old HTML, you'll need some more sophisticated sanitizing mechanism to parse out any potentially harmful code elements like JavaScript actions and the like.
ColdFusion Pingback
Let me start with small introduction.
What is pingback?
"A pingback is one of three types of linkbacks, methods for Web authors to request notification when somebody links to one of their documents. This enables authors to keep track of who is linking to, or referring to their articles."
That's what Wikipedia says. I say this is nothing more but automation of politeness. When you quote someone's words, it's polite to notify author about it. And if author likes what you said about his work, he will linkback to you (post).
BuddyPress – Xprofile Privacy plugin
Please note: This plugin was developed in 2009 for Buddypress 1.1. It will not work with versions >=1.2. We're no longer doing any Buddypress development, so I am afraid that we cannot help you with any Buddypress related questions, not even in regards to this plugin, as the original developer is no longer working at our company. You may of course take a look at the code and see if you can make any use of it, feel free to copy, adapt and distribute at your pleasure.
BuddyPress currently doesn't support any kind of privacy control over profile data. Members of BuddyPress team are working on Privacy Component which will be part of some of the future releases, but until then this plugin can be helpful.
Xprofile Privacy plugin will give your users option to choose which profile data they want to share. Profile data can be public, viewable only to friends or be completely private. Users can set their privacy while editing profile or within Settings section in Profile Privacy part.
ColdFusion-UDF Wrapper for JTidy to clean up HTML
JTidy is a Java port of HTML Tidy, which allows you to clean up messy HTML. This comes in useful when you need to output some Code which has been created by users. I'll show in some later post how to allow users to actually enter HTML without compromising the security of your site, today I'll just show how to clean up this user-generated code. JTidy will not only generate XHTML-valid code from incomplete code by correctly closing opened tags, it will also do a couple of "prettifying" operations to increase quality of the result.
Using content compression with ColdFusion and SSI
This is actually an old story, just wanted to blog this so it might eventually help somebody else...
You probably know that most web-pages you'll find nowadays don't come as plain textfiles through this series of tubes, but the content is actually gzip-compressed server-side and unpacked by your browser, as long as the latter signals the server that it actually digests compressed content, which it usually does by sending the appropriate header.
Anyway, compressing static content is quite simple, you'd use something like mod_deflate with Apache2 or mod_gzip with Apache 1 and I am sure there are similar options for other webservers.
Compression of ColdFusion-generated pages is a little trickier though - mod_deflate doesn't seem to help you here.
Using diff/patch from within PostgreSQL
Sometimes you might want to store diffs of two strings in the database, so you save some space and actually see what has changed - and apply those patches to a string to get from one version to the other.
Using wdiff to show differences between text strings
We're currently in the process of adding some versioning- and history-functions to our ColdFusion-based CMS CBOX. Versioning is completely done on the database layer, thanks to some PostgreSQL database programming with lots of triggers and PL/pgSQL and PL/Perl. I might elaborate on this some other time.
One issue I had was to display the changes between two versions of a text to users. On the database level I actually already use unified diffs for a similar purpose, as I don't want so store a couple of thousand characters which haven't changed at all but for maybe one deleted comma. I'm using some Perl to do the diffing and patching from within PL/pgSQL functions, but you could also try something like cfdiff if you need a pure ColdFusion solution.
A simple diff might look like this:
@@ -1,3 +1 @@ -Article 1 +Article 1 UPDATED - -
I find diffs quite hard to read for humans though, especially as they drop at least some context. It might be alright for programmers, but ordinary people expect something more like the "change track" feature from OpenOffice or Word, something that's not line-based, but in fact word-based and displays the full text with the changes marked intuitively inside. This is where wdiff kicks in because it can provide just that.
Regular Expression Optimization
Last night I bumped on article talking about regular expression performance tuning. After reading it and since we extensivly use regex to parse article & community content, I decided to see can we do something to boost performance on that side. So, here we go.