Programming

Quick EE tip, RSS feed not working

Posted in Ramblings, Websites on April 22nd, 2009 by Jason – Be the first to comment

This is not so much a tip for what to do but what not to do. I recently had an RSS page that was giving some strange errors in expression engine. The fix was simple, when you create your template, make sure you select it to be an RSS page. Seems simple enough, but if you select it to be a webpage, everything will look as it should with the exception of just one thing.

When I created the template, I would get the following error in the safari web browser, and would not get results in other web browsers.

The error was: “The feed could not be loaded because the content is not in a known feed format.” (PubSub:2)

After looking at the source code, the only thing that I could see which was different than that of a standard RSS feed was the following line of code.

<ee:last_update>

Why expression engine adds that line, I dont know, but if you see this, be sure to check that your template is set to be an RSS template and not a webpage.

Quickly Delete all emails in Horde Mail

Posted in Programming on April 22nd, 2009 by Jason – 13 Comments

I recently ran into a problem with an email account getting over 3,000 emails within a very short amount of time. The webmail client that was being used is Horde, and there did not seem to be an easy way to just delete all of the emails in the inbox. After a little searching around I found this solution.

First you will need to select Folders from the top navigation. This should bring up a list of all your folders, including your inbox. This screen shot was taken after I already emptied the inbox, which is why it shows (0/0).

picture-4

Once you have selected the folders that you want to empty, you can use the drop down menu above it to empty the folders of all the emails that they have.

picture-7

It should ask for confirmation and then you should no longer have any emails in your inbox.

picture-5

WordPress 7.2.1

Posted in Ramblings, Websites on March 30th, 2009 by Jason – Be the first to comment

After only a few hickups along the way I finished updating the blog to the latest version of wordpress. The main issue I had, and due to not following the upgrade instructions was that after the install the screen would be totally blank, with no error messages. I finally realized that since I had not kept all of my wp-contents files, the theme I was using was not in the new version and so it was causing a blank screen to appear. After I uploaded the theme I use, it worked great. If you want to avoid this problem, you can set the theme to the classic or default theme that come with wordpress, that way when you upload the latest version, it will already have those two themes standard.

How to find your version of wordpress

Posted in Ramblings, Websites on March 23rd, 2009 by Jason – Be the first to comment

Today I had a simple question of how to find what the current version or build of wordpress I am running is. When I login, it is easy to see if there is a new one available as notices are put all over, but I did not see anywhere that it stated what the current version is. After poking around the only place I have come across is the source code of my blog in the head section. For those who may have their own templates that do not show the version number, you can also find the same information within the souce code from the admin section.

Bounce Rates, What does it Mean?

Posted in Ramblings, Websites on March 10th, 2009 by Jason – Be the first to comment

One question that I get asked a lot is about bounce rates. Most programs that track your website statistics will show your bounce rates. Google analytics, which is what I use will show the entire site average and also the rate for individual pages. I said that it was one question I get asked about, but it is actually two.

First, what is it?

The bounce rate is a ratio of people that visit one page on your site and leave, compared to people who visit one page on your site, and then visit another page on your site. Image you have four pages on your website “A, B, C, D”. A is your home page, while B and D are product pages, and C is a contact page. Each of these pages can be an Entrance page and an Exit page. Entrance and Exit pages are any page “A, B, C, D” that a visitor first visits your website with or leaves your website from. Imagine searching Google for YourCompany.com. You might get a result of page A (your homepage) as a result. This would be the entrance page to your site. Now imagine that you search for YourCompany.com and Product B. Now instead of Google returning page A, it might return page B since it better represents what your searching for. This time page B would be the entrance page. So what does this have to do with your Bounce Rate? When a visitor enters your site on page B, and doesn’t visit any other page, and leaves your site (closes their browser, returns to Google, etc.) then this counts toward your bounce rate. The higher it is, the more people are viewing entering and exiting your website from the same page.

Second, should it be high or low?

Now that you know what your bounce rate is, you might be curious if it should be high or low. There are various responses to this, some say it should be low, and others will tell you it doesnt matter. My view is a mix of the two. It depends on your content, and also what you want your website to be. Lets return to the example pages mentioned above. Lets say that you created page C, your contact page, with the purpose of displaying the address and phone number of your company, and really want people to call instead of just browsing the site. If this is the case, when people search for YourCompany.com and Contact info, they might get a search result that takes them directly to page C. This becomes their entrance page, they see your phone number and call you, and then close the webpage. That means they also exited on page C, so the bounce rate for page C is now higher. In this example, your purpose was to get people to call you, page C provided them the information they needed and they called you. Page C served its purpose, but has a high bounce rate. Your bounce rate in this case is not as important. Lets now imagine that page A, your homepage, is setup to welcome people and direct them to your products, which intern direct visitors to your contact page. If some one “enters” your website on page A and then “exits” your website without visiting any product pages then again your bounce rate will be high. This time it does matter, because the purpose of A was to direct them to look at your product pages B and D. So while your bounce rate on page C could be high, it may not matter, but having a high bounce rate on page A will matter.

Time on Site.

There is one thing that you should check to help you decide if a high bounce rate is something to be concerned with. I recently posted an article giving a solution to a common problem people were having. The bounce rate was almost 100%. Was this good or bad? You can take this two ways: 1. it is bad, people entered the site, didnt find what they needed and left, or 2. people entered the site, got exactly what they needed on the first page they visited, and then left as a satisfied customer. How can you tell the difference? While not a perfect method, the average time on page is a great indicator. If it is number 1, most likely your average time on site will be very low, they opened the page, looked and didnt see what they needed and left (10 seconds). For number 2, the found what they needed, read the full article and left a happy customer ( several minutes). Luckily for me, my situtation was the latter.

Google has a quick synapsis of what bounce rate means, in a little less detail, here. If you are still have questions feel free to drop a comment.

Find out your MediaTemple (gs) Cluster Number

Posted in Ramblings, Websites on March 9th, 2009 by Jason – Be the first to comment

There have been several complaints about the mediatemple grid server (gs) since its original launch over a few years ago. Since then there have been several changes to the way that they maintain their grid server accounts. Since I recently moved all of my sites over to the grid server, I have been keeping an eye on its performance. So far I have not had any issues.

In a recent article that mediatemple posted, they discussed some of the ups and downs they have had over the years with getting the grid server to where it is today. One thing that stuck out to me in their article was the fact that customers who are located on the original cluster servers 1 and 2 are still running on the original architecture. The grid clusters after one and two are using the newer architecture and have greater improved stability.

Getting to the point, if you would like to check which grid cluster that you are on, you will need to login to the account center. Click the admin button on the overview page, and then click on Server Guide. This page will have a lot of you grid server information and at the bottom you will notice the cluster section and it will contain your grid cluster number. As you can see, I am on Cluster 4. So far so good.

Moving a WordPress Database to a New Server

Posted in Websites on February 27th, 2009 by Jason – Be the first to comment

This past weekend I had the joy of moving two different installations of wordpress to a new server. The first one, which is this blog, moved from my old godaddy.com hosting account to a mediatemple grid server. The second blog (thebaileyblog) which my wife and I use, moved from a subdomain of sidewaysgravity.com to its own domain.

When moving a wordpress blog from one location to another there are a couple steps you will need to take to make sure that everything continues to work. Wether you are moving a blog to a new server with the same domain name or a new one, the steps stay the same, with only a few extra steps if the domain name is changed.

There are a couple things that you will need when you are preparing to move your blog. You will need an ftp program to be able to retrieve files from your current host and to put them onto the new server. It is also extremely useful to have access to phpMyAdmin and since that is what I used, I will use directions for it. If you are not sure how to access phpMyAdmin, you can contact your hosting company and they can help answer any questions you may have. For Mac users, CyberDuck is a great ftp application.

One thing I cant stress enough is to BACKUP you wordpress blog. I have moved my handfull of blogs and everynow and then something happens and I would be in a world of hurt if I didnt have my backup. You will want to backup not only your database, but also all the files for the blog. Fortunately when you are moving the database between servers, you have to back up the files to do the transfer anyways so you dont have to spend any extra time for the backups. Just dont delete your files until you are completely done and fully tested.

The first step is to login to the existing server with your ftp client and download all your files. I like to create a folder on my desktop and load all the blog files into it. Once you have downloaded all your files, depending on the size of your blog and number of photos this could take a while, you will want to login to your database to backup the rest of the blog. You will need to choose your database and select the export option. From there you can export the entire database as an sql file and save it. This is all you should need to do to backup all of your current blog.

Now to loading your blog onto the new server. First you will need to setup your new database. Make sure you write down your connection information such as your database name, user name and password. Some hosting also gives a specific connection address to databases such as godaddy and mediatemple (gs). Once you finish setting it up you will want to login to phpMyAdmin. Here you have two options, once is to copy and paste the entire sql file that you backed up previously into the sql page (there should be a sql tab). The other option is to select the import function and to import the file. I find that copying and pasting the sql file seems to work the best.

The following step should only need to be done ONLY if you are moving your blog to a NEW domain such as www.myoldblog.com to www.mynewblog.com or if you are changing subdomains. If you are only changing your server but maintaining the same domain name, you can skip these steps and procede to upload your files via ftp.

Anytime you add a photo to your blog, wordpress will store the address to the file with an absolute url, which means once you remove the files off your old server, all those images will no longer work in your new blog. There are also a couple other settings where wordpress stores the blog url and it will need to be changed. The first time I transfered a blog, I went through the database and changed out the urls one post at a time. Since then I have learned a better way. While logged into your database, open the sql statement window and use the following code to update find and replace every instance of the old blog url and change it to the new.

This code will update the site url and home page that is set for your blog. This must be set to the new blog domain for your wordpress to work.

UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldblogdomain.com', 'http://www.newblogdomain.com');

Next, you will want to update all the image or any file paths that you have added to your blog.

UPDATE wp_posts SET guid = replace(guid, 'http://www.oldblogdomain.com','http://www.newblogdomain.com');

Finally, the following code can update any links within your blog posts that may point to another area of your site. You may or may not want to update this code. Although I dont use many internal links, I still run this just incase I have one or two.

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldblogdomain.com', 'http://www.newblogdomain.com');

Finally as a note, their is one other area where data from your old server is stored. In the wp_postmeta table and meta_value field, the actual server path to images and files is stored. Even though your server path will most likely change when you move to a new server, you do NOT need to update this code. This is one area that can cause all of your images to display at full size and not as a thumbnail as intended. Unfortunately I found this out the hard way. Many wasted hours. I still do not fully understand the reasoning behind this, but I know that your blog images will display properly if you dont mess with these fields.

Finally you are ready to upload the files you downloaded to your destop onto the new server. Before you do this, you will need to open up the wp-config.php file and add your new database information. Once the upload is completed you should be ready to go! If you have troubles along the way or if you know why you cant change the absolute paths held in the meta_value field I would love to know why.

How To: File Checksum

Posted in Programming on January 5th, 2009 by Jason – Be the first to comment

In the past I have downloaded jquery, a javascript library, from google that I like to use when building different websites. When you go to download the file, it gives you a checksum, or value of numbers and letters, that is used to verify the integrity of a file. Usually I dont pay any attention to the checksum value because I am never too worried about it not downloading correctly but mainly because I didnt know how to use a checksum.

A quick google search turned up step by step instructions on how to verify the checksum on a Mac computer. Here is the link: http://www.bresink.de/osx/sha1.html.

Since I am running OS X.4 all of my downloads go staight to my desktop so used a slightly different process.

  1. Open Terminal
  2. Change to your Desktop (Only if file to check is on desktop) (cd Desktop)
  3. Type the following command (openssl sha1 filenamehere)

Thats all there is to it. There are a couple things you should note. First of all this is for an sha1 checksum. Usually if you download a file that has a checksum, it should be listed with the file what the encryption type used is. If it is different than sha1 you would just need to change it in step 3 to the specified encryption. Also, if your file is not located on the desktop, then like the steps in the link, you can just drag and drop into the terminal window.

Reuse your Select statements with mysql_data_seek( )

Posted in Programming on January 2nd, 2009 by Jason – Be the first to comment

This function has come in very handy with the developement of this site. You can use this function to set the data pointer to a certain row within your result that you recieve from a database function, in my case, mysql_query().

There are a couple reasons you would want to use the mysql_data_seek(). One would be to return to the first row returned from the database, or it could be used to return to any row. There are also other uses for this function but to keep it simple I will just talk about the first.

The following code is a standard mysql query created by dreamweaver.

mysql_select_db($database, $connection);
$query="SELECT * FROM tables;
$resource=mysql_query($query, $connection) or die(mysql_error());
$row_recordset= mysql_fetch_assoc($resource);
$totalRows_recordset = mysql_num_rows($resource);

When you request information from the database it is stored as a resource. You can then pull from that resource with the mysql_fetch_assoc($resource). You can also use other functions such as mysql_fetch_row($resource).

PHP handles a resource very similar to reading a file. As PHP reads from the resource, it marks its place, much like earmarking a page in a book PHP remembers the last spot that was read from the resource. When you get to the last page of the book, you turn back to page one, and when you get to the last of the resource you have to set the pointer back to the beginning.

mysql_data_seek("$resource",0);
$row_recordset=mysql_fetch_assoc($resource);

The mysql_data_seek() uses two values to accomplish this.The first value “$resource” is exactly what it says it is, the resource of your mysql select statement. The second is a numeric value of where you want to move the pointer or bookmark for that resource. The next time you get a value from the resource it will be from the new location of the pointer.

An important note if you are using dreamweaver. As you saw earlier in the code, dreamweaver initially sets $row_resource. With it initially set, you can use a do while loop so that the first instance is set and each reoccurring instance is set by the while statement. This is why after using the mysql_data_seek, I re-assigned $row_resource with the next value after the dataseek, in this case setting it back to the first value from the mysql select statement.

Guide to Paypal – Part 1: Account Setup

Posted in PayPal on October 14th, 2008 by Jason – Be the first to comment

Over the last few months the need to know how to use paypal on a basic and advanced level has come up several times so I decided to take the time to get to know paypal a little better. Although the process was “fairly” simple, there did not seem to be a real easy step by step process to follow to get things put together. At times I had at least 3 to 4 different development documents opened trying to crossreference them to see what to do. In the coming weeks I will be providing a multi part Guide on how to get going with paypal, from starting an account to implementing the final product.

read more »