Sunday, 1 September 2013

Unable to consume Axis2 webservice(WSDL) using PHP client

Unable to consume Axis2 webservice(WSDL) using PHP client

call('departmentResponseComponent',array('departmentResponseComponent'=>'$reqData'));
?>
The problem is, I am unable to pass the data to the webservice call. When
they logged my string input to a file, they are getting null value.
I am able to call the function and I am getting the correct response
message for null parameter.

how to implement AsyncTask in Fragment

how to implement AsyncTask in Fragment

I've a activity which output data from json as a list. But now I want to
implement it in a fragment as I planned to put them into a tab.
This is my Activity file:
public class ListsActivity extends Activity {
private static final String SALES_ID = "sid";
private static final String CAT_ID = "cat_id";
TextView capitalTextView;
ProgressDialog progressDialog;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main2);
this.retrieveCapitals();
}
void retrieveCapitals() {
progressDialog = ProgressDialog.show(this,
"Please wait...", "Retrieving data...", true, true);
CapitalsRetrieverAsyncTask task = new CapitalsRetrieverAsyncTask();
task.execute();
progressDialog.setOnCancelListener(new CancelListener(task));
}
private class CapitalsRetrieverAsyncTask extends AsyncTask<Void, Void,
Void> {
Res res;
@Override
protected Void doInBackground(Void... params) {
File file = new File( "/json_example.txt");
if(file.exists()) {
try{
Reader inputStreamReader = new
InputStreamReader(new FileInputStream(file));
Gson gson = new Gson();
this.response = gson.fromJson(inputStreamReader,
Res.class);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (@SuppressWarnings("hiding") IOException e){
e.printStackTrace();
}
}
return null;
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
List<HashMap<String,String>> aList = new
ArrayList<HashMap<String,String>>();
for(Sales sales : this.response.sales){
HashMap<String, String> hm = new HashMap<String,String>();
//doing something
}
}
aList.add(hm);
}
}
// Keys used in HashMap
// Ids of views in listview_layout
// Instantiating an adapter to store each items
// R.layout.listview_layout defines the layout of each item
SimpleAdapter adapter = new SimpleAdapter(getBaseContext(),
aList, R.layout.listview_layout, from, to);
// Getting a reference to listview of main.xml layout file
ListView myList = ( ListView ) findViewById(R.id.listview);
// Setting the adapter to the listView
myList.setAdapter(adapter);
myList.setClickable(true);
// Item Click Listener for the listview
OnItemClickListener itemClickListener = new
OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View
container, int position, long id) {
Toast.makeText(getBaseContext(), ((TextView)
container).getText(), Toast.LENGTH_SHORT).show();
}
};
//myList.setTextFilterEnabled(true);
myList.setOnItemClickListener(itemClickListener);
progressDialog.cancel();
}
}
private class CancelListener implements OnCancelListener {
AsyncTask<?, ?, ?> cancellableTask;
public CancelListener(AsyncTask<?, ?, ?> task) {
cancellableTask = task;
}
@Override
public void onCancel(DialogInterface dialog) {
cancellableTask.cancel(true);
}
}
}
I want to put it into a following fragment file:
public class GridFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View gv = inflater.inflate(R.layout.hot_sales, null);
GridView gridView = (GridView) gv.findViewById(R.id.grid_view);
gridView.setAdapter(new ImageAdapter(this.getActivity()));
return gv;
//return super.onCreateView(inflater, container, savedInstanceState);
}
public class ImageAdapter extends BaseAdapter {
private Context mContext;
// Keep all Images in array
public Integer[] mThumbIds = {
R.drawable.sample_0,
R.drawable.sample_1, R.drawable.sample_2,
R.drawable.sample_3, R.drawable.sample_4,
R.drawable.sample_5, R.drawable.sample_6,
R.drawable.sample_7, R.drawable.sample_8,
R.drawable.sample_9, R.drawable.sample_10,
R.drawable.sample_11, R.drawable.sample_12,
R.drawable.sample_13, R.drawable.sample_14,
R.drawable.sample_15
};
// Constructor
public ImageAdapter(Context c){
mContext = c;
}
@Override
public int getCount() {
return mThumbIds.length;
}
@Override
public Object getItem(int position) {
return mThumbIds[position];
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(final int position, View convertView,
ViewGroup parent) {
ImageView imageView;
if (convertView == null) { // if it's not recycled,
initialize some attributes
imageView = new ImageView(mContext);
imageView.setImageResource(mThumbIds[position]);
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setLayoutParams(new GridView.LayoutParams(300, 200));
imageView.setPadding(10, 10, 10, 10);
imageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//Log.d("onClick","position ["+ position +"]");
//Toast.makeText(HotSalesFragment.this, "" + position,
Toast.LENGTH_SHORT).show();
}
});
} else {
imageView = (ImageView) convertView;
}
imageView.setImageResource(mThumbIds[position]);
imageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//Log.d("onClick","position ["+position+"]");
if(position == 0){
Intent gk = new
Intent(getActivity().getApplicationContext(),
ShopsListsActivity.class);
startActivity(gk);
}
}
});
return imageView;
}
}
}
Note: In this fragment I want to view it as gridview. And both files works
fine. but when I tried to implement AsyncTask I gets several redflags as
unreachable code. Can some help me with this please?

Can you use AngularJS with Parse.com?

Can you use AngularJS with Parse.com?

I am new to phonegap development & I am trying to pick a framework to use.
I'd like to use AngularJS as I've read good things about it, but I'd like
it to work with Parse.com as a backend. I noticed that one Parse.com they
don't specify any compatibility with Angular, and all their documentation
and Javascript API requires Backbone.
I know AngularJS supports http, so I can communicate with Parse using the
REST API. But is this going to end up being a mess & will I save myself
time & stress if I use Backbone with the Parse.com Javascript API instead?

Saturday, 31 August 2013

Javascript registry for calling methods and objects

Javascript registry for calling methods and objects

I want to have an object which can act as a registry for calling functions
on it.
So far, I have been thinking of something along these lines:
var registry = new Object();
registry.doStuff = function(){ /* */ };
Is there a better way ? What about adding objects ? Ideally, I'd like to
be able to add these at run time.

How to free Watch Henderson vs Pettis live streaming UFC?

How to free Watch Henderson vs Pettis live streaming UFC?

Watch UFC live Fighting Click Here To: Watch Henderson vs Pettis
ufc-live-show.blogspot.com/
ufc-live-show.blogspot.com/
ufc-live-show.blogspot.com/
ufc-live-show.blogspot.com/
ufc-live-show.blogspot.com/

Henderson vs Pettis Live Fight DETAILS Date : Saturday, August 31, 2013
Competition: UFC MMA Major Events live Live / Repeat:Live 10:00pm ET

Wildcard in shell script called from an Expect script

Wildcard in shell script called from an Expect script

I have an Expect script that directs a shell script into ssh and runs that
script on several hosts. However, there's a wildcard in that shell script
which is causing errors.
Here's what my Expect script looks like.
spawn list.sh 2&>1 > /dev/null
Here's what list.sh looks like.
ssh user@host "cat | bash /dev/stdin " < command.sh
And here's command.sh.
ls -l /var/log/*
The error...
ls: /var/log/*: No such file or directory
This is only a simplified example of what I'm trying to achieve with what
I have to work with. Any help would be appreciated.

How to extract skeleton information from kinect sensor using openNI and primesense's python bindings?

How to extract skeleton information from kinect sensor using openNI and
primesense's python bindings?

I've downloaded and installed the bindings and have been poking around the
C API, but haven't been able to find even a workflow for extracting this
information, and the examples that ship with openNI seem to be closed
source.
Ultimately, i'm looking to get XYZ and orientation data for each joint,
but I can't even get raw data out of it yet.
Any thoughts?