Skip to content

Instantly share code, notes, and snippets.

View mmalmeida's full-sized avatar

Miguel Almeida mmalmeida

  • ITClinical
  • Lisbon
View GitHub Profile
@mmalmeida
mmalmeida / gist:3076560
Created July 9, 2012 13:28
Postgresql complex insert into
Consider the model:
car
|id|code|Model name|
|1|100|Deluxe|
|10|100|Deluxe improved|
color
|id|Name|
|2|Red|
@mmalmeida
mmalmeida / gist:3077365
Created July 9, 2012 16:09
Postgresql complex insert into attempt
WITH old_models AS(
SELECT car.id,car.code, cc.color_id
FROM car inner join car_color cc ON car.id=cc.car_id
),new_models AS(
SELECT car.id
FROM car left outer join car_color cc ON car.id=cc.car_id WHERE cc.id IS NULL
)
INSERT INTO car_color(id,car_id,color_id)
VALUES(nextval('id_sequence'),SELECT car_id FROM new_models, SELECT color_id FROM old_models);
## In the logs:
85.244.99.60 - - [03/Aug/2012:22:19:32 +0200] "GET /xxx HTTP/1.1" 302 199 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:11.0) Gecko/20100101 Firefox/11.0"
85.244.99.60 - - [03/Aug/2012:22:19:32 +0200] "GET /manager/ HTTP/1.1" 404 508 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:11.0) Gecko/20100101 Firefox/11.0"
# Already in proxy.conf, but somehow you need it...
ProxyRequests Off
<Proxy *>
AddDefaultCharset Off
Order deny,allow
@mmalmeida
mmalmeida / gist:3258070
Created August 4, 2012 14:22
apache2 log
[Sat Aug 04 16:21:39 2012] [debug] mod_proxy_ajp.c(45): proxy: AJP: canonicalising URL //localhost:8009/manager
[Sat Aug 04 16:21:39 2012] [debug] proxy_util.c(1506): [client 85.138.123.80] proxy: ajp: found worker ajp://localhost:8009/manager for ajp://localhost:8009/manager
[Sat Aug 04 16:21:39 2012] [debug] mod_proxy.c(1020): Running scheme ajp handler (attempt 0)
[Sat Aug 04 16:21:39 2012] [debug] mod_proxy_ajp.c(681): proxy: AJP: serving URL ajp://localhost:8009/manager
[Sat Aug 04 16:21:39 2012] [debug] proxy_util.c(2011): proxy: AJP: has acquired connection for (localhost)
[Sat Aug 04 16:21:39 2012] [debug] proxy_util.c(2067): proxy: connecting ajp://localhost:8009/manager to localhost:8009
[Sat Aug 04 16:21:39 2012] [debug] proxy_util.c(2193): proxy: connected /manager to localhost:8009
[Sat Aug 04 16:21:39 2012] [debug] proxy_util.c(2444): proxy: AJP: fam 2 socket created to connect to localhost
[Sat Aug 04 16:21:39 2012] [debug] ajp_header.c(224): Into ajp_marshal_into_msgb
[Sat Aug 04 16:21:39 2012
@mmalmeida
mmalmeida / gist:3258187
Created August 4, 2012 14:47
apache config
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80 is a NameVirtualHost
default server vps18841.ovh.net (/etc/apache2/sites-enabled/000-default:1)
port 80 namevhost vps18841.ovh.net (/etc/apache2/sites-enabled/000-default:1)
Syntax OK
###My conf.d file:
LogLevel debug
@mmalmeida
mmalmeida / gist:3296615
Created August 8, 2012 16:51
bash script
logme(){
while read -r line; do
logline="$(getdate): $line"
echo $logline >> $current_log
done
}
@mmalmeida
mmalmeida / gist:3760757
Created September 21, 2012 10:11
Jenkins 1.482 error
[SCP] Connecting to localhost
FATAL: org/bouncycastle/crypto/modes/SICBlockCipher
java.lang.NoClassDefFoundError: org/bouncycastle/crypto/modes/SICBlockCipher
at org.bouncycastle.jce.provider.JCEBlockCipher.engineSetMode(Unknown Source)
at javax.crypto.Cipher$r.a(DashoA13*..)
at javax.crypto.Cipher.a(DashoA13*..)
at javax.crypto.Cipher.init(DashoA13*..)
at javax.crypto.Cipher.init(DashoA13*..)
at com.jcraft.jsch.jce.AES256CTR.init(AES256CTR.java:57)
at com.jcraft.jsch.Session.checkCipher(Session.java:1891)
@mmalmeida
mmalmeida / gist:3866680
Created October 10, 2012 16:21
spring issue when upgrading to hibernate 4
package persist.integration.audit;
import persist.integration.hibernateentities.CodeIntegrationTest;
import org.hibernate.SessionFactory;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
@mmalmeida
mmalmeida / gist:3885672
Created October 13, 2012 18:28
Simple query
drop table person;
CREATE TABLE person
(
id integer NOT NULL,
"name" character varying,
code integer,
CONSTRAINT pk_person PRIMARY KEY (id)
);
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.0:site (default-site) on project irrs: SiteToolException: Unable to read local module-POM: 1 problem was encountered while building the effective model for com.itclinical:irrs-model:1.1.5-SNAPSHOT
[ERROR] [FATAL] Non-resolvable parent POM for com.itclinical:irrs:1.1.5-SNAPSHOT: Could not find artifact com.itclinical:itclinical-settings:pom:1.0.2 in central (http://repo1.maven.org/maven2) and 'parent.relativePath' points at wrong local POM @ com.itclinical:irrs:1.1.5-SNAPSHOT, /home/mike/workspace/irrs/pom.xml, line 9, column 10