Amigo leitor,
Talvez você possa estar com dificuldades para criar um campo auto increment no PostgreSQL e não consiga resolver.
Não existe auto increment no PostgreSQL, o que existe é um tipo de campo do tipo serial, no final das contas ele resolve o problema.
Como criar uma tabela cujo o id é auto increment?
CREATE TABLE professorcoruja (
id SERIAL,
descricao varchar(255),
CONSTRAINT professorcoruja_pkey PRIMARY KEY(id)
);
Quando você executar no pgAdminIII o resultado sera:
NOTICE: CREATE TABLE will create implicit sequence "professorcoruja_id_seq" for serial column "professorcoruja.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "professorcoruja_pkey" for table "professorcoruja"
Query returned successfully with no result in 62 ms
Traduzindo isso vai criar uma sequencia com o nome "professorcoruja_id_seq".
Para fazer inserts na tabela professorcoruja veja o exemplo abaixo:
INSERT INTO professorcoruja VALUES
(DEFAULT, 'Professor Coruja Teste')
Boa sorte!!!
Saturday, May 30, 2009
Campo Auto Increment no PostgreSQL
Marcadores:
Campo Auto Increment no PostgreSQL
Basic Install of PostgreSQL (Linux Ubuntu)
Hello folks,
Below there are a step by step explaining how to install PostgreSQL 8.3 on Linux Ubuntu.
Installing postgresql (8.3)
Below there are a step by step explaining how to install PostgreSQL 8.3 on Linux Ubuntu.
Installing postgresql (8.3)
sudo apt-get install postgresql-8.3
Setting up the password for postgres’ postgres user
sudo -u postgres psql template1
ALTER USER postgres WITH PASSWORD 'your-password';
\q
Configure postgres’ authentication method :
sudo cp /etc/postgresql/8.3/main/pg_hba.conf /etc/postgresql/8.3/main/pg_hba.conf_bak
sudo vi /etc/postgresql/8.3/main/pg_hba.conf
Add the following at the bottom of the file
# TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD
host all all 127.0.0.1 255.255.255.0 password
Marcadores:
Basic Install of PostgreSQL (Linux Ubuntu)
This error usually means that PostgreSQL's request for a shared memory segment
Bom dia amigo leitor,
Fiz o update do meu laptop com ubuntu 8.10 (64bits) para a nova versão 9.04 (64 bits) do Ubuntu e o PostgreSQL 8.3 parou de funcionar exibindo a seguinte mensagem de erro:
Extraído do meu shell script.
root@coruja-mobile:/home/caio# /etc/init.d/postgresql-8.3 start
* Starting PostgreSQL 8.3 database server * The PostgreSQL server failed to start. Please check the log output:
2009-05-30 08:23:14 BRT LOG: could not load root certificate file "root.crt": no SSL error reported
2009-05-30 08:23:14 BRT DETAIL: Will not verify client certificates.
2009-05-30 08:23:14 BRT FATAL: could not create shared memory segment: Invalid argument
2009-05-30 08:23:14 BRT DETAIL: Failed system call was shmget(key=5432001, size=39288832, 03600).
2009-05-30 08:23:14 BRT HINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded your kernel's SHMMAX parameter. You can either reduce the request size or reconfigure the kernel with larger SHMMAX. To reduce the request size (currently 39288832 bytes), reduce PostgreSQL's shared_buffers parameter (currently 4096) and/or its max_connections parameter (currently 103).
If the request size is already small, it's possible that it is less than your kernel's SHMMIN parameter, in which case raising the request size or reconfiguring SHMMIN is called for.
The PostgreSQL documentation contains more information about shared memory configuration.
[fail]
root@coruja-mobile:/home/caio#
Como resolver?
Muito simples abaixo segue os passos:
Edite o arquivo /etc/postgresql/8.3/main/postgresql.conf
Eu gosto de utilizar o Jed, mas tanto faz podem utilizar o famoso vi
root@coruja-mobile:/home/caio# jed /etc/postgresql/8.3/main/postgresql.conf
Procure pelo parametro shared_buffers e altere o valor da variável de 32MB para 26MB.
# - Memory -
shared_buffers = 26MB # min 128kB or max_connections*16kB
# (change requires restart)
Depois de salvo, reinicie o PostgreSQL
root@coruja-mobile:/home/caio# /etc/init.d/postgresql-8.3 start
* Starting PostgreSQL 8.3 database server [ OK ]
Pronto funcionou!!!
Fiz o update do meu laptop com ubuntu 8.10 (64bits) para a nova versão 9.04 (64 bits) do Ubuntu e o PostgreSQL 8.3 parou de funcionar exibindo a seguinte mensagem de erro:
Extraído do meu shell script.
root@coruja-mobile:/home/caio# /etc/init.d/postgresql-8.3 start
* Starting PostgreSQL 8.3 database server * The PostgreSQL server failed to start. Please check the log output:
2009-05-30 08:23:14 BRT LOG: could not load root certificate file "root.crt": no SSL error reported
2009-05-30 08:23:14 BRT DETAIL: Will not verify client certificates.
2009-05-30 08:23:14 BRT FATAL: could not create shared memory segment: Invalid argument
2009-05-30 08:23:14 BRT DETAIL: Failed system call was shmget(key=5432001, size=39288832, 03600).
2009-05-30 08:23:14 BRT HINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded your kernel's SHMMAX parameter. You can either reduce the request size or reconfigure the kernel with larger SHMMAX. To reduce the request size (currently 39288832 bytes), reduce PostgreSQL's shared_buffers parameter (currently 4096) and/or its max_connections parameter (currently 103).
If the request size is already small, it's possible that it is less than your kernel's SHMMIN parameter, in which case raising the request size or reconfiguring SHMMIN is called for.
The PostgreSQL documentation contains more information about shared memory configuration.
[fail]
root@coruja-mobile:/home/caio#
Como resolver?
Muito simples abaixo segue os passos:
Edite o arquivo /etc/postgresql/8.3/main/postgresql.conf
Eu gosto de utilizar o Jed, mas tanto faz podem utilizar o famoso vi
root@coruja-mobile:/home/caio# jed /etc/postgresql/8.3/main/postgresql.conf
Procure pelo parametro shared_buffers e altere o valor da variável de 32MB para 26MB.
# - Memory -
shared_buffers = 26MB # min 128kB or max_connections*16kB
# (change requires restart)
Depois de salvo, reinicie o PostgreSQL
root@coruja-mobile:/home/caio# /etc/init.d/postgresql-8.3 start
* Starting PostgreSQL 8.3 database server [ OK ]
Pronto funcionou!!!
Tuesday, May 26, 2009
Pentaho BI Suite 3.0 stable
Pessoal,
Não sei quantos de vocês viram, mas saiu a versão "stable" do Pentaho 3.0.
Para baixar acesse:
http://sourceforge.net/projects/pentaho/
Não sei quantos de vocês viram, mas saiu a versão "stable" do Pentaho 3.0.
Para baixar acesse:
http://sourceforge.net/projects/pentaho/
Marcadores:
Pentaho
Batalha da nova geração de smartphones
Pessoal,
Escolher um smartphone é uma tarefa bem complicada, para ajudar quem está nessa angustia eu recomendo uma matéria que saiu comparando 4 brinquedinhos.
Batalha da nova geração de smartphones
http://macworldbrasil.uol.com.br/dicas/2009/05/25/batalha-da-nova-geracao-de-smartphones/
Escolher um smartphone é uma tarefa bem complicada, para ajudar quem está nessa angustia eu recomendo uma matéria que saiu comparando 4 brinquedinhos.
Batalha da nova geração de smartphones
http://macworldbrasil.uol.com.br/dicas/2009/05/25/batalha-da-nova-geracao-de-smartphones/
Marcadores:
Batalha da nova geração de smartphones
Saturday, May 23, 2009
java.lang.OutOfMemoryError: PermGen space
Pessoal,
Se você tem o erro abaixo em sua apliacação java:
java.lang.OutOfMemoryError: PermGen space
15:19:09,089 ERROR [[default]] Servlet.service() for servlet default threw exception
java.lang.OutOfMemoryError: PermGen space
A solução é:
http://codare.net/2007/01/11/java-solucionando-o-erro-de-permgen-space/
Mais informações:
http://www.jroller.com/agileanswers/entry/preventing_java_s_java_lang
http://stackoverflow.com/questions/88235/how-to-deal-with-java-lang-outofmemoryerror-permgen-space-error
Se você está tendo esse problema com seu Tomcat + Pentaho veja o link abaixo:
http://forums.pentaho.org/showthread.php?t=50872
Se você tem o erro abaixo em sua apliacação java:
java.lang.OutOfMemoryError: PermGen space
15:19:09,089 ERROR [[default]] Servlet.service() for servlet default threw exception
java.lang.OutOfMemoryError: PermGen space
A solução é:
http://codare.net/2007/01/11/java-solucionando-o-erro-de-permgen-space/
Mais informações:
http://www.jroller.com/agileanswers/entry/preventing_java_s_java_lang
http://stackoverflow.com/questions/88235/how-to-deal-with-java-lang-outofmemoryerror-permgen-space-error
Se você está tendo esse problema com seu Tomcat + Pentaho veja o link abaixo:
http://forums.pentaho.org/showthread.php?t=50872
Marcadores:
java.lang.OutOfMemoryError: PermGen space
MBA com Vito Corleone
Olá amigo leitor,
Não sei quantos de vocês assistiu a trilogia "O Poderoso Chefão", mas quem assistiu sabe como é bom, para quem não assistiu eu recomendo.
Para quem não sabe os três filmes tem duração total de 9 horas, porém são 9 horas muito bem gastas, vale a pena assistir muitas vezes.
Ontem lendo na internet encontrei um artigo interessante, chamado MBA com Vito Corleone, achei bem bacana a comparação feita pelo autor. Para ler o artigo acesse o endereço abaixo.
http://www.administradores.com.br/artigos/mba_com_vito_corleone/24352/
Vale ressaltar algumas frases clássicas de Vito Corleone.
"Ela é bonita, mas para você. Eu só tenho olhos para a minha esposa e filhos", "Um italiano não deve abusar de outros italianos", "Nunca se esqueça de retornar um favor" e "Eu vou fazer uma oferta que você não conseguirá recusar".
Além do filme tem o Jogo para Playstation 3 chamado "O Poderoso Chefão" também muito bacana que eu também recomendo.
Não sei quantos de vocês assistiu a trilogia "O Poderoso Chefão", mas quem assistiu sabe como é bom, para quem não assistiu eu recomendo.
Para quem não sabe os três filmes tem duração total de 9 horas, porém são 9 horas muito bem gastas, vale a pena assistir muitas vezes.
Ontem lendo na internet encontrei um artigo interessante, chamado MBA com Vito Corleone, achei bem bacana a comparação feita pelo autor. Para ler o artigo acesse o endereço abaixo.
http://www.administradores.com.br/artigos/mba_com_vito_corleone/24352/
Vale ressaltar algumas frases clássicas de Vito Corleone.
"Ela é bonita, mas para você. Eu só tenho olhos para a minha esposa e filhos", "Um italiano não deve abusar de outros italianos", "Nunca se esqueça de retornar um favor" e "Eu vou fazer uma oferta que você não conseguirá recusar".
Além do filme tem o Jogo para Playstation 3 chamado "O Poderoso Chefão" também muito bacana que eu também recomendo.
Marcadores:
MBA com Vito Corleone
Saturday, May 16, 2009
OpenOffice (The Free and Open Productivity Suite)
Change My IP Address in Windows Vista
Hello Folks,
Usually I don't use Windows Vista, my laptop runs Ubuntu.
But today I helped remotely (by phone) my brother with a network problem he had, and the solution was "Change his IP Address in Windows Vista".
So I found a good tutorial about it:
http://maximumpcguides.com/windows-vista/change-my-ip-address-in-windows-vista/
This tutorial is good to send to people how doesn't know a lot of computers.
Usually I don't use Windows Vista, my laptop runs Ubuntu.
But today I helped remotely (by phone) my brother with a network problem he had, and the solution was "Change his IP Address in Windows Vista".
So I found a good tutorial about it:
http://maximumpcguides.com/windows-vista/change-my-ip-address-in-windows-vista/
This tutorial is good to send to people how doesn't know a lot of computers.
Marcadores:
Change My IP Address in Windows Vista
Google App Engine supports Java
Hello folks,
Google announced some days ago that they are hosting Java applications on the Google App Engine.
It means that you can host your java web application with them for free, the free service includes:
- up to 500 MB of storage
- 5 million page views a month
- CPU Time: 6.5 hours of CPU time per day
- Bandwidth: 1 gigabyte of data transferred in and out of the application per day
If you need more resources you have to pay for it. To see the billing page click here.
The good thing about this service is that it does a lot of hard work for you, I mean you code your application and host it for free. But if your application becomes famous and you need more resources you have to pay for it on demand, and you don't have to worry about changing for another server or anything.
We are talking about no worries with the infrastructure (servers, datebase, load balancing, etc). The only thing you have to worry about is coding your program and paying for the resources you are using.
Testing the Service
- I did a small java program and signed it in to Google Apps Engine service, for that I had to give my cell phone number to receive a sms with a code, and with this code I was able to continue the registration processes.
After maybe 10 days I was able to start deploying my application because they did some kind of approvement that took a lot of time.
Deploying an application
- Using Eclipse I coded my application and clicked on the "Deploy App Engine Project" button and it automaticly deployed to my google website.
Adding a domain
By default you have a web address (in my case http://caiomsouza.appspot.com/), but you can add a domain if you want to.
So I also did it.
http://googlejava.professorcoruja.com/
One thing, this is just a test page, so please, if you visit don't think it is a production environment.
Docs about it
There are a lot of information about this service, so I won't put them here, but if you want to know more about it please visit:
http://code.google.com/appengine/docs/java/overview.html
It works and it is free
I just want to say that it works and it is free to use (small resource).
Have fun!!!
Google announced some days ago that they are hosting Java applications on the Google App Engine.
It means that you can host your java web application with them for free, the free service includes:
- up to 500 MB of storage
- 5 million page views a month
- CPU Time: 6.5 hours of CPU time per day
- Bandwidth: 1 gigabyte of data transferred in and out of the application per day
If you need more resources you have to pay for it. To see the billing page click here.
The good thing about this service is that it does a lot of hard work for you, I mean you code your application and host it for free. But if your application becomes famous and you need more resources you have to pay for it on demand, and you don't have to worry about changing for another server or anything.
We are talking about no worries with the infrastructure (servers, datebase, load balancing, etc). The only thing you have to worry about is coding your program and paying for the resources you are using.
Testing the Service
- I did a small java program and signed it in to Google Apps Engine service, for that I had to give my cell phone number to receive a sms with a code, and with this code I was able to continue the registration processes.
After maybe 10 days I was able to start deploying my application because they did some kind of approvement that took a lot of time.
Deploying an application
- Using Eclipse I coded my application and clicked on the "Deploy App Engine Project" button and it automaticly deployed to my google website.
Adding a domain
By default you have a web address (in my case http://caiomsouza.appspot.com/), but you can add a domain if you want to.
So I also did it.
http://googlejava.professorcoruja.com/
One thing, this is just a test page, so please, if you visit don't think it is a production environment.
Docs about it
There are a lot of information about this service, so I won't put them here, but if you want to know more about it please visit:
http://code.google.com/appengine/docs/java/overview.html
It works and it is free
I just want to say that it works and it is free to use (small resource).
Have fun!!!
Marcadores:
Google App Engine supports Java
Subscribe to:
Posts (Atom)