loading
Please wait while loading...

Read more Support docx, xlsx download for IE

header('Content-type: application/vnd.openxmlformats-officedocument.wordprocessingml.document');
header('Content-Disposition: attachment; filename="'.$filename.'"');
readfile($path);

Read more A better way to support placeholder in IE

Using a float span as the placeholder message instead change the value of the input

Firstly, make the form input as following style

<label><input type="text" placeholder="email" /></label>
...........

Read more Unlimited email address with one gmail account

A secret of gmail --- evolve one gmail account to unlimited (a huge number but actually it is limited) email address

1) For example: if your gmail account is "mygmailacc@gmail.com"

2) Than you send an email to either one of the following email address:
my.gmailacc@gmail.com
my.gmail.acc@gmail.com
MyGmailAcc@gmail.com
my.GmailAcc@gmail.com
MYGMAILACC@gmail.com

Your account mygmailacc@gmail.com will also receive this email.

Its to tell you that google ignore "." and the capitalization of the email address, so you can add "." to anywhere of the account and change any word to capital case, you will still receive the email. This let you make many different email address and the limited number is depending on your account name's length.

Read more Using CSS and a noise image to make a noise background

Using CSS and a noise image to make a noise background
To make a image with noise pattern, we always directly using a png image to do so. However, if we have different color of noise background and want to have different opacity, we should make much more image. Here introduce a method that allow you to make a noise background with numerous different color which just use one image.

Firstly, we should create a background with some noise. Than apply a background color on it. CSS code as below:

background: url(noise.png) #F00

We have now made a red background with noise. If you need a transparent background, than we can use rgba instead:

background: url(noise.png) rgba(255,0,0,0.5)

This created a red noise background with opacity 50%
As lower version IE doesn't support rgba setting, so we need to do more:

filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#AAFF0000', endColorstr='#AAFF0000');

On the above case, #AAFF0000, FF0000 is the color code and AA represent the transparent gradient which FF means opaque and 00 means full transparent. Note that if rgba and the filter exists together, the noise will not work, so we would need to use CSS hack to handle different case, the full supported code as below  

background: url(noise.png) rgba(255,0,0,0.5);
background: url(noise.png) transparent \\\\9;
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#77FF0000', endColorstr='#77FF0000');

Below is an example:

 

Read more Check time/date overlap in MySQL

There are four case make the overlap exists
(ns, ne, es, ee) = (new_start, new_end, existing_start, existing_end):
  1. ns - ne - es - ee: doesn't overlap and doesn't match (because ne < es)
  2. ns - es - ne - ee: ovarlaps and matches
  3. es - ns - ee - ne: ovarlaps and matches
  4. es - ee - ns - ne: doesn't overlap and doesn't match (because ns > ee)
  5. es - ns - ne - ee: ovarlaps and matches
  6. ns - es - ee - ne: ovarlaps and matches

SQL Statment Below method is found from internet while the second method is my own way usally use.

SELECT * FROM tbl WHERE
existing_start BETWEEN '$newStart' AND '$newEnd' OR
existing_end BETWEEN '$newStart' AND '$newEnd' OR
'$newStart' BETWEEN existing_star AND existing_end

SELECT * FROM tbl WHERE
( existing_start<='$newStart' AND existing_end>'$newStart' )
AND ( existing_start<'$newEnd' AND existing_start>'$newStart' )
1 2 3 4 5 6 7 8 9 10