Big Data/Analytics Zone is brought to you in partnership with:
DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
  • submit to reddit
Trevor Parsons08/05/14
7147 views
0 replies

How to combine D3 with AngularJS

As we all know, Angular and D3 frameworks are very popular, and once they work together they can be very powerful and helpful when creating dashboards.

Ian Mitchell08/05/14
4560 views
0 replies

Pattern of the Month: Minimum Viable Product

Minimum Viable Product is a term for which we might expect a rigorous definition, but it actually means different things to different people. In this article we consider the intent and motivation behind MVP's and discern the pattern behind their usage.

Mike Bushong08/05/14
1388 views
0 replies

At the office, are you a doctor or a patient?

Every interaction with your management chain is effectively a dress rehearsal for your career. With this in mind, be mindful of whether the conversation you initiate is closer to a doctor-patient or a doctor-doctor discussion.

Lijin Joseji08/05/14
4313 views
0 replies

6 sparkling features of Apache Spark!

What is Apache Spark? Why there is a serious buzz going-on about this? If you are in the Big Data analytics business, should you really care about Spark? I hope this post will help to answer some of these questions which might have coming to your mind these days.

MainActivity.java :

package www.andygeeks.blogspot.com;

import java.net.SocketTimeoutException;
import java.net.UnknownHostException;

import org.json.JSONArray;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;

import android.app.Activity;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.Menu;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends Activity {
    
boolean timeoutexcep=false,httpexcep=false,genexcep=false;
    
private static final String TAG_NAME = "J_Name";
private static final String TAG_ID = "J_Id";
private static final String TAG_PLACE = "J_Place";
private static final String TAG_MOBILE = "J_Phone";
    
public static String dist="Krishnagiri",type="P",no="50";
String Name,Id,Place,Phone;
    
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
new pay().execute();
}

class pay extends AsyncTask<Void, Void, Void> {

private final ProgressDialog dialog = new ProgressDialog(MainActivity.this);

@Override
protected void onPreExecute() {
this.dialog.setMessage("Loading data");
this.dialog.show();
}

@Override
protected Void doInBackground(Void... unused) {

final String NAMESPACE = "http://tempuri.org/";
final String URL = "http://www.xxxxxx.com/xxxx/xxx.asmx";
final String SOAP_ACTION = "http://tempuri.org/xxxxx";
final String METHOD_NAME = "xxxxx";

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

request.addProperty("sDistrict", dist);
request.addProperty("sTaxType", type);
request.addProperty("sTaxNo", no);

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;

envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.debug = true;

try {
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapPrimitive response = (SoapPrimitive) envelope.getResponse();

String responseJSON=response.toString();
JSONArray jarray =new JSONArray(responseJSON);

Name=jarray.getJSONObject(0).getString(TAG_NAME);
Id=jarray.getJSONObject(0).getString(TAG_ID);
Place=jarray.getJSONObject(0).getString(TAG_PLACE);
Phone=jarray.getJSONObject(0).getString(TAG_MOBILE);

System.out.println(request);
System.out.println(responseJSON);

}
catch(SocketTimeoutException e){
timeoutexcep=true;
e.printStackTrace();
}
catch(UnknownHostException e){
httpexcep=true;
e.printStackTrace();
}
catch (Exception e) {
genexcep=true;
e.printStackTrace();
}
return null;
}

@Override
protected void onPostExecute(Void result) {
if (this.dialog.isShowing()) {
this.dialog.dismiss();
}
if(timeoutexcep){
Toast.makeText(MainActivity.this, "Unable to connect to server, Please try again later",Toast.LENGTH_LONG).show();
}
else if(httpexcep){
Toast.makeText(MainActivity.this, "Please check your Internet connection",Toast.LENGTH_LONG).show();
}
else if(genexcep){
Toast.makeText(MainActivity.this, "Please try later",Toast.LENGTH_LONG).show();
}

else{
tableview();
}
timeoutexcep=false;httpexcep=false;genexcep=false;
}
}

public void tableview(){
try{
TextView name = (TextView)findViewById(R.id.textView5);
name.setText(Name);

TextView door = (TextView)findViewById(R.id.textView6);
door.setText(Id);

TextView ward = (TextView)findViewById(R.id.textView7);
ward.setText(Place);

TextView mobile = (TextView)findViewById(R.id.textView8);
mobile.setText(Phone);
}
catch(Exception e){
}
}
    
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
Adi Gaskell08/04/14
7651 views
0 replies

How breaks help you get in the zone

The general gist is that taking regular breaks allows ones brain to refresh and attack tasks with a renewed vigour. A couple of recent studies have explored how social media can play its part in all of this.

Jennifer Wright08/04/14
5539 views
0 replies

The Future on Your Wrist

While convenient, modern technology has struggled to move beyond phones, and the potential for a transformative product remains obvious.

Steve Francia08/04/14
7421 views
0 replies

Go for Object Oriented Programmers

If you’re a OO programmer, especially one with a background with dynamic languages and are curious about Go then this talk is for you. We will cover everything you need to know to leverage your existing skills and quickly start coding in go including:

Mike Cottmeyer08/04/14
2927 views
0 replies

Agile 2014: Personal Kanban

Here is the deck from my Agile2014 workshop on Personal Kanban.

Jakub Holý08/03/14
2909 views
0 replies

Most interesting links of July '14

A curated collection of the most interesting articles, links, and news in the programming world from last month, July of 2014.

Rob Galanakis08/01/14
6501 views
0 replies

Everyone should take vacation at the same time

To be sure, some people were screwed over by bad managers, but (in contrast to most other management offenses) this was largely due to particular managers and not underlying cultural causes.

Martin Fowler08/01/14
6859 views
0 replies

Retreaded: Composed Regex

One of the most powerful tools in writing maintainable code is break large methods into well-named smaller methods - a technique Kent Beck refers to as the Composed Method pattern. A few people mentioned using fluent interfaces (internal DSLs) as an more readable alternative to regexs. I see this as a separate thing.

Krzysztof Kotowicz 08/01/14
6283 views
0 replies

JS crypto goto fail?

Javascript cryptography is on the rise. What used to be a rich source of vulnerabilities and regarded as "not a serious research area", suddenly becomes used by many. This article is a long, passionate discussion about JS crypto.

Robert Diana08/01/14
5518 views
0 replies

Geek Reading July 31, 2014

These items are a combination of tech business news, development news and programming tools and techniques.

Mike Bushong08/01/14
3701 views
0 replies

Do you really need to understand the guts of an Ethernet Switch?

This week I read a perfectly reasonable article by Tom Hollingsworth, which then deteriorated in the comments section to a “you don’t know how a switch works” exchange.

Andrew Fuqua07/31/14
6670 views
0 replies

Continuous Backlog Refinement

Create your initial backlog, then stay on top of it. Here’s the how and why of Continuous Backlog Refinement.

Eric Minick07/31/14
5324 views
0 replies

Release Managers Risking Irrelevancy

As Agile breaks through the WaterScrumFall format of rapid development wrapped in slow project initiation and release cycles to actually delivering more frequently, Release Managers have been put into something of a bind.

Abishek Baskaran07/31/14
1596 views
0 replies

Why Docker is awesome for a lean tech Startup

An article on how Docker helps us develop faster while keeping the environment clean.

package com.bos.jmx;

public class Shutdown implements ShutdownMBean {
	private static volatile boolean flagRunOne = false;

	@Override
	public void shutdown() throws Exception {
		if (!flagRunOne) {
			System.out.println("Server shutting down...");
			//Sample shutdown code here
			Main.shutdown();
			System.out.println("Server shutdown.");
			flagRunOne = true;
		}
	}
}
Alec Noller07/30/14
11192 views
0 replies

Dev of the Week: Sean Lorenz

Every week here and in our newsletter, we feature a new developer/blogger from the DZone community to catch up and find out what he or she is working on now and what's coming next. This week we're talking to Sean Lorenz, Technical Product Guy for the Xively IoT platform from LogMeIn.