Java synchronized method concurrent execution

I read this puzzle years ago (unfortunately I can't find the reference) but didn't appreciate it at the time. Java synchronized methods [1] can supposedly be invoked only by a single thread at a time. The essence of aforementioned puzzle was that, if the synchronized method obtains a lock on the object the method belongs … Continue reading Java synchronized method concurrent execution →

The art of copy & paste in programming

Code structures help fit code into your head Every programming course starts with showing a "hello world", moves on to computations, I/O, control structures, data structures and code structures. The necessity for data and code structures doesn't become obvious until one has written a larger programme. Until then (and often even then) it feels like … Continue reading The art of copy & paste in programming →

Controlling the TP-LINK HS100 Wi-Fi smart plug

[update 7 June 2020] Available now on Docker: https://hub.docker.com/repository/docker/georgovassilis/hs100 [update 27 January 2017] TP-LINK HS100 project on github: https://github.com/ggeorgovassilis/linuxscripts [update December 2020] TL;DR; This is about a shell script which controls the TP-LINK HS100, HS103s, HS110, HS200 and KP105 Wi-Fi smart power plugs. Other models in that product line may also work (the tplink-smarthome-api project uses … Continue reading Controlling the TP-LINK HS100 Wi-Fi smart plug →

Debugging Spring REST bad request 400 codes

This happens way too often: you POST or PUT something to a Spring @RestController and Spring only tells you that there is a bad request, HTTP 400 code; no further explanations, no logs, no exceptions. Spring logs the error cause under the category "org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod" so you can enable logging for that in your log4j.properties: log4j.logger.org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod=DEBUG,stdout … Continue reading Debugging Spring REST bad request 400 codes →