8. marvin@goldenheart ~ $ ssh root@deepthought
****
WELCOME TO 1 OF YOUR 38,157,987 SERVERS.
TRY THE VEAL. IT'S THE BEST IN THIS FARM.
****
root@deepthought ~ $ tail -f /var/log.txt
COMO ACESSAR
OS LOGS?
16. RFC 3164: SYSLOG
<34>Oct 11 22:14:15 mymachine su: 'su
root' failed for lonvick on /dev/pts/8
<priority = facility*8+severity>
<date/time>
<host>
<process>
<message>
17. CHAVE: VALOR
message <34>Oct 11 22:14:15 mymachine su: 'su root'
failed for lonvick on /dev/pts/8
text su, root, failed, for, lonvick, on, /dev/pts/8
facility AUTH
severity CRITICAL
date 20121011
time 221415
host mymachine
process su
20. CAJU OU BANANA
CAJU U BANANA
BANANA ➜ 2, 3, 42
CAJU ➜ 3, 11, 42, 50
CAJU U BANANA ➜ 2, 3, 11, 42, 50
21. QUERIES
TERM abacaxi
PREFIX abaca*
WILDCARD ab*a?i
FUZZY abacazi~
RANGE [abacaxi TO banana]
22. QUERIES
(cajá~ || bana*) -damasco
Registros que contenham algo parecido com
cajá (talvez cajú) ou algo que comece com
bana, mas que definitivamente não contenham
damasco.
25. ORDENAÇÃO SELEÇÃO
Como encontrar os 1000
menores inteiros de um total
de 100M+ em tempo hábil?
introSelect(data, 1000) ➜ 300ms
26. ORDENAÇÃO SELEÇÃO
public void select(int[] data, int begin, int end, int m) {
if (begin >= end) return;
m = Math.min(m, end - begin);
for (int depth = 0; depth < MAX_DEPTH; depth++) {
int pivot = partition(data, begin, end, begin + (end - begin) / 2);
int d = pivot - begin + 1;
if (d == m) {
return;
} else if (m < d) {
end = pivot;
} else {
m -= d;
begin = pivot + 1;
}
}
//fall back to heap sort when too deep
heap.select(data, begin, end, m);
}