Skip to content

Instantly share code, notes, and snippets.

@fabriciocolombo
fabriciocolombo / gist:4119771
Last active October 13, 2015 01:47
PostgreSQL - Change Owner
select 'ALTER FUNCTION ' || quote_ident(routine_schema) || '.' || quote_ident(routine_name) || ' OWNER TO ' ||routine_schema || ';'
from information_schema.routines
where specific_schema NOT LIKE E'pg\\_%'
and specific_schema <> 'information_schema'
and specific_schema <> 'public'
/*AND specific_schema = $YourSchema leave commented for all */
union all
SELECT 'ALTER TABLE ' || quote_ident(s.nspname) || '.' || quote_ident(s.relname) || ' OWNER TO ' || nspname || ';'
FROM (SELECT nspname, relname
FROM pg_class c
@fabriciocolombo
fabriciocolombo / http_codes_family.md
Created September 26, 2012 11:51 — forked from rponte/http_codes_family.md
HTTP codes, we are family

HTTP codes, we are family

Above we have looked at just a few of the available HTTP codes; there are many others. Some are very well-known, such as 404 Not Found, but others are quite obscure and don't crop up very often. Whatever the case, the first digit is always an indication of the family of codes they belong to:

  • 1xx (Informational): Request received, continuing process.
  • 2xx (Successful): The action was successfully received, understood, and accepted.
  • 3xx (Redirection): Further action needs to be taken in order to complete the request.
  • 4xx (Client Error): The request contains bad syntax or cannot be fulfilled.
  • 5xx (Server Error): The server failed to fulfil an apparently valid request.
@fabriciocolombo
fabriciocolombo / gist:3732735
Created September 16, 2012 14:56
BSONArray modify
procedure ReplaceArray;
var
vPerson: IBSONObject;
vAddresses,
vNewAddresses: IBSONArray;
begin
//Insert person
vAddresses := TBSONArray.NewFromValues(['one address', 'two address']);
vPerson := TBSONObject.NewFrom('id', 1).Put('name', 'fabricio').Put('addresses', vAddresses);
FCollection.Save(vPerson);
@fabriciocolombo
fabriciocolombo / gist:3721539
Created September 14, 2012 12:00
Hibernate Connection Leak on Lazy Load
Testing spring web flow with hibernate option AvailableSettings.ENABLE_LAZY_LOAD_NO_TRANS enabled to verify if the connection leak on Lazy Load without transaction disappear
https://hibernate.onjira.com/browse/HHH-7524
@fabriciocolombo
fabriciocolombo / gist:3555254
Created August 31, 2012 16:14
GitHub commit + issues

Synonyms to close an issue with commit message

  • fixes #xxx
  • fixed #xxx
  • fix #xxx
  • closes #xxx
  • close #xxx
  • closed #xxx
@fabriciocolombo
fabriciocolombo / gist:3430899
Created August 23, 2012 00:43
Pentaho Basic Config

Admin console

user: admin
password: password

BI server

user: joe
password: password
@fabriciocolombo
fabriciocolombo / gist:3405794
Created August 20, 2012 16:58
PostgreSQL Backup/Restore
pg_dump.exe --host $host --port 5432 --username $userName --format plain --create --verbose --file $fileName $databaseName
To restore backup done with plain format
psql -a -h $host -p 5432 -U $user -d $database -f $fileName -o restore.log
To restore backup done with other format
pg_restore -h $host -U $user --verbose -d $databaseName -C $backupFileName [2> restore.log]
@fabriciocolombo
fabriciocolombo / gist:3375118
Created August 17, 2012 01:23
JDBC Connection URLs

JDBC Connection URLs for 22 Databases

Source

PostgresSQL JDBC connection URL

jdbc:postgresql:template1
org.postgresql.Driver

MySQL JDBC connection URL

@fabriciocolombo
fabriciocolombo / Agregação x Composição
Created June 29, 2012 16:23
Agregação x Composição
Agregação
Os objetos contidos podem existir sem serem parte do objeto que os contém. Exemplo: Carro -> Rodas. Você pode tirar as rodas do carro antes de destruí-lo e elas podem ser colocadas em outro carro.
Composição
Os objetos contidos não fazem sentido fora do contexto do objeto que os contém.
Exemplo: Pedido -> Itens. Se você destruir o pedido, os itens são destruidos junto, eles não tem sentido fora do pedido.
@fabriciocolombo
fabriciocolombo / Delphi Compiler Messages
Created June 15, 2012 01:35
Delphi Compiler Messages
{$Message Hint 'Feed the cats'} //emits a hint
{$MessaGe Warn 'Looks like rain.'} //emits a warning
{$Message Error 'Not implemented'} //emits an error, continues compiling
{$Message Fatal 'Bang. Yer dead.'} //emits an error, terminates compiler