background preloader

JDK

Facebook Twitter

Java Reflection: Getters and Setters. Using Java Reflection you can inspect the methods of classes and invoke them at runtime. This can be used to detect what getters and setters a given class has. You cannot ask for getters and setters explicitly, so you will have to scan through all the methods of a class and check if each method is a getter or setter.

First let's establish the rules that characterizes getters and setters: Getter A getter method have its name start with "get", take 0 parameters, and returns a value. Setter A setter method have its name start with "set", and takes 1 parameter. Setters may or may not return a value. Here is a code example that finds getter and setters of a class: Jdk6: Java SE 6. Creating Shazam in Java - Redcode. A couple of days ago I encountered this article: How Shazam Works This got me interested in how a program like Shazam works… And more importantly, how hard is it to program something similar in Java? About Shazam Shazam is an application which you can use to analyse/match music. When you install it on your phone, and hold the microphone to some music for about 20 to 30 seconds, it will tell you which song it is.

When I first used it it gave me a magical feeling. “How did it do that!?”. And even today, after using it a lot, it still has a bit of magical feel to it. Listen up..! First things first, get the music sample to analyse we first need to listen to the microphone in our Java application…! But it turned out it was very easy: Now we can read the data from the TargetDataLine just like a normal InputStream: Using this method it is easy to open the microphone and record all the sounds!

So, now we have the recorded data in a ByteArrayOutputStream, great! Microphone data Erhm… yes? Ah yes!

Json

Ascii Table - ASCII character codes and html, octal, hex and decimal chart conversion. Perf. Security. Jmx.