Today is Thursday, 12th January 2017

Archive for July, 2012


Conference Slides from EclipseCon 2012

I just stumbled on the website for EclipseCon. EclipseCon is a conference for users/developers of Eclipse.

The conference slides are all on-line and freely available. I just scanned the list and found some sessions that are really interesting.

Enjoy!

Share


Sending SMS Text Message From Java

In this article, I’ll show you how to send SMS text messages from Java. In order to accomplish this, you will need an SMS gateway. There are a number of vendors on the market that will provide this service. I will use the service from Red Oxygen. I have used their API for the past 6 years with no problems.

You will need to register with the service. Once registered, you can use the following client code to send a text message. I added comments to the code to make it easy to read.

package com.luv2code.sms;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
/**
* Collection of methods for SMS text messaging
*
* @author Chad Darby
*/
public class SmsUtils {
/**
* Sends a SMS text message
*
* @param accountID
* @param email
* @param password
* @param recipient
* @param message
* @param response
* @return
* @throws Exception
*/
public static int sendSMS(String accountID, String email, String password,
String recipient, String message) throws Exception {
String requestURL = "http://www.redoxygen.net/sms.dll?Action=SendSMS";
// build the request message
StringBuilder data = new StringBuilder();
data.append("AccountId=" + URLEncoder.encode(accountID, "UTF-8"));
data.append("&Email=" + URLEncoder.encode(email, "UTF-8"));
data.append("&Password=" + URLEncoder.encode(password, "UTF-8"));
data.append("&Recipient=" + URLEncoder.encode(recipient, "UTF-8"));
data.append("&Message=" + URLEncoder.encode(message, "UTF-8"));
// prepare HTTP connection
int result;
URL address = new URL(requestURL);
HttpURLConnection connection = (HttpURLConnection) address.openConnection();
connection.setRequestMethod("POST");
connection.setDoInput(true);
connection.setDoOutput(true);
// send data
DataOutputStream out = new DataOutputStream(connection.getOutputStream());
out.writeBytes(data.toString());
out.flush();
out.close();
// read response
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
StringBuilder response = new StringBuilder();
String inputLine;
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
response.append("\n\n\n");
}
// parse response code
String resultCode = response.substring(0, 4);
result = Integer.parseInt(resultCode);
in.close();
return result;
}
public static void main(String[] args) {
String accountID = "the account id";
String email = "your email";
String password = "your password";
String recipient = "the recipient phone number";
String message = "the message";
try {
sendSMS(accountID, email, password, recipient, message);
}
catch (Exception exc) {
exc.printStackTrace();
}
}
}
Share


Continuous Integration

I found a very good presentation on Continuous Integration. The presentation was developed by Sebastian Bergmann. The complete presentation is available here. I selected a couple of slides from the presentation that are very valuable.

Share