Sometimes, when working with Postgres DB, we run a query within the application and one of the tables just gets locked. This is a useful query to see the actual query which caused the lock, the PID of the process running that query (we could use it to just kill it and release the lock, for example):
SELECT bl.pid AS blocked_pid,
a.usename AS blocked_user,
ka.current_query AS blocking_statement,
now() - ka.query_start AS blocking_duration,
kl.pid AS blocking_pid,
ka.usename AS blocking_user,
a.current_query AS blocked_statement,
now() - a.query_start AS blocked_duration
FROM pg_catalog.pg_locks bl
JOIN pg_catalog.pg_stat_activity a ON a.procpid = bl.pid
JOIN pg_catalog.pg_locks kl ON kl.transactionid = bl.transactionid AND kl.pid != bl.pid
JOIN pg_catalog.pg_stat_activity ka ON ka.procpid = kl.pid
WHERE NOT bl.granted;
Developer from Grao in London
Posts from a Java Developer who arrived at London a couple of years ago. I'll be adding here some interesting things and solutions to problems I find during my daily work that maybe can save you some time :)
Monday, 3 February 2014
Wednesday, 29 January 2014
Good examples of how to set policies on an Amazon S3 bucket.
For example: if you have a test bucket you use only for internal testing you don't normally want it to be accessible from outside (or google to index its content).
You can set a Bucket policy like this one:
{"Version":"2008-10-17","Id":"S3PolicyId1","Statement":[{"Sid":"IPDeny","Effect":"Deny","Principal":{"AWS":"*"},"Action":"s3:*","Resource":"arn:aws:s3:::dev.youbucket.com/*","Condition":{"NotIpAddress":{"aws:SourceIp":"X.X.X.X/32"}}}]}
where sourceIP will be the IP range of your test environment. You'll deny any action coming from outside. More useful examples here.
{"Version":"2008-10-17","Id":"S3PolicyId1","Statement":[{"Sid":"IPDeny","Effect":"Deny","Principal":{"AWS":"*"},"Action":"s3:*","Resource":"arn:aws:s3:::dev.youbucket.com/*","Condition":{"NotIpAddress":{"aws:SourceIp":"X.X.X.X/32"}}}]}
where sourceIP will be the IP range of your test environment. You'll deny any action coming from outside. More useful examples here.
Tuesday, 18 September 2012
java 2 Objective-C
Seems that google is trying to make life easier for app developers. Now they've created a compiler from Java to Objective-C language.
https://code.google.com/p/j2objc/
Subscribe to:
Posts (Atom)