Thursday, July 09, 2009

Negotiation in Apache

In Apache HTTP web server (v2.2), If the browser requesting an image (http://www.yahoo.com/images/example.png) for example without extension, such that http://www.yahoo.com/images/example, the server can resolve the issue automatically by search all files under "images" directory that match example.*. The reason behind this is the feature of "Content Negotiation" in Apache Web Server, it seems like this is only the feature for v2.2 or above.

The effect of MultiViews is as follows: if the server receives a request for /some/dir/foo, if /some/dir has MultiViews enabled, and /some/dir/foo does not exist, then the server reads the directory looking for files named foo.*, and effectively fakes up a type map which names all those files, assigning them the same media types and content-encodings it would have if the client had asked for one of them by name. It then chooses the best match to the client's requirements.


For more information, go to: http://httpd.apache.org/docs/2.2/content-negotiation.html#negotiation

Tuesday, June 30, 2009

New way to style for IE 6

Just discover that we can specify style for ie 6 using: _myclass syntax.
For all modern browsers, it will think that this is incorrect syntax and will ignore it entirly; However, for old browser, such as IE 6, it intelligently think this is a typo, and assume it to be myclass.
More Info in: Underscore hack for CSS and IE


Other way to style IE 6 is through conditional commenting or using syntax like myclass[class] which only regonize by modern browser.

Thursday, June 25, 2009

Extjs: Using stripCharsRe

Ext js comes with a config option for textarea (maybe also for another form field) that to strip off any unwant character from a value, here is an example of stripping leading white space for the textara field in my form:
           
{
xtype:'textarea',
fieldLabel:'Copy',
id:'copy',
name:'copy',
allowBlank:true,
width:300,
height:50,
stripCharsRe: /^\s+/g, //strip off leading white space
grow: true
}

Tuesday, June 16, 2009

SVN COPY files from respository

svn copy svn://svn.xxx.com/xxx/trunk/xxx/public/lib/classes/vcard.class.php -r 277 .

Syntax: svn copy [fullpath] -r [revision #] [distination]

Friday, June 12, 2009

PHP installation checker script

PHP installation checker script FROM ZEND

Friday, June 05, 2009

Running PHP from Command Line (CLI) directly

First, finding the php location, usually in /usr/bin for mac;
Then use execute: /usr/bin/php -r 'echo phpinfo();'

DONT forget put quote surround your script.
For more info, type 'man php'

UPDATE:
ANOTHER EASY WAY, JUST TYPE: 'php -a'

Wednesday, June 03, 2009

Extjs AUTO complete of combo box

Here is and example to make a auto complement combo box in Ext JS. 3 important factors keep in mind here:
1. I am using jsonstore and set mode to local
2. jsonstore should set autoload to "true"
3. Set triggerAction to "all" in the combo box config

{ xtype:'combo', id: 'shoutoutsTags',
fieldLabel: 'Tag',
value: '',
mode: 'local',
width: 200,
store: new Ext.data.JsonStore({
url: 'get_data.php',
fields: ['id', 'name'],
root: 'tags',
autoLoad: true
}),
displayField: 'name',
valueField: 'id',
forceSelection: true,
triggerAction: 'all',

hiddenName: 'mytag' //dont put it the same name as name filed value
},