<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7533010044153504067</id><updated>2024-10-07T00:59:01.236-03:00</updated><category term="Banco de Dados"/><category term="Delphi"/><category term="IBM DB2"/><category term="C#"/><category term="Columns_Updated"/><category term="DataGridView"/><category term="Linux"/><category term="SQL Server"/><category term="Shell Script"/><category term="Visual Studio"/><title type='text'>Desenvolvimento em T.I.</title><subtitle type='html'>Compartilhar é evoluir !</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://tidevelopers.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7533010044153504067/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://tidevelopers.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Grupo - T.I. Developers</name><uri>http://www.blogger.com/profile/17857091138024315345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>8</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7533010044153504067.post-1821692195697123218</id><published>2010-05-06T09:25:00.002-03:00</published><updated>2010-05-06T09:25:40.766-03:00</updated><title type='text'>Delphi - Excluindo um registro do windows variável</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;Todo mundo já deve conhecer sobre a manipulação de registros do Windows através do Delphi, então o que eu vou mostrar é um exemplo prático do que você pode fazer.&lt;br /&gt;
&lt;br /&gt;
Conteúdo dessa postagem:&lt;br /&gt;
- Listar pastas de uma determinada chave de registro.&lt;br /&gt;
- Buscar através de uma lista de pastas, uma pasta com um caracter coringa.&lt;br /&gt;
- Verificar existência de uma chave de registro.&lt;br /&gt;
- Excluir uma chave de registro.&lt;br /&gt;
&lt;br /&gt;
Antes de mais nada, temos que declarar a biblioteca Registry no projeto.&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;pre class=&quot;brush:sql&quot;&gt;uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ComCtrls, StdCtrls, Registry;
&lt;/pre&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt; &lt;br /&gt;
Já declarada, você poderá manipular variáveis do tipo TRegistry, vou colocar a procedure inteira mas você pode parametrizar ela conforme a sua necessidade.&lt;br /&gt;
A procedure abaixo apaga um determinado registro fixo no programa, mas o problema é que a primeira chave é variável, ou seja, não tem como passar um caminho fixo para excluir o registro.&lt;br /&gt;
A solução foi executar um loop, buscando pelo caracter coringa, até encontrar o registro a excluir.&lt;br /&gt;
&lt;br /&gt;
Raiz: HKEY_USERS &lt;br /&gt;
Chave: S-1-5-21-xxxxxxxxxx-xxxxxxxxx-xxxxxxxxxx-xxxx\Software\SimonTatham\putty\SshHostKeys\&lt;br /&gt;
onde xxxxxxxxxx-xxxxxxxxx-xxxxxxxxxx-xxxx é variável de computador para computador.&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;pre class=&quot;brush:sql&quot;&gt;procedure ApagaRegistrosWindows;
var i : integer;
    RegWin : TRegistry;
    achou, fim : boolean;
    Chaves : TStringList;
begin
   RegWin := TRegistry.Create; // Chama o construtor do objeto
   RegWin.RootKey := HKEY_USERS; // seta raiz do registro

   Chaves := TStringList.Create; // cria uma stringlist para referência
   RegWin.OpenKey(&#39;&#39;, False); // abre a pasta da raiz caso exista
   RegWin.GetKeyNames(Chaves); // associa as pastas para a stringlist

   // inicializa variáveis
   i := 0;
   achou := false;
   fim := false;

   while ((not achou) and (not fim)) do
   begin
      // busca a chave que contém &#39;S-1-5-21&#39; e não contenha a palavra &#39;Classes&#39;
      if ((Pos(&#39;S-1-5-21&#39;, Chaves.Strings[i]) &amp;gt; 0) and (Pos(&#39;Classes&#39;, Chaves.Strings[i]) = 0)) then
         achou := true
      else if i = Chaves.Count-1 then // se estiver no último registro, termina
         fim := true
      else Inc(i); // se não encontrar, incrementa o contador
   end;

   if achou = true then
   begin
      // facilitando a vida do programador
      Chaves.Strings[i] := Chaves.Strings[i] + &#39;\Software\SimonTatham\PuTTY\SshHostKeys&#39;;

      // verifica se o registro existe
      if RegWin.KeyExists(Chaves.Strings[i]) then
         RegWin.DeleteKey(Chaves.Strings[i]); // apaga o registro se existir
   end;

   RegWin.CloseKey; // Fecha a chave e o objeto
   RegWin.Free; // Libera o registro da memória
   Chaves.Free; // Libera a stringList da memória
end;
&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;T.I. Developers - Desenvolvimento em T.I. - &quot;Compartilhar é evoluir !&quot;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tidevelopers.blogspot.com/feeds/1821692195697123218/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://tidevelopers.blogspot.com/2010/05/delphi-excluindo-um-registro-do-windows.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7533010044153504067/posts/default/1821692195697123218'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7533010044153504067/posts/default/1821692195697123218'/><link rel='alternate' type='text/html' href='http://tidevelopers.blogspot.com/2010/05/delphi-excluindo-um-registro-do-windows.html' title='Delphi - Excluindo um registro do windows variável'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7533010044153504067.post-7414984946412221943</id><published>2010-04-28T15:22:00.005-03:00</published><updated>2010-04-28T15:27:11.345-03:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Banco de Dados"/><category scheme="http://www.blogger.com/atom/ns#" term="Columns_Updated"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server"/><title type='text'>SQL Server - Analisando qual campo foi alterado via trigger</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#444444;&quot;&gt; &lt;br /&gt;
Muitas vezes precisamos validar se uma &quot;coluna x&quot; foi alterado dentro de uma trigger.&lt;br /&gt;
No SQL Server, temos duas maneiras de fazer tal validação.&lt;br /&gt;
&lt;br /&gt;
1) A função Update(nome_coluna) retorna um valor boolean se tal coluna for alterada;&lt;br /&gt;
2) E a função Columns_Updated() que retorna um varbinary;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;1) Para comparar duas colunas de uma tabela sem se independente das outras, o Update resolve bem o problema.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;pre class=&quot;brush:sql&quot;&gt;If (Update(col1) And Update(col2))
   Print &#39;Coluna 1 e Coluna 2 foram alteradas.&#39;
&lt;/pre&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#444444;&quot;&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;2) Agora, se você quiser comparar uma coluna que depende de outras, aí você terá que utilizar o Columns_Updated(). Essa função retorna uma variável onde cada byte representa 8 colunas da sua tabela. Começando da esquerda para a direita, o primeiro byte referencia da 1ª a 8ª coluna. O segundo byte referencia da 9ª a 16ª coluna e assim por diante.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Falando em linguagem binária, temos 8 bits em que cada posição desse bit referencia a 8 colunas da sua tabela.&lt;br /&gt;
Exemplo 1: 00000000 (Nenhuma alteração nas colunas)&lt;br /&gt;
Exemplo 2: 00000100 (A 3ª coluna foi alterada)&lt;br /&gt;
Exemplo 3: 10100000 (A 6ª e 8ª colunas foram alteradas)&lt;br /&gt;
&lt;br /&gt;
Em decimal, temos:&lt;br /&gt;
&lt;br /&gt;
Exemplo 1: 0 (Nenhuma alteração nas colunas)&lt;br /&gt;
Exemplo 2: 4 (A 3ª coluna foi alterada)&lt;br /&gt;
Exemplo 3: 160 (A 6ª e 8ª colunas foram alteradas)&lt;br /&gt;
&lt;br /&gt;
Bom, chega de falar de teoria e vamos ao código que tudo vai ficar mais simples.&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;pre class=&quot;brush:sql&quot;&gt;-- Exemplo 1:
-- O valor da comparação é feito em decimal e é utilizado uma comparação binária &quot;&amp;&quot; para retonar o valor inteiro da função Columns_Updated()

If (Columns_Updated() &amp; 4) = 4
   Print &#39;Somente a terceira coluna foi alterada&#39;
   
-- Exemplo 2:

If (Columns_Updated() &amp; 0) = 0
   Print &#39;Não houve alteração na tabela&#39;
   
-- Exemplo 3:

If (Columns_Updated() &amp; 160) = 160
   Print &#39;Colunas 6 e 8 foram alteradas&#39;
&lt;/pre&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#444444;&quot;&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;2a) Mas e se a minha tabela tiver mais de 8 colunas? Bom, aí teremos que ler cada byte separadamente, pois cada byte corresponde somente a 8 colunas como já foi dito anteriormente. Os exemplos abaixo são somente para uma tabela de até 16 colunas&lt;/b&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;pre class=&quot;brush:sql&quot;&gt;-- Exemplo 1a:
-- O valor da comparação é feito em decimal e é utilizado uma comparação binária &quot;&amp;&quot; para retonar o valor inteiro da função Columns_Updated()
-- O primeiro substring analisa as 8 primeiras colunas (1ª a 8ª) e depois as 8 próximas colunas (9ª a 16ª)

If ((Substring(Columns_Updated(),1,1) &amp; 4) = 4) And 
    (Substring(Columns_Updated(),2,1) &amp; 1) = 1))    
   Print &#39;Colunas 3 e 9&#39;
   
-- Exemplo 2a:

If ((Substring(Columns_Updated(),1,1) &amp; 160) = 160) And 
    (Substring(Columns_Updated(),2,1) &amp; 21) = 21))      
   Print &#39;Colunas 6, 8, 9, 11 e 13 foram alteradas&#39;
   
-- Exemplo 3a:
-- ao invés de utilizar um número decimal, é possível fazer o cálculo através da função power(2, pos_coluna-1)

If ((Substring(Columns_Updated(),1,1) &amp; (power(2, 6-1) + power(2, 8-1)) ) = power(2, 6-1) + power(2, 8-1)) And 
    (Substring(Columns_Updated(),2,1) &amp; power(2, 1-1) + power(2, 3-1) + power(2, 5-1) ) = power(2, 1-1) + power(2, 3-1) + power(2, 5-1)))
   Print &#39;Colunas 6, 8, 9, 11 e 13 foram alteradas&#39;   
   
-- Exemplo 4: OR (para tabelas com até 8 colunas)
-- é possível validar através do &quot;OU&quot; binário &quot;|&quot;
-- valida se somente as colunas 6 ou 8 foram alterados

If (Columns_Updated() | 160) = 160
   Print &#39;Colunas 6 ou 8 foram alteradas&#39;
   
-- Exemplo 5: XOR (para tabelas com até 8 colunas)
-- é possível validar através do &quot;OU Exclusivo&quot; binário &quot;^&quot;
-- valida se as colunas 6 ou 8 &lt;b&gt;não&lt;/b&gt; foram alterados

If (Columns_Updated() ^ 160) = 160
   Print &#39;Colunas 6 ou 8 não foram alteradas&#39;
&lt;/pre&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-family:&#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#444444;&quot;&gt; &lt;br /&gt;
&lt;br /&gt;
Fim, ufa :)&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;T.I. Developers - Desenvolvimento em T.I. - &quot;Compartilhar é evoluir !&quot;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tidevelopers.blogspot.com/feeds/7414984946412221943/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://tidevelopers.blogspot.com/2010/04/sql-server-analisando-qual-campo-foi_28.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7533010044153504067/posts/default/7414984946412221943'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7533010044153504067/posts/default/7414984946412221943'/><link rel='alternate' type='text/html' href='http://tidevelopers.blogspot.com/2010/04/sql-server-analisando-qual-campo-foi_28.html' title='SQL Server - Analisando qual campo foi alterado via trigger'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7533010044153504067.post-8422374776950261061</id><published>2010-04-26T08:34:00.008-03:00</published><updated>2010-04-27T07:59:07.415-03:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="Shell Script"/><title type='text'>Shell Script - Criação de um script de Backup com o p7zip ou 7za e compactar somente as subpastas de um diretório.</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt; Para realizar um script de backup com a utilização do p7zip ou 7zip, é necessário informar o caminho onde fica o bin do 7zip &quot;/usr/local/bin/7za&quot; pois se utilizar somente o comando &quot;7za&quot; no script, não irá funcionar utilizando o cron para iniciar o script. Portanto para utilizar o p7zip no cron do linux é necessário passar todo o caminho do bin (7za).&lt;br /&gt;
Para realizar o backup por de um diretório e compactando somente as subpastas, utilizei o script abaixo.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;pre class=&quot;brush:shell&quot;&gt;#!/bin/sh
# Para melhor visualização do script irei colocar variáveis no script.
# Para informar que é uma viável é só colocar um $ antes da variável.
# Para exempĺo irei realizar a compactação da pasta /root e irei colocar os arquivos de backup em /BKP.


##### Setando as variáveis
# Arquivos de backup.
BKP_PASTA=/BKP/

# Temporário para ler as pastas do diretório.
TMP=/BKP/txt.tmp

# Setando a variável &quot;x&quot; para 1 (Esse onde ele começa a pegar a linha)
x=1

# Captura o número de pastas. (no caso no /root/) 
N_PASTAS=$(ls -d /root/*/ |wc -l)


### Inicio do Script
cd /root
# Captura as pastas do diretório (no caso o /root)
ls -d * &amp;gt; $TMP

# Utilizo o while para ele percorrer as linhas da variável TMP para realizar o backup das pastas
while [ $x -le $N_PASTAS ];
do

# Neste ponto ele lê a linha onde a variável &quot;x&quot; onde está apontado
L_TMP=$(cat $TMP | head -n $x | tail -n 1);

# Realiza o processo de compactação com o 7za
# Como dito, para a utilização do p7zip ou 7za deve-de fazer da forma abaixo
# Neste ponto ele faz a compactação e joga para o diretório de Backup definido anteriormente e compacta a pasta onde o &quot;x&quot; está apontando.
/usr/local/bin/7za a -sfx -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on tar -jcvf $BKP_PASTA$L_TMP.exe  /root/$L_TMP 

# Incrementa mais 1 no x, fazendo assim pulando para a pŕoxima linha.
x=$((x+1));
}

done; # Sai do While

##### FIM
&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;T.I. Developers - Desenvolvimento em T.I. - &quot;Compartilhar é evoluir !&quot;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tidevelopers.blogspot.com/feeds/8422374776950261061/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://tidevelopers.blogspot.com/2010/04/criacao-de-um-script-de-backup-com-o.html#comment-form' title='3 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7533010044153504067/posts/default/8422374776950261061'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7533010044153504067/posts/default/8422374776950261061'/><link rel='alternate' type='text/html' href='http://tidevelopers.blogspot.com/2010/04/criacao-de-um-script-de-backup-com-o.html' title='Shell Script - Criação de um script de Backup com o p7zip ou 7za e compactar somente as subpastas de um diretório.'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7533010044153504067.post-999541975366494245</id><published>2010-04-23T15:03:00.003-03:00</published><updated>2010-04-28T07:43:05.869-03:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Banco de Dados"/><category scheme="http://www.blogger.com/atom/ns#" term="IBM DB2"/><title type='text'>IBM DB2 - Criando Tabela temporária a partir de um Select</title><content type='html'>&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;Criando Tabela temporária a partir de um Select:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;&lt;pre class=&quot;brush:sql&quot;&gt;DECLARE GLOBAL TEMPORARY TABLE TAB_TEMP AS (SELECT NOME FROM TABELA) WITH NO DATA&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #cc0000;&quot;&gt;OBS:&lt;/span&gt; com esta instrução não é retornado dados do select.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;&lt;br /&gt;
Criando uma tabela temporária a partir de um Select e inserindo os registros do Select:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;pre class=&quot;brush:sql&quot;&gt;DECLARE GLOBAL TEMPORARY TABLE TAB_TEMP AS (SELECT * FROM TABELA) DEFINITION ONLY ON COMMIT PRESERVE ROWS;
&lt;/pre&gt;&lt;pre class=&quot;brush:sql&quot;&gt;INSERT INTO SESSION.TAB_TEMP SELECT * FROM TABELA;&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;T.I. Developers - Desenvolvimento em T.I. - &quot;Compartilhar é evoluir !&quot;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tidevelopers.blogspot.com/feeds/999541975366494245/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://tidevelopers.blogspot.com/2010/04/ibm-db2-criando-tabela-temporaria_6445.html#comment-form' title='1 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7533010044153504067/posts/default/999541975366494245'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7533010044153504067/posts/default/999541975366494245'/><link rel='alternate' type='text/html' href='http://tidevelopers.blogspot.com/2010/04/ibm-db2-criando-tabela-temporaria_6445.html' title='IBM DB2 - Criando Tabela temporária a partir de um Select'/><author><name>Renato Sousa</name><uri>http://www.blogger.com/profile/00016711721344148486</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7533010044153504067.post-1072885217527816007</id><published>2010-04-23T08:28:00.002-03:00</published><updated>2010-04-28T07:43:05.869-03:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Banco de Dados"/><category scheme="http://www.blogger.com/atom/ns#" term="IBM DB2"/><title type='text'>IBM DB2 - Criando tabela temporária</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;O comando SQL abaixo demonstra como criar uma tabela temporária no banco de dados IBM DB2:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;pre class=&quot;brush:delphi&quot;&gt;DECLARE GLOBAL TEMPORARY TABLE TEMP_EMP
   (EMPNO CHAR(6) NOT NULL,
    NOME VARCHAR(12) NOT NULL,
    ATIVO CHAR(1) NOT NULL,
    RAMO VARCHAR(15) NOT NULL,
    DEPTO CHAR(3),
    FONE CHAR(4)
   );&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;T.I. Developers - Desenvolvimento em T.I. - &quot;Compartilhar é evoluir !&quot;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tidevelopers.blogspot.com/feeds/1072885217527816007/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://tidevelopers.blogspot.com/2010/04/ibm-db2-criando-tabela-temporaria_23.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7533010044153504067/posts/default/1072885217527816007'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7533010044153504067/posts/default/1072885217527816007'/><link rel='alternate' type='text/html' href='http://tidevelopers.blogspot.com/2010/04/ibm-db2-criando-tabela-temporaria_23.html' title='IBM DB2 - Criando tabela temporária'/><author><name>Renato Sousa</name><uri>http://www.blogger.com/profile/00016711721344148486</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7533010044153504067.post-4201817861871738658</id><published>2010-04-22T07:53:00.014-03:00</published><updated>2010-04-24T11:18:13.333-03:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Delphi"/><title type='text'>Delphi - Impedir que abra duas instâncias da mesma aplicação</title><content type='html'>&lt;div class=&quot;gmail_quote&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;O código abaixo demonstra como impedir que seja aberto duas instâncias da aplicação Delphi.&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;&amp;nbsp;Essa consistência deve ser colocada na unit do projeto(.dpr) de sua aplicação.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;gmail_quote&quot;&gt;&lt;br /&gt;
&lt;pre class=&quot;brush:delphi&quot;&gt;Var hd : THandle;
Begin
   hd := FindWindow(&#39;TApplication&#39;, &#39;NomeDaAplicação&#39;); // Localizando janela de acordo com o nome da aplicação
   If hd = 0 Then // Verificando se a aplicação com o nome passado acima já esta aberto.
   Begin
      Application.Title := &#39;NomeDaAplicação&#39;; // Definindo um nome para aplicação
      Application.Initialize;
      Application.CreateForm(TForm1, Form1);
      Application.Run;
   End;
End.
&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;T.I. Developers - Desenvolvimento em T.I. - &quot;Compartilhar é evoluir !&quot;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tidevelopers.blogspot.com/feeds/4201817861871738658/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://tidevelopers.blogspot.com/2010/04/delphi-impedir-que-abra-duas-instancias.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7533010044153504067/posts/default/4201817861871738658'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7533010044153504067/posts/default/4201817861871738658'/><link rel='alternate' type='text/html' href='http://tidevelopers.blogspot.com/2010/04/delphi-impedir-que-abra-duas-instancias.html' title='Delphi - Impedir que abra duas instâncias da mesma aplicação'/><author><name>Renato Sousa</name><uri>http://www.blogger.com/profile/00016711721344148486</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7533010044153504067.post-3838967800413466638</id><published>2010-04-20T12:43:00.006-03:00</published><updated>2010-04-24T21:50:22.236-03:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="C#"/><category scheme="http://www.blogger.com/atom/ns#" term="DataGridView"/><category scheme="http://www.blogger.com/atom/ns#" term="Visual Studio"/><title type='text'>C# - Colorir linha do DataGridView</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;O trecho de código abaixo demonstra de forma simples como colorir um linha do DataGridView utilizando o evento RowPrePaint.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div&gt;&lt;pre class=&quot;brush:csharp&quot;&gt;private void DataGridView_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
{
&amp;nbsp;&amp;nbsp; DataGridView dgv = sender as DataGridView;
&amp;nbsp;&amp;nbsp; /* Pegando valor de uma celula do DataGridView */
&amp;nbsp;&amp;nbsp; string valor = dgv.Rows[e.RowIndex].Cells[1].Value.ToString();
&amp;nbsp;&amp;nbsp; if (/*Sua Condição. Ex: valor = 1 */)
&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;/* Alterando cor do Fundo */
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;dgv.CurrentRow.DefaultCellStyle.BackColor = Color.Blue;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;/* Alterando cor da fonte */
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;dgv.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.Red;
&amp;nbsp;&amp;nbsp; }
}
&lt;/pre&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;T.I. Developers - Desenvolvimento em T.I. - &quot;Compartilhar é evoluir !&quot;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tidevelopers.blogspot.com/feeds/3838967800413466638/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://tidevelopers.blogspot.com/2010/04/c-colorir-linha-do-datagridview_20.html#comment-form' title='3 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7533010044153504067/posts/default/3838967800413466638'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7533010044153504067/posts/default/3838967800413466638'/><link rel='alternate' type='text/html' href='http://tidevelopers.blogspot.com/2010/04/c-colorir-linha-do-datagridview_20.html' title='C# - Colorir linha do DataGridView'/><author><name>Renato Sousa</name><uri>http://www.blogger.com/profile/00016711721344148486</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7533010044153504067.post-8622776408928440720</id><published>2010-04-01T11:52:00.011-03:00</published><updated>2010-04-25T15:41:22.958-03:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Delphi"/><title type='text'>Delphi - Parâmetros de Valor Default</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Para declarar um procedimento ou função que contém parâmetros de valor default, siga o tipo do parâmetro com um sinal de igual e o valor default como mostrado no exemplo seguinte:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;brush:delphi&quot;&gt;procedure FuncaoComValorDefault(Str: string; I: Integer = 0);
&lt;/pre&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;O procedimento FuncaoComValorDefault() pode ser chamado de uma das formas. Primeiro, você pode chamar especificando os dois parâmetros:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;brush:delphi&quot;&gt;FuncaoComValorDefault(&#39;Passando valor&#39;, 26);
&lt;/pre&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Segundo, você pode especificar apenas o parâmetro S e usar o valor default para I:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;pre class=&quot;brush:delphi&quot;&gt;FuncaoComValorDefault(&#39;Usando valor default&#39;); //Neste caso é usado o valor default 0 para I
&lt;/pre&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Você deve seguir várias regras quando usar parâmetros de valor default:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Parâmetro que tem valor default devem aparecer no fim da lista de parâmetros. Parâmetros sem valores default não podem seguir parâmetros com valores default em uma lista de parâmetros de uma função ou procedimento.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Parâmetros de valor default devem ser de um tipo ordinal, ponteiro ou set.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Parâmetros de valor default devem ser passados por valor ou como constante. Eles não devem ser parâmetros de referência, out ou sem tipo.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Um dos maiores benefícios dos parâmetros de valor default é adicionar funcionalidade a funções e procedimentos existentes sem sacrificar compatibilidades anteriores, ou seja, se você já estiver utilizando a função em alguma parte do seu código e precisar adicionar um novo parâmetro que será utilizado somente por uma rotina especifica em outra parte código, o parâmetro com valor default irá livra-lo do retrabalho de alterar todas as chamadas a esta função.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;Adaptado de: &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;&lt;a href=&quot;http://www.fundao.wiki.br/articles.asp?cod=47&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;http://www.fundao.wiki.br/articles.asp?cod=47&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Trebuchet MS&#39;, sans-serif;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #444444;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: small;&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;T.I. Developers - Desenvolvimento em T.I. - &quot;Compartilhar é evoluir !&quot;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tidevelopers.blogspot.com/feeds/8622776408928440720/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://tidevelopers.blogspot.com/2010/04/parametros-de-valor-default-no-delphi.html#comment-form' title='1 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7533010044153504067/posts/default/8622776408928440720'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7533010044153504067/posts/default/8622776408928440720'/><link rel='alternate' type='text/html' href='http://tidevelopers.blogspot.com/2010/04/parametros-de-valor-default-no-delphi.html' title='Delphi - Parâmetros de Valor Default'/><author><name>Grupo - T.I. Developers</name><uri>http://www.blogger.com/profile/17857091138024315345</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry></feed>