Build the future of communications.
Start building for free

"java" posts

  • By Matthew Gilliard
    Getting Started with the Java Streams API Blog Header: Getting Started with the Java Streams API by Matthew Gilliard, Developer Evangelist

    The Streams API was added in 2014 with the release of Java 8 so you’ve almost certainly got it available today. It is used to pass a series of objects through a chain of operations, so we can program in a more functional style than plain iteration allows. Still, when working with collections many developers still reach for the classic for loop.

    In this post, I’ll introduce the terms used when talking about Streams, show some examples of each term and how they can be used together to create compact and descriptive code. Then I’ll show a real-world example of Streams code I wrote recently to pick winners in a raffle.

    What’s a Stream?

    A Stream is a (possibly never-ending) series of Objects. A Stream starts from a Source. The objects in a Stream flow through Intermediate Operations, each of which results in another stream, and ...

    Read More
  • By Matthew Gilliard
    How to read and understand a Java Stacktrace Copy of Photo blog Header 2-2.png

    When things go wrong in a running Java application, often the first sign you will have is lines printed to the screen that look like this:

    Exception in thread "main" java.lang.RuntimeException: Something has gone wrong, aborting!
        at com.myproject.module.MyProject.badMethod(MyProject.java:22)
        at com.myproject.module.MyProject.oneMoreMethod(MyProject.java:18)
        at com.myproject.module.MyProject.anotherMethod(MyProject.java:14)
        at com.myproject.module.MyProject.someMethod(MyProject.java:10)
        at com.myproject.module.MyProject.main(MyProject.java:6)
    

    This is a Stacktrace, and in this post I'll explain what they are, how they are made and how to read and understand them. If that looks painful to you then read on...

    Anatomy of a Stacktrace

    Usually a Stacktrace is shown when an Exception is not handled correctly in code. This may be one of the built-in Exception types, or a custom Exception created by a ...

    Read More
  • By Matthew Gilliard
    Coding Twilio Webhooks in Java with Spring Boot OaO_XJW_jNspphskhagxUqwgYna48fdsintjxgUZxg8PQ2Y8D7jBnmUa_g4kwpliEvf3ZB8QaajTv0LZ5Y6QltTsbY3WrscGMWuWw61bS7XvOQO4sglr5cF1xGGFxib6Zomr9J1g

    Twilio’s APIs enable communication in a whole host of ways: by phone, WhatsApp, Facebook, SMS and more.  Usually when events such as incoming messages or calls happen Twilio will make an HTTP request to a server the user provides to discover what it should do - these are called webhooks. HTTP servers can be written with any technology to respond to these webhooks, and for Java developers the most popular framework is Spring Boot.

    In this post we’ll create a Spring Boot app which can respond to incoming phone calls by playing callers a short message followed by the marvellous Rogers and Hammerstein song “It Might As Well Be Spring”.

    Requirements

    Creating a Spring Boot App

    The Spring folks have created the Spring Initializr for quickly creating a new project. Head over to https://start.spring.io and set up a ...

    Read More
  • By Maciej Treder
    Implementing Eureka and Zuul for Service Discovery and Dynamic Routing in JavaScript Microservices Running on Node.js Gw87W418humMuagmwCQwtUyO2SOfwrWPG7TdI2vz7z_y86RFhQPQorXMBTcuPGWz1qCgkzBfvzX51Lgf1K1y493wa4Apwoq-y0zQf8Sig9UDXo5XaZi-y_YdGYoecOCIvX4Jfawz

    Building your JavaScript applications as a collection of microservices give you a number of advantages. Your applications can be more modular, uniform, and testable as you build them and they can be more robust, scalable, and available when you deploy them to the production environment. Including a service discovery registry and dynamic routing capabilities will help you achieve scalability and availability in the production.

    This post will show you how to integrate service discovery and intelligent routing into a Node.js application built with a microservices architecture. You'll see how you can do this with two Netflix open source projects, Eureka and Zuul, that run in the Java SE Runtime Environment.

    The Netflix Eureka server provides service discovery. This gives your application's services the ability to find other services without knowing where they are hosted or the full URL required to reach them, so you don't have to provide complete ...

    Read More
  • By Matthew Gilliard
    Using WhatsApp, Twilio and Azure to Generate Photo Alt-text in Java People programming together

    AI services like Computer Vision (CV) are getting easier and easier to play with, and we can have some fun by making them available to use from our cellphones. In this post, we will use Java to connect the Twilio API for WhatsApp with Azure’s CV APIs to create a bot that can describe photos. It would be neat to use this for generating alt-text to help make your images more accessible online, for example.

    We will need the following to get started with this post

    Overview of our app

    How it works

    When Twilio receives a WhatsApp message it will send an HTTP request to a URL we provide.

    Our mission is to create an app in Java which can handle those requests. The app will take the URL of any ...

    Read More
  • By Matthew Gilliard
    Introducing Developer Evangelist Matthew Gilliard young_gilliard_horiz_crop.jpg

    When I was a young kid we used to take family holidays from the UK to France. I remember meeting other kids on holiday with their families for a week at a time, spending time playing with them and having loads of fun.

    These other kids were from exotic-sounding places like Germany and France. Despite enjoying the same kinds of games and having loads of fun together we didn’t speak the same language and could never have a conversation. As children we had a lot in common but our lives and toys and everything were so different.

    Since that time I always wanted to travel - to meet people and see what life is like in different places - how it is similar and how it is different.

    Living and Working Abroad

    I was very shy of public speaking when I was young. After two years of working as a programmer ...

    Read More
  • By Matt Makai
    How to Send WhatsApp Messages from Java Applications with Twilio whatsapp-java-1600x650.png

    WhatsApp is a global messaging service that helps billions of people communicate with each other. Applications can now also programmatically interact with people on the service using the Twilio Messaging API and Twilio's Java Helper Library. Let's learn how to quickly send messages to people from a new or existing Java application.

    Installing Dependencies

    Our local development environment needs the following dependencies to properly send WhatsApp messages from Java.

    First, install Java on your development machine if you do not already have it. You can also read this detailed tutorial on setting up your Java development environment if you are having trouble.

    Next, log into your existing Twilio account or sign up for a new free Twilio account.

    Take note of your Account SID and Auth Token when you log ...

    Read More
  • By David Thurston
    How to Call the Twilio API from Java Programs on the Commandline G4AOOuVSiZ84gRix_NtaIT3orcqHSsqlTzeA21hXLL6aPILIKh28RXHk2zc_ZrB_D7wMBPtWkcKVCJWz1M5_06iWXQNLc-gWHigtM7QzsOXzN1F6qX9Uhab1J5Q-UfUidXR0tno1

    If you you need to do a quick Twilio test, or compile and run programs on a remote computer without any GUI, or run test programs on your own computer and you don’t want to use a full blown IDE development environment, this is the article for you.

    Check Java Installation

    Confirm that you have a Java runtime environment (JRE) on your computer for running Java class files:

    $ java -version
    java version "1.8.0_131"<br/>Java(TM) SE Runtime Environment (build 1.8.0_131-b11)<br/>Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
    Check that you have the Java compiler on your computer:
    $ javac
    Usage: javac <options> <source files>
    ...
    

    If you don’t have both, please go to Oracle’s Java SE page and download the Java JDK.

    The Java Standard Edition (Java SE) is what you need for developing ...

    Read More
  • By SaraAnn Stanway
    Cloud Orchestration, Lazarus and Interning at Twilio yvTYO9hgKtXVuKlg74fAuugByS68Q7dvho1MNtwKwb6sZWZpolnqj9_iQVNrrOTcg8zX17xmp5E98_i2kTSHGV0cJ26pK8r6fNtRIMzQacD8v7_m7lDsYK4elemXJTo3yIcO4-ZU

    There are a few technical interview strategies everyone knows: communicate your thoughts, give yourself time to think, and keep calm. Absent among these, of course, is coming up entirely blank for a question. So when in the interview for an engineering internship my manager asked, “What experience do you have with distributed systems?” I took a deep breath and, cringing a little, replied, “None, yet. But I’m smart and I learn fast, and I’m interested to learn by working in one.” This was true. I’d been curious about the subject for a while, and figuring it wouldn’t hurt to try, had worked up the courage to apply to a role for which I didn’t hit every “ideal qualification” checkbox. (Take that, tech gender gap!) And to my surprise and relief, I moved forward – all the way to San Francisco, to a spot on Twilio’s ...

    Read More
  • By Kelley Robinson
    Round up: Libraries for checking Pwned Passwords in your 7 favorite languages ySHxI-gQII7uqLxqbAg9CSDY7Ii3rQmDuTLIyMIIFQRijKMlxZR1Y-OKmqj2gOifoI2XIgck4v29K6b5_WfXSQqoAMf9SpCY9iI9a8MCHeUjMa5rEKdqpj9G-Ge1ZEzyql__zVmU

    Earlier this year Troy Hunt released version 2 of his popular Pwned Passwords API service. The new version comes with even more compromised passwords and a more secure way to query the password API that doesn’t require sending plain text passwords over the network.

    The API update comes at a good time. When NIST updated its password guidelines in 2016, it included a new recommendation to check “memorized secret verifiers”, or passwords, against known data breaches:

    When processing requests to establish and change memorized secrets, verifiers SHALL compare the prospective secrets against a list that contains values known to be commonly-used, expected, or compromised. For example, the list MAY include, but is not limited to passwords obtained from previous breach corpuses.

    Since the API release, the community has created API wrappers in many of our favorite programming languages. In this post, I round up the libraries in 7 languages ...

    Read More
  • Newer
    Older
    Sign up and start building
    Not ready yet? Talk to an expert.