Skip to content

Tag: java

codility absolute distinct count from an array

so i took the codility interview test yesterday and was informed today that i failed, unfortunately i wasnt given any other information by either codility nor the employer as to where i screwed up so i would appreciate some help in knowing where i went wrong. i know codility pays alot of emphasis on how fast …

Java: set timeout on a certain block of code?

Is it possible to force Java to throw an Exception after some block of code runs longer than acceptable? Answer Yes, but its generally a very bad idea to force another thread to interrupt on a random line of code. You would only do this if you intend to shutdown the process. What you can do is to use Thread.i…

How do I pass JavaScript values to Scriptlet in JSP?

Can anyone tell me how to pass JavaScript values to Scriptlet in JSP? Answer Your javascript values are client-side, your scriptlet is running server-side. So if you want to use your javascript variables in a scriptlet, you will need to submit them. To achieve this, either store them in input fields and submi…

Decode base64Url in Java

https://web.archive.org/web/20110422225659/https://en.wikipedia.org/wiki/Base64#URL_applications talks about base64Url – Decode a modified Base64 for URL variant exists, where no padding ‘=’ will be used, and the ‘+’ and ‘/’ characters of standard Base64 are respectiv…

Simple Java name based locks?

MySQL has a handy function: SELECT GET_LOCK(“SomeName”) This can be used to create simple, but very specific, name-based locks for an application. However, it requires a database connection. I have …