Tuesday, August 5, 2008

 

SEO simplified

A client was confused about how SEO works, so I made a very simple diagram about the basics of SEO (for Google, really).

Monday, July 21, 2008

 

Safari scrolling div select bug

This is one of the strangest cross-browser things I've come across, including IE bugs...

Picture this:
-A div that is hidden until moused over (abs position, z-index > 1)
-Onmouseout, it hides itself
-When it is displayed, it has an overflow:scroll

In Safari, when you would scroll and try to click any of the items in the list, it would scroll back to the beginning!

The fix is to make the div visibility:hidden, not display:none. So, since this would leave the scrollbar with no div in IE/FF, I did this in PHP:

if(strstr(strtolower($_SERVER['HTTP_USER_AGENT']),strtolower("Safari"))) {
$visibility = "visibility:hidden";
} else {
$visibility = "display:none";
}


Then just printed out the var in the JavaScript.

Wednesday, July 9, 2008

 

Stringing together replaces in JS

You can string together string functions like replace into one line:

lc_make = full_make.replace("%20","_").replace("%2520","_").replace(" ","_");

Monday, June 30, 2008

 

CLI PHP

It's been a while since I last wrote a command line PHP script, but I needed one today to parse through a database dump csv file. This is how to get the ID, which was my first column:

if($file= file_get_contents('myfile.csv')) {
  $line = split("\n",$file);
    foreach($line as $lines) {
     $data = split(";", $lines);
    echo $data[0] . "\n";
    }
} else {
  echo "couldn't open";
}

Sunday, February 17, 2008

 

How to clear cache

This is an informational post...to clear cache on:

  • Internet Explorer 6: choose Tools->Internet Options, Delete Files (screen shot)
  • Internet Explorer 7: choose Tools->Internet Options, Delete->Delete Files (screen shot)
  • Firefox: (Mac->Firefox | PC->Tools) ->Preferences, Advanced, Network->Clear now (screen shot)
  • Safari: Safari->Empty cache (screen shot)

Tuesday, January 29, 2008

 

Optimus Mini Three

I got the coolest thing ever.

After talking about how I wanted copy and paste buttons on the right because I'm a lefty on the mouse, I finally got it! It's called the Optimus Mini Three. <-- pasted using the middle button.

Mine is so pretty too...I made the buttons be flowers - well, and a firefox logo until I learn that I made the shift + top button be "open new tab".

Friday, January 11, 2008

 

IE onchange

onchange doesn't work consistently in IE, but if you change it to onclick, it works fine in both IE and FF.

Friday, December 7, 2007

 

Firefox not showing stylesheet

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

Tuesday, December 4, 2007

 

CuteFTP Backup

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

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

Tuesday, November 27, 2007

 

Symbolic Links in Unix

I always have to look this up

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

Wednesday, November 14, 2007

 

Boring business post

If I had it all to do again, some things I would do differently from the start:
-use versioning software for everything
-set up every (5 page or more) site in a CMS
-set up every site using only CSS layout
-have a QA person from the start
-have an after-hours staffed phone for problems

Things I know I've done right:
-used a good contract book
-got a good accountant
-got an office
-kept on learning!

Tuesday, November 6, 2007

 

Outlook 2007 HTML email rendering

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)

Monday, October 29, 2007

 

Awstats

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).

Friday, October 26, 2007

 

Follow up to CakePHP Post

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

Thursday, October 25, 2007

 

Is a number, is not a number

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.

Tuesday, October 23, 2007

 

Importing CSV into PHPMyAdmin

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.

Monday, October 15, 2007

 

Ajax frameworks

From an email list I'm on, this was the aggregated list of Ajax frameworks they all like:

http://script.aculo.us/
http://developer.yahoo.com/yui/
http://jquery.com/
http://www.gregphoto.net/sortable/index.php

Sunday, October 14, 2007

 

Sed is fun!

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

Wednesday, October 10, 2007

 

Google Maps - As the Crow Flies

I have a client who wants a distance calculator AND Google Maps. I thought it was impossible, but upon reading a Maps discussion board I found this. And then I created this.

The next task is to figure out how to create these points on the fly.

Tuesday, October 9, 2007

 

Subversion

As if I needed a new version control system to learn...I now have to learn and use Subversion on top of the clients who use CVS and P4.

Installing a GUI version is easy though...I just used this one.

Monday, October 8, 2007

 

At job in Mac OSX

Turns out that at jobs (a.k.a. the at queue) don't support some of the shortcuts you can use in most other flavors of *nix, times like "15:00", "3PM", or "teatime".

In OSX, you have to specify -t YYMMDDhhmm. Example:
at -t 10081637.30

Don't forget the CTRL + D to schedule it!

In my example, I have it pointing to a file that has only one line:
sh uploadAtCertainTime.sh

No more waking up at 6AM (that's 9AM EST) to upload press releases! :)

---

Here is my uploadAtCertainTime.sh script:
#!/bin/sh
USER=username
PASSWD=supersecretpassword
ftp -n ftp.myhost.org <<script
user $USER $PASSWD
binary
cd public_html
lcd /Applications/xampp/htdocs/[wherefileslive]/
put file.html
quit
SCRIPT

Post Script: this only works if you leave your computer on. D'oh!

Monday, September 17, 2007

 

Google Analytics "Outclicks"

In order to track something that's not a standard web page with Analytics code in Google Analytics, you put this on the link:

<a href="http://www.example.com/files/map.pdf" onclick="javascript:urchinTracker ('/thingyouwant/toshowupinanalytics'); ">

Friday, September 14, 2007

 

imagettftext

The graphic designer/marketing guy I share an office with hates web fonts and there's a function in PHP I've always wanted to use - imagettftext. It converts TTF fonts into images on the fly using a TTF on the server.

Here's what I did:
1. Uploaded a few ttf fonts
2. Put this in index.php:

<?php


$folder=dir("."); //The directory where your fonts reside

while($font=$folder->read())

{

if(stristr($font,'.ttf'))echo '<IMG SRC="img.php?'.substr($font,0,strpos($font,'.')).'">'; //only ttf fonts

}

$folder->close();


?>


3. Put this in img.php:
$font=$_SERVER["QUERY_STRING"];
header("Content-type: image/png");
$im=@imagecreatetruecolor(200,30)or die("Cannot Initialize new GD image stream");
$black=imagecolorallocate($im,0,0,0);
$white=imagecolorallocate($im,255,255,255);

imagefill($im,0,0,$white);
imagettftext($im,18,0,5,25,$black,$font,$font);

imagepng($im);
imagedestroy($im);
4. View the index.php file on a server

Thursday, September 13, 2007

 

Let them eat cake

There's a potential new client who wants someone who can work in the Cake PHP framework. It took a record 5 minutes to install. Here's my instance.

All I did was unzip, upload, create a db, edit the database.php file, and create the home.thtml file.

It's a little hard to find their manual, so here's a link.

Monday, September 10, 2007

 

Illustrator Workaround

Recently I've gotten a few comps from graphic designers in Illustrator, but I don't know the program very well. So I got a graphic designer to teach me how to re-import it into Photoshop (just until I learn Illustrator...eventually).

1. Select in Illustrator the pieces that will become a layer in Photoshop


2. Paste it into Photoshop, choosing Pixels


3. It will automatically be put in a new layer.

Thursday, August 23, 2007

 

Google Advertising Tools

Last night I read Google Advertising Tools. Here are my notes.

Adsense:
-skyscrapers have better clickthrough than horizontal ads

Adwords:
-images ads (maybe those don't exist anymore?)
-enable "site targeting"
-a nice way to manage multiple Adwords accounts

Getting better traffic (kindof a "duh" list):
-create a 2 sentence description of your site that uses your keywords
-see if webhost has a search engine submission service
-submit to directories (dmoz, yahoo)
-submit RSS feed to aggregators
-send out a newsletter

Making your site rank higher:
-check it in Lynx
-meta keyword tag should only have about 12 words, both single and plural versions of your major keywords
-sitemap!
-100-250 words on the home page
-title, h1, h2... keyword hierarchy

There was also a whole chapter on how to run an adult site, another on Adwords API programming, and another on another on Adsense API programming. All of which I skimmed.

Tuesday, August 21, 2007

 

Converting WMV to SWF

In order to convert WMV to a Flash video for a website, there's this program (free for 15 days) which does a fantastic job: Ultra Flash Video Converter.

It has just about the ugliest interface ever, but it converts to FLA and then you can open in Flash and publish as SWF. Here's the result.

Friday, August 17, 2007

 

Removing the background from a Flash movie

I'm working on a site that has a simple Flash globe spinning on top of a graphic background. The client wanted to change the background, but it was embedded in the Flash.

What I did:
1. Remove the background image from the background layer
2. Set the Alpha on the background layer to 0
3. Added to Flash code in the HTML
param name="wmode" value="transparent"
4. In the embed tag added
wmode="transparent"
5. Republish

Saturday, August 11, 2007

 

An Event Apart

Apparently this is event season...

I decided not to go to the Web 2.0 Summit, it's just too expensive with not enough potential.

However, this year I'm going to An Event Apart! Eric Meyer, Zeldman, Joe Clark...these are the people who are out there doing it. The Summit is the people who talk about the people doing it.

Friday, August 10, 2007

 

Web 2.0 Summit

I got an invitation to the Web 2.0 Summit. I can't decide if should go...

Pros:
  • Good conference topics
  • Speakers include Steve Ballmer, Danny Hillis, Google, Yahoo!, Viacom, HP, EMI, Sun, Verizon, eBay, Facebook, and that Twitter guy
  • Launchpad seemed to be what everyone blogged about last year
  • Networking
Cons:
  • $3595
  • Despite the possibility of "networking", I may be too small of a fish to get anything out of it.
What do you think?

 

Wget mini man

Just before going on a trip, I always find something I want to download, like a book or a series of articles, but I always have to look up the WGET options...and I always seem to choose the same ones.

Here is my Wget mini man page:
--level=0: go as deep as needed
-r: recurse
-np: no parent (go deep instead of shallow)
-L: follow relative links only
-p: get all images, etc. needed to display HTML page

wget --level=0 -r -np -L -p http://www.little-truck.com

Wednesday, August 1, 2007

 

Adding a path to your Bash profile

I've found myself doing this often enough:

When installing a new program for the UNIX shell, if you want it to be able to be run from anywhere:

vim .bash_profile
PATH=$PATH:/usr/local/bin
export PATH


Restart the terminal and it's done.

 

SecureClient mocks me

After a hard drive crash where I had to restore from a SuperDuper backup, everything worked except Checkpoint's VPN-1 SecureClient.

The error was: "SecureClient services are down. Please reboot your machine to start them."

After searching numerous forums and finding that "it just doesn't work" on OS X > 10.3.9, I went into the terminal, to the /opt/CPsrsc-50/bin folder, and ran "sudo ./scuninstall". It uninstalled, despite some errors and I was able to run the installer again.

Friday, July 27, 2007

 

New site design - and branding!

Just before going on vacation, I hired a graphic designer to make me a new logo. I specifically wanted something that evoked a blueprint - I'm so happy with the result!

So tonight I redesigned the site by only changing the stylesheet - what do you think? The color scheme is from Adobe's Kuler site, it's called Peer e0 (stupid Flash so you can't bookmark)

Wednesday, June 27, 2007

 

.htaccess and .htpasswd creator

Thank you Interwebs for all the things you give me...like this.

That link creates a password protected directory or file by giving you the code for your .htaccess file and then encrypting the password for you (!) for the .htpasswd file.

Friday, June 22, 2007

 

Class with multiple link stylings

In order to make a class with multiple link stylings, repeat the name of the class with each a property. This is because anything after the comma is considered a new style, i.e.

.navPriSelected a:link, a:visited {}

will style .navPriSelected a:link AND ALL a:visited, not .navPriSelected a:visited.

So the code for the above should be:

.navPriSelected a:link, .navPriSelected a:visited {}

Thanks, Jacob! :)

Wednesday, June 20, 2007

 

Google Sitesearch

Here's a quick 'n dirty Google Sitesearch:


<form method="get" action="http://www.google.com/search" target="_blank">
<input name="ie" value="UTF-8" type="hidden">
<input name="oe" value="UTF-8" type="hidden">
<input name="q" maxlength="255" value="" style="width: 80%;" type="text">
<input name="btnG" value="Search" type="submit">
<input name="domains" value="www.little-truck.com" type="hidden">
<input name="sitesearch" value="www.little-truck.com" type="hidden">
</form>


 

Ordering domains and hosting

Being a Godaddy reseller, I found that one of the things I've been wanting to do is create an order for someone and have them login and buy it, since this is easily the most complicated part for users.

Here are the steps I do:
1. Create an account for the person (with their email and other info)
2. Add the appropriate hosting, domain registrations, etc. to a cart
3. Send them to https://www.securepaynet.net/gdshop/rhp/default.asp?prog_id=422889
4. Tell them to:
Click on "My Account"
Login with Account# xxx, password xxx
Click on "My Account", "Account Settings" and update your address or other info
Click on "My Cart" and "Checkout Now", purchasing registration and hosting

 

CVS Headaches

Trying to figure out why MacCvsX is throwing this error: "cvsgui [checkout aborted]: end of file from server (consult above messages if any)".

Found this answer (vague as it is): "The most common cause for this message is if you are using an external rsh program and it exited with an error. In this case the rsh program should have printed a message, which will appear before the above message."

So, I am downloading Xcode finally to see about just using the command line version (or maybe the GUI version needs the command line version as well?).

Updates to follow...

----------

Update:

While XCode has lots of cool stuff, it didn't fix MacCvsX.

Got rid of MacCvsX and instead went with Mac CVS Pro which worked with no problems.

Thursday, June 14, 2007

 

Photoshop Coolness

Learned today how to make text in Photoshop that has a transparent background but doesn't have that awful white line around it.

Here's my tutorial.

My day is ending on a very good note...considering I wrecked my brand new bicycle today.

Tuesday, June 12, 2007

 

Form element shows through layer

I had an interesting problem yesterday where a div that's hidden, when shown over a form field, the form field shows through it. I found this answer, but it was overly complex.

But I did get from it that all I had to do was hide the form field when I showed the div. Worked great! Once the project is live, I'll post the URL, but it's a Big Company with a scary NDA.

...code here...
this.tip.style.visibility = 'visible';
//this fixes the select box showing through the div problem
document.getElementById('id_name').style.visibility = 'hidden';
}

...code here...
this.tip.style.visibility = '';
document.getElementById('id_name').style.visibility = 'visible';
}

 

Fieldset in IE

How could I be doing this for so long and not know the fieldset tag (it is XHTML compliant)? Anyway, I learned by having to fix a weird issue in an app I'm working on.

The fieldset boxes were overlapping in IE; the answer is here. It has to do with adding {position:relative} and a margin to the fieldset attributes in the CSS.

Friday, June 1, 2007

 

"A" order

You know they're serious when there are TWO exclamation points (from w3schools):

Note: a:hover MUST come after a:link and a:visited in the CSS definition in order to be effective!!

Note: a:active MUST come after a:hover in the CSS definition in order to be effective!!

Since I sometimes forget the order, so I'll put it here:

  • link
  • visited
  • hover
  • active
Addendum: Here's a good way to combine:
a:link, a:visited {
text-decoration: underline;
color: #6A5ACD;
background-color: transparent;
}
a:hover, a:active {
text-decoration: underline overline;
color: #191970;
background-color: #C9C3ED;
}

 

Restarting Apache

Learned something new today...apachectl is a script that invokes the httpd daemon to restart Apache. A client used this: /etc/rc.d/init.d/httpd restart

I never looked under the hood of my various scripts.

Tuesday, May 29, 2007

 

Godaddy Reseller

I've become a reseller for Godaddy domains and hosting now. Check out the storefront.

Wednesday, May 9, 2007

 

Finds and greps and seds, oh my!

I have got to be the single worst person at searching and replacing in UNIX.

Here are commands I use intermittently but have to look up every time:

-Find in the current directory and recurse, in all files with a .html extension, the string "stuff to find", and print it to the screen:
find . -name '*.html' -exec grep 'stuff to find' '{}' \; -print

-Find in the current directory and recurse, in all files with a .html extension, the string "stuff to find", and replace it with "stuff to replace with"
grep -Rl 'stuff to find' * | grep .html$ | xargs sed -i '' -e 's/stuff to find/stuff to replace with/g'

Tuesday, May 8, 2007

 

Radio button styling in CSS

I've never bothered to look before, but there are very few ways to style radio buttons.

Here are a couple of the ways I found; the second one is stupidly complicated.

 

.htaccess file in OSX

I'm using Xampp for OSX, so I couldn't use the many answers I found online for showing hidden files, specifically .htaccess, in personal web service directories.

But with a little closer look, I found that both my FTP program and my text editor can see hidden files even though OSX can't. Who needs to see files in Finder anyway? :)

And the point of this exercise was to get a client's HTML site parsing as PHP without changing the extension from .htm. Here's the snippet for the .htaccess file if you don't have control over the httpd.conf file:
RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html

Tuesday, April 24, 2007

 

Adwords

I had a client tell me she found Adwords confusing, so I wrote a tutorial.

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]