Cyprich.com

Occasionally Relevant Insights from a Software Builder

By

Make Your Own Text Link Ads

I recently read a post on John Chow dot Com on a plugin for WordPress to sell your own text link ads without using the Text Link Ads service. I eventually want to use Text Link Ads, but I need to get more reciprocal links on other blogs before I’m accepted into their program. I have many more links on other web sites, but they only count links on blogs. I would imagine they check your link popularity on Technorati.

I’m determined to sell text link ads on my web sites, so until I qualify for the Text Link Ads service, I’ll make my own ads.

You can build text ads using the WP Text Ads plugin by Alex Choo. It comes in two versions. The free one supports a limited number of ads that can be placed on your site, and the $127 one gives you unlimited ads.

I really don’t want buy WP Text Ads to create these types of ads because I can create my own by modifying the PHP code in WordPress. The example I’ll use is for WordPress but you can use the same source code in any PHP blog or web site.

I added the ads in the sidebar of my blog. You can view the sidebar source code by logging into your blog as the administrator. Go to the Presentation tab and then go to Theme Editor. On the right side, you will see the pages that your theme is using. Select Sidebar and the source code will be displayed for editing.

Now you need to decide where you want to place your text ads. Your ads will be placed after the following PHP code:

<div id=”sidebar”>
<div align=”center”>

If you don’t know PHP, you can still find a position in the sidebar for your ads by entering the following bit of code.

<h1>test</h1>

The text, test, will appear in a large font in the sidebar. Test it in various places until you find the location where you want to place your ads.

After you’ve picked a spot, enter the following code:

<h2><?php _e(‘Featured Sites’); ?></h2>
<ul>
<li><a href=”
http://www.cyprich.com/featuredsites/seobook/”>SEO Book</a></li>
<li><a href=”
http://www.cyprich.com/featuredsites/1and1/”>Cheap Web Hosting</a></li>
<li><a href=”
http://www.cyprich.com/featuredsites/babytv/”>Baby TV</a></li>

<br/>
<a href=”
http://www.cyprich.com/advertise/”>Advertise Here</a>
</ul>

The text link ads will look like:

You can edit Feature Sites to any text you want, along with the Advertise Here text. The first two links, SEO Book and Cheap Web Hosting, are affiliate programs that I have joined. These affiliates gave me a URL which links to my account on their web site. I wanted to hide the URL, so I created a subfolder in my web site called featuredsites and each text ad has its own subfolder with a page linking to my account on the affiliate site. You can learn how to do this by reading Hiding Affiliate Links on my blog. If you don’t want to hide your links, you can use the URL given to you by your affiliate.

You add your links between the <ul></ul> tags with <li></li>. The href points to the URL for your affiliate, and the text before the </a> is what appears as the text link ad on your site.

As a side note, Baby TV isn’t an affiliate but after seeing it on John Chow dot Com, I thought it might be a good idea to share with other parents of babies.

Make sure that you create a Advertise page for the Advertise Here link. The Advertise Here link goes to a page on my blog which is a sales pitch page that gives excellent reasons why people should purchase advertising from me. 🙂

The procedure here for making your text link ads may seem complicated for the non-programmer, but it really isn’t. I recommend you first back up your blog by downloading it by FTP to your hard drive before making these changes, or test it on another theme that you’ve installed.

By

Moving the My Documents Folder

Windows applications by default save files to the My Documents folder on drive C: This is where many people store all of their documents. The problem with this folder is that it’s on the same drive where Windows is normally installed.

It’s not a good idea to store data files on drive C:. If your computer crashes and you have to reformat the drive, this will destroy all of your data in My Documents. Another problem is that the size of your data may be getting larger and larger and you’ll run out of disk space sooner. Many Windows programs use drive C: to store temporary files and they might create very large files for their work space.

Fragmentation is a serious issue with storing data files on the Windows drive. You will cause worse fragmenting of the hard drive if you save and delete large files. It’s better saving your data on another drive, preferably a dedicated data drive.

This can easily be done by saving your files to another drive when prompted to do so. However, most people will just save it to the first folder that appears in the save dialog box which happens to be My Documents.

You can move the My Documents folder to another drive with the following steps.

  1. Right click on the My Documents folder. You can find it either on the desktop or in the Start menu (note: this won’t work in the classic Start menu).
  2. Select Properties.
  3. Press the Move button.
  4. Select a drive where you want to create the folder, and press the Make New Folder button to create a folder called My Documents.
  5. Press the OK button.
  6. Press the OK button again in the My Documents Properties dialog box.
  7. You will get another dialog box asking if you like to move the contents of the current My Documents folder to it’s new location. Press the Yes button if you want to copy them.

That’s it! Your My Documents folder is now in a safer place. Make sure you defrag your drive C: and also defrag the drive you copied your My Documents to as well.

By

Windows Live Writer

I’m always looking for better ways to do things and I’ve spent some time thinking about how I can make blog posts an easier task. It’s not really a difficult thing to do, but the editor that comes with WordPress really isn’t that great. Web-based editors tend to be slow and sluggish.

I did a Google search for a WordPress client and found a large number of blog editors available for Windows. After trying a few of them, I decided to use Microsoft’s product, Windows Live Writer. The software is in beta still but I haven’t experienced any problems with it, other than it crashing a few times but I’m running Windows so these things are to be expected. 🙂

Windows Live Writer can post directly to Windows Live Spaces or to any blog that uses Really Simple Discovery, the Metaweblog API, and the Movable Type API. This allows it to work with Blogger, LiveJournal, TypePad, and WordPress.

The advantage of posting to your blog with this application as opposed to using your blog’s web-based editor is speed. The editor is very responsive and you can easily add links, pictures, or maps from Microsoft Virtual Earth. The pictures can be uploaded to a specific folder in your blog by FTP. I like this feature because I place images by the month and year of the blog post.

You can switch to HTML view by pressing the F12 key, and switch back to editor view by pressing F11. I normally edit the HTML to add the Google Adsense code after the first paragraph. A preview of how the blog will actually look in your web site can also be seen.

Windows Live Writer has the standard functions that are typical with editors, such as making text bold, changing colour, and making bullets. Of course, there is a spell checker for peeple whu haf trubel speling. A grammar checker would be nice, but you can always drop your blog post into Microsoft Word for that.

I recommend this program for people who want to become probloggers. You will probably make more posts with this software because it’s just a matter of typing your text and pressing the Publish button.

You can download Windows Live Writer at windowslivewriter.spaces.live.com.

By

Deprecating Functions in Visual C++ 2005

I was recently trying to modify an open source FTP client in Visual C++ 2005. The software was written for an earlier version of VC++ so it had to be imported into the 2005 version. The import process generated hundreds of warnings of deprecated functions. This is not really something you want to see when compiling a program.

The warnings were the result of Microsoft deprecating many standard C functions. The complete list can be found on MSDN. These functions are being removed due to security concerns that Microsoft has. The new function has “_s” appended to it’s name, for example, printf becomes printf_s.

One might think that all you have to do is a global search and replace throughout your project to change the function names, but this won’t work. The updated functions have different parameter lists and return types.

So you can spend hours or days manually updating all of your code, or you can tell the compiler to use the deprecated functions instead. This can be done by placing the following at the start of your program:

#define _CRT_SECURE_NO_DEPRECATE

Keep in mind that this is a temporary solution. There may come a time when Microsoft removes these deprecated functions completely but at least you have time to gradually update the functions to their more secure counterparts.

By

Hiding Affiliate Links

There may be certain situations when you need to hide a URL on your web site. This is useful, for example, in changing the display URL for affiliate links. While there are several good techniques for accomplishing this, I prefer using the refresh metatag to redirect users entering that page to another location.

This is how it works. When you open a URL, such as www.cyprich.com, it will automatically look for a page called index.htm, index.html, or index.php (if you have PHP installed on your web server). An ASP.NET server will try to open a page called index.asp, index.aspx, or Default.aspx. These default pages can be defined by the web server settings for that URL.

The defaults also work for subfolders. For example, if you open www.cyprich.com/richmond/ and there is a file called index.php in that folder, it would be opened just as if you would had entered www.cyprich.com/richmond/index.php.

You can redirect a user that opens a web page with the refresh metatag as the following example shows.

====[ index.php ]===============

<html>

<head>
<meta http-equiv=”refresh” content=”0; url=http://www.advertiser.com/id=57912″>
</head>

<body>
</body>

</html>

=============================

So now when someone moves the mouse over the linked ad, they will see http://www.cyprich.com/richmond/ and when they click on it, they will be directed to www.advertiser.com/id=57912.

This technique for hiding affiliate links is very easy to do because all you have to do is define the url in the refresh tag. However, in order to hide links this way you need to be able to log into your web site by FTP or SSH and create these subfolders. I’m not sure if you can do this sort of thing in Blogger or similar sites.