3 tips from work.
Blogs20112011-02-20
1. Issue: How to customize only input(type=âtextâ)âs width?
Solution: use input[type=âtextâ]
The following is a quick way to customize the input buttonâs width (the input type is only âtextâ, NOT âradioâ, âcheckboxâ, âsubmitâ, âresetâ etc.)
input[type="text"] {
width: 350px;
}Since the apps scatter in different html templates, so modifying css is the only way. Adding the above codes into css file will make all apps change appearances immediately.
2. Mysql table definition
The following is a little complex MySQL table:
create table group1_group2 (
upid int unsigned not null AUTO_INCREMENT,
uid int(10) unsigned not null,
...,
created timestamp not null default current_timestamp,
primary key(upid),
index (uid, pid),
foreign key(uid) references users(uid) on delete cascade,
foreign key(pid) references projects(pid) on delete cascade
);
--
CREATE TABLE `test` (
`uid` int(10) unsigned NOT NULL,
`pid` tinyint not null,
`username` varchar(30) NOT NULL,
...,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
unique index(uid),
index (pid),
foreign key (username) references others(username)
on delete cascade on update cascade
)ENGINE = InnoDB;The on delete cascade on update cascade act as a trigger. Does Pearâs MDB2 totally support MySQL powerful syntax ?
3. Draw MySQL Schemas
phpMyAdmin brings with a simple tool to draw Database Structure. Select the Database, then choose âDesignerâ tab on the top tabs: the total Database Structure are displayed! Quite cool. By using FFâs FireShot to process the graphic and immediately generate the Database Schema documents.
It seems âMySQL Workbenchâ and DB Schema Viewer plugin for EClipse also have such functionality. But didnât use yet.
