Archive for the ‘Blogging’ Category

Flock

Monday, October 24th, 2005

I read about a pretty neat browser today called “Flock“. It has a lot of integration for blogging built rite into it. When I clicked the blog button, it asked for the URL of my blog. It was able to detect my blogs API and connect up to it.

I am able to drag my Flickr photographs from the top-bar into each post.

Flickr Photo

Although the editor is a WYSIWYG editor, it doesn’t have much functionality rite now. My preference would be to add a spell checker to it.

Blog Useability Guidelines

Tuesday, October 18th, 2005

I’m assuming there are many bloggers out there who really know there stuff when it comes to designing a blog. If you are one of these people, then you may be interested in a new article that came out on Jakob Nielsen’s Alertbox yesterday. His article, Weblog Usability: The Top Ten Design Mistakes focuses on many aspects such as trust, navigation, headlines, schedules, and more. I subscribe to his articles and am always interested in what he has to say.

FLV videos

Friday, October 14th, 2005

I have a very small collection of videos that I recorded through AudioBlogs. When I tried to retrieve the videos, I found that they were all in a format called Flash Video. They all had an extension of FLV. I didn’t know how to view these files.

After searching the internet, I came accross a few players that were free and open-source. I took a liking to one called Flash Video Player. It was easy to install. I just dropped an SWF shockwave flash file onto my website and made a reference to it. I saw my videos play in no time at all.

For most of us, our FLV files will probably be missing some metadata due to an earlier bug with many programs that converted other video formats to FLV. AudioBlogs is no exception. Because my video didn’t have any metadata, the Flash Video Player didn’t know how long the videos were. It would not show the progress of how much video I have watched.

Fortunately, I found an FLV MetaData Injector (free of course). After downloading the files necessary, I pointed the program at a directory full of FLV files and let it go to work. It didn’t take long and after uploading the modified files to my website, I saw that I now had progress bars being displayed with the videos.

Do you already have a few videos in a different format? You may want to consider converting them to FLV format. Statistics show that there are more users who can view flash files then those that can play AVI files. There is free software called Riva FLV Encoder to help you convert your AVI, MPEG, Quicktime, and WMV files to FLV. Good luck in finding something to convert them from FLV to another format.

Last is WordPress. There are a few WordPress plugins going around that let you show off your FLV files. Unfortunately, I have not gotten this far yet. I will do it soon, but I had to at least get this much information out for one of my loyal readers. At the moment, I have a small PHP script that lists all of my FLV files within a specified directory and shows them off when you click them.

PHP and Dreamy Audio

Wednesday, October 12th, 2005

I’ve been working with my audio and video files from audioblogs. I’m mostly working on getting a script setup to list all files within the directory. This is simple enough, but I’m also trying to parse the meta data out of those files as well such as the title, comments, artist, play time, etcetra. You can temporarily see how far I have gotten so far over at my Dreamy Audio testing site. In the end, I’ll be able to simply upload a new MP3 file into the directory and everything else will be taken care of as long as I’ve properly edited the MP3’s meta data before doing so.

Most of the parsing is taken care of through an open-source library that I found on the internet. I’ll need to work on refining the RSS feed to sort in the same way. Next is to apply the same technique to my Flash Video files (FLV). I promised I would say something about that soon. I’ll try and get something posted before the end of the week.

For now, anyone playing with PHP and listing file sizes might find this small piece of code useful. It converts the bytes to KB, MB, GB, TB, or PB to make the file sizes more easier to read.

171 function calcBytes($bytes)
172 {
173 $unit = ‘bytes’;
174 while($bytes > 768)
175 {
176 switch($unit)
177 {
178 case ‘bytes’: $unit = ‘KB’;break;
179 case ‘KB’: $unit = ‘MB’;break;
180 case ‘MB’: $unit = ‘GB’;break;
181 case ‘GB’: $unit = ‘TB’;break;
182 case ‘TB’: $unit = ‘PB’;break;
183 default: continue 2;
184 }
185 $bytes = $bytes / 1024;
186 }
187 return round($bytes, 1).‘ ‘.$unit;
188 }

A look into things to come

Monday, October 10th, 2005

This past weekend, I have been moving all of my audio and video files from audioblog.com over to my own website. Along with the files, I’ve had to do some research into how to play video files since they were all in Flash video format.

I found a little flash project called FlowPlayer. This open-source project will play both MP3 audio and FLV video files. I have more to say, but it is late and I need my rest. I’ll write more about it after I have everything setup. There is also some information on the site about a WordPress plugin that used the FlowPlayer as well.

For now, here is one of my earlier tests when I first tried out AudioBlog.

(Flash player removed - see Video Files page)

Here is another player called FLV Player (I found here) showing off a video I put together on the 4th of July.

(Flash player removed - see Video Files page)

I like the second player better.

Spacing out with TechnoTag

Saturday, October 8th, 2005

The other day I had made a tweak to the TechnoTag plugin for WordPress. As I am using the plugin heavily, I had found another feature that I needed. Any space and comma are treated as delimiters for a list of tags in the ttaglist custom field for each post. I wanted to add a phrase with spaces. The first thing that I tried was to put quotes around it, but it didn’t work.

I went into the plugin editor once more and made a tweak. Rather then splitting the tags by commas and spaces, I decided to match valid entries with a preference over quoted phrases. It took a little while to figure out the pattern that I needed, but in the end I got the results that I wanted.

/(”[^”]*?”|’[^’]*?’|[^”‘, ]+)/

For anyone who uses the plugin, you may find the following code useful:

1 function ttags($text) {
2 global $ttag_image, $ttag_link;
3 $ttaglist = get_post_custom_values(‘ttaglist’);
4 $ttagvals = get_post_custom_values(‘ttag’);
5 if(!empty($ttaglist)) {
6 preg_match_all(“/(\”[^\”]*?\”|’[^’]*?’|[^\”‘, ]+)/”, $ttaglist[0], $ttags);
7 $ttags = array_merge($ttags[0], $ttagvals);
8 } else {
9 $ttags = $ttagvals;
10 }
11 if(!empty($ttags)) {
12 $ttags_list = ‘<span class=”Tags” title=”Technorati Tags”>’;
13 $ttags_list .= ‘<a href=”http://www.technorati.com/help/tags.html”>’;
14 $ttags_list .= ‘<img src=”‘ . $ttag_image . ‘” alt=”Technorati Tags” style=”vertical-align:middle;padding-left:3px;padding-right:3px;” /></a> Tags: ‘;
15 foreach ($ttags as $ttag) {
16 $ttag = trim($ttag, “, \t\r\n\0\x0B’\”");
17 $ttags_list .= ‘<a href=”‘ . $ttag_link . urlencode($ttag) . ‘” rel=”tag”>’;
18 $ttags_list .= htmlentities($ttag).‘</a>, ‘;
19 }
20 $ttags_list = rtrim($ttags_list, ‘, ‘);
21 $ttags_list .= ‘</span>’;
22 $text .= $ttags_list;
23 }
24 return $text;
25 }

WordPress Link List Generation

Saturday, October 8th, 2005

I’m scratching my head here again. Tonight I was working on setting up the rest of my template for WordPress. I ran into a problem when I tried to check to see if it was XHTML compliant. It turns a method called get_links_list() was the culprit. This method is used to create my blogroll and other lists of links.

When designing a template, you want to make sure that you have total control over the layout and design of the page. The list of links are a little buggy in this area. First, the back-end interface allows the user to customize the text that appears before and after the link, as well as any text that appears between the link and the description. There are some list item tags suggested for the user by default.

Why is this a problem? The reason is that the template files that I am designing may one day appear on someone elses site. They may not be using list item tags. List item tags are required to be enclosed within list tags in order to be xhtml compliant. An additional problem is that only list item tags may be a direct child item of list elements.

Now let’s move onto the problem with get_links_list(). This method ignores the end-users preferences completely. That’s a good thing since I can now write a template knowing how the results will come back. The bad news is that I don’t have control over this in future upgrades, and I personally don’t want the list to be formatted the way that it comes back.

In the end, I made a modified function and placed it directly within my sidebar template. This is going a little overboard, but it does get the job done. I fixed it so that it does get the end-users information from the database about how individual links are formatted. I believe that template designers should have more control over this.

1 <?php
2 function get_links_list2($order = ‘name’, $hide_if_empty = ‘obsolete’, $cat_prefix = ‘<strong>’, $list_prefix = ‘</strong><ul>’, $list_suffix = ‘</ul>’) {
3 global $wpdb;
4
5 $order = strtolower($order);
6
7 // Handle link category sorting
8 if (substr($order,0,1) == ‘_’) {
9 $direction = ‘ DESC’;
10 $order = substr($order,1);
11 }
12
13 // if ‘name’ wasn’t specified, assume ‘id’:
14 $cat_order = (‘name’ == $order) ? ‘cat_name’ : ‘cat_id’;
15
16 if (!isset($direction)) $direction = ;
17 // Fetch the link category data as an array of hashesa
18 $cats = $wpdb->get_results(
19 SELECT DISTINCT link_category, cat_name, show_images,
20 show_description, show_rating, show_updated, sort_order,
21 sort_desc, list_limit, text_before_link, text_after_link, text_after_all
22 FROM `$wpdb->links`
23 LEFT JOIN `$wpdb->linkcategories` ON (link_category = cat_id)
24 WHERE link_visible = ‘Y’
25 AND list_limit <> 0
26 ORDER BY $cat_order $direction “, ARRAY_A);
27
28 // Display each category
29 if ($cats) {
30 foreach ($cats as $cat) {
31 // Handle each category.
32 // First, fix the sort_order info
33 $orderby = $cat[’sort_order’];
34 $orderby = (bool_from_yn($cat[’sort_desc’])?‘_’:) . $orderby;
35
36 // Display the category name
37 echo $cat_prefix. $cat[‘cat_name’] .$list_prefix;
38 // Call get_links() with all the appropriate params
39 get_links(
40 $cat[‘link_category’],
41 $cat[‘text_before_link’],
42 $cat[‘text_after_all’],
43 $cat[‘text_after_link’],
44 bool_from_yn($cat[’show_images’]),
45 $orderby,
46 bool_from_yn($cat[’show_description’]),
47 bool_from_yn($cat[’show_rating’]),
48 $cat[‘list_limit’],
49 bool_from_yn($cat[’show_updated’]));
50
51 // Close the last category
52 echo $list_suffix;
53 }
54 }
55 }
56 ?>

How to Fix The TechnoTag Plugin

Thursday, October 6th, 2005

I found that the TechnoTag plugin had a bug in it when I tried to place multiple tags within the same post. Every tag linked to the first tags target. If I had 3 tags linking to “Spiders”, “Bugs”, and “Spooky” - then all three tags would link to “Spiders”.

After looking at a discussion about TechnoTags, I had found that other people had the same problem as well. No one had a solution so I started taking a look at the PHP code. I don’t know how I get myself into these messes sometimes. It builds out of necesity. I really like tagging my entries, so I couldn’t settle for a buggy plugin.

It appears that the author tried to solve another problem regarding how to encode tags to be xhtml friendly. It solved the problem, but another problem arose. He only took the first tag into account.

After learning a few things about regular expressions, I came up with a solution that looped through each match of a regular expression. Regular Expressions are a way of detecting patterns within text. I later found out about another method that passed a matching piece of text to another method in the code. I setup a special method to alter the text passed to it. Once that was done, things looked a little bit cleaner.

The following is the new code that I replaced the technotag($text) function with:

2 function technotag($text) {
3 $pattern = ‘/<ttag[^>]*?(\s+word=”([^”]*)”)?[^>]*?>(.+?)<\/ttag>/i’;
4 return preg_replace_callback($pattern, ‘technotagreplace’, $text);
5 }
6 function technotagreplace($match){
7 global $ttag_image_small, $ttag_link;
8 $tag = $caption = $match[3];
9 if($match[2] != “”) $tag = $match[2];
10 return ‘<a href=”‘ . $ttag_link . urlencode($tag) . ‘” rel=”tag” title=”See posts from other blogs talking about &quot;’ . $tag . ‘&quot; on Technorati.com”>’ .
11 $caption . ‘<img src=”‘ . $ttag_image_small . ‘” style=”vertical-align:middle;padding-left:2px;padding-right:2px;border-width:0px;” alt=”‘ . $ttag_alt . ‘” /></a>’;
12 }

A Technorati Tag Plugin

Thursday, October 6th, 2005

Wow. That’s what I have to say is, “Wow”. Some of you may have known about my little adventures building software to create tags for Technorati to spider within my blog entries. The Technorati Tagger program even got some recognition on the Blogosphere. Tonight, I can finally put it to rest.

I discovered a WordPress plugin called TechnoTag. The TechnoTag plugin lets me edit my posts as I normally do. If I enclose a word within <ttag>a ttag element</ttag>, it becomes tagged! But that is not all. I can also add a comma delimited list of tags as a custom property to my post (in advanced editing mode). A list of linked tags shows up at the end of my posts.

No more building 3rd party applications for me. I can just edit the plugin for any little changes I wish to make and it instantly appears accross the entire site. This is sweet. I just need to find a way to convert my old posts to use the new ttaglist property.

Learning about Templates

Tuesday, October 4th, 2005

I had perfected my templates for use with my old blogspot account. Now with WordPress, templates have changed. Perhaps they are for the better. I am able to put PHP code into my templates. Actually, they depend on it. The setup is a little awkward as they only permit one sidebar.
(more…)