Word Frequency in 5 Programming Languages (Java, Scala, Go, C++, R)

Let the code speak for itself. Java 8 public class Application { public static void main(String[] args) throws IOException { Map wordCounts = Files.lines(new File("samples.txt").toPath()) .parallel() .flatMap(Pattern.compile("\\W")::splitAsStream) .filter(word -> word.length() > 6) .map(String::toUpperCase) .collect(Collectors.toConcurrentMap(w -> w, w -> 1, Integer::sum)); wordCounts.entrySet().stream() .sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())) .limit(20) .forEach(System.out::println); } } Golang type WordOccourences struct { word string occourcenres int } func main() { expression := regexp.MustCompile("[^a-zA-ZüäößÜÄÖ]") data, error := os.Open("samples.txt") defer data.Close() if error == nil { var wordCounts = make(map[string]int) scanner := bufio.

Continue Reading

Alexa Skill development and testing with Java

Alexa Skill development and testing with Java As the mayority of the Alexa Skill developer tutorials are focusing on Node or Python, I would like to highlight the Java way and point out some things that I missed in the official trainings and some things that I would personally have solved differently. For demonstration purposes, I wrote a simple fun application which finds crew members on the enterprise spaceship. A user could ask Alexa questions like “Where is captain Picard” or “Ask Enterprise where Captain Picard is” - so this application makes perfectly no sense, but it demonstrates everything a developer has to know to implement own basic skills.

Continue Reading

Message Queue Telemetry Transport (MQTT)

After various encounters and two projects which employed MQTT, I thought it was a good idea to write a summary about my experiences and my point of view. As my new job is very close to the IoT and Industry 4.0 sector, it did not take much time to encounter the hype. Once upon a time MQTT is, like AMQP, a messaging protocol for distributed systems, meaning that a node can pass a message to one or multiple other nodes.

Continue Reading

Recent Posts

Fuzz Testing in Golang
Gran Canaria
Copenhagen | København