Friday, April 29, 2005

firefox config

To go along with my favorite mozilla/firefox extensions I'm documenting all the about:config stuff I like to change in my setup
accessibility.tabfocus 3
allows you to tab around buttons and checkboxes, not just text areas
network.cookie.alwaysAcceptSessionCookies true
network.cookie.cookieBehavior 2 (this was 1 (allow) but now I use Permit Cookies)
network.cookie.lifetimePolicy 1
you can store session cookies, but I'll ask about cookies that'll get saved to disk
view_source.wrap_long_lines true
keyword.enabled false
this feature sucks
browser.xul.error_pages.enabled true
reduces number of popups with dns or connection problems
fyr.urlpattern http://www.google.com/reader/preview/*/feed/@URL@
preview feeds in Feed Your Reader so you can subscribe.
browser.dom.window.dump.enabled true
javascript.options.showInConsole true
allow dump() in javascript to output to mozilal console (You'll need to MAKE these boolean keys)

mozex.general.tmpdir /home/ark/tmp/mozex
where does mozex save it's tmp stuff
mozex.command.textarea /home/ark/bin/share/editor %t
What command to use to edit text areas
mozex.command.source /home/ark/bin/share/editor %t
What command to use with view source
adblock.patterns
*yimg.com/a/* *pointroll.com* *doubleclick.net* *adlegend.com* *unicast.com* *atdmt.com* *ingdirect.com/*.swf* *wunderground.com/ads/* http://images.citypages.com/*banner* *247realmedia.com* http://img.fark.com/images/*/totalfark/* http://sportsbybrooks.com/farkbutton.gif *adview.php* http://img.fark.com/images/*/125x125/* http://img.fark.com/*/ads/* http://img.fark.com/images/com000.jpg http://www.bullz-eye.com/pictureofday/* *adimage.php* *fastclick.net* *m7z.net* *pro-market.net* */ads/* *2o7.net* http://ads.* *ru4.com* *advertising.com* *falkag.net* *towerad* */banners/pdp/* http://www.engadget.com/common/media/*.swf *mediaplex.com* *tiser.com* *serving-sys.com* */house_ads/* *w3schools.com/banners/*

Saturday, April 23, 2005

mkhtpasswd

I run a website and some mailman lists. I wanted to create some areas that only members of certains lists can get at. I'd like to use mailman's password management to look after users rather than have them look after multiple usernames and passwords. I know mailman keeps passwords in plain text so I dug around in the code and created a script that takes the users/passwords for a list and creates a .htaccess and .htpassword file for them.

Just run this with a listname and the directory you want to protect and you're all done!

Stay tuned for some fancy redirection error document magic to link people to the right page in mailman for them to find and set their passwords.


NOTE: this needs some work, it doesn't update if someone updated their password (doh!)

Thursday, April 14, 2005

Debugging Javascript

So you're used to using alert to debug your javascript. STOP IT! it's
totally lame

Rather than use alert, try a dump instead

dump("Hello World\n");

will print "Hello World" to the console that firefox/mozilla was
launched from (who cares what IE does)

you should set the mozilla config variable (use about:config)
javascript.options.showInConsole to true
and add a new boolean config variable (also set to true)
browser.dom.window.dump.enabled

see:
http://kb.mozillazine.org/Dev_:_Javascript_variables

This really helps in loops and the like when you'd have to close a gazillion alert popups.

-- or --

if you're a greasemonkey user you can use GM_log(message, level) which pops up in the javascript console (along with all your javascript errros) which is really nice

-- or --

just put a little bit of HTML in your page as you debug like this...

<form><textarea style="width: 100%;" rows="25" id="'debug'"></textarea></form>

and add this to your javascript...

/** updates a textarea if there is one - much better than alert */
function debug(msg) {
var ta = document.getElementById('debug');
if (ta) {
ta.value = msg +"\n" + ta.value;
}
}