Archive for the ‘How To’ Category

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: 2% [?]

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% [?]

Logged in as . Logout - WordPress Support forum saves the day.

So… I was having a brutal bug with WordPress seeming to think that I was logged in when I wasn’t. I tried everything I could think of, turning off all plugins, trying different themes, looking at various database settings. Then, of course, I finally had to just Google what I was looking for. And lo and behold, the exact answer to the problem:

Logged in as . Logout — WordPress Support

Logged in as . Logout

try checking your user list to see if you have a blank user added somehow?

That was the answer. I had a blank user in the Users list somehow. I gave the user a user name, then demoted to level 0 so that I could delete.

And now, you can actually comment, sign in and also use the live search functionality on Ajax Blog now! :) :) :)

Popularity: 2% [?]

Better javascript debugging through logging

Here’s a more advanced method of doing javascript logging than the javascript debugging technique I suggested before. Check it out! :)

This article will introduce fvlogger (available for download here), a library that brings simple logging functionality to JavaScript and the browser.

Logging in JavaScript with fvlogger

Whereas logging packages in the languages listed above provide a complex class/package structure built on top of inheritance and other object-oriented concepts, fvlogger borrows concepts from Log4J and its cousins, but eschews their complexity by providing a simple API and offloading the heavy lifting onto the DOM.

The library defines four basic functions (and provides a few others that can be considered optional), a few flags that can be set to define its behaviour, and several CSS classes that can be used to govern how the log will appear. It requires just one special element to be placed in the document, and including fvlogger in your pages is as easy as adding the following two lines to the head of your documents:

<script type="text/javascript" src="/fvlogger/logger.js" />
<link rel="stylesheet" type="text/css" href="/fvlogger/logger.css" />

Essentially, all fvlogger does is append new elements to a specific element in the document. These new elements contain the logging messages that will assist you in debugging your script(s). The four functions used to create the log messages are: debug(msg), info(msg), warn(msg), and error(msg). Each function expects a single string that will be appended to the document.

Read article: A List Apart: Articles: JavaScript Logging

Popularity: 1% [?]

svn keyword Id expansion

svn propset svn:keywords "Id" * will set the Id property to expand in your source code on everything. Coupled with a little find action and you’ve got a whomper of a property setting command.

Properties

svn:keywords

Subversion has the ability to substitute keywords%u2014pieces of useful, dynamic information about a versioned file%u2014into the contents of the file itself. Keywords generally describe information about the last time the file was known to be modified. Because this information changes each time the file changes, and more importantly, just after the file changes, it is a hassle for any process except the version control system to keep the data completely up-to-date. Left to human authors, the information would inevitably grow stale.

For example, say you have a document in which you would like to display the last date on which it was modified. You could burden every author of that document to, just before committing their changes, also tweak the part of the document that describes when it was last changed. But sooner or later, someone would forget to do that. Instead simply ask Subversion to perform keyword substitution on the LastChangedDate keyword. You control where the keyword is inserted into your document by placing a keyword anchor at the desired location in the file. This anchor is just a string of text formatted as $KeywordName$.

All keywords are case-sensitive where they appear as anchors in files: you must use the correct capitalization in order for the keyword to be expanded. You should consider the value of the svn:keywords property to be case-sensitive too%u2014certain keyword names will be recognized regardless of case, but this behaviour is deprecated.

Subversion defines the list of keywords available for substitution. That list contains the following five keywords, some of which have aliases that you can also use:

Popularity: 2% [?]

Fix for WordPress database error: [Can't open file: 'wp_stattraq.MYI'. (errno: 145)]

Having this problem or one like it?

WordPress database error: [Can't open file: 'wp_stattraq.MYI'. (errno: 145)]

In case you’re wondering how to fix this situation, just go to your MySQL control panel (in my case, a cPanel), click on MySQL then on the Repair button next to the database’s name. Has worked like a charm for me on a number of sites where the database had gotten corrupted.

Popularity: 1% [?]

Applescript to automate process of recording Real Player .ram to .mp3 on Mac OS X and putting into iTunes (for Christian Science Bible Lesson podcast)

You may recall that I had shared instructions before about how to record the weekly Christian Science Bible Lesson using Real Player, Audio Recorder and Soundflower.

Well, after one more time of forgetting to hit the Audio Recorder Stop button after the Real Player was finished streaming the file, ending up with a 37 minute long recording, comprising approximately 9 minutes of silence at the end, I decided to finally do something about it. This application is the result of that frustration.

This application still requires that you have Soundflower, Real Player and Audio Recorder correctly installed. Click on the link above if you don’t have them yet. Once you’ve installed them, you can download and run the scripts below to automatically record this week’s lesson.

This script automates the previously manual process of:

  1. Change System Preferences > Sound > Input and Output to Soundflower (2ch)
  2. Open Real Player
  3. Open Audio Recorder
  4. Open Bible Lesson URL in Real Player
  5. Click Record button in Audio Recorder
  6. Click Stop button in Audio Recorder after the file finishes (~28:31)
  7. Drag timestamped .mp3 file into iTunes
  8. Quit Real Player
  9. Quit Audio Recorder
  10. Change Sound Preferences back to something that I can actually listen to
  11. Delete original .mp3 file
  12. Get info on file in iTunes
  13. Add Artist, Composer, Title, Album, Genre and Comments
  14. Optionally play in iTunes

This script automates ALL of that. So, without further ado, here it is to download, use and modify if you wish, licensed under Creative Commons. Open Source, free for you to take, modify and use as you like, as long as it is not for commercial uses and you give attribution to me as the original author. Thanks!

Download the script

Click here to download Bible_Lesson_to_MP3_Recorder_Script_1.6.dmg

There are two versions of the script in the .dmg file. The Quiet Version simply has all dialogs turned off. It runs the script without prompting you for any input. It is particularly suited to using with a cron script (example: open Bible_Lesson_to_MP3_Recorder_Script_1.6_quiet.app). The other one has fancy dialog scripts to walk you through the process, also have bonus voice promts. Weeeeee!

The final results of both versions are the same: A 28:50 long mp3 recording sitting in your iTunes, waiting to be listned to and added to your iPod the next time you sync.

Thanks to all the Applescripters on the net who helped me figure things out, particularly how to talk to Real Player using the window 0 identifier.

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.

AppleScript source code:

Click here to view HTML color coded Applescript

Feel free to add any suggestions or comments below.

Popularity: 2% [?]

HOWTO: Connect Mac OS X Panther laptop to Canon MP390 multi-function printer

My brother was having problems hooking up his Powerbook to a Canon MP390 multi-function printer/scanner/fax. Here is his write-up about how to successfully print to this (PC-only) printer:

So I have a Powerbook OS 10.3.8 and I needed to print a word document and my roommate only has a Canon MP390 which only works for PC’s. Not happy with this answer, I decided to check all printers that might be similar on the network. I was happy to see that their was a printer that prints pretty darn well.

Here is how I got there.

  1. Open your MS Word document
  2. Apple P
  3. Click on the Printer Scroll Button
  4. Edit Printer List….
  5. Add Printer
  6. Find your server and choose it
  7. Choose what ever printer you have or if you can click on Printer Model
  8. Choose CANON
  9. Find: CANON BJC 7000, CUPS+Gimp-Print v4.2.5 and add it

Now, you have a printer that is very close to the MP390 and it has worked just as well for me, printing color just fine.

Hope you find this helpful

Andysan

You can check his site at Botzo.com

Popularity: 2% [?]