View Natalino Busa's profile on LinkedIn

Principal Data Scientist, Director for Data Science, AI, Big Data Technologies. O’Reilly author on distributed computing and machine learning.​

Natalino leads the definition, design and implementation of data-driven financial and telecom applications. He has previously served as Enterprise Data Architect at ING in the Netherlands, focusing on fraud prevention/detection, SoC, cybersecurity, customer experience, and core banking processes.

​Prior to that, he had worked as senior researcher at Philips Research Laboratories in the Netherlands, on the topics of system-on-a-chip architectures, distributed computing and compilers. All-round Technology Manager, Product Developer, and Innovator with 15+ years track record in research, development and management of distributed architectures, scalable services and data-driven applications.

Sunday, April 22, 2012

Non blocking background HTTP web request

A great snippet for android async http calls:

import org.apache.http.util.ByteArrayBuffer;

public class Iconic extends Activity {
private String html = "";
private Handler mHandler;

public void onCreate(Bundle savedInstanceState) {
mHandler = new Handler();

private Thread checkUpdate = new Thread() {
public void run() {
try {
URL updateURL = new URL("http://your-site/update");
URLConnection conn = updateURL.openConnection();
InputStream is = conn.getInputStream();
BufferedInputStream bis = new BufferedInputStream(is);
ByteArrayBuffer baf = new ByteArrayBuffer(50);

int current = 0;
while((current = != -1){

/* Convert the Bytes read to a String. */
html = new String(baf.toByteArray());;
} catch (Exception e) {

private Runnable showUpdate = new Runnable(){
public void run(){
"HTML Code: " + html,
// see

Popular Posts

Featured Post

The AI scene in the valley: A trip report

A few weeks back I was lucky enough to attend and present at the Global AI Summit in the bay area. This is my personal trip report about th...