Skip to main content

Posts

Showing posts from December, 2007

Dealing with spammers on forums

I've got a couple forums I help run, and dealing with spammers is a recurring problem. They either want to get an account with a link their site in their profile, or they want to active post spam in the forums - or both. There's been a bit of an upsurge in the little bastards lately, apparently they're getting through the "image verification" systems more easily now - or they're just going the sweatshop route and having humans make the accounts. Either way, it's a pain. What I've taken to doing is setting the forums so that the users must be approved before their active. With phpBB I also had to modify the code so that the user list only shows active users - for some reason it showed inactive users by default before! So even if they'd never clicked the activation link, they'd still get the url in their profile on the forum's user list. So now, when I'm going through the list of new users to be moderated, I follow these steps: Check th

Recursively deleting folders on linux

Had this problem to resolve the other day. I had a fairly deep directory structure - and at the "end" of each path, there was one empty folder to delete. Thank you dreamweaver, but I don't need a _notes folder in every directory on my site! So, rather than delete this manually from every directory - on both the live and staging server, I figured there had to be a way to do this in one command on linux. Of course, I had to be careful, since you can see all sorts of ways that this could go wrong with recursively deleting folders! First, I made backups - always key when doing something like this. I just made a quick tar in my home dir, from the root of the directory I was working on: tar -cf ~/backup.tar Then, knowing I could fairly easily restore things that went wrong, I found the command I needed to delete the offending folders. find . -name "_notes" -exec rm -rf {} \; So the key here is the find command, which looks through all the directories below the cur

phpBB 3.0 is out!

phpBB version 3.0 is now out . phpBB is one of the most popular bulletin board/forum systems out there, and is open source. I run a few forums on phpBB 2.x and I've always been happy with the ease of setting it up. My biggest complaint was a relative lack of tools built-in to help with spammers. Perhaps 3.0 will solve this! Of course, you can't convert over to 3.0 from 2.x yet, so I guess I'll be waiting a while before trying the new system.

Firebug! Go get it now!

Ok, you probably already have heard of firebug - it's a handy little extension for Firefox that is absolutely invaluable in debugging CSS. But just in case you haven't, I thought I'd mention it here. This thing has saved me days of annoying debugging over the past few months - if not more!

Handy vi tip - opening a list of files from a grep command

My primary text editor of choice is VI (actually, vim ) - a console-based text editor that I use via SSH on the various linux servers that I work with. There's also a windows version available that I use occasionally, but I'm more likely to use textpad for that work. Anyways, vim when used via a console on a linux server is really quite powerful. Here's a handy tip - suppose you're working with a large number of files nested within multiple subdirectories - and you need to edit all the files that contain a certain string. Perhaps you need to open and edit every file that uses a certain javascript file (let's call it 'example.js'). First, you can find all the files that have this string in them by using grep to search recursively for it: grep -r 'example.js' * This will return a long list of files with the text where that string was found. But what you really need is just the file names that have the string. This can be done by adding the "-l&qu

1st Post! How to remove the spacing above an unordered bullet list using CSS

This will hopefully be the first of many posts where I plan to post quick little tips to help all my fellow web developers out there in the big ol' Internet. This one is to fix what's occasionally an annoying "feature" of HTML - about a line of space is added by default between an unordered bullet list and the paragraph above it. This can look a little funny sometimes, especially if you're using the paragraph as header above the unordered list. To fix this, add two new classes to your CSS: p.ulHeader { margin-bottom: 0px; } ul.noTopMargin { margin-top: 0px; } Then you can just add those classes to the appropriate places in your code to remove that pointless spacing.