/code.google.com/p/virtualhost-sh/

code.google.com/p/virtualhost-sh/wiki/VirtualhostsOverNetwork

patrickgibson.com/utilities/virtualhost/

how-to-setup-development-domains-on-os-x/

Tags:

See full description for PHP here, for activating SSI here.

Add PHP with debugging

Activate: goto /private/etc/apache2/httpd.conf and uncomment LoadModule php5_module . Save.
Add debugging: In Terminal type:
cd /private/etc
sudo cp php.ini.default php.ini

Edit said php.ini: change
error_reporting = E_ALL & ~E_NOTICE to
error_reporting = E_ALL .Save

Add SSI

Go back to /private/etc/apache2/httpd.conf

1. Uncomment these lines from the <ifmodule mime_module> stanza:
AddType text/html .shtml and
AddOutputFilter INCLUDES .shtml

2. Add “Includes” to the “Options” statement in the <directory "/Library/WebServer/Documents"> stanza (so it now reads
Options Indexes FollowSymLinks MultiViews Includes)

3. [Re]start Apache with sudo apachectl graceful

Job’s a good ‘un.

Tags: ,

One of the reasons I changed a random content rotation script that was sitting in my <head> tags last month was because this JavaScript failed to validate. I don’t intend to change back - but today I found out the why-for when I came across the same thing happening in two versions of “The Son of Suckerfish”. One wrapped the JavaScript with CDATA tags the other not. That simple. Of course removing the script into its own file would do the trick too.

Don’t forget to wrap up your script tags safely!

<script type="text/javascript"><!--//--><![CDATA[//><!--
PUT YOUR CODE IN HERE
//--><!]]></script>

This applies to all XHTML pages.

Tags:

Twitter…

…or xkcd is inspired today

I guess a link to explain Burma Shave is necessary. Tom Waits made me wonder with his song.

Tags:

Spell checker

Thanks to Jens Meiert This little line will allow a single typo in your users’ URIs (guess who just discovered that “URL” is a depreciated term):
CheckSpelling On

Rewrite

Get rid of those pesky Ws.

RewriteEngine on
Options +FollowSymLinks
RewriteCond %{HTTP_HOST} ^www\.example\.co\.uk$ [NC]
RewriteRule ^(.*)$ http://example.co.uk/$1 [R=301,L]

#specific page redirects
redirect 301 /example-page.html http://example.com/new-name.html

Get rid of any instances of “index.html”. And more

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.(html?|php)\ HTTP/
RewriteRule ^(([^/]+/)*)index\.(html?|php)$ http://example.com/$1 [R=301,L]

more…

Set PDFs to download rather than open in browser:
#option for PDFs to download rather than open
AddType application/octet-stream .pdf

Disable directory browsing:
# disable directory browsing
Options All -Indexes

Redirect denied directory listings etc to standard error page:
# redirect denied directory listings etc to standard error page
ErrorDocument 403 /404-redirect.html
ErrorDocument 404 /404-redirect.html

Tags:

I had been using a JavaScript solution from javascriptkit.com to randomly show one option from a series on a page. All the options are wrapped in DIVs and placed in a single include file. This first solution used JS to set a CSS display:none; to all but one of a series of DIVs in a document. Nice as it was, the resulting xHTML markup would not validate properly. [UPDATE - this is due to the fact that xHTML needing extra CDATA markup around any JavaScript contained within.] Another minus was that, although sold as plus for web-crawlers etc (all options remain in the HTML at all times), if JavaScript was off then all of the options would appear and muck-up the carefully honed design.

I looked for fixes to the validation issues caused by this line for (var i=0; i<alldivs .length; i++) but to no avail. Half a day of searching later and after trying these other options I found the answer;

The Answer

None of these worked for me. The best (only) solution I found before the sun went down was from Joe Crawford. Based on PHP’s srand function
this solution allowed me to wrap PHP around the include file with the options and bingo; it works. As this is server side now - only one DIV will be in the HTML so no problem if JavaScript is off.

Happy.

Tags:

Have nice PNG with transparency. Wish to implement. Must consider IE6. Nasty, distinctly non-transparent grey background for PNGs in IE6.

Current job requires a PNG implemented as a CSS background which repeats on all pages of the site…

If-already-then-already — the search was on to find a solution that works on CSS background images and regular in-line images. That and it had to be a nice standards compliant thing with a low footprint.

Jump to the best options and/or the conclusion

Googled it. Solutions I found and tried first:

  • supersleight - couldn’t get it to work at-all at-all.
  • unitpngfix - worked well - but if image is reused (cached) on a different page then image suffers from a flash of the nasty grey. That and there are positioning issues.
  • ie7 - works as unitpngfix - also does other things I’m not too interested in. No want the flashy flashy grey.

Then, on having another look a the long wiki list of other possible options, - eureka! I realised I really should be using IE6 itself as the first test. [Still not used to having IE6 on my mac!] Most of these have an on-line demo! Brilliant. What a clever chap. [A-hem.] OK - it’s late, forgive me please…

With intelligent filtering™ now in place I found that most of the solutions suffer from the grey/gray flash. Of these not-so-rans Flixn suffers the grey flash but at least positioning is good.

The Best Options

In the end the fix comes in the shape of IE’s proprietary image filters; DirectX weirdness over a ten-year-old standardised graphic format. “Go figure.” Anyway most of the fixes available use this feature but only two options pass the grey/gray flash test*:

  • “pngbehavior” from webfx
  • “Cross Browser PNG Transparency” parts one and two from drunkenfist

pngbehavior

Great! Just add a CSS class to your inline images, one CSS declaration (non-standard) and throw a lovely pngbehavior.htc. Bingo. But this only works on inline images - not with CSS background images…

“Cross Browser PNG Transparency” from drunkenfist

Perfect with CSS background images but more work than pngbehavior for inline images as requires an extra named div and then two lines of CSS per image. Great point from this chap about using the conditional comments and separate style sheets to hide IE specific CSS hacks from other browsers.

Conclusion

OK - so neither of the best options do the full task (for images and CSS backgrounds, nicely) but can drunkenfist and pngbehavior work together? YES!
Me, happy? Yabetcha.

CSS goes something like this:

/* TRANSPARENT PNGs IN IE6 */
/* For background images (from from http://www.drunkenfist.com/304/2007/04/04/cross-browser-png-transparency-part-2/ ) NOTE THE FIRST background:url() IS BLANK. LEAVE IT SO! */
#YourID {
background:url();
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='
/path/to/image.png',sizingMethod='crop');
}

/* For inline images (from http://webfx.eae.net/dhtml/pngbehavior/demo.html
) */
img.png {
behavior: url("/path/to/pngbehavior.htc");
}

Wrap all this IE gubbins into a single CSS file and link via a conditional comment to hide your shame (and keep things ‘validatable’ of course).

Said conditional bit to put in your head:

<!--[if gte IE 5.5]>
<![if lt IE 7]>
<link rel=”STYLESHEET” type=”text/css” href=”/path/to/ie-gubbins.css” />
<![endif]>
<![endif]–>

Don’t forget that pngbehavior.htc file from webfx.


*I tried supersleight again but still couldn’t get it to work at-all at-all. Pluitsolutions was not tested as I couldn’t find an on-line demo to show it whooping ass of the grey box flash.

Tags:

« Older entries