Archive for the ‘Code’ Category

Adobe kills off Homesite :(

Thursday, June 25th, 2009
Adobe kills off Homesite :(

Adobe kills off Homesite :(

It is sad news, my beloved XHTML editor is now dead no thanks to Adobe with them announcing the death of Homesite as of the 26th May 2009.  They acquired Homesite from Macromedia (2003) and simply let it die, without even a hint of updating it or letting anyone know it would be abandoned since they took it over.

While other editors exist and will have to take the place of Homesite, at this stage there os no product (yet) that is as good as Homesite.   Adobe have simply said use Dreamweaver, but if I wanted to use Dreamweaver I would already be doing that.  The benefit Homesite has over Dreamweaver is that Homesite is light weight and very customisable – which is very different to Dreamweaver which is well over priced (as are all Adobe products) and is over bloated with extensions and tools and add-ons that for the most part are not needed.

I have made a post in their forums to ask why and also to see if they could release the software as open source, I will not hold my breath on that one as Adobe have never been on the side of goodwill intentions… Maybe (yer right) Adobe might release the final version (5.5) as a free download – but the downloads still show Homesite trial only as a download.

I find it very dissappointing in that it has taken them several years since taking over Macromedia to announce Homesites death, I will assume that many still bought it whilst also realising that number would have reduced over time since no updates or word on updates were provided by Adobe at any time.  There forums for Homesite (http://forums.adobe.com/community/homesite) while little used were there for some communication between users, but Adobe themselves never responded to any requests for where Homesite was going.

It is a sad day that this has happened and while it may not affect many I am sure there are some like me that had a faint hope that Adobe would release an updated version.. alas that is not to be :(

Keeping your CSS code clean

Friday, July 11th, 2008

I love code, that is pretty simple to see and I like it as it can give me full control over every element of the website design.  I also like clean code, without it your website may look nice but if you need to come back to the code in a year or two my bet is that it will take you more time to work out what is what in the code instead of simply getting the job done.

Clean code in whatever language you are using and for whatever purpose you need it for is essential.  This first post of a series I will do is for CSS (style sheets).

You can go even further by breaking up the CSS into separate style sheets such as Header, Footer, Content and so on, this is totally up to you, the following is my starting point I use for CSS, I hope you find it useful.

/*
Site Name:
Site URI: http://somedomain.com.au/
Description: Stylesheet for somedomain
Version: 1.0
Author: That Net Site
Author URI: http://thatnetsite/
Version Comments
v1.0
This Style sheet is ......
*/

/*-----------------------------------------------------
Reset all basic browser properties
-----------------------------------------------------*/

* {
     margin: 0;
     padding: 0;
     border: 0;
     font-family: sans-serif;
     font-size: 1em;
     font-weight: normal;
     font-style: normal;
     text-decoration: none;
}
/*-----------------------------------------------------
Basic Page Properties
-----------------------------------------------------*/
html {
     height: 100%;
     margin-bottom: 1px;
}
body {
     margin: 0;
     padding: 0;
}
p {
     margin-top: 10px;
     margin-bottom: 15px;
}
fieldset {
     border: 0;
     padding: 5px 0;
}
/*-----------------------------------------------------
Font Size Properties
-----------------------------------------------------*/
h1 {
     font-size: 200%;
}
h2 {
     font-size: 170%;
}
h3 {
     font-size: 150%;
}
h4 {
     font-size: 120%;
}
/*-----------------------------------------------------
Padding and Margins
-----------------------------------------------------*/
div {
     margin: 0;
}
h1 {
}
h2 {
}
h3 {
}
h4 {
}
h5 {
}
/*-----------------------------------------------------
Fonts and Font Weights
-----------------------------------------------------*/
body {
     font-family: "Lucida Grande", Tahoma, Helvetica, sans-serif;
}
h1 {
}
h2 {
}
h3 {
}
h4 {
}
h5 {
}
/*-----------------------------------------------------
Colours
-----------------------------------------------------*/
body {
     color: #5B5648;
}
a {
     color: #960000;
}
a:hover {
     color: #000000;
}
/*-----------------------------------------------------
Backgrounds
-----------------------------------------------------*/
/*-----------------------------------------------------
Text Decorations
-----------------------------------------------------*/
a:link,
a:visited {
     text-decoration: none;
}
a:hover {
     text-decoration: none;
}
/*-----------------------------------------------------
Borders
-----------------------------------------------------*/
a img {
     border: 0;
}
div {
     border: 0;
}
/*-----------------------------------------------------
Width and Heights
-----------------------------------------------------*/
/*-----------------------------------------------------
Floats and Alignments
-----------------------------------------------------*/
.clear {
     clear: both;
}
.right {
     float: right;
}
.left {
     float: left;
}
.center {
     text-align: center;
}
/*-----------------------------------------------------
Lists
-----------------------------------------------------*/
/*-----------------------------------------------------
Displays and Positions
-----------------------------------------------------*/

Please feel free to share your thoughts and comments on how the above can be improved or even if you have some alternative methods that work well for you.

.htaccess file Code Snippets

Monday, July 7th, 2008

I often have a need to add specifics to the htaccess file to make the web site meet a clients needs (or my own).  Over the years I have compiled a number of htaccess code snippets that I have used that may be useful to you if needed.

Disable Directory Browsing

Options All -Indexes

Enable Directory Browsing

Options +Indexes

If you want to block specific file types from showing you can use

IndexIgnore *.wma *.mp3 *.avi

Prefer to use Custom Error Messages

ErrorDocument 403 /forbidden.html
ErrorDocument 404 /notfound.html
ErrorDocument 500 /servererror.html

If you need SSI working with HTML instead of just SHTML
These do not all have to be used they are provided just as examples

## SSI for html files
AddType text/html .html
AddHandler server-parsed .html
## SSI for shtml files
AddType text/html .shtml
AddHandler server-parsed .shtml
## SSI for htm files
AddType text/html .htm
AddHandler server-parsed .htm

Change the Default Home Page – note the order you place them in is followed

DirectoryIndex home.html index.html index.php

Block Users from accessing the site

<limit GET POST PUT>
order deny,allow
# By the IP Address
deny from XXX.XX.XXX.XX
# By Domain
deny from .domain.com
allow from all
</limit>

Allow only LAN users

order deny,allow
deny from all
allow from 192.168.0.0/24

Redirect Visitors to New Page/Directory

Redirect oldpage.html http://www.domain.com/newpage.html
Redirect /olddir http://www.domain.com/newdir/

Block site from specific referrers

RewriteEngine on
RewriteCond %{HTTP_REFERER} block-site\.com [NC]
RewriteCond %{HTTP_REFERER} block-site-2\.com [NC]
RewriteRule .* - [F]

Block Hot Linking/Bandwidth hogging

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]
RewriteRule \.(gif|jpg)$ - [F]

Want to show a “Stealing is Bad” message too?

Add this below the Hot Link Blocking code:
RewriteRule \.(gif|jpg)$ http://www.mydomain.com/nosteal.gif [R,L]

Another example of not letting someone hotlink or use your images on their site

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} .*jpg$|.*gif$|.*png$|.*php$ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !domain1allowed\.com [NC]
RewriteCond %{HTTP_REFERER} !domain2allowed\.org [NC]
RewriteCond %{HTTP_REFERER} !google\. [NC]
RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]
RewriteRule (.*) /pathto/nohotlink.jpe

Stop .htaccess (or any other file) from being viewed

<files file-name>
order allow,deny
deny from all
</files>

To use or not to use www in your URL

# Rule for duplicate content removal : domain.com vs www.domain.com
RewriteCond %{HTTP_HOST} ^www.domain\.com [NC]
RewriteRule (.*) http://domain.com/$1 [R=301,L,NC]

or in reverse

# Rule for duplicate content removal : domain.com vs www.domain.com
RewriteCond %{HTTP_HOST} ^domain\.com [NC]
RewriteRule (.*) http://www.domain.com/$1 [R=301,L,NC]

Prefer to use just domain.com/ and not domain.com/index.php?

# Rule for not using index.php or index.html etc as home page
Options +FollowSymLinks
RewriteCond %{THE_REQUEST} ^./index.php
RewriteRule ^(.)index.php$ http://domain.com/$1 [R=301,L]

Avoid the 500 Error

# Avoid 500 error by passing charset
AddDefaultCharset utf-8

Grant CGI Access in a directory

Options +ExecCGI
AddHandler cgi-script cgi pl
# To enable all scripts in a directory use the following
# SetHandler cgi-script

If you want to change script extensions

AddType application/x-httpd-php .gjw
gjw will now be treated as if they were PHP files!
The same can apply for cgi files
AddType application/x-httpd-cgi .gjw