New Plugin for Mura CMS: MuraMetaGenerator

In honor of Mura's new and improved App Store, I've release another plugin for Mura CMS into the wild called MuraMetaGenerator™. In a nutshell, this allows Mura CMS to auto-generate meta keywords and descriptions for your pages.

Why Should I Use This?

There could be a number of reasons why someone would want to use MuraMetaGenerator™. One of the best reasons is that most Authors and Editors either don't have the time and/or the knowledge of what information to put in these fields to begin with.

Also, since search engines change their algorithms daily and actually rely less and less on meta keywords and meta descriptions, why not spend your time going through the actual content of your pages and making sure your content contains the information you want indexed by search engines? After all, MuraMetaGenerator™ derives its information based on the actual page content which means you'll be following 'White Hat' Search Engine Optimization (SEO) techniques so your search engines rankings will most likely grow organically over time.

So go ahead and let MuraMetaGenerator™ do it for you! You can grab it from http://www.getmura.com/index.cfm/app-store/apps/murametagenerator/

BFusion/BFlex 2010: ColdFusion and Flex Training at Indiana University

Looking for some live, hands-on ColdFusion and/or Flex training and education? Then you'll want to attend BFusion/BFlex 2010. The event is hosted in Bloomington, Indiana at none other than the Indiana University campus! The event will be held Saturday, September 11, 2010 and Sunday, September 12, 2010. Mark your calendars now and be sure to visit their web site for additional details and registration information.

For those who might be curious, I've thrown my name in the hat to present (again) on Mura CMS. I'm not certain if I'll be speaking or not yet, but I plan on attending either way. So if you're interested in learning more about Mura CMS live, in-person and hands-on, be sure to check back here for details on that. If you have any suggestions on what you would like to know about Mura, feel free to leave your comments for me here too.

Hope to see you there! Peace.

ColdFusion UDF For Converting Strings Into ASCII Characters

I needed a simple solution for converting strings such as email addresses, etc. into ASCII characters. So, I whipped up this little ColdFusion user-defined function to do just that and wanted to share it with anyone else who might need the same thing one day.

stringToAscii(str)


<cfscript>
function stringToAscii(str) {
    var local = StructNew();
    local.oldStr = '';
    local.newStr = '';
    if ( StructKeyExists(arguments, 'str') and IsSimpleValue(arguments.str) ) {
        local.oldStr = arguments.str;
        for ( local.i=1; local.i lte Len(arguments.str); local.i++ ) {
            local.newStr = local.newStr & '&##' & Asc(Left(local.oldStr,1)) & ';';
            local.oldStr = RemoveChars(local.oldStr,1,1);
        };
    };
    return local.newStr;
};
</cfscript>

Here's some sample code for you to test with:


<cfparam name="form.txt" default="" />
<cfparam name="form.isSubmitted" default="false" />
<cfoutput>
    <form method="post" enctype="application/x-www-form-urlencoded">
        <p><label for="txt">Text:</label><br />
        <input type="text" name="txt" id="txt" size="50" value="#form.txt#" /></p>
        
        <p><input type="submit" value=" Encode It! " /></p>
        <input type="hidden" name="isSubmitted" value="true" />
    </form>
    <cfif form.isSubmitted>
        <h4>#stringToAscii(form.txt)#</h4>
        <cfdump var="#stringToAscii(form.txt)#" /><br />
    </cfif>
</cfoutput>

Enjoy!

Using ColdFusion to Parse CSV via JavaLoader and OpenCSV

Recently I needed a quick and easy way to parse a CSV file with ColdFusion, and while there are a few projects floating around out in the wild, I had used OpenCSV in the past and remembered how easy it was to use.

While I've seen a few examples for ColdFusion users on how to parse and read a CSV file with OpenCSV, they've all used Java's FileReader to do it. This meant you had to have the file stored on your server somewhere and then get the full path to its location. For example, C:\csvfiles\sample.csv. In addition, most all of the examples I've found assumed you had OpenCSV installed somewhere in your server's classpath.

Unfortunately, I couldn't rely on this method for a number of reasons. The primary reason was because I was building this as a plugin for Mura CMS. So, if it's going to be a plugin, I can't just assume everyone has OpenCSV installed. In addition, Mura offers three different file storage options: 1) locally, 2) Amazon S3 and 3) database. While we could easily use Java's FileReader method with the first option, the other two would bomb.

My first stroke of luck was that Mark Mandel contributed a nifty little project called JavaLoader to the ColdFusion community awhile back. I was also fortunate because Mura offers a way to serve most of its files via the URL. So, using a wee bit of Java and JavaLoader, I can read in the URL of a CSV file in much the same way as the FileReader method.

So for completeness, let's look at both options and then you can decide which one would work best for you.

sample.csv

You can use any csv file that you want to. This is one I put together for my recent project.


LocationName,Lat,Lng,Address,Phone,InfoWindow,Zindex,Icon
Chicago White Sox,,,"333 W 35th St, Chicago, IL 60609",(312) 674-1000,,1,
Cleveland Indians,,,"2401 Ontario St, Cleveland, OH 44115",(216) 241-8888,,2,
Detroit Tigers,,,"2100 Woodward Ave, Detroit, MI 48201",(313) 962-4000,,3,
Kansas City Royals,,,"1 Royal Way, Kansas City, MO 64129",(816) 921-8000,,4,
Minnesota Twins,,,"351-413 5th Ave N, Minneapolis, MN 55401",(612) 659-3400,,5,

Parsing CSV With FileReader


<cfscript>
    csvFile = ExpandPath("/sample.csv");
    csvData = [];

    // FileReader
    fileReader = createobject("java","java.io.FileReader");
    fileReader.init(csvFile);

    // use JavaLoader to load OpenCSV
    paths = [ExpandPath("/opencsv-2.2/deploy/opencsv-2.2.jar")];
    loader = CreateObject("component", "javaloader.JavaLoader").init(paths);

    csvReader = loader.create("au.com.bytecode.opencsv.CSVReader");
    csvReader.init(fileReader);
    csvData = csvReader.readAll();

    // release system resources
    csvReader.close();
    fileReader.close();
</cfscript>
<cfdump var="#csvData#" />

Parsing CSV With URL and InputStreamReader


<cfscript>
    csvUrl = "http://yourdomain.com/sample.csv";
    csvData = [];

    // InputStreamReader
    streamUrl = CreateObject("
java","java.net.URL").init(csvUrl);
    streamReader = CreateObject("
java","java.io.InputStreamReader").init(streamUrl.openStream());

    // use JavaLoader to load OpenCSV
    paths = [ExpandPath("
/opencsv-2.2/deploy/opencsv-2.2.jar")];
    loader = CreateObject("
component", "javaloader.JavaLoader").init(paths);

    csvReader = loader.create("
au.com.bytecode.opencsv.CSVReader");
    csvReader.init(streamReader);
    csvData = csvReader.readAll();

    // release system resources
    csvReader.close();
    streamReader.close();
</cfscript>
<cfdump var="
#csvData#" />

CFDump Result

I've only scratched the surface of what OpenCSV can do for you by the way ... I'll leave it up to you on how to write CSV files and even dump out SQL tables to CSV with OpenCSV. It's pretty cool stuff!

Peace.

My cf.Objective() 2010 Pecha Kucha Presentation Is Now Online

So, you couldn't make it to cf.Objective() 2010 ... or if you did make it, and for whatever reason, you weren't able to attend the Pecha Kucha BOF and you really wanted to see my presentation ... ok, not really want to see it, but kinda sorta wanted to see it ... then you're in luck! Thanks to Michael Canonigo, my presentation and most of the other ones, were recorded and preserved for future generations to see ... and laugh at.

You can find my presentation at http://www.youtube.com/stephenwithington#p/a/f/0/9OXeMqTULVg. Bob Silverberg has posted links to all of the other presentations on his blog too. Speaking of who, a huge thanks goes out to Bob Silverberg for putting this BOF together!

I ended up spending much more time on preparing and planning for this presentation than I initially thought I would ... primarily because of the strict timing requirements of a Pecha Kucha. That said, I would most definitely do it again! I hope everyone else had as much fun as I did ... I thoroughly enjoyed the diversity of topics and thought that everyone who participated did a great job.

Thanks also to everyone who attended as well and and cheered us on! Hopefully, we can do this again next year.

Cheers!

Learn About Beer at cf.Objective() Pecha Kucha BOF

If you're attending cf.Objective() 2010, you might be interested in a Birds of a Feather (BOF) on Friday, April 23 at 8:00 P.M. Bob Silverberg will be hosting a Pecha Kucha Night which will consist of around nine or so presentations. Each presentation is limited to 6 minutes 40 seconds and will consist of 20 slides, with each slide shown for 20 seconds.

This should be a fun BOF and will definitely cover a varying degree of subject matter. To the best of my knowledge though, most of the presentations will be about ColdFusion and other 'techie' topics ... which is why I've chosen to break things up a bit and give a presentation on something else I enjoy: beer.

That's right, I said it (or typed it actually), I'll be giving a presentation on beer. I'm still putting it all together at the moment, but I'll be attempting to cover at least some of the major milestones in the wonderful history of beer as well as a few other bits of information. It's amazing how quickly 6 minutes and 40 seconds passes by, so this will definitely be a challenge for me.

So if you're able to, please stop by and enjoy the fun. After it's all over, maybe you'll consider joining me for a pint!

How to Remove WWW from the URL in Mura CMS with ColdFusion

Recently, a Mura CMS user asked how to remove the 'www' from the URL. So I thought I would whip up a quick post on how to do it.

  1. Login to the Admin and go to your 'Site Settings' (top-right on yellow toolbar).
  2. Select the site you wish to enforce this rule on.
  3. On the 'Basic' tab, make sure you have 'yourdomain.com' in the 'Domain' field.
  4. Also, make sure you list 'www.yourdomain.com' in the 'Domain Alias List' text area.
  5. Click 'Update'
  6. Now we'll edit a file that would probably be included on each page in your site such as \{siteid}\includes\themes\merced\templates\inc\html_head.cfm
  7. Copy and paste the code below into the top of the file that is located on each page:


<cfscript>
    myDomain = "yourPreferredDomain.com";
    domainIsCorrect = true;
    if ( getPageContext().getRequest().getServerName() neq myDomain ) {
        domainIsCorrect = false;
        urlstr = "http://" & myDomain & getPageContext().getRequest().getRequestURI();
        if ( len(trim(getPageContext().getRequest().getQueryString())) ) {
            urlstr = urlstr & "
?" & getPageContext().getRequest().getQueryString();
        };
    };
</cfscript>
<cfif not domainIsCorrect><cflocation url="
#urlstr#" addtoken="false" statuscode="301" /></cfif>

That's it! Enjoy.

Launched New Online Presence for Family Optical Centre Powered by ColdFusion + Mura CMS

Family Optical Centre, Inc. has officially launched their first ever online presence at www.familyopticalcentre.com. Family Optical Centre has been a part of the Rockford-area community for over forty-five years and currently operates three locations throughout the area. If you're in the market for some new frames and/or lenses, you might be interested in taking advantage of some of their Special Offers too.

The site is powered by Adobe® ColdFusion® and Microsoft® SQL Server with online content management provided via Mura CMS. Talented artist and designer Greg L. provided an elegant, yet simple design which I quickly and easily converted into HTML, CSS and Mura CMS templates.

Congratulations to the team at Family Optical Centre on your new online presence. Best wishes for continued success!

Family Optical Centre
Designer: Greg L. | Developer: Steve Withington

MuraMediaPlayer Plugin Released for ColdFusion-Powered Mura CMS

I was finally able to finish up my MuraMediaPlayer plugin for Mura CMS. This plugin uses JW Player™, the Internet's most popular and flexible media player. It supports playback of any format the Adobe Flash Player can handle (FLV, MP4, MP3 and AAC). It also supports RTMP, HTTP, live streaming, a wide range of settings and more.

This plugin is available in the Mura CMS App Store under plugins. Since the primary guts of the plugin are driven by my cfMediaPlayer project hosted on RIAForge (a ColdFusion wrapper of the JW Player™), I'm posting a copy of the license here just so there's no confusion.

License

By using MuraMediaPlayer, you agree to the 'non-commercial' license found at http://creativecommons.org/licenses/by-nc-sa/3.0/. For corporate use or if you're planning to generate revenue from your site (e.g., by running advertisements on the page, selling anything, etc.) you will need to buy a license for JW Player™. To obtain a commercial license of the JW Player™, please visit http://longtailvideo.com/players/jw-flv-player/commercial-license/

Installation

Installing the plugin is pretty simple. I've created a brief video tutorial and also included an outline of some simple steps to follow:

Installing MuraMediaPlayer

  1. Download the plugin from the Mura CMS App Store's plugins section
  2. Note the location of the 'muramediaplayer.zip' file that you downloaded
  3. Log in to your Mura CMS Admin area
  4. Click 'Site Settings' found on the top-right portion of the screen on the yellow bar
  5. Select the 'Plugins' tab
  6. 'Browse' to the location of the 'muramediaplayer.zip' file and select it
  7. Click 'Deploy' and the 'Plugin Settings' form should appear
  8. If you want to change the 'Plugin Name,' feel free to do so
  9. You can simply leave the 'Load Priority' alone or change it to anything you want to be if you have other plugins that require loading ahead of it
  10. If you're Mura CMS install is using Amazon S3 for file storage and you've set up an Amazon CloudFront, you can enter the 'Cloud URL.' Otherwise, leave it blank.
  11. If you're Mura CMS install is using Amazon S3 for file storage, you have an Amazon CloudFront set up and you've setup a Streaming Distribution to deliver content to end users in real time, you can enter the 'Streaming URL.' Otherwise, leave it blank.
  12. Under 'Site Assignments,' select the site(s) you wish to enable the plugin to run on.
  13. Click 'Update' when finished.
  14. That's it! You're ready to create MuraMediaPlayer pages and/or use a new [mura] tag method that is now available to you.

Please visit Amazon for more information about their S3 and CloudFront services.

Usage/Instructions

Detailed instructions for using the plugin are available at http://www.getmura.com/index.cfm/app-store/plugins/muramediaplayer/documentation/. In addition, instructions can be found after you install the plugin simply by logging into the Admin area, click 'Plugins' (or go to 'Site Settings', then select 'Plugins' tab), then click the 'MuraMediaPlayer' link.

How to Strip/Remove the SiteID From the URL in Mura CMS

The first step in removing the SiteID from the URL in Mura CMS is to edit the file located at /config/settings.ini.cfm. Find the 'siteidinurls' attribute and set it to read siteidinurls=0. If you don't see this attribute, you might be using an older version of Mura, and you should probably upgrade your install. If for some reason, you cannot upgrade your install, then read this Mura blog posting titled Removing the SiteID from URLs in Mura.

Once this is done, you're usually pretty good to go. However, you can still actually navigate to your pages with the SiteID in the URL. In fact, when you preview your site from the Admin area, it usually includes the SiteID and someone expressed a desire to "fix" this for search engine optimzation (SEO), analytics, etc.

This is actually pretty easy to do by adding a few lines of code to your Mura CMS templates. The easiest thing to do would be to probably just add this to your 'html_head.cfm' file if you use it.


<cfscript>
    hasSiteIDinURL = false;
    if ( not application.configBean.getSiteIDinURLs() ) {
        urlstr = getPageContext().getRequest().getRequestURL();
        idx = listFindNoCase(getPageContext().getRequest().getRequestURL(), event.getSite().getSiteID(), '/');
        if ( idx gt 0 ) {
            hasSiteIDinURL = true;
            urlstr = listDeleteAt(urlstr, idx, '/');
            if ( len(trim(cgi.query_string)) ) {
                urlstr = urlstr & '?' & cgi.query_string;
            };
        };
    };
</cfscript>
<cfif hasSiteIDinURL><cflocation url="#urlstr#" addtoken="false" statuscode="301" /></cfif>

Hope this helps!

More Entries

© 2010, Stephen J. Withington, Jr.  |  BlogCFC was created by Raymond Camden – Version 5.9.004

Creative Commons License  |  This work is licensed under a Creative Commons Attribution 3.0 Unported License.