Archive for April, 2004

Free Music from iTunes

Wednesday, April 28th, 2004

Ever since I’ve been buying my music from iTunes (and not Buymusic, because they suck) - I’ve been very happy. (I know in the past I had mentioned trying out Napster - but in the end, iTunes won out.)

In any case - if you haven’t yet started using iTunes - this week is a good week to start. In honor of their Anniversary - they’re giving out a new free song each day this week. And no “no-namers”, either. Today’s free download is a Foo Fighters song.

FYI - Another reason why I like iTunes - is the ability for garage bands to upload and sell their music. (I know someone who did this recently)

CSS Help Pile

Monday, April 26th, 2004

Another good bookmark found by Jennifer’s ETC. blog here:

CSS Help Pile

pMachine to MT, Multiple blogs on one page, another (php) 404 handler

Monday, April 26th, 2004

Some great tutorials over at Lynda’s at So Very Posh:
pMachine to MT import script
Combining multiple blogs on one index page

As well, Bryan from RevloltingDigits.com expanded on my php 404 handling script - including adding a traceroute. Here’s where you can find his version

CSS: Mac IE issues

Thursday, April 22nd, 2004

I’m not sure that “Lessons Learned” is the most appropriate category for this, as all I’ve really learned from this little exercise is that IE on the Mac SUCKS.

1) When testing changes to a stylesheet on the Mac - I can’t just hit refresh and have it load in the new/revised stylesheet. I have to actually QUIT IE completely (not just close all browsers - actually QUIT the program) then open it again - and THEN it will load the new stylesheet

2) That little trick they talk about with doing CSS forms - making an outer “row” div - and then two inline “label” and “formw” spans inside. This will only work in Mac IE (and sit all on one line) if I add an extra unlabeled, unstyled div… so instead of this:

<div class=”row”>
<span class=”label”>First Name</span>
<span class=”formw”><input type=”text” name=”First_Name”></span>
</div>

I have to do this:

<div class=”row”><div>
<span class=”label”>First Name</span>
<span class=”formw”><input type=”text” name=”First_Name”></span>
</div></div>

UPDATE: HERE IS A BETTER WAY!!! - I’ll leave all the above up here too, if for no other reason than just because it’s interesting that this works also - but ideally, less code is better. I previously left a comment in this post that I would try it - and I did - and this new link has a solution that’s better than mine. :D (found via the CSS Help Pile.)

3) In addition to the above, if that last </span> and the two </div></div> are on the same line - it gets messed up again. So if that last line looks like this:

…etc. etc….</span></div></div>

it’ll get messed up. So it has to look like this:

…etc. etc….</span>
</div></div>

4) I also ran into a really weird problem with links completely disappering (on Mac IE only) when you hovered over them. I’m not talking like you hover, it turns to white, then you hover off, and it comes back. I’m talking about you hover over it, and then it’s gone… and the only way to make it reappear on the page was to refresh. I DID fix this - but I’m not sure how. I have a suspicion that it had to do with too many nested divs styled with IDs instead of CLASSes. But I’m not sure. All I know is that I changed many of the styles to use CLASSes and it went away.

Again - like I said - I think the only thing I’m sure of here is that Mac IE REALLY sucks. I’ve only been doing my layouts in CSS for a few weeks now - and already I see a trend. Every browser is happy - pages validate - but Mac IE kicks the bucket.

ASP: 404 handling

Wednesday, April 21st, 2004

I recently published a new site (in ASP), and took down the old pages. Some of them had been updated (with new page names) - others were simply going away. Just as I had done with PHP - I wanted a simple 404 page (in ASP) that would email me when people tried to hit the old pages. That way I could decide if I wanted to set up a redirect for some pages - but in all cases, I didn’t want to show a 404 - (I’d just send them back to the home page). I was only interested in htm, htmls, and asp type pages (not interested in missing .ico or gifs)… so here’s the script I came up with for my custom 404 page:

(That long explanation was basically to give you the idea that there’s probably better/other ways to do this - but I had a specific goal in mind. You’re welcome to post alternate, more elaborate methods in the comments. Just thought I’d give you the background first. I should also note that I am NOT anything even CLOSE to an expert on ASP. I only need to use it occasionaly, and I fumble my way through it the best I can - usually, very ungracefully.)
(more…)

CSS: Forms

Wednesday, April 21st, 2004

I’ve already seen this article, but needed it today when converting a table based form to a CSS based form - A List Apart: Practical CSS

Here’s another link about styling web forms: Sitepoint - Style Web Forms Using CSS

User Editable Comments

Thursday, April 15th, 2004

I can’t tell you how many times I’ve left a comment on a blog, and even though I had previewed it, noticed about ten spelling errors just as soon as I pressed the ’submit’ button.

I decided to fix this problem, at least on my blog, by letting users modify their comments for a designated period of time. I decided to share the code in case anyone else wants to implement this. It works directly with the MySQL database, so obviously it requires a MySQL-powered Movable Type blog.
(more…)

PHP Syntax Coloring

Thursday, April 15th, 2004

I’ve been fiddling with a syntax coloring hack for PHP that makes use of PHP’s highlight_string function. Coupled with an upload script, it can highlight a file and stick it in a div that you can paste into a page.

The clever part was figuring out how to make the resulting code valid, as well as getting rid of non-breaking spaces (which turn into nasty invisible script-breaking beasts when you copy and paste from the browser). Just to be clear, 99% of the cleverness on my part was obtained from reading through the PHP.net user comments and public CVS.

Anyhow, here it is:
http://www.metalgeek.com/archives/2004/03/30/000018.php. And there’s a link to the source as well, which shows you what it does.

I’d be interested to know if anybody finds it useful, or has any helpful comments. It would also be pretty cool to turn it into an MT plugin, but I can’t quite grasp the syntax yet.

Average Posts Per Day

Thursday, April 15th, 2004

I wrote this little snippet of code to display my average posts per day on my journal. Unfortunately that number turned out embarrassingly small (0.383) so I added functionality to display how many days between posts (a post every 2 days looks better). Just uncomment the echo you prefer.

Requires PHP and MySQL.
(more…)

Another Script blog

Tuesday, April 13th, 2004

My good friend Jenni just announced the grand opening of her site “Code Novice” - already she has a few scripts and tutorials up that look pretty interesting. :D