Source: MySQL Date and Time Functions
Select count by day:
select count(*), DAY(date_time) from table n group by DAY(date_time) order by date_time desc;
Source: MySQL Date and Time Functions
Select count by day:
select count(*), DAY(date_time) from table n group by DAY(date_time) order by date_time desc;
Re-posted from To be or not to be >> Speed up Grep:
GNU grep is very slow in the UTF-8 locale. It is orders of magnitude faster in the C locale. To check your current locale, type the following at shell prompt: locale
LANG=en_US.UTF-8
LC_CTYPE=”en_US.UTF-8″
LC_NUMERIC=”en_US.UTF-8″
LC_TIME=”en_US.UTF-8″
LC_COLLATE=”en_US.UTF-8″
LC_MONETARY=”en_US.UTF-8″
LC_MESSAGES=”en_US.UTF-8″
LC_PAPER=”en_US.UTF-8″
LC_NAME=”en_US.UTF-8″
LC_ADDRESS=”en_US.UTF-8″
LC_TELEPHONE=”en_US.UTF-8″
LC_MEASUREMENT=”en_US.UTF-8″
LC_IDENTIFICATION=”en_US.UTF-8″
LC_ALL=
In the above example, my locale is en_US.UTF-8. If you are
grep’ing very large files, you can greatly improve the speed by changing
the locale to C. In bash, you would type: export LC_ALL=C
Then type locale again, the display should look something like this :
LANG=en_US.UTF-8
LC_CTYPE=”C”
LC_NUMERIC=”C”
LC_TIME=”C”
LC_COLLATE=”C”
LC_MONETARY=”C”
LC_MESSAGES=”C”
LC_PAPER=”C”
LC_NAME=”C”
LC_ADDRESS=”C”
LC_TELEPHONE=”C”
LC_MEASUREMENT=”C”
LC_IDENTIFICATION=”C”
LC_ALL=C
Future version of grep are planned to address this issue. Until then, use the C locale with grep. If you are frequently using grep to search for large text files, you should include it in your .bash_profile.
Egrep for linguists was written around 1997. It deals with different Unix/Linux commands useful for text processing. It contains examples of how to use regular expressions, egrep, sed, sort, uniq, cat, cut, tr, etcetera. The text has been used at university courses.
Excerpted from How a Checklist Can Save Your Life:
“As experts, we will fail,” he said. “As elites, we will fail. The first thing they teach aviators, surprisingly, is, ‘You’re going to screw up. And it’s going to kill someone. Definitely you and maybe others….’
Due to increasing complexity in our jobs, it’s easy to lose sight of critical tasks. The argument for the checklist is that experts and leaders need written guides to walk them through the steps of any complicated procedure.”
“…In his book, Gawande distinguishes between ignorance, when the knowledge doesn’t exist; and ineptitude, when the knowledge exists but an individual or group of individuals fails to apply it correctly.”
Excerpted from How Checklists Can Keep You Alive After Surgery:
The problem with the checklist, as Pronovost himself learned, is that their use and control sets off a power struggle. He recommends nurses control the checklist, so doctors resist the process, because they don’t like taking orders from nurses.
Recent Comments