Blog posts tagged "articles"

On the third day of Kirby Week, Four Island gave to me: An article about using IntenseDebate.

Welcome back! Yesterday, I promised I'd show you how to add a commenting system to your blog. And I will! But, being the lazy person I am, I'm not going to show you how to write one. Instead, we'll be using Automattic's IntenseDebate.

IntenseDebate is a good commenting system by the makers of Wordpress. Yes. Ok. Anyway, it has lots of prettiful features that it enumerates all over its site so you should go read it.

IntenseDebate is pretty easy to get started with. Simply go to its website, register for an account, and add a blog. When it asks you what type of blog you have, choose "Custom" or "Generic". It'll provide you with two Javascript snippets.

We're nearly done! Already! Take the first snippet and paste it in read.php, after the call to displayPost() but before the inclusion of footer.php. There! You're done! That was easy!

If you want to change your settings, moderate comments or anything, simply log in at the IntenseDebate website and you're dashboard is your friend!

Tomorrow, we'll be adding RSS support to your blog so people can receive notification and other fun stuffses.

Hatkirby on December 16th, 2008 at 12:31:02pm
πŸ‘ -1 πŸ‘Ž

On the second day of Kirby Week, Four Island gave to me: A tutorial on coding an admin panel.

Welcome back to the second day of Kirby Week! As I told you yesterday, today's post is about writing an Admin Panel! Yay! We're going to only create a very basic panel: Single user login and when you get there, all you can do is write posts.

We'll be storing the single user in the database for some deranged reason. Possibly later we'll add multi-user support, I don't know. Anyway, here's the schema for the users table:

CREATE TABLE `users` (
`id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`username` VARCHAR( 255 ) NOT NULL ,
`password` VARCHAR( 255 ) NOT NULL DEFAULT ''
);

And remember to add a user to the users table!

First, you need a login form. I'll let you handle this as, I assume, if you're writing a blog you probably know something or other about HTML. It should POST to admin.php and contain Username (NAME="username") and Password (NAME="password") fields.

Finish the form? Good. Now, we need to write the back end. Create a file called admin.php and put this in it: http://other.fourisland.com/kirbyweek08/?source=admin.php.

Since I don't want to do all of the work, I'm going to let you design another form! YAY. Between the two comments ([/code]), create a form thatPOSTs toadmin.php?submit=. Create a textbox in itNAMEdtitle, a textareaNAMEdtextand another textboxNAMEdtags`. Obviously, also put in a submit button.

You may want to label the elements so you know what to do while posting. The first is the Title of the post, the second is the content, and the third is the comma-delimited list of tags for the post.

YAYish, I guess. We're done with the Admin panel.... Sort of. The admin panel is currently annoying, you have to type in all of your formatting and such using HTML. We'll fix that with a handy JavaScript editor called TinyMCE.

Download TinyMCE from the aforementioned link, extract it and plop the jscripts/tiny_mce folder into your kirbyweek08 folder. Now, let's add TinyMCE to our admin panel. Append this code above your FORM.

Hurray! If everything went right, your admin panel should now be better looking and easier to use! Remember that this is just a basic model and you should really style it and add more functionality on your own.

Next time, we'll be adding commenting system to your blog so people have the chance to talk about the wonderful things you're blogging about.), create a form thatPOSTs toadmin.php?submit=. Create a textbox in itNAMEdtitle, a textareaNAMEdtextand another textboxNAMEdtags`. Obviously, also put in a submit button.

You may want to label the elements so you know what to do while posting. The first is the Title of the post, the second is the content, and the third is the comma-delimited list of tags for the post.

YAYish, I guess. We're done with the Admin panel.... Sort of. The admin panel is currently annoying, you have to type in all of your formatting and such using HTML. We'll fix that with a handy JavaScript editor called TinyMCE.

Download TinyMCE from the aforementioned link, extract it and plop the jscripts/tiny_mce folder into your kirbyweek08 folder. Now, let's add TinyMCE to our admin panel. Append this code above your FORM.

Hurray! If everything went right, your admin panel should now be better looking and easier to use! Remember that this is just a basic model and you should really style it and add more functionality on your own.

Next time, we'll be adding commenting system to your blog so people have the chance to talk about the wonderful things you're blogging about.

Hatkirby on December 15th, 2008 at 12:31:54pm
πŸ‘ 3 πŸ‘Ž

On the first day of Kirby Week, Four Island gave to me: A tutorial on coding a blogging engine.

Welcome to Kirby Week 2008. As I told you yesterday, I'm going to spend this week teaching you how to write your own blogging engine. As we go along, we'll be adding many enhancements and such, but for now, we'll be starting with the basics. The blog you will be building will be loosely based on the SimpleBlog engine.

To do this tutorial, you, of course, need:

  • A Web Server
  • PHP
  • MySQL

We'll start with creating the base directory structure. In your webroot, create a folder called kirbyweek08. Create a css folder inside that folder.

Next, we need to set up the database. Create a new database called "kirbyweek08" and use this schema to create the tables:

CREATE TABLE `posts` (
  `id` int(11) NOT NULL auto_increment,
  `title` varchar(255) NOT NULL,
  `text` text NOT NULL,
  `slug` varchar(255) NOT NULL,
  `pubDate` timestamp NOT NULL default CURRENT_TIMESTAMP,
  `tags` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`)
);

We need to let your site connect to the database. So, create a db.php in the kirbyweek08 folder, and put this in it:

<?php

$dbwebhost = 'localhost';
$dbwebuser = 'root';
$dbwebpasswd = '';
$dbwebname = 'kirbyweek08';

mysql_connect($dbwebhost, $dbwebuser, $dbwebpasswd);
mysql_select_db($dbwebname);

?>

$dbwebhost and $dbwebname are probably correct for you, but swap in the correct values for $dbwebuser and $dbwebpasswd (a.k.a. username and password of someone with permission to access and modify the kirbyweek08 database). Now that that's done, we can start making the blog.

Create an index.php file in your kirbyweek08 folder, and put this in it:

<?php

require_once('db.php');
require_once('functions.php');
include('header.php');

$getposts = "SELECT * FROM posts LIMIT 0,4";
$getposts2 = mysql_query($getposts);
$i=0;
while ($getposts3[$i] = mysql_fetch_array($getposts2))
{
    displayPost($getposts3[$i],true);

    $i++;
}

include('footer.php');

?>

A little explanation is required here. First, this file connects to the database by loading the db.php file we created before. Second, it loads a file called functions.php that we haven't created yet, and a file called header.php that we also haven't created yet. These files will contain useful functions reused often in your code, and a header to display above every file, respectively.

Next, the file downloads the latest four posts from your database and uses a function called displayPost() to display it. Finally, it loads a non-existent file called footer.php which will contain a footer.

The most important part is the displayPost() function. It will lie in the functions.php file. Instead of posting the code, I'm just going to link to it because it's rather long and it goes off of the side of the post.

Wow! That was a lot. Don't worry, that's the longest code snippet in this application. Whew. I think it's time for testing. However, if we test it now, there'll be nothing to see. First, add a record to the posts database.

The fields are simple. Ignore id and pubDate, they're automatically generated by MySQL. title and text should be self-explanatory. tags is a comma-deliminated list of tags for the post. Now we can test it.

You should see your post, surrounded by tons of errors. Oops. We forgot to make the header and footer! Also, you'll notice that it's saying your post is by "Anonymous". Want to fix that? Notice at the top of functions.php, a variable named $author. Set that to your username and you're set.

Let's create that header. Basically, you can put whatever you like in it. Just remember that it is pasted above the contents of every file, so make sure that a <BODY> tag has been opened by the time the file ends. Use this as an opportunity to theme this new blog with the rest of your site! Follow suit with footer.php as well, it's just a footer.

Nearly done! Now, all we have to do is create the other two files linked to by the displayPost() function. Here's read.php:

<?php

require_once('db.php');
require_once('functions.php');
include('header.php');

$getpost = "SELECT * FROM posts WHERE id = " . $_GET['id'];
$getpost2 = mysql_query($getpost);
$getpost3 = mysql_fetch_array($getpost2);

displayPost($getpost3, false);

include('footer.php');

?>

And tag.php:

<?php

require_once('db.php');
require_once('functions.php');
include('header.php');

$getposts = "SELECT * FROM posts WHERE tags LIKE \"%" . $_GET['tag'] . "%\" LIMIT 0,4";
$getposts2 = mysql_query($getposts);
$i=0;
while ($getposts3[$i] = mysql_fetch_array($getposts2))
{
    displayPost($getposts3[$i],true);

    $i++;
}

include('footer.php');

?>

We'll, we're pretty much done! I know, I know, it's mediocre. Don't worry, during this week we'll really spruce it up. Thank you for surviving that long tutorial, the rest is more fun.

You'll have noticed that there's no way you can post to this blog short of manually editing the database. Tomorrow we'll be looking at creating an admin panel for you to use for your bloggy funness. Enjoy!

Hatkirby on December 14th, 2008 at 12:32:13pm
πŸ‘ 7 πŸ‘Ž

This sort of goes hand-in-hand with yesterday's post of drastic changes. I often get the urge to switch to Wordpress for my blogging engine, instead of the homebrew one I currently use.

I mean, I have pride in my own work, my own, extremely customizable, hand-typed code, but sometimes, Wordpress just really looks attractive with all of it's power and the more dedicated work put into it by a team of people.

I just started reading Lorelle again, and the first post I saw was about the new release of Wordpress that came out yesterday, 2.7. I was a little interested, but what really caught my attention was the new admin panel. It looks soooooo good! How can I resist?

It's hard, resisting a wonderful looking package (that, by the way, Color Pencils and Dream Weaver use) for my own work, but it's worth it. While I don't get the same degree of power and looks, I get the power that I want that Wordpress can't provide as easily: complete freedom.

If there's something my blog isn't doing correctly, I can just go into the source code and fix it. If there's something in Wordpress, if I was using it, that I was unhappy with, I'd have to go hack it or try to write a good plugin.

For instance, at one point, when I was developing the 7th layout that will not exist, I was using Wordpress on the development machine. However, the first, instantly noticeable problem was, "How am I going to have a pending queue?" The thing that I find most useful with my blog is that I can just write posts to it and they're posted on a daily basis, without any required intervention from me.

Wordpress can't provide that the way I want. It does have a scheduled posting feature, but with that, you have to provide the exact date and time you want each post to be posted. That wouldn't work for me, because sometimes there's an emergency post I have to post instantly, and let the pending queue delay for one day. With Wordpress, I'd have to manually edit each post and change the post date.

This would also happen if I decided to make a simple change in the order of the posts in the pending queue. With Four Island, I click on the "Move Up" or "Move Down" button next to the necessary post. With Wordpress, I'd have to manually edit both posts in question. And what if I wanted to move a post more than one space? shivers

So, in conclusion, and without a reason to care, I don't want to use Wordpress, no matter how.... tempting it may be. And I'll try to stand by that. And if that means forcing my readers to yell at me and not read my site anymore if I switch to Wordpress, so be it. :)

Hatkirby on December 11th, 2008 at 12:30:13pm
πŸ‘ 7 πŸ‘Ž

Ok. So, I found about Automattic's new commenting system thing, IntenseDebate from CSS-Tricks. The features list made it sound really good, so I tried installing it, and I also got Drifty and Timbo94 to install it on their blogs too.

Well.... it's interesting. I mean, it does have it's good features, which are great, like reputation and threading and generally looking nice. But there is a problem.

It's so slooooooow! I mean, it loads quickly enough, but when I sit down to type in a comment, I'm way ahead of it and the letters are appearing the box one.... by.... one.... very.... slowly and I'm just sitting there, waiting for everything to appear so I can figure out what spelling mistakes I made.

So.... I guess IntenseDebate is pretty good. However, I'd like to argue about it with someone, so we can do that here. :) I've uninstalled IntenseDebate for the time being because I can't really have it perfectly yet until I hack the Wordpress plugin, so we're back to Four Island comments for now!

Or, even better, we can deblatog about it!

Hatkirby on December 7th, 2008 at 12:32:04pm
πŸ‘ -2 πŸ‘Ž

Ok. Recently, I (OMG, I didn't mean to!) attempted to help an acquatience activate their copy of Windows XP, which was expiring in a day. Their computer was really old, and it had a copy of Xubuntu Gutsy on it, but they preferred Windows XP for some strange reason.

So, I though, this'll take five seconds. Oh, but I forgot to mention, their computer didn't have internet access. Oh well. At least there's an automated phone service used to handle Windows activations (toll-free!).

So I called the number for my region and waited. It asked me a few questions like "Are you activating Windows XP?", but it wanted me to say yes or no. Confused, I answered, but the next part was the GAH.

The computer at the other end told me to recite the Windows XP activation code to her. This is a some 32 digit long number and I have to TELL her it instead of just typing in the numbers on the phone.

Warning: If you're ever trying to do this, get someone to do it who has no emotions. I giggled after the first block of numbers and the computer said: "I did not understand that. Good bye."

Oh, and by the way, it turned out that they had an expired version of Windows XP anyway, so the time I spent was futile. Oh well, at least it was funny. :)

Hatkirby on December 5th, 2008 at 4:10:12pm
πŸ‘ 1 πŸ‘Ž

This post is the sixth and final day of VisitorGrid Week. For more information, read the post linked to right there.

This week seems to have gone pretty well. I'm going to end it off with a yummy tutorial. This time it's about MPD, the Music Player Daemon. MPD is a program you can use to play music from your computer without any interface, which is why it is usable even on the command line. MPD usually interacts with a client, which range from MPC, a command line client to GMPC, a GNOME-based graphical client. There are quite a few clients, however, that allow you to interact with MPD wirelessly, via some type of remote control.

I browsed through these and found none that I could to immediately without running out to the store and buying some type of accessory. But, then I found mousempc, a bare-bones client controlled by a mouse. That's right, that includes wireless mice. And, I just happen to have a wireless mouse lying about.

First, I'll tell you how to install MPD, then I'll tell you how to setup mousempc. MPD is easily installed, due to the amount of distributations it's been ported and packaged to, but mousempc is quite a challenge.

Ok, installing MPD. MPD can be found in most Linux distribution's packaging system under the name "mpd". So, for instance, on Debian/Ubuntu, you'd run this command to install MPD:

sudo apt-get install mpd

That wasn't too difficult, was it? The only other thing you really have to do is to import your music into MPD's library.

On Debian, this library resides at /var/lib/mpd/music/ by default. You can find the location of your library in your /etc/mpd.conf MPD configuration file under the name "music_directory". Copy your songs into that folder. Note that you may need root privileges to access that folder, so add sudo to the front of each cp command you run.

After copying in your files, you need to have MPD re-create it's database. You can do this by running the commands:

sudo mpd --create-db
sudo /etc/init.d/mpd restart

The first command re-creates the database and the second restarts MPD. Note that the second command may be different depending on your distribution.

Well, there you have it. Your music files are safe and snug in MPD's database. Now you need to install mousempc. This, as I said before, is the difficult part.

  1. Begin by downloading the Makefile and mousempc.c from its Subversion repository.
  2. You need GCC (the GNU C Compiler) to compile mousempc, but it's normally pre-installed on most Linux systems. In case it isn't, however, try installing it with your packaging system using the package name "gcc"
  3. You also require Make to parse the Makefile. Same post-text as above applies.
  4. Finally, you require a small package called runit.
  5. Run the following commands:
make
mkdir ~/mousempc
cp mousempc ~/mousempc/
cd ~/mousempc
mkdir env log
cat > run << EOF
<\$EVENTFILE exec chpst -u mousempc -e ./env ./mousempc
EOF
chmod a+x run
> env/MPD_HOST
> env/MPD_PORT
OLD_UMASK=$(umask)
umask 077
> env/MPD_PASSWORD
umask $OLD_UMASK
cat > repeat << EOF
./run
./repeat
EOF
chmod a+x repeat
  1. The last thing you need to do is find out which event device your mouse is. Enter this line into the top of the run file created in the previous step:
EVENTFILE=/dev/input/event2

Then, run run:

sudo ./run

Try right clicking with your wireless mouse. If nothing happens, try /dev/input/event3 in run. If that fails as well, /dev/input/event4 and so on. 7. When you find the correct device, all you need to do to start mousempc is run repeat:

sudo ./repeat

There are two problems you can have with this. One is that, after running repeat, you get some error about not having enough permissions to do whatever. This is resolved by looking in the /etc/mpd.conf file mentioned earlier, finding the value entitled "password", and placing that into the MPD_PASSWORD file inside of the env folder.

The other problem you can have is that after a while, mousempc stops working. This may be due to the fact that your wireless mouse reciever may have changed event devices. If this happens, simply retry going through /dev/input/event2 and so on.

Finally, that long tutorial is over! Well, I hope you've enjoyed this tutorial, and I hope you've enjoyed VisitorGrid week!

Hatkirby on November 21st, 2008 at 12:55:33pm
πŸ‘ 0 πŸ‘Ž

This post is the fourth day of VisitorGrid Week. For more information, read the post linked to right there.

Now that you know why you should blog, here's a handy tutorial on how to start a blog just in case you decide that blogging interests you.

The first thing you need are some ideas. Like, for instance, what are you going to name your blog? Or, what's it going to be about? Your life? Blogging?

Once you've handled that stage, you need a host. There are many free blogging hosts on the internet (myself included, I'm already hosting two), so this one isn't difficult. We'll assume that you're using Wordpress.com, a hosting service that runs off of the popular Wordpress blogging software. It's fairly easy to create an account on Wordpress.com. It has a large "Sign up" button on the home page, and the forms are easy to navigate.

Now that you have a blog, you should write an introduction post. Explain what your blog is there for, why people should read it. This, and some more self-promoting information should also be inserted into an "About" page.

Finally, you need to come up with a blogging schedule. How often are you going to blog? Are you going to do special things on certain days of the week? Think about this, because when people start to enjoy your blog, want to keep reading some good content, they'll be disappointed when you fail to post.

Hatkirby on November 19th, 2008 at 1:31:35pm
πŸ‘ 3 πŸ‘Ž

This post is the second day of VisitorGrid Week. For more information, read the post linked to right there.

Many people on the internet have blogs. Many people have more than one blog. But do you have one?

There are many good reasons for you to have a blog. That's why I've decided to make a list! YAY! This is probably going to be terrible (as it's my first blog post list), but anyways, here we go!

  1. Blogging is fun
  2. Blogging is a method of telling people of the outside world your feelings
  3. Blogging is a way to connect to people you don't know
  4. Blogging is a good way to vent your feelings
  5. Blogging is a good way to get feedback from your visitors
  6. Blogging is a good way to have daily content on your site
  7. Blogging makes it easier to have a reason to make a site
  8. A blog can be an online diary
  9. Blogging can be a way to speak your feelings to the world without revealing your true identity
  10. People on the internet who have blogs can sometimes look more professional
  11. Having a blog can be a good way to direct traffic to your site
  12. A blog doesn't always have to be an updates archive. You can use it as a type of game
  13. A blog can keep your visitors updated to the most recent events on your site
  14. Blogging can be a way to keep yourself from being bored
  15. Um.... insert more good reasons here

Ok, that was terrible. But I hope you enjoyed it!

By the way, if you have any ideas that you think would do well on this list, please comment!

NOTE: Verify blognomic.net, make sure it's not a different TLD

Hatkirby on November 18th, 2008 at 12:56:06pm
πŸ‘ 2 πŸ‘Ž

I know what you're thinking. I'm going to start this post with my "Recently, I....." line that I've completely overused. Well, forget it. I've already written the first line, and it's not "Recently, I....", it's "I know what you're thinking." See? I've outsmarted you. The "Recently, I...." line is in the second paragraph.

Recently, I wrote a post entitled Lorelle Link and Comment Challenge which included a link to a post on Timbo94's blog, Dream Weaver. Timbo94 seems to have a strange habit of including special characters in his blog post titles, which mess up the permalink badly. In fact, when I clicked on the link in my admin panel, it just came up as 404.

Because of this, I decided to change his permalink structure to not include post titles. I discovered Wordpress' page on Permalink Structure Tags, and I was soon messing around, trying to create the ugliest permalink structure I could. In fact, I ended up with the monstrous:

/%category%/%author%/%year%%monthnum%%day%%minute%%second%
        %post_id%/

While that was fun, it made me think. If you're going to have a permalink structure (if you don't, I'll be scared of your blog), make sure it's a good one that you won't want to change sooner or later. Changing your permalink structure can make old backlinks fail, but a bad permalink structure (like special characters in post titles), backlinks will also fail.

In the case of Timbo, he should either have used a different permalink structure to begin with, or simply omitted the special characters from his post titles. And, the latter's probably preferable because, well, fourisland.com/blog/permalink-structure/ is much prettier than, to take the example of Wordpress' default permalink structure, fourisland.com/blog/?p=18 (or whatever this post's ID is).

But, you should also remember, that when picking a permalink structure, if you're going to make it obnoxious like the monstrosity above, make sure you actually like it before setting it in stone.

Hatkirby on November 13th, 2008 at 12:33:02pm
πŸ‘ 0 πŸ‘Ž