quarta-feira, 20 de fevereiro de 2013
terça-feira, 5 de fevereiro de 2013
Gmail selecionar/apagar e-mails por tamanho ou por data - Gmail select/delete many e-mails by size or by date
Faça a pesquisa por datas:
after:2005/01/01 before:2010/12/31
pesquisa por tamanho (maior que 2 MBs e de um ano atrás):
larger:2m older_than:1y
Depois basta clicar no selecionar todas e no ícone da lixeira.
terça-feira, 11 de dezembro de 2012
Ubuntu instalando OCI8 para rodar no PHP
Prerequisites:
Confira a instalação rodando phpinfo() no servidor.
sudo apt-get install build-essential sudo apt-get install php5-dev php-pear libaio1
You will need the Basic (58MB) and SDK (600K) -- baixe as versões ZIP. The Basic Lite version does not work.
Vc precisará saber se seu servidor é AMD ou Intel e se é 32 ou 64 bits, clique aqui para conferir os comandos
Vc precisará saber se seu servidor é AMD ou Intel e se é 32 ou 64 bits, clique aqui para conferir os comandos
crie a pasta lib se ela não existir
cd /usr/local/lib sudo unzip <location-of-instant-client-basic> sudo unzip <location-of-instant-client-sdk> cd instantclient_11_2 sudo ln -s libclntsh.so.11.1 libclntsh.so
renomeie a pasta instantclient_11_2 mv instantclient_11_2 instantclient
The symbolic link is needed during the compilation step later.
sudo pecl install oci8
You will be prompted for the location of the library:
instantclient,/usr/local/lib/instantclient no meu caso eu apenas dei [enter] para ele localizar automaticamente, da maneira acima não funcionou.
PHP5 Instructions
You should now create a new oci8.ini file which will be included when loading php.ini (Editing the php.ini is discouraged):
nano /etc/php5/conf.d/oci8.ini
this will create a blank file; add to this file:
extension=oci8.so
segunda-feira, 10 de dezembro de 2012
MySQL select a partir de
No select abaixo teremos emails a partir da letra G SELECT email, id
FROM `TABELA`
WHERE LOWER( LEFT( email, 1 ) ) NOT
IN ( 'a', 'b', 'c', 'd', 'e', 'f')
ORDER BY emailAki apenas letras:SELECT `empresa`
FROM `TABELA`
WHERE empresa NOT
REGEXP '^[0-9]+$'
E aki apenas numeros:
SELECT * FROM table WHERE columnName REGEXP '^[0-9]+$'sábado, 8 de dezembro de 2012
Exim4 configuração
Arquivo update.conf:
dc_eximconfig_configtype='smarthost' # veja as configurações detalhadas abaixo
dc_other_hostnames='COLOQUE AQUI O HOSTNAME SECUNDARIO'
dc_local_interfaces='127.0.0.1'
dc_readhost='COLOQUE AQUI O HOSTNAME PRINCIPAL'
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets='COLOQUE AQUI SEUS IPS'
dc_smarthost='COLOQUE AQUI SEU SMARTHOST' # se vc não souber pergunte para o seu provedor de acesso (é o servidor de smtp do seu provedor)
CFILEMODE='644'
dc_use_split_config='false'
dc_hide_mailname='true'
dc_mailname_in_oh='true'
dc_localdelivery='mail_spool'
Geralmente o "problema" esta nesta variavel dc_eximconfig_configtype em caso de duvida pergunte ao seu provedor de acesso qual deve usar.
Não esquecer de mudar:
de www-data para o e-mail desejado:
vi /etc/email-addresses
hostname desejado
vi /etc/hosts
vi /etc/hostname
Não esquecer de tirar totalmente o sendmail:
sudo apt-get --purge remove sendmail-base sendmail-cf sendmail-doc
Descrição das variaveis acima:
dc_eximconfig_configtype='smarthost' # veja as configurações detalhadas abaixo
dc_other_hostnames='COLOQUE AQUI O HOSTNAME SECUNDARIO'
dc_local_interfaces='127.0.0.1'
dc_readhost='COLOQUE AQUI O HOSTNAME PRINCIPAL'
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets='COLOQUE AQUI SEUS IPS'
dc_smarthost='COLOQUE AQUI SEU SMARTHOST' # se vc não souber pergunte para o seu provedor de acesso (é o servidor de smtp do seu provedor)
CFILEMODE='644'
dc_use_split_config='false'
dc_hide_mailname='true'
dc_mailname_in_oh='true'
dc_localdelivery='mail_spool'
Geralmente o "problema" esta nesta variavel dc_eximconfig_configtype em caso de duvida pergunte ao seu provedor de acesso qual deve usar.
Não esquecer de mudar:
de www-data para o e-mail desejado:
vi /etc/email-addresses
hostname desejado
vi /etc/hosts
vi /etc/hostname
Não esquecer de tirar totalmente o sendmail:
sudo apt-get --purge remove sendmail-base sendmail-cf sendmail-doc
Descrição das variaveis acima:
- CFILEMODE
- The octal file mode of the generated file.
- dc_eximconfig_configtype
- The main configuration type. One of internet, smarthost, satellite, local, exim3manual or none.
- dc_hide_mailname
- Boolean option that controls whether the local mailname in the headers of outgoing mail should be hidden. (Only effective for smarthost and satellite.
- dc_mailname_in_oh
- Internal use only Boolean option that is set by the maintainer scripts after adding the contents of /etc/mailname to the dc_other_hostnames list. This is a transition helper since it wouldn't otherwise be possible to see whether that domain name has been removed from dc_other_hostnames on purpose.
- ue4c_keepcomments
- Boolean option that controls whether update-exim4.conf strips the comments from the target configuration file (default) or leaves them in. This can be overridden by the command line options --keepcomments and --removecomments.
- dc_localdelivery
- name of the default transport for local mail delivery. Defaults to mail_spool if unset, use maildir_home for delivery to ~/Maildir/. This setting does not correspond to a Debconf question and needs to be set manually.
- dc_local_interfaces
- Used as the value for Exim's main configuration option local_interfaces.
- dc_minimaldns
- Boolean option to activate some option to minimize DNS lookups, if set to true a macro DC_minimaldns is defined.
- dc_other_hostnames
- is used to build the local_domains hostlist, together with localhost. This is the list of domains for which this machine should consider itself the final destination.
- dc_readhost
- For smarthost and satellite it is possible to hide the local mailname in the headers of outgoing mail and replace it with this value instead, using rewriting.
- dc_relay_domains
- is used to populate the relay_to_domains domainlist, a list of domains for which we accept mail from anywhere on the Internet but which are not delvered locally, e.g. because this machine serves as secondary MX for these domains.
- dc_relay_nets
- A list of machines (hostlist) for which we serve as smarthost. Used to populate the relay_from_hosts hostlist. Please note that in the default configuration, 127.0.0.1 and ::::1 are always permitted to relay since /usr/lib/sendmail is available anyway and relay control doesn't make sense here.
- dc_smarthost
- List of hosts to which all outgoing mail is passed to and that takes care of delivering it. Multiple hosts are colon separated. Each of the hosts is tried, in the order specified (See exim specification, chapter 20.5). All deliveries go out to TCP port 25. Specifying different ports is not (yet) possible due to upstream restrictions. Used as value of the DCsmarthost macro.
- dc_use_split_config
- Boolean option that controls whether update-exim4.conf uses /etc/exim4/exim4.conf.template (false) or the multiple files below /etc/exim4/conf.d (true) as input.
terça-feira, 16 de outubro de 2012
javascript - getelementbyid select / option
HTML:
<select name='chegada' id='chegada'>
<option value='valor1'>valor1</option>
<option value='valor2'>valor2</option>
</select>
JavaScript:
<script>
chegada_valor = document.getElementById("chegada").selectedIndex;
alert (chegada_valor);
</script>
OU
<script>
chegada_valor =
document.getElementById("chegada").value;alert (chegada_valor);
</script>
MySQL - Transformar coluna upper / lower
Para transformar toda a colunada tabela:
UPDATE tabela SET empresa = UPPER(empresa), email = lower(email);
terça-feira, 9 de outubro de 2012
jquery com PHP - Ordenar campos e salvar no MySQL - Re-Order MySQL and Jquery + PHP - Site and mobile
ATUALIZADO em -- UPDATED in: 24.06.2020
src="https://code.jquery.com/ui/1.12.0/jquery-ui.min.js"
integrity="sha256-eGE6blurk5sHj+rmkfsGYeKyZx3M4bG+ZlFyA7Kns7E="
crossorigin="anonymous"></script>
<script src="js/jquery.ui.touch-punch.min.js"></script> <!-- To work in Mobiles -->
<style>
#ordenacao ul { list-style-type: none; margin: 0; padding: 0; width: 60%; }
#ordenacao li { width:250px; border:solid 3px black; background-color:#ccc; padding: 12px 20px;margin-top:10px;border-radius: 4px; box-sizing: border-box; cursor: move; }
/*#ordenacao li span { position: absolute; margin-left: -1.3em; }*/
</style>
<?php
// make your db connection up here ...
include_once "SUA_CONEXAO.php";
// handle POST
if ($_POST) {
// use $i to increment the order
$i=1;
// loop through post array in the order it was submitted
foreach ($_POST['item'] as $item_id) {
// update the row
$result = $pdo->prepare("UPDATE SUA-TABELA SET ordem=".$i." WHERE id=".($item_id));
$result->execute();
// increment order to make the next item "heavier"
$i++;
}
echo "ok";
exit;
}
?>
<script type="text/javascript">
// when the entire document has loaded, run the code inside this function
$(document).ready(function(){
$('#ordenacao').sortable();
});
</script>
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']?>">
<ul id="ordenacao">
<?php // query fruit table and print out each item
$result = $pdo->prepare("SELECT id, data, ordem FROM SUA-TABELA ORDER BY ordem");
$result->execute();
// print the list items
while ($row = $result->fetch()) {
echo '<li>
<input type="hidden" name="item[]" value="'.$row['id'].'" />
'.$row['data'].'</li>';
}
?>
</ul>
<p></p>
<div style='float:left;width:100%;text-align:center;display:block;clear: both;'>
<button type='submit' class='btn2'>ORDERNAR</button>
</div>
</form>
===================================
Jquey Touch link and how to is here:
https://github.com/furf/jquery-ui-touch-punch
terça-feira, 2 de outubro de 2012
Ubuntu saber qual cpu e memória
Para saber o tipo de Maquina do seu servidor:
lshw -C cpu
OU
cat /proc/cpuinfo
cat /proc/meminfo
Para saber qual o sistema instalado 32 ou 64 bits:
file /bin/bash | cut -d' ' -f3
ou
uname -m
se a resposta for i686 é 32 bits.
Mac upgrade do Snow Leopard para Lion
Para quem teve o mesmo problema que eu: Falha no disco rigido...
Este problema no meu caso foi gerado devido a eu ter particionado o HD. Não há uma solução da mac para isso e eu não achei nada na internet que pudesse voltar minha instalação prévia (fica a dica para o pessoal da MAC...), pois uma vez q vc começa a fazer a instalação do novo OS, adeus instalação antiga.
Como eu já tinha perdido mesmo a instalação do Snow Leopard, fiz uma nova instalação do Zero usando meu CD de instalação do Snow Leopard (coloque o cd e reinicie o computador e fique segurando a tecla "C") e depois usando o Time Machine e alguns comandos no Terminal para poder "ver"algumas pastas e arquivos, com isso consegui recuperar senhas, fontes, lista de favoritos do FireFox/Chrome, arquivos e dados preciosos.
Comando no Terminal para que vc possa "ver" todos os arquivos e pastas ocultos:
defaults write com.apple.Finder AppleShowAllFiles TRUE;
killall Finder;
Comando no terminal para que vc possa "esconder" todos os arquivos e pastas:
defaults write com.apple.Finder AppleShowAllFiles FALSE;
killall Finder;
Lembrete: Sempre faça um backup completo via Time Machine, em HD externo, antes de tentar qualquer upgrade de OS.
segunda-feira, 17 de setembro de 2012
MySQL / PHP - Maiúsculas e Minúsculas
Utilizar UCASE para maiúsculas e LCASE para minúsculas.
$sql_pais=mysql_query("select id, UCASE(porto) as portoU, pais from portos");
$porto=$linha_pais['portoU'];
Apenas uma observação a coluna porto na base MySQL esta como utf8_unicode_ci não testei esse comando para latin1...
Assinar:
Postagens (Atom)
Linux bash file returns unexpected token `$'do\r''
open file in vi edit with vi filename.sh command; type in vi :set ff=unix command; save file with :wq It will save the file with unix...
-
Adicionar ♦ 10 dias a partir de hoje echo date('d/m/Y', strtotime("+10 days")); ♦ 10 dias a partir de uma data echo ...
-
function retira_acentos($texto) { $array1 = array( "á", "à", "â", "ã", "ä", "é...