BlogCFC: Using cfmediaplayer in your posts

Word Count: 164

Yesterday I posted a video demo of my new ColdFusion Builder Extension. I recorded the mp4 demo using Jing Pro which I am really like. I was really tired of posted videos the way I used to. I would record a video, take a screen shot of the 1st frame, post the screen shot on my blog and link to a view in a new window.

Now that I am up and running on ColdFusion 9 I thought it was time to take advantage of cfmediaplayer. This tag does what all ColdFusion tags do, make something very easy to do. Just by passing a source you can embed a player that has all the controls as well as full screen capabilities. This is exactly what I needed, but how was I going to use it on myblog. I couldn't just use the following code in a blog post.

[More]

Problems with Comments

Word Count: 64
I believe I have solved the issues I have been having with comments. There were some issues with the remember text that came up but I think we should be good going forward. Please let me know (danvega at gmail) if you have any problems leaving comments. Thanks for all of your help who let me know about this!

Remember Me

Tags: BlogCFC
Word Count: 57
A couple people pointed out that the remember me feature was not working. I have cleared up this issue and should not be a problem going forward. When I switched to inline comments I forgot to populate the fields with form.x and those values get loaded from a cookie if the cookie is present.

Maximum and Minumum Height in IE

Tags: BlogCFC,CSS
Word Count: 457
While re coding my site I have come across many IE bugs that I been forced to learn about. The max and min bug is just another example of IE6 not playing well with others. Fortunately they fixed this in 7 and should only affect 6 and below. The min and max height (and width for that matter) allow you to set minimum and maximums for an element. I actually use this for my code view. In BlogCFC everything you put in between code tags gets parsed out in a .code block. When you have very little code there is no problem but what happens if you have 300 lines of code in your example? You don't want it taking up your whole page do you? The answer is no, so you can set a max-height property for the code div. This is the css code for my code block.
.code {
   font-family:courier new;
   font-size:12px;
   color: black;
   border: solid thin #bc5e1f;
   background-color: #f3f3f3;
   overflow: auto;
   max-height: 200px;
   padding: 4px;
   line-height: 15px;
   margin:5px 0;   
}
This works great in Firefox and IE 7 but IE6 does not recognize min and max height values so it shows all of the code. This is where expressions come into play.CSS expressions were introduced in Internet Explorer 5.0 and it allows you to to assign a JavaScript expression to a CSS property. This is a great way to correct this problem because no other browser will see our expression. We still can not use a max-height property but we can set the height of this div. All this expression does is evaluate the height of the element, if it is greater than 200 pixels it sets the height to 200.
height: expression(this.scrollHeight > 200 ? "200px" : "auto"); /* IE */
Firefox and IE7 will rely on the max height while IE6 will see height property. The only downfall to expressions is that they will fail if JavaScript is turned off. All in all I think it is an easy fix for our problem.

BlogCFC Author Comments

Tags: BlogCFC
Word Count: 289

One common design technique you will see on blogs is the distinct separation between a user comment and an author comment. Just by taking a quick glance at a group of comments you should be able to see where the Author has responded. In BlogCFC this is snap to do and I want to walk you through how I did it on my blog. Here is a quick snapshot of what my comments look like now in case they change in the future.

This first thing we need to do is setup our structure for our css. I took this completely out of the code so you could see it raw. You will notice that we have a container for all comments (comments) along with a comments section header (h3). Next we have a container for individual comments (comment). Each comment will have a head (commet-head) that contains information like the current comment number, the posters name and when the comment was posted. Finally each comment will have a body (comment-body) which is the actually comment. When we have multiple comments the single comment will just repeat itself.

<div id="comments">
<h3>Comments</h3>
<div class="comment">
   <div class="comment-head">
      #1 Posted By: Jake Munson Posted On: 12/29/07 11:13 AM
   </div>
   <div class="comment-body">
      My problem with services like this is they just give you a snapshot of your site. I am usually worried about how JavaScript works, so these services are useless for that.
   </div>
</div>
</div>

[More]

BlogCFC Survey

Word Count: 65

Ray Camden released a second survey for BlogCFC. Anyone who reads this blog already knows I am a BlogCFC supporter. Please take a second to fill out the survey and help with input on the next version. It will not take you that long and really helps Ray with what development time should be spent on.

BlogCFC Survey #2

BlogCFC - Counting Words in an entry

Word Count: 242
I thought I would add a quick feature to my blog today. I wanted to be able to display the number of words per post. This was way easier than I thought it would be and it was mainly because of the power behind Regular Expressions. I am still new to regex so this may not be completely right but it works so I am going with it. To add this feature to your blog you have to add 1 line in your index on the same line where it displays the date and tags, here is the code.
<cfoutput>| Word Count: #application.blog.getWordCount(body)#</cfoutput>

Then you need to add the following function to the main BlogCFC Component. All we are doing here is reading the entry text, stripping the html tags and counting the words using Java's String method split. The split method actually returns an array of words so a quick arrayLen() will give us the count we are looking for.
<cffunction name="getWordCount" access="public" output="true" returntype="numeric">
   <cfargument name="str" type="string" required="true">
   <cfset var stripped = REReplace(arguments.str, "<.*?>", "", "all")>
   <cfset var words = stripped.split('\W')>
   <cfreturn arrayLen(words)>
</cffunction>

Finally just clear the cache by appending ?reinit=1 to the url.

BlogCFC: Removing lastXDays feature

Tags: BlogCFC
Word Count: 415
In a previous entry I showed you how could change the default value for number of days to show entries. Well after hearing others thoughts about this, especially Charlie Arehart, this feature really does not make much sense and from everything I read Ray agrees. The reason this feature does not make much sense is because there is already a feature to display last x entries. There is no reason to go any further than this. Let us say that you are a blogger who posts entries 5 times a day or someone who posts 5 times a month, using the last x entries feature will work for both of them. This will also help cut down on going to blog and seeing the dreaded "Sorry there are no blog entries".

With that being said I would like to remove this feature from blogCFC. Fortunately you may not realize this but its as easy as removing 1 digit from the code. If you goto the tags folder and open the getMode.cfm template you will see the following code towards the bottom.
<!--- For default view, limit by date and max entries --->
<cfset params.lastXDays = 30>
<cfset url.mode = "">

In the end this is a part of a paramter structure that gets passed to the getEntries() method of the component org.camden.blog.blogcfc. Here is the part of the getEntries method that we are interested in.
<!--- If lastXDays is passed, verify X is int between 1 and 365 --->
      <cfif structKeyExists(arguments.params,"lastXDays")>
         <cfif not val(arguments.params.lastXDays) or val(arguments.params.lastXDays) lt 1 or val(arguments.params.lastXDays) gt 365>
            <cfset structDelete(arguments.params,"lastXDays")>
         <cfelse>
            <cfset arguments.params.lastXDays = val(arguments.params.lastXDays)>
         </cfif>
      </cfif>

Basically this code is looking for a value between 1 and 365 if it does not find a valid value it deletes the structure key. If the structure key is not there this feature is not used. So how do you remove the feature? Simply go back to the getMode.cfm template and change the lastXDays paramater to 0.
<!--- For default view, limit by date and max entries --->
   <cfset params.lastXDays = 0>
   <cfset url.mode = "">
And there you have it, even if you write 1 entry per month your home page will display entries based on the last x entries setting in your admin.

BlogCFC hides old entries, how to change that.

Word Count: 446

Dan Lancelot was having an issue with BlogCFC. He visited his blog and saw the text "Sorry There are not blog entries". This was mainly to do with his lack of posts in the last 30 days. By default BlogCFC will show the last 30 days entries along with the max number of entries which is set in your BlogCFC settings file. If you are someone who does not post as frequently and you want to change the 30 day default to say 60 or 90 days. To change this go to tags > folder and edit the getMode.cfm template. At the bottom of this template you will see the following code. If you change the lastxdays variable you can have BlogCFC search further back.

   1:  <cfset params.lastxdays = 30>
   2:   
   3:  <cfset params.lastxdays = 90>

One other alternative which Dan brought up is to make an effort to post more articles which is exactly what I have been trying to follow.

BlogCFC Evangelist Rumors

Word Count: 220

Brian Rinaldi over at www.remotesynthesis.com published his open source update for July 2 and can found here. Brian was kind enough to mention a bunch of my BlogCFC tutorials that I was working on. He also lead his readers to believe I was a paid BlogCFC evangelist. While I would gladly except this position sadly it is not true. If Ray Camden is not getting paid for his work I hardly doubt there are any openings for me.

In all seriousness though BlogCFC is a great product and I enjoy using it everyday. I know Brian was having fun with it but open source projects live because of the great work put forth by the developers and by the community. Contributing to an open source project does not mean that you need to dig into the code and start making modifications or additions. Most of the time developers need help with graphics, documentation, spreading the word & at the very least getting others excited about it. So the next time you feel like giving back to a project take a few minutes and write up a quick tutorial, its the least you can do to support the projects we all use everyday.

blogcfc_195

More Entries

Copyright © 2007 Dan Vega | BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.