Firefox not showing stylesheet

December 7th, 2007

Was uploading a site and discovered that the CSS didn’t work in Firefox, but worked in Safari and IE. It acted like there was no stylesheet, but the Web Developer Toolbar could show it. Clicking “edit CSS” on the Web Developer Toolbar showed a brief blink of the stylesheet being attached.

Turns out it’s a server misconfiguration, discussed in this article.

Apache reads a “mime.types” file. Make sure it includes the line:

text/css   css

You can also use Apache configuration directives to set the Content-type. If the worst comes to the worst you may be able to use a .htaccess file (which applies to the directory it is in and all subdirectories) to set the configuration (the default Apache configuration disallows this, but many hosts turn it on to allow users some degree of configuration).

AddType text/css .css

CuteFTP Backup

December 4th, 2007

I totally live and die by my FTP program, which on the Mac is CuteFTP.

I’ve been moving my files from my old MacBook, which is having some issues, to my new MacBook Pro. Among many things, this means moving over my CuteFTP site list. Here’s how to do it…

Copy these 2 files form the old computer:
YourUserName > Library > Preferences > com.globalscape.CuteFTP2.plist (Settings) and CuteFTP AddressBook.plist (Address Book).

SCP mini-man

December 4th, 2007

Another mini-man post…

SCP an entire directory from local to remote:
scp -r directoryname roxane@hostname:directoryname

SCP a file from local to remote:
scp file.txt roxane@hostname:directoryname

Follow up to CakePHP Post

November 27th, 2007

Some things I’ve learned about cakephp:
1. To attach javascript to a submit button the HTML way:

<input type="submit" id="send_button" onclick="disableMe('send_button')" value="Register" />

The Cake way:

submit('Register',array('id'=>'send_button', 'onclick'=>"disableMe('send_button')")); ?>

2. Complete list of HTML helpers

Symbolic Links in Unix

November 27th, 2007

I always have to look this up

ln -s /long/directory/path/to/make/shorter mypath

Outlook 2007 HTML email rendering

November 6th, 2007

I worked on a project today to fix 2 HTML emails that were broken in Outlook 2007. What I did to fix them was:
1. Make all CSS internal (in the head)
2. Make the layout table-based with only one level embedded at the most
3. Make all backgrounds be rendered by CSS
4. Make the page validate using Tidy (the FF extension)

Awstats

October 29th, 2007

In trying to set up external links tracking in Awstats, I inadvertently learned some things about Awstats:
1. /etc/awstats/awstats.mysite.com.conf
This file contains the ExtraSections area.
2. There is an error in the PDF documentations for this section, use their site documentation instead.
3. The stats it produces are actually pretty good (and LIVE).

Is a number, is not a number

October 27th, 2007

SQL for is not a number: SELECT * FROM table WHERE country NOT REGEXP(’[0-9]‘)
PHP for starts with a letter: if (preg_match (”/^([A-Z][a-z]+)$/”, $country)) {
}

Just in case, ya know.

And to round out my week of SQL…dates must be in quotes.

Importing CSV into PHPMyAdmin

October 23rd, 2007

Learned a very valuable lesson today…when importing a CSV into PHPMyAdmin, if the CSV was created on a Mac, “Lines terminated by” is \r.

Sed is fun!

October 14th, 2007

Jotting down quick notes from a sed tutorial with Jacob…

Did an ls > ../file.txt first, then replaced all spaces with nothing
(while read f; do newf=`echo $f | sed ’s/ //g’`; mv “$f” “$newf”; done;) < ../file.txt

To test first before doing it, can do:
(while read f; do newf=`echo $f | sed ’s/ //g’`; echo mv “$f” “$newf”; done;) < ../file.txt

Take the contents of a file (in this case a list of images) and add the URL to the beginning of each line:
sed ’s/^/http:\/\/www.little-truck.com\//’ <> file2.txt