quarta-feira, 29 de maio de 2019

How to Enable Click to Minimize On Ubuntu

Open a terminal using Ctrl+Alt+T shortcut or searching for it in the menu. All you need is to copy paste the command below in the terminal:

gsettings set org.gnome.shell.extensions.dash-to-dock click-action 'minimize'

quinta-feira, 23 de maio de 2019

Download file using htmlunit

// Exemplo de como baixar um arquivo após clicar em um link com HtmlUnit - Java

WebClient webClient = new WebClient();
try {
    HtmlPage page = webClient.getPage("https://cdn.kernel.org");
    List anchors = page.getByXPath("//*[@id='latest_link']/a");
    anchors.get(0).click();
    InputStream is = page.getEnclosingWindow().getEnclosedPage().getWebResponse().getContentAsStream();
    String file = "public/kernel.tar.xz";
    Files.copy(is, Paths.get(file));
    File f = new File(file);
} catch (IOException e) {
    e.printStackTrace();
}

quinta-feira, 4 de junho de 2009

Renomear uma tabela no Firebird

Existe um mito que diz não ser possível renomear nome de tabelas no banco de dados Firebird.
Realmente pelo tradicional commando ALTER TABLE não é possível renomear, coisa que aliás, faz falta durante o desenvolvimento de um sistema.
Porém podemos usar as tabelas de sistema do Firebird para tarefas como esta, desde que tenhamos acesso como SYSDBA:

UPDATE RDB$RELATIONS
SET RDB$RELATION_NAME='NOVO_NOME' where
RDB$RELATION_NAME='NOME_ANTIGO';

UPDATE RDB$RELATION_FIELDS
SET RDB$RELATION_NAME='NOVO_NOME' where
RDB$RELATION_NAME='NOME_ANTIGO' and
RDB$SYSTEM_FLAG=0;

segunda-feira, 11 de maio de 2009

Diff em arquivo remoto usando VIM e SCP

Juntando estes dois comandos consegui economizar o tempo que
perdia baixando arquivos no servidor para depois
compará-los.
É possível fazer o diff diretamente em arquivos remotos.

vimdiff /caminho/do/arquivo scp://user@host//caminho/do/arquivo

Se você não tiver as chaves do SSH configuradas a senha será
solicitada para que o scp possa trazer o arquivo remoto.


quarta-feira, 4 de março de 2009

Gerar data no passado - shell script

Criando uma rotina de backup no meu servidor me deparei com a necessidade de saber qual era a data de ontem.
A solução? => RTFM do comando date

O comando é: date "+%d/%m/%Y" --date "now 1 day ago"

;)

sexta-feira, 20 de fevereiro de 2009

Corrigir permissões de diretórios (apenas) usando comando find

Me deparei com uma estrutura medonha de diretórios que precisava ter as permissões corrigidas. Os arquivos não deviam ser alterados.
Logo pensei no comando "find" que aliás, é muito poderoso.
Após uma breve olhada em
"find --help":

find -type d -exec chmod 770 {} \;


Com este comando você altera as permissões dos diretórios de maneira recursiva e sem alterar a permissão dos arquivos.


terça-feira, 7 de outubro de 2008

The tao

The tao that can be tar(1)ed
is not the entire Tao.
The path that can be specified
is not the Full Path.

We declare the names
of all variables and functions.
Yet the Tao has no type specifier.

Dynamically binding, you realize the magic.
Statically binding, you see only the hierarchy.

Yet magic and hierarchy
arise from the same source,
and this source has a null pointer.

Reference the NULL within NULL,
it is the gateway to all wizardry.

How to Enable Click to Minimize On Ubuntu

Open a terminal using Ctrl+Alt+T shortcut or searching for it in the menu. All you need is to copy paste the command below in the terminal: ...