Archive for the ‘How To’ Category

The secret to getting your website featured on the frontpage of RSS2.com

New RSS2.com homepage

If you’ve ever tried to get your website featured on the front page of a site like digg, reddit, or Slashdot you might have felt frustration when you didn’t get the right number of votes to make it.

There is a site called RSS2.com that will automatically put your website’s content directly on its homepage.

How to get onto the homepage

Here are the 3 easy steps for you to take to get your website featured on the homepage of RSS2.com:

  1. Go to the site and make sure that your RSS feed is in the database. The easiest way to do this is to paste in the URL for your RSS feed into the “Read a Feed” input box at the bottom of the page.
  2. Verify that your existing site RSS feed was imported correctly. You should be forwarded to the page that shows you your feed’s page on RSS2.com if it was imported successfully. (For example, the page for this site is http://rss2.com/feeds/Gabriel)
  3. Publish a new item on your website. RSS feeds are updated every 5 minutes so you should only have to wait for a minute or two. Refresh your feed page until you see your new item appear. Now check the homepage. Your new item should be at the top of the list, and will remain until 9 newer items are published by other people in their RSS feeds.

Bonus tip #1 - how to get into the top 30 feeds list

If you want to make it into the top 30 feed list (featured at the top of every page), all you have to do is tell people about your RSS2.com page that features your feed and increase your view count. The easiest way to do this is to use the RSS feed stats widget at the bottom of your feed page (copy and paste the HTML into your blog sidebar or another HTML page) — note that your site must allow <script> tags to enable the live updates of your RSS2.com feed stats information. You can also promote yourself to the top 30 by linking to your feed page in your blog roll and by sending the link to your friends.

Bonus tip #2 - Pretty site icon

To have your site icon show up nicely in the all feeds page and in the explore lists make sure you have a favicon installed for your website. RSS2.com will look for that and use it for your site icon. If it doesn’t find one, it will use a generic one that doesn’t set your site apart from any of the other ones. See the Wikipedia entry on favicons for how to get one installed for your site if you don’t already have one.

So, 3 easy steps to get your website content promoted on the RSS2.com website.

Try it for yourself: Submit your site to RSS2.com

(P.S. It usually accepts most Atom feeds as well as RSS feeds.)

Popularity: 4% [?]

bash script to copy all files in a directory and convert uppercase characters to lowercase

So, I recently found out that the version of PHPList that we were using on a client site (2.10.2) had a nasty bug in it where it would convert all URLs in a text version of an email message to lowercase. This bug is fixed in the latest version (2.10.3) but it left a number of subscribers complaining that the links in their email were broken.

I wrote this handy bash script to fix those links for emails that had already been sent out.

To use this script, follow these steps on your server command line. This is a bash script.

First, copy this code to your clipboard:


#!/bin/sh

# This script takes the contents of a directory and will make a copy
# of every file converting any uppercase characters to lowercase
# (Useful because PHPList had a bug where it converted URLs to
# lowercase in text-only mailing list messages and the links were
# therefore broken. This script will enable those links to work.)

for file in *
do
if [ -f "$file" ]; then
filelower=`echo $file | tr “[:upper:]” “[:lower:]“`
if [ -f "$filelower" ]; then
echo “You are trying to copy a file that has the same name as an existing file.”
echo “$filelower file was NOT copied.”
echo “”
else
if [ -d "filelower" ]; then
echo “You are trying to copy a file that has the same name as an existing directory - $filelower”
echo “$filelower file was NOT copied.”
echo “”
else
# not a file or directory. make a copy of the file
cp “$file” “$filelower”
fi
fi
fi
done

Next, you are going to create a bash script file.

$ vi cp_files_to_lowercase.sh

Press i and then paste in the code.

Press ESC then :wq to write the file and quit vi.

Next you are going to set the executable permission on the file.

$ chmod 700 cp_files_to_lowercase.sh

Next, change directory to the place you want to run the script on. In this case, we’ll change to the images directory.

$ cd images/

Let’s see what’s in the directory currently:

$ ls

$ Image1.jpg IMAGE2.jpg image3.jpg

Now run the script.

$ ../cp_files_to_lowercase.sh

The script will make a copy of any file that has an uppercase character in it and name it the same thing except all lowercase. It will tell you if the file already exists as a completely lowercase file (it won’t copy a file onto itself).

Now let’s see what it did:

$ ls

$ Image1.jpg image1.jpg IMAGE2.jpg image2.jpg image3.jpg

Now any URLs should work and any previous text-version emails that were sent out using the old version of PHPList should now have working links again.

DISCLAIMER: This script will copy files on your server. I am not responsible for any problems that this causes. I’ve tested this on my server, but you’d be wise to test what will happen first. If you add an echo in front of the cp command in the script you will see displayed what it would do without actually doing it.

Popularity: 8% [?]

Unix command line tip of the day: How to recursively add all newly added files to Subversion in an existing working copy

When using Subversion for version control, if you have a working copy checked out and then you want to add a variety of new files and directories to the existing ones, you might do something like this:

[code]cp -R newfiles/* files/[/code]

Unfortunately, svn add only will add files or directories in the immediate directory unless you explicitly specify each new file or directory to add when you are adding to directories that already exist.

This means that if there is a directory called images in both files and newfiles that is already under version control, and inside of newfiles/images/ is a new directory called icons, running svn add * from within the files directory will NOT recursively add it as you might hope it would.

Here is a one-line command-line way to find all new / unknown files using Subversion’s status command and recursively add all of the found files to your current working copy, ready to commit.

[code]svn st | grep ? | sed ’s/^?[\t]*//;’ | xargs svn add[/code]

This runs Subversion status, then filters the resulting list using grep to find only entries with a ? in front of them (unknown files), then pipes the resulting list through sed to remove the question mark and the leading space, then pipes the resulting set of files / directories into Subversion add using xargs, which operates on each supplied line.

Popularity: 2% [?]

Fix for PHP PEAR on OS X 100% CPU problem

I was rebuilding PHP 5.1.4 for my G4 PowerBook to use with Apache 2.2.2 and MySQL 5.* when I ran into this problem using PEAR:

When I would run a command like:

pear install Log

PEAR would download the package, indicate that it was done, and then hang, consuming 100% of the CPU and never do anything more.

I finally tracked down that this seems to be a problem with PHP uncompressing the file (a .tgz). I’m not entirely sure WHY PHP is having this problem, but I did find a workaround solution:

Instead of this:

pear install Log

Run this:

pear install -Z Log

This requests just the .tar version of the file, which is larger, but doesn’t require the .tgz uncompression. Once I used that command, PEAR worked like it used to (just fine, super quick, actually works, etc…)

P.S. This is the ./configure command that I used to compile PHP:

./configure –with-apxs2=/usr/local/apache2/bin/apxs –with-mysql –with-gd –with-libjpeg=/sw –with-libtiff=/sw –with-mysql=/usr/local/mysql –with-mcrypt –enable-soap –with-curl –enable-trans-sid –enable-ftp –with-ldap –enable-exif –with-mhash –with-openssl –with-zlib –with-ttf –enable-gd-native-ttf –with-zlib-dir=/usr/local/lib/ –with-png-dir=/usr/local/lib/ –with-bz2

I’m not sure if this is an issue with how I compiled PHP, or OS X Tiger, or zlib, or what. I’m glad to have a working PEAR again though even if it isn’t quite as efficient as it would be otherwise.

Popularity: 2% [?]

How-to: Run the Mac OS 9 (Classic) version of Concord on a new Mac OS X (Intel) Macbook

The one biggest application that my mom wanted to have running on her shiny new Macbook was Concord. A program that the publisher has not updated in many years. And that, for Macintosh, assuming you already have a copy, will not run under the new OS X Intel version, since Apple really wants OS 9 (Classic) to die.

This is how I got it to run without installing Windows and the Windows version of Concord. Note that this may or may not work for you.

  1. Download the latest version of Basilisk II (Universal Binary)
  2. Download an old Macintosh ROM file. These can be tricky to find. I got the 1mbMacrom.zip one from here. You are looking for a Quadra or Performa ROM.
  3. Download the free and legal 4.3MB Macintosh OS 7.5.3 Starter Disk from here
  4. Use Stuffit Expander to expand it. It will then have a .hfv extension. Change the extension from .hfv to .dmg. You can then open this in the Finder.
  5. Create a Mac OS Standard format disk image using Disk Utilities application. I made mine 200MB and called it Classic Drive. Save it into a location you’ll be able to find later.
  6. Copy your copy of Concord into a folder in your new disk image.
  7. Delete any old preferences and Notebooks from the copy of Concord that you will be running. (It was crashing for me before I did that).
  8. Copy the Basilisk II into your Applications folder
  9. Run the BasiliskIIGUI.app application to configure Basilisk.
  10. Select the location of the ROM file under the Memory/Misc tab, select Quadra 900 in the drop down and give it a good amount of memory (I set it to 128MB). CPU Type was set to 68040.
  11. Set Graphics/Sound Width to 800 and Height to 600
  12. Click Add… on the Volumes tab and select the Starterdisk.dmg image. Also click Add… again to add the Classic Drive image.
  13. Under JIT Compiler, click Enable JIT Compiler.
  14. Click Start
  15. You should see OS 7.5.5 start up (quickly) and the be presented with a VERY old-school Mac OS desktop. You really really want Concord, remember?
  16. Navigate to Classic Drive > Concord, then double-click on it to open. Hopefully you should see it open.
  17. Create an alias for Concord, then add it to the System Folder > Startup Items folder.
  18. Create an alias for BasiliskII.app and give it the Concord icon. Drag this alias into the Dock.
  19. Now, to run Concord, all you have to do is click once on the Dock icon for it.

This is somewhat of a “hack” in that you are emulating the old Motorola 68040 chip to run a really old program. I’m not sure how printing will work or if it will. That will have to be explored another time.

Incidentally, this loads much quicker than loading OS 9.2.2 does under Classic mode on a PowerPC Powerbook. Lots less that is being loaded, but it really feels snappy. Of course, going back to OS 7.5.5 style menus where you have to keep on clicking in order to scroll down in them is a bit of a pain.

References:

  • Basilisk II - Motorola 68000 chip emulator - works like a champ once you figure out what all you need.
  • Sheepshaver - PowerPC emulator. I wasn’t able to get this to work since I didn’t have the OS 8.6 installer disk.
  • MacOSHints.com article about running Classic apps on Intel Macs
  • Old Computer ROMS - where I finally found a working download for an old Macintosh ROM. I owned a Quadra, so I feel pretty OK about pulling the ROM down for this purpose.

Popularity: 6% [?]

How-to: Get your Treo 700p EXIF tags to show up in Flickr

Flickr picture taken on a Treo 700p

If you use Picture Mail or Versamail to email your pictures to Flickr (using the upload via email trick) then the EXIF tags are stripped out of the jpegs that you send.

If, however, you upload your pictures using a Flickr uploading tool from your computer after syncing your Treo 700p, then the proper EXIF tags will be preserved and will be displayed by Flickr. Neat huh.

Here are the pics I’ve taken so far with my new phone:

Pictures taken with a Treo 700p

By the way, if you are using Mac OS X, the pictures are stored in ~/Pictures/Palm Photos/username/Internal/album name. I just drop them into iPhoto (not using iSync… yet) then use the Flickr Export from iPhoto to send to my Flickr account.

I really like the convenience of having a camera in my pocket at all times. The fact that I can instantly publish pictures to both Flickr and my own blog is pretty fantastic.

Popularity: 2% [?]

How to activate the $Id:$ keyword on files in an existing Subversion repository

This is a quick update to my earlier post about using svn keywords:

If you have a Subversion repository already full of files, and you want to activate the $Id:$ keyword on all of them so it expands out to something like:


$Id: index.php 783 2006-04-27 06:05:24Z gserafini $

whenever you check in the file, then use this command:


find . \! -name "*\.svn*" -name "*.php" -exec svn propset svn:keywords "Id" {} \;

This finds all *.php files that are NOT in .svn directories and sets the svn keyword property on each file.

Substitute other filename extensions for the .php that you want to activate the keyword expansion on. Then commit the files and the next time you make a change it will update the $Id:$ tag.

Popularity: 2% [?]

Cleaning out WPMU Splogger spammers like the friendly folk @uk-search-guide.co.uk and internet-guider.co.uk

The friendly folk who own the uk-search-guide.co.uk and internet-guider.co.uk domains are spammers who’ve been registering on one of my Wordpress Multi-User installations and creating automated splogs (spam blogs).

I just deleted over 300 of their sites. They are like kudzu.

Things that might help if your site is getting spammed by someone like this:

  1. Block the IPs that they are using. In this case, they have been using 3 IP addresses:

    202.47.247.116
    217.160.171.20
    202.47.247.138

    I blocked them using cPanel’s IP Block manager function, but you could also do it with an Apache .htaccess file.

  2. Delete all the spam blogs that have been created. Go to Site Admin > Blogs to delete them.
  3. Delete all the users that now have no blogs associated and that have the common spammer email address.

You have to kill splogs dead. This is a major issue for people who run Wordpress MU installations.

Popularity: 2% [?]

Blog-o-Matic Developers Blog - How to: Fix your WPMU .htaccess file to enable comments and images (problems with the wpmu-2005-11-25 nightly build)

Cross-posting this. Oh yeah, and I’m on the dev team at Blog-o-Matic. And our new homepage is up. If you want to help us test the system (we’ve been wrestling with the gnarly WordPress MU unstable nightlies (fun fun fun, can you say RewriteRules :) )) then please feel free to sign up and give it a whirl.

Free blog signup: http://blog-o-matic.com/

Blog-o-Matic Developers Blog - How to: Fix your WPMU .htaccess file to enable comments and images (problems with the wpmu-2005-11-25 nightly build)

So, We fixed both comments and images. It was a problem with the included htaccess.dist file.

This HOWTO assumes that you:

1. Have successfully installed the latest nightly build of WPMU (as of this writing, the wpmu-2005-11-25 nightly build)
2. Have installed using the Virtual Hosts option and can create new blogs, enter posts, etc…
3. Don’t have comments or images working correctly

Here are the steps to fix this in the current nightly build of WPMU:

Popularity: 3% [?]

How to make form labels work for images in IE and Safari

You already use <label> tags for your forms, right? This is the great little bit of HTML that allows you to click on a text label instead of directly on a form control to select. It always pisses me off when designers don’t put them in since it makes forms much easier to interact with.

So, you may have tried to wrap a <label> around an image, like so:

Try clicking on the picture to select the radio box in IE or Safari: (works in Firefox, Opera, NOT in IE or Safari)

[code]

[/code]

You were probably expecting it to behave like it does when you wrap it around just text. This works as expected in Firefox and Opera (producing an effect as if you had just clicked the radio button or checkbox) but doesn’t work in IE or Safari.

The solution to make everything within your <label> activate the radio button is a simple small bit of additional javascript to add to your <label>, where radio3 is the same ID as the element you want to activate:

[code]
onclick=”document.getElementById(’radio3′).click();”
[/code]

Now try clicking on the picture to select the radio box in IE or Safari: (works in all browsers)

[code]

[/code]

This allows you to use images in your forms to click on to select a radio button, and works in Firefox, IE, Safari, Flock, Opera.

Feedback is welcome!

Popularity: 1% [?]