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 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
},