Home arrow Tips and Tweaks
Tips and Tweaks

.htaccess file PDF Print E-mail

The Apache Web server provides a feature called .htaccess file, which provides commands to control a Web site. This file is simply a text file containing Apache directives. Those directives apply to the documents in the directory where the file is located, and to all subdirectories under it as well. Other .htaccess files in subdirectories may change or nullify the effects of those in parent directories.

Here are some useful information:

Redirect non-www to www version of site

 
RewriteEngine On
RewriteCond %{HTTP_HOST} ^YourSite.com [nc]
RewriteRule (.*) http://www.YourSite.com/$1 [R=301,L]

Or the code below that you don't have to rewirte the domain:

 
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

Redirects

You can use .htaccess file to redirect any request for a specific page to a new page...

 
Redirect /OldDir/old.html http://site.com/NewDir/new.html

Redirect the missing file to index

 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://%{HTTP_HOST}/ [R]
Apache Module mod_rewrite reference
 

ActionScript 3.0 Click Button Code Example PDF Print E-mail

There are two buttons are careted in the flash. One is named as btnReplay and another one is myButton

 
var clickTAG = root.loaderInfo.parameters.clickTAG;
myButton.addEventListener("click", onClick);
btnReplay.addEventListener("click", replay);
 
function onClick(evt:MouseEvent):void {
  // comment out for testing
  // trace("you clicked me"); 
 
  // embedded with a static URL or...
  // var targetURL:URLRequest = new URLRequest("http://yourURL.com/");
  //navigateToURL(targetURL);
 
  // when URL is a flash var use this
  var targetURL:URLRequest = new URLRequest(clickTAG); 
  navigateToURL(targetURL);
}
function replay(evt:MouseEvent):void {
  gotoAndPlay("start");
}

Then, in html codes, add a flash var to access the above flash.

animation.swf?clickTAG=http://yourURL.com

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

 

Adobe Videos PDF Print E-mail

Dreamweaver CS4 Live Preview

Jorge and Paul show how Dreamweaver's new Live View mode makes designing dynamic, JavaScript-powered interfaces easy, powerful and accurate.

Dreamweaver CS4 Code Navigator

Dreamweaver's new Code Navigator gives you lighting-fast access to the CSS rules that define any element of your page, wherever they're defined.

 

The Pharos Trips & Pics - GPS Location Tagger PDF Print E-mail
Pharos GPS + Google Map

I bought a Pharos Trips and Pics, which is a GPS location tagger, and installed the software (Pharos Trips & Pics Version 1.7.0.0). The Trips & Pics is a great travel GPS tracker and a digital camera add-on. It recorded my trips and geotagged my photos offline by using the time stamp of the photos. (Note: Digital camera's clock must be calibrated against some accurate time source. The GPS gadget provides the most accurate time.) It also supports EXIF, Flickr and GPX. This is a picture opened with Adobe Bridge to see the extra EXIF Metadata include GPS Latitude, Longitude and Map Datum

Pharos Trips & Pics is a low-cost solution for recording trips and geotagging photos, ideal for leisure travelers, photographers, outdoor enthusiasts, field workers, real estate agents, conservationists, fleet managers... The applications of the product are limited only by your imagination.

Read more...
 

Detect user's device and redirect to a mobile web PDF Print E-mail

While working on mobile web, first is think about how to detect the user's device. If the user is using a mobile device, then you have to redirect to a mobile web, not a general long and 3 or 4 columns website.

In Apache web server, Browser ID, more correctly called User Agent IDs, is the environmental variable HTTP_USER_AGENT. In dot net server (ASPX), you can use a string variable Request.UserAgent.

Here is a great place you can find a whole list of the Mobile Browser ID strings, a.k.a. User Agent ID: http://www.zytrax.com/tech/web/mobile_ids.html

JavaScript code use navigator.userAgent

 
<button onclick="alert(navigator.userAgent);">User Agent</button>