Monday, January 26, 2015

AWS Bitnami Default Passwords

In the current version as at this posting, it is output into the server log and retrived via the "View System Log" feature in the AWS console.

Reference: https://bitnami.com/stack/wordpress/cloud/amazon

AWS HVM vs PV

HVM: Hardware Virtual Machine
PV: Paravirtual machine

HVM is newer (feature of new CPUs). Some of the newer instance types only support HVM.

References:



Saturday, January 24, 2015

Ant SCP Error com.jcraft.jsch.JSchException: reject HostKey

This happens when the target server is not a "known host". Just do a normal SSH to the server and say yes to adding the server to known hosts, and after that SCP from Ant should be fine.

http://anahorny.blogspot.sg/2013/05/solution-for-comjcraftjschjschexception.html

Wednesday, January 21, 2015

REST: When to Use GET, PUT, POST, DELETE in Non-CRUD Situations

In normal CRUD situations, the answer is obvious. In non-CRUD situations, this gets a bit more tricky.

I think the best way to approach this is based on the following quoted from REST Wikipedia page

"The PUT and DELETE methods are referred to as idempotent, meaning that the operation will produce the same result no matter how many times it is repeated. The GET method is a safe method (or nullipotent), meaning that calling it produces no side-effects. In other words, retrieving or accessing a record doesn't change it."
  • If the REST end-point has no side effect (e.g. search), use GET.
  • If it is idempotent, it is possible to use PUT or DELETE depending on the nature of the request
  • If not idempotent and has side effect, use POST

Saturday, January 3, 2015

SimpleDateFormat Strange Results / Thread Safety

SimpleDateFormat can give strange results when running on a server when multiple threads share the same instance. This is because it is not thread-safe due to intermediate results being stored in instance variables. To avoid this problem always instantiate a new SimpleDateFormat object when needed or find a way to ensure there is one instance per thread (e.g. using ThreadLocal).

References: