Search Results

Search found 547 results on 22 pages for 'hashmap'.

Page 8/22 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • How to mange big amount users at server side?

    - by Rami
    I built a social android application in which users can see other users around them by gps location. at the beginning thing went well as i had low number of users, But now that I have increasing number of users (about 1500 +100 every day) I revealed a major problem in my design. In my Google App Engine servlet I have static HashMap that holding all the users profiles objects, currenty 1500 and this number will increase as more users register. Why I'm doing it Every user that requesting for the users around him compares his gps with other users and check if they are in his 10km radius, this happens every 5 min on average. That is why I can't get the users from db every time because GAE read/write operation quota will tare me apart. The problem with this desgin is As the number of users increased the Hashmap turns to null every 4-6 hours, I thing that this time is getting shorten but I'm not sure. I'm fixing this by reloading the users from the db every time I detect that it became null, But this causes DOS to my users for 30 sec, So I'm looking for better solution. I'm guessing that it happens because the size of the hashmap, Am I right? I have been advised to use spatial database, but that mean that I can't work with GAE any more and that mean that I need to build my big server all over again and lose my existing DB. Is there something I can do with the existing tools? Thanks.

    Read the article

  • How to manage many mobile device users at server side?

    - by Rami
    I built a social Android application in which users can see other users around them by GPS location. At the beginning thing went well as I had low number of users, but now that I have increasing number of users (about 1500 +100 every day) it has revealed a major problem in my design. In my Google App Engine servlet I have static HashMap that holds all the users profiles objects, currently 1500 and this number will increase as more users register. Why I'm doing it? Every user that requests for the users around him compares his GPS with other users and checks if they are in his 10km radius. This happens every five minutes on average. Consequently, I can't get the users from db every time because GAE read/write operation quota will tear me apart. The problem with this design is? As the number of users increases, the Hashmap turns to null every 4-6 hours, I think that this time is getting shorter, but I'm not sure. I'm fixing this by reloading the users from the db every time I detect that it becomes null, but this causes DOS to my users for 30 sec, so I'm looking for better solution. I'm guessing that it happens because the size of the hashmap. Am I right? I have been advised to use a spatial database, but that means that I can't work with GAE any more and it means that I need to build my big server all over again and lose my existing DB. Is there something I can do with the existing tools? Thanks.

    Read the article

  • JSON Paring - How to show second Level ListView

    - by Sophie
    I am parsing JSON data into ListView, and successfully parsed first level of JSON in MainActivity.java, where i am showing list of Main Locations, like: Inner Locations Outer Locations Now i want whenever i do tap on Inner Locations then in SecondActivity it should show Delhi and NCR in a List, same goes for Outer Locations as well, in this case whenever user do tap need to show USA JSON look like: { "all": [ { "title": "Inner Locations", "maps": [ { "title": "Delhi", "markers": [ { "name": "Connaught Place", "latitude": 28.632777800000000000, "longitude": 77.219722199999980000 }, { "name": "Lajpat Nagar", "latitude": 28.565617900000000000, "longitude": 77.243389100000060000 } ] }, { "title": "NCR", "markers": [ { "name": "Gurgaon", "latitude": 28.440658300000000000, "longitude": 76.987347699999990000 }, { "name": "Noida", "latitude": 28.570000000000000000, "longitude": 77.319999999999940000 } ] } ] }, { "title": "Outer Locations", "maps": [ { "title": "United States", "markers": [ { "name": "Virgin Islands", "latitude": 18.335765000000000000, "longitude": -64.896335000000020000 }, { "name": "Vegas", "latitude": 36.114646000000000000, "longitude": -115.172816000000010000 } ] } ] } ] } Note: But whenever i do tap on any of the ListItem in first activity, not getting any list in SecondActivity, why ? MainActivity.java:- @Override protected Void doInBackground(Void... params) { // Create an array arraylist = new ArrayList<HashMap<String, String>>(); // Retrieve JSON Objects from the given URL address jsonobject = JSONfunctions .getJSONfromURL("http://10.0.2.2/locations.json"); try { // Locate the array name in JSON jsonarray = jsonobject.getJSONArray("all"); for (int i = 0; i < jsonarray.length(); i++) { HashMap<String, String> map = new HashMap<String, String>(); jsonobject = jsonarray.getJSONObject(i); // Retrieve JSON Objects map.put("title", jsonobject.getString("title")); arraylist.add(map); } } catch (JSONException e) { Log.e("Error", e.getMessage()); e.printStackTrace(); } return null; } @Override protected void onPostExecute(Void args) { // Locate the listview in listview_main.xml listview = (ListView) findViewById(R.id.listview); // Pass the results into ListViewAdapter.java adapter = new ListViewAdapter(MainActivity.this, arraylist); // Set the adapter to the ListView listview.setAdapter(adapter); // Close the progressdialog mProgressDialog.dismiss(); listview.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Toast.makeText(MainActivity.this, String.valueOf(position), Toast.LENGTH_LONG).show(); // TODO Auto-generated method stub Intent sendtosecond = new Intent(MainActivity.this, SecondActivity.class); // Pass all data rank sendtosecond.putExtra("title", arraylist.get(position).get(MainActivity.TITLE)); Log.d("Tapped Item::", arraylist.get(position).get(MainActivity.TITLE)); startActivity(sendtosecond); } }); } } } SecondActivity.java: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Get the view from listview_main.xml setContentView(R.layout.listview_main); Intent in = getIntent(); strReceived = in.getStringExtra("title"); Log.d("Received Data::", strReceived); // Execute DownloadJSON AsyncTask new DownloadJSON().execute(); } // DownloadJSON AsyncTask private class DownloadJSON extends AsyncTask<Void, Void, Void> { @Override protected void onPreExecute() { super.onPreExecute(); } @Override protected Void doInBackground(Void... params) { // Create an array arraylist = new ArrayList<HashMap<String, String>>(); // Retrieve JSON Objects from the given URL address jsonobject = JSONfunctions .getJSONfromURL("http://10.0.2.2/locations.json"); try { // Locate the array name in JSON jsonarray = jsonobject.getJSONArray("maps"); for (int i = 0; i < jsonarray.length(); i++) { HashMap<String, String> map = new HashMap<String, String>(); jsonobject = jsonarray.getJSONObject(i); // Retrieve JSON Objects map.put("title", jsonobject.getString("title")); arraylist.add(map); } } catch (JSONException e) { Log.e("Error", e.getMessage()); e.printStackTrace(); } return null; }

    Read the article

  • How to refresh ListAdapter/ListView in android

    - by user2463990
    I have database with 2 table, custom layout for my listView, and I'm using ListAdapter to display all data on ListView - this works fine. But, I have problem when I wish display something other on listView from my Database. The data is just append on my ListView - I won't this! How I refresh/update ListAdapter? This is my MainActivity: ListAdapter adapter; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); search = (EditText) findViewById(R.id.search); lista = (ListView) findViewById(android.R.id.list); sqlite = new Sqlite(MainActivity.this); //When apps start, listView is populated with data adapter = new SimpleAdapter(this, sqlite.getAllData(), R.layout.lv_layout, new String[]{"ime","naziv","kolicina","adresa"}, new int[]R.id.kupac,R.id.proizvod,R.id.kolicina,R.id.adresa}); setListAdapter(adapter); search.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before,int count) { // TODO Auto-generated method stub String tekst = s.toString(); ArrayList<HashMap<String, String>> rez = Sqlite.getFilterData(tekst); adapter = new SimpleAdapter(MainActivity.this, rez,R.layout.lv_layout, new String[]{"ime","naziv","kolicina","adresa"}, new int[]{R.id.kupac,R.id.proizvod,R.id.kolicina,R.id.adresa}); lista.setAdapter(adapter); } } The problem is when the method onTextChanged is called. I get all the data but the data just append to my ListView. How to fix it? And this is my Sqlite class where is needed method: ArrayList<HashMap<String,String>> results_criteria = new ArrayList<HashMap<String,String>>(); public ArrayList<HashMap<String, String>> getFilterData(String criteria) { String ime_kupca = ""; String product = ""; String adress = ""; String kolicina = ""; SQLiteDatabase myDb = this.getReadableDatabase(); Cursor cursor = myDb.rawQuery("SELECT " + DB_COLUMN_IME + "," + DB_COLUMN_NAZIV + "," + DB_COLUMN_KOLICINA + "," + DB_COLUMN_ADRESA + " FROM " + DB_TABLE1_NAME + "," + DB_TABLE2_NAME + " WHERE kupac.ID = proizvod.ID AND " + DB_COLUMN_IME + " LIKE '%" + criteria + "%'", null); if(cursor != null){ if(cursor.moveToFirst()){ do{ HashMap<String,String>map = new HashMap<String,String>(); ime_kupca = cursor.getString(cursor.getColumnIndex(DB_COLUMN_IME)); product = cursor.getString(cursor.getColumnIndex(DB_COLUMN_NAZIV)); kolicina = cursor.getString(cursor.getColumnIndex(DB_COLUMN_KOLICINA)); adress = cursor.getString(cursor.getColumnIndex(DB_COLUMN_ADRESA)); map.put("ime", ime_kupca); map.put("naziv", product); map.put("kolicina", kolicina); map.put("adresa", adress); results_criteria.add(map); }while(cursor.moveToNext()); //cursor.close(); } cursor.close(); } Log.i("Rez", "" + results_criteria); return results_criteria;

    Read the article

  • get Phone numbers from android phone

    - by Luca
    Hi! First of all i'm sorry for my english... I've a problem getting phone numbers from contacts. That's my code import android.app.ListActivity; import android.database.Cursor; import android.os.Bundle; import android.provider.ContactsContract; import android.widget.SimpleAdapter; import android.widget.Toast; import java.util.ArrayList; import java.util.HashMap; public class TestContacts extends ListActivity { private ArrayList<HashMap<String,String>> list = new ArrayList<HashMap<String,String>>(); private SimpleAdapter numbers; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.contacts); numbers = new SimpleAdapter( this, list, R.layout.main_item_two_line_row, new String[] { "line1","line2" }, new int[] { R.id.text1, R.id.text2 } ); setListAdapter( numbers ); Cursor cursor = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null); while (cursor.moveToNext()) { String contactId = cursor.getString(cursor.getColumnIndex( ContactsContract.Contacts._ID)); String hasPhone = cursor.getString(cursor.getColumnIndex( ContactsContract.Contacts.HAS_PHONE_NUMBER)); //check if the contact has a phone number if (Boolean.parseBoolean(hasPhone)) { Cursor phones = getContentResolver().query( ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = "+ contactId, null, null); while (phones.moveToNext()) { // Get the phone number!? String contactName = phones.getString( phones.getColumnIndex( ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME)); String phoneNumber = phones.getString( phones.getColumnIndex( ContactsContract.CommonDataKinds.Phone.NUMBER)); Toast.makeText(this, phoneNumber, Toast.LENGTH_LONG).show(); drawContact(contactName, phoneNumber); } phones.close(); } }cursor.close(); } private void drawContact(String name, String number){ HashMap<String,String> item = new HashMap<String,String>(); item.put( "line1",name); item.put( "line2",number); list.add( item ); numbers.notifyDataSetChanged(); } } It'seems that no contact have a phone number (i've added 2 contacts on the emulator and i've tried also on my HTC Desire). The problem is that if (Boolean.parseBoolean(hasPhone)) returns always false.. How can i get correctly phone numbers? I've tried to call drawContact(String name, String number) before the if statement without querying for the phone number, and it worked (it draws two times the name). but on the LinearLayout they are not ordered alphabetically... how can i order alphabetically (similar to the original contacts app)? thank you in advice, Luca

    Read the article

  • Block copy PDF document

    - by Wiliam Witter
    hello Gentlemen, I would like block copy (ctrl+c ctrl+v) PDF document using java. I have a code that build a PDF document with JasperReport... //seta o caminho dos arquivos jasper String pathLote = ScopeSupport.getServletContext().getRealPath("priv/sgc/relatorios/AtaPregaoLotePageReport.jasper"); String pathCabecalho = ScopeSupport.getServletContext().getRealPath("priv/sgc/relatorios/CabecalhoPageReport.jasper"); String pathRodape = ScopeSupport.getServletContext().getRealPath("priv/sgc/relatorios/rodapePageReport.jasper"); String imagemDir = ScopeSupport.getServletContext().getRealPath("/priv/comum/img"); //HashMap parametros passa o parametro usado na query e o caminho da imagem HashMap<String,Object> parametros = new HashMap<String,Object>(); parametros.put("idPregao", idPregao); parametros.put("idLote", idLote); parametros.put("IMAGEM_DIR", imagemDir + "/"); parametros.put("USUARIO", "NomeUsuario" ); parametros.put("texto", texto); parametros.put("numeroAta", numAta); if(numAta != null && numAta > 0) parametros.put("relatorio", "Ata "+numAta); HashMap<String,Object> parametrosSub = new HashMap<String,Object>(); parametrosSub.put("CabecalhoPageReport", pathCabecalho); parametrosSub.put("rodapePageReport", pathRodape); parametrosSub.put("AtaPregaoPorLotePageReport", pathLote); for(String element : parametrosSub.keySet()){ parametros.put(element, (JasperReport) JRLoader.loadObject((String) (parametrosSub.get(element)))); } JasperReport report = (JasperReport) JRLoader.loadObject( pathLote ); JasperPrint printRel = JasperFillManager.fillReport( report, parametros, getJDBCConnection() ); byte[] bytes = JasperExportManager.exportReportToPdf(printRel); httpResponse.setHeader("Content-Disposition","attachment; filename=\""+ report.getName() + ".pdf" +"\";"); httpResponse.setContentLength(bytes.length); httpResponse.setContentType("application/pdf"); ServletOutputStream ouputStream = httpResponse.getOutputStream(); ouputStream.write(bytes, 0, bytes.length); ouputStream.flush(); ouputStream.close(); Who can help me with this?

    Read the article

  • listView dynamic add item

    - by pengwang
    hello,I used ListView to dynamic add item,but there is a problem about not Smooth add. there are textView and button in my listActivity,Iwant to Press button ,then textView"s text can auto add to listView,but i Pressed button ,it donot work,unless after i enter content , press "OK"Key ,then Pressed button ,textView"s text can auto add to listView. I donot know why. if I continuous Pressed button ,as3 times, then press "Ok"Key ,the content auto add list View but 3 times. public class DynamicListItems extends ListActivity { private static final String ITEM_KEY = "key"; ArrayList<HashMap<String, String>> list= new ArrayList<HashMap<String, String>>(); private SimpleAdapter adapter; private EditText newValue;@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.dynamic_list); newValue = (EditText) findViewById(R.id.new_value_field); setListAdapter(new SimpleAdapter(this, list, R.layout.row, new String[] { ITEM_KEY }, new int[] { R.id.list_value })); ((ImageButton) findViewById(R.id.button)).setOnClickListener(getBtnClickListener()); } private OnClickListener getBtnClickListener() { return new OnClickListener() { public void onClick(View view) { try { HashMap<String, String> item = new HashMap<String, String>(); item.put(ITEM_KEY, newValue.getText().toString()); list.add(item); adapter.notifyDataSetChanged(); } catch (NullPointerException e) { Log.i("[Dynamic Items]", "Tried to add null value"); } } }; }} my another question is how to dynamic delete the item,which event i need to used,could you give me some directions or Code snippets? dynamic_list.xml only contains listView ,button,textView row.xml contains TextView . i amm sorry i donot edit code together.

    Read the article

  • How can I set drawable to a ListView in android

    - by sxingfeng
    I am writing a app for android 1.5. I want to use a complex listview to display my data. I want to show a ImageView of a drawable object in my List item. I learned from a demo: ------> listData.put("Img", listData.put("Img", R.drawable.XXX)); listData.put("Time", "100"); listItems.add(listData); It can display correctly, however, I want to change Img at runtime, The image maybe generated at run-time, so I change the code as follow, but it falls. Can anyone help me ? many thanks! protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.item_list); itemListView = (ListView) findViewById(R.id.listview); ArrayList<HashMap<String, Object>> listItems = new ArrayList<HashMap<String, Object>>(); for(int i = 0;i <XXX.size(); ++i) { HashMap<String, Object> listData = new HashMap<String, Object>(); ---------> 1) listData.put("Img", new Drawable(XXX)); 2) listData.put("Time", "100"); 3) listItems.add(listData); } SimpleAdapter listItemAdapter = new SimpleAdapter(this, listItems, R.layout.listitem, new String[] { "Img", "Time"}, new int[] { R.id.listitem_img, R.id.listitem_time }); itemListView.setAdapter(listItemAdapter); listitem.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout android:layout_width="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:paddingBottom="4dip" android:paddingLeft="12dip" android:paddingRight="12dip"> <ImageView android:paddingTop="12dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/listitem_img" /> <TextView android:layout_height="wrap_content" android:textSize="20dip" android:layout_width="wrap_content" android:id="@+id/listitem_time" /> </LinearLayout>

    Read the article

  • proper use of volatile keyword

    - by luke
    I think i have a pretty good idea about the volatile keyword in java, but i'm thinking about re-factoring some code and i thought it would be a good idea to use it. i have a class that is basically working as a DB Cache. it holds a bunch of objects that it has read from a database, serves requests for those objects, and then occasionally refreshes the database (based on a timeout). Heres the skeleton public class Cache { private HashMap mappings =....; private long last_update_time; private void loadMappingsFromDB() { //.... } private void checkLoad() { if(System.currentTimeMillis() - last_update_time > TIMEOUT) loadMappingsFromDB(); } public Data get(ID id) { checkLoad(); //.. look it up } } So the concern is that loadMappingsFromDB could be a high latency operation and thats not acceptable, So initially i thought that i could spin up a thread on cache startup and then just have it sleep and then update the cache in the background. But then i would need to synchronize my class (or the map). and then i would just be trading an occasional big pause for making every cache access slower. Then i thought why not use volatile i could define the map reference as volatile private volatile HashMap mappings =....; and then in get (or anywhere else that uses the mappings variable) i would just make a local copy of the reference: public Data get(ID id) { HashMap local = mappings; //.. look it up using local } and then the background thread would just load into a temp table and then swap the references in the class HashMap tmp; //load tmp from DB mappings = tmp;//swap variables forcing write barrier Does this approach make sense? and is it actually thread-safe?

    Read the article

  • Accessing global variable in multithreaded Tomcat server

    - by jwegan
    I have a singleton object that I construct like thus: private static volatile KeyMapper mapper = null; public static KeyMapper getMapper() { if(mapper == null) { synchronized(Utils.class) { if(mapper == null) { mapper = new LocalMemoryMapper(); } } } return mapper; } The class KeyMapper is basically a synchronized wrapper to HashMap with only two functions, one to add a mapping and one to remove a mapping. When running in Tomcat 6.24 on my 32bit Windows machine everything works fine. However when running on a 64 bit Linux machine (CentOS 5.4 with OpenJDK 1.6.0-b09) I add one mapping and print out the size of the HashMap used by KeyMapper to verify the mapping got added (i.e. verify size = 1). Then I try to retrieve the mapping with another request and I keep getting null and when I checked the size of the HashMap it was 0. I'm confident the mapping isn't accidentally being removed since I've commented out all calls to remove (and I don't use clear or any other mutators, just get and put). The requests are going through Tomcat 6.24 (configured to use 200 threads with a minimum of 4 threads) and I passed -Xnoclassgc to the jvm to ensure the class isn't inadvertently getting garbage collected (jvm is also running in -server mode). I also added a finalize method to KeyMapper to print to stderr if it ever gets garbage collected to verify that it wasn't being garbage collected. I'm at my wits end and I can't figure out why one minute the entry in HashMap is there and the next it isn't :(

    Read the article

  • Display contact pictures in list view

    - by user1068400
    I need to display the contact pictures in a list view. In my custom_row_view.xml I have: <ImageView android:id="@+id/contact_image" android:layout_width="60dp" android:layout_height="50dp" /> and then in my activity i have: final SimpleAdapter adapter = new SimpleAdapter( this, list, R.layout.custom_row_view, new String[] {"avatar","telnumber","date","name","message","sent"}, new int[] {R.id.contact_image,R.id.text1,R.id.text2,R.id.text3,R.id.text4,R.id.isent} ); I have a hashmap HashMap temp2 = new HashMap(); where i put all the values of each line. ("list" is a list of Hashmap) But when I do: Cursor photo2 = managedQuery( Data.CONTENT_URI, new String[] {Photo.PHOTO}, // column for the blob Data._ID + "=?", // select row by id new String[]{photoid}, // filter by photoId null); Bitmap photoBitmap = null; if(photo2.moveToFirst()) { byte[] photoBlob = photo2.getBlob(photo2.getColumnIndex(Photo.PHOTO)); photoBitmap = BitmapFactory.decodeByteArray(photoBlob, 0, photoBlob.length); if (photoBitmap != null) temp2.put("avatar",photoBitmap); else temp2.put("avatar",R.drawable.unknowncontact); } photo2.close(); Nothing is displayed! "temp2.put("avatar",photoBitmap);" does not display anything but when I try to display something from the drawable folder it works!!! Please help me, i have been locked on this problem for several days! Thanks a lot!

    Read the article

  • Coldfusion 8 Application Crashes Under Heavy Load

    - by KM01
    Hello, We have a CF8 app that runs for 20-25 minutes before crashing under heavy load ~ 1200 users. This load is generated by our load testing tool: 1200 users ramped up in 5 mins (approx behavior of our users), running for an hour. We have this app on Solaris 10, Apache 2, JRun 4 and Oracle 10g. Java version is 1.6. During the initial load tests, the thread dumps pointed to monitor deadlocks that pointed to sessions. "jrpp-173": waiting to lock monitor 0x019fdc60 (object 0x6b893530, a java.util.Hashtable), which is held by "scheduler-1" "scheduler-1": waiting to lock monitor 0x026c3ce0 (object 0x6abe2f20, a coldfusion.monitor.memory.SessionMemoryMonitor$TopMemoryUsedSessions), which is held by "jrpp-167" "jrpp-167": waiting to lock monitor 0x019fdc60 (object 0x6b893530, a java.util.Hashtable), which is held by "scheduler-1" We increased the number of sessions relative to the number of CPUs (48 simultaneous threads against 32 CPUs), and the deadlock went away. While varying the simultaneous threads helped a little bit in terms of response time, the CF server still tanked in 20-25 minutes during all of these tests. We ran more thread dumps, and saw a thread locking a monitor, for e.g.: "jrpp-475" prio=3 tid=0x02230800 nid=0x2c5 runnable [0x4397d000] java.lang.Thread.State: RUNNABLE at java.util.HashMap.getEntry(HashMap.java:347) at java.util.HashMap.containsKey(HashMap.java:335) at java.util.HashSet.contains(HashSet.java:184) at coldfusion.monitor.memory.MemoryTracker.onAddObject(MemoryTracker.java:124) at coldfusion.monitor.memory.MemoryTrackerProxy.onReplaceValue(MemoryTrackerProxy.java:598) at coldfusion.monitor.memory.MemoryTrackerProxy.onPut(MemoryTrackerProxy.java:510) at coldfusion.util.CaseInsensitiveMap.put(CaseInsensitiveMap.java:250) at coldfusion.util.FastHashtable.put(FastHashtable.java:43) - locked <0x6f7e1a78> (a coldfusion.runtime.Struct) at coldfusion.runtime.CfJspPage._arrayset(CfJspPage.java:1027) at coldfusion.runtime.CfJspPage._arraySetAt(CfJspPage.java:2117) at cfvalidation2ecfc1052964961$funcSETUSERAUDITDATA.runFunction(/app/docs/apply/cfcs/validation.cfc:377) As you see in the last line above there were several references CFMs and CFCs, and the lines have "cflock" tags, which were scoped to the "application." We (the dev team) then changed them to be scoped to a "name". After more load tests, there is no locking going on and there no deadlocks, but now the application tanks in 7-10 minutes. We've gotten system, network and DB reports from the respective admins, and they are not being taxed; even watched the server stats with server monitor, top, prstat, ran sar reports, etc. So we believe it is an issue with the CF server or maybe the JVM. I am running out of ideas as to what else we can try. Disclaimer: I am not a CF developer or Admin. I am just running the load test, analyzing the reports, threads etc, and sharing the results with the dev and admin teams, and trying the next change, and so on. So far no dice. Has anyone run into something similar? How did you go about diagnosing and troubleshooting? All thoughts and pointers welcome. Thank you for your time! KM

    Read the article

  • Gson Deserialize to Java Tree

    - by MountainX
    I need to deserialize some JSON to a Java tree structure that contains TreeNodes and NodeData. TreeNodes are thin wrappers around NodeData. I'll provide the JSON and the classes below. I have looked at the usual Gson help sources, including here, but I can't seem to come up with the solution. Serialization works fine with Gson. The JSON below was produced by Gson. But deserialization is the problem I need help with. Can someone show me how to write the deserializer (or suggest an alternative approach using Gson best practices)? Here is my JSON. The "data" element corresponds to class NodeData, and the "subList" JSON element corresponds to Java class TreeNode. { "data": { "version": "032", "name": "root", "path": "/", "id": "1", "parentId": "0", "toolTipText": "rootNode" }, "subList": [ { "data": { "version": "032", "name": "level1", "labelText": "Some Label Text at Level1", "path": "/root", "id": "2", "parentId": "1", "toolTipText": "a tool tip for level1" }, "subList": [ { "data": { "version": "032", "name": "level1_1", "labelText": "Label level1_1", "path": "/root/level1", "id": "3", "parentId": "2", "toolTipText": "ToolTipText for level1_1" } }, { "data": { "version": "032", "name": "level1_2", "labelText": "Label level1_2", "path": "/root/level1", "id": "4", "parentId": "2", "toolTipText": "ToolTipText for level1_2" } } ] }, { "data": { "version": "032", "name": "level2", "path": "/root", "id": "5", "parentId": "1", "toolTipText": "ToolTipText for level2" }, "subList": [ { "data": { "version": "032", "name": "level2_1", "labelText": "Label level2_1", "path": "/root/level2", "id": "6", "parentId": "5", "toolTipText": "ToolTipText for level2_1" }, "subList": [ { "data": { "version": "032", "name": "level2_1_1", "labelText": "Label level2_1_1", "path": "/root/level2/level2_1", "id": "7", "parentId": "6", "toolTipText": "ToolTipText for level2_1_1" } } ] } ] } ] } Here are the Java classes: public class Tree { private TreeNode rootElement; private HashMap<String, TreeNode> indexById; private HashMap<String, TreeNode> indexByKey; private long nextAvailableID = 0; public Tree() { indexById = new HashMap<String, TreeNode>(); indexByKey = new HashMap<String, TreeNode>(); } public long getNextAvailableID() { return this.nextAvailableID; } ... [snip] ... } public class TreeNode { private Tree tree; private NodeData data; public List<TreeNode> subList; private HashMap<String, TreeNode> indexById; private HashMap<String, TreeNode> indexByKey; //this default ctor is used only for Gson deserialization public TreeNode() { this.tree = new Tree(); indexById = tree.getIdIndex(); indexByKey = tree.getKeyIndex(); this.makeRoot(); tree.setRootElement(this); } //makes this node the root node. Calling this obviously has side effects. public NodeData makeRoot() { NodeData rootProp = new NodeData(TreeFactory.version, "example", "rootNode"); String nextAvailableID = getNextAvailableID(); if (!nextAvailableID.equals("1")) { throw new IllegalStateException(); } rootProp.setId(nextAvailableID); rootProp.setParentId("0"); rootProp.setKeyPathOnly("/"); rootProp.setSchema(tree); this.data = rootProp; rootProp.setNode(this); indexById.put(rootProp.getId(), this); indexByKey.put(rootProp.getKeyFullName(), this); return rootProp; } ... [snip] ... } public class NodeData { protected static Tree tree; private LinkedHashMap<String, String> keyValMap; protected String version; protected String name; protected String labelText; protected String path; protected String id; protected String parentId; protected TreeNode node; protected String toolTipText;//tool tip or help string protected String imagePath;//for things like images; not persisted to properties protected static final String delimiter = "/"; //this default ctor is used only for Gson deserialization public NodeData() { this("NOT_SET", "NOT_SET", "NOT_SET"); } ... [snip] ... } Side note: The tree data structure is a bit strange, as it includes indexes. Obviously, this isn't a typical search tree. In fact, the tree is used mainly to create a hierarchical path element (String) in each NodeData element. (Example: "path": "/root/level2/level2_1".) The indexes are actually used for NodeData retrieval.

    Read the article

  • How to handle optional variables of an object in Java?

    - by Arvanem
    Hi folks, For my trading program, I have a Merchant class. A given Merchant object may or may not have a particular special quality or bundle of special qualities. For example, one Merchant object may have the Stockbroker quality, another Merchant may have the Financial Services and Stockbroker qualities, and another Merchant may have no special qualities at all. My initial thought was to create a HashMap and a Qualities class as follows: Map<Qualities, Boolean> merchantQualities = new HashMap<Qualities, Boolean>(); The only problem is, there are at least 50 possible special qualities for Merchants, such that it would be extremely tiresome to subclass all the qualities from the Quality class. Is there a better way of coding for these optional special qualities and representing them in the Merchants class than a HashMap and subclassing a Qualities class?

    Read the article

  • Invoke private method with interface as argument

    - by Stephanie
    Hi, I've been attempting to invoke a private method whose argument is a parameter and I can't quite seem to get it right. Here's kind of how the code looks so far: public class TestClass { public TestClass(){ } private void simpleMethod( Map<String, Integer> testMap) { //code logic } } Then I attempt to use this to invoke the private method: //Hashmap Map <String, Integer> testMap = new HashMap <String, Integer>(); //method I want to invoke Method simpleMethod = TestClass.class.getDeclaredMethod("simpleMethod", Map.class); simpleMethod.setAccessible(true); simpleMethod.invoke(testClassObject, testMap); //Throws an IllegalArgumentException As you can see, it throws an IllegalArgumentException. I've attempted to cast the hashmap back to a map, but that didn't work. What am I doing wrong?

    Read the article

  • I have applied a check for not allowing alphabets.But its not working.....

    - by bhavna raghuvanshi
    import java.util.Scanner; public class Main extends Hashmap{ public static void main(String[] args) { Hashmap hm = new Hashmap(); int x=0; Scanner input = new Scanner(System.in); do{ System.out.print("Enter any integer value between 1 to 12: "); x = input.nextInt(); }while(x<=0 || x>12); Scanner sc = new Scanner(System.in); //int number; do { while (!sc.hasNextInt()) { System.out.println("That's not a number!"); sc.next(); } x = sc.nextInt(); }while(x>=0); String month = hm.getEntry(x); System.out.println(month); } } here I need to restrict user from entering an alphabet.But its not working. pls help...

    Read the article

  • How to Initialise a static Map in Java

    - by fahdshariff
    How would you initialise a static Map in Java? Method one: Static initialiser Method two: instance initialiser (anonymous subclass) or some other method? What are the pros and cons of each? Here is an example illustrating two methods: import java.util.HashMap; import java.util.Map; public class Test { private static final Map<Integer, String> myMap = new HashMap<Integer, String>(); static { myMap.put(1, "one"); myMap.put(2, "two"); } private static final Map<Integer, String> myMap2 = new HashMap<Integer, String>(){ { put(1, "one"); put(2, "two"); } }; }

    Read the article

  • how can i update view when fragment change?

    - by user1524393
    i have a activity that have 2 sherlockfragment in this The first two pages display fragments with custom list views which are built from xml from server using AsyncTask. However, when the app runs, only one list view is displayed, the other page is just blank public class VpiAbsTestActivity extends SherlockFragmentActivity { private static final String[] CONTENT = new String[] { "1","2"}; TestFragmentAdapter mAdapter; ViewPager mPager; PageIndicator mIndicator; protected void onCreate(Bundle savedInstanceState) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); super.onCreate(savedInstanceState); setContentView(R.layout.simple_tabs); mAdapter = new TestFragmentAdapter(getSupportFragmentManager()); mPager = (ViewPager)findViewById(R.id.pager); mPager.setAdapter(mAdapter); mIndicator = (TabPageIndicator)findViewById(R.id.indicator); mIndicator.setViewPager(mPager); mIndicator.notifyDataSetChanged(); } class TestFragmentAdapter extends FragmentPagerAdapter { private int mCount = CONTENT.length; public TestFragmentAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { switch(position) { case 0: return new customlist(); case 1: return new customlistnotuser(); default: return null; } } @Override public int getCount() { return mCount; } public CharSequence getPageTitle(int position) { return VpiAbsTestActivity.CONTENT[position % VpiAbsTestActivity.CONTENT.length].toUpperCase(); } @Override public void destroyItem(View collection, int position, Object view) { ((ViewPager) collection).removeView((View) view); } } } what can i update viewpager when change pages ? the customlistnotuser page likes customlist page but not show public class customlistnotuser extends SherlockFragment { // All static variables static final String URL = "url"; // XML node keys static final String KEY_TEST = "test"; // parent node static final String KEY_ID = "id"; static final String KEY_TITLE = "title"; static final String KEY_Description = "description"; static final String KEY_DURATION = "duration"; static final String KEY_THUMB_URL = "thumb_url"; static final String KEY_PRICE = "price"; static final String KEY_URL = "url"; private ProgressDialog pDialog; ListView list; LazyAdapterbeth adapter; XMLParser parser = new XMLParser(); public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); } public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); new getFeed().execute(); } public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View thisfragment = inflater.inflate(R.layout.dovomi, container, false); return thisfragment; } private class getFeed extends AsyncTask<Void, Void, Document> { } protected Document doInBackground(Void... params) { XMLParser parser = new XMLParser(); String xml = parser.getXmlFromUrl(URL); // getting XML from URL Document doc = parser.getDomElement(xml); // getting DOM element return doc; } protected void onPostExecute(Document doc) { ArrayList<HashMap<String, String>> songsList = new ArrayList<HashMap<String, String>>(); NodeList nl = doc.getElementsByTagName(KEY_TEST); // looping through all song nodes <song> for (int i = 0; i < nl.getLength(); i++) { // creating new HashMap HashMap<String, String> map = new HashMap<String, String>(); Element e = (Element) nl.item(i); // adding each child node to HashMap key => value map.put(KEY_ID, parser.getValue(e, KEY_ID)); map.put(KEY_TITLE, parser.getValue(e, KEY_TITLE)); map.put(KEY_Description, parser.getValue(e, KEY_Description)); map.put(KEY_DURATION, parser.getValue(e, KEY_DURATION)); map.put(KEY_THUMB_URL, parser.getValue(e, KEY_THUMB_URL)); map.put(KEY_PRICE, parser.getValue(e, KEY_PRICE)); map.put(KEY_URL, parser.getValue(e, KEY_URL)); // adding HashList to ArrayList songsList.add(map); pDialog.dismiss(); } list=(ListView)getActivity().findViewById(R.id.list); // Getting adapter by passing xml data ArrayList adapter=new LazyAdapterbeth(getActivity(), songsList); list.setAdapter(adapter); // Click event for single list row list.setOnItemClickListener(new OnItemClickListener() {

    Read the article

  • Improving performance of fuzzy string matching against a dictionary [closed]

    - by Nathan Harmston
    Hi, So I'm currently working for with using SecondString for fuzzy string matching, where I have a large dictionary to compare to (with each entry in the dictionary has an associated non-unique identifier). I am currently using a hashMap to store this dictionary. When I want to do fuzzy string matching, I first check to see if the string is in the hashMap and then I iterate through all of the other potential keys, calculating the string similarity and storing the k,v pair/s with the highest similarity. Depending on which dictionary I am using this can take a long time ( 12330 - 1800035 entries ). Is there any way to speed this up or make it faster? I am currently writing a memoization function/table as a way of speeding this up, but can anyone else think of a better way to improve the speed of this? Maybe a different structure or something else I'm missing. Many thanks in advance, Nathan

    Read the article

  • What datastructure would you use for a collision-detection in a tilemap?

    - by Solom
    Currently I save those blocks in my map that could be colliding with the player in a HashMap (Vector2, Block). So the Vector2 represents the coordinates of the blog. Whenever the player moves I then iterate over all these Blocks (that are in a specific range around the player) and check if a collision happened. This was my first rough idea on how to implement the collision-detection. Currently if the player moves I put more and more blocks in the HashMap until a specific "upper bound", then I clear it and start over. I was fully aware that it was not the brightest solution for the problem, but as said, it was a rough first implementation (I'm still learning a lot about game-design and the data-structure). What data-structure would you use to save the Blocks? I thought about a Queue or even a Stack, but I'm not sure, hence I ask.

    Read the article

  • Should I tell a departed coworker about their "sev 1" defect?

    - by noahz
    I had a co-worker leave our company recently. Before leaving, he coded a component that had a severe memory leak that caused a production outage (OutOfMemoryError in Java). The problem was essentially a HashMap that grew and never removed entries, and the solution was to replace the HashMap with a cache implementation. From a professional standpoint, I feel that I should let him know about the defect so he can learn from the error. On the other hand, once people leave a company, they often don't want to hear about legacy projects that they have left behind for bigger and better things. What is the general protocol for this sort of situation?

    Read the article

  • Amazon Kindle - Whispersync implementation?

    - by Bala
    For those who are not aware of Kindle's whispersync, here is how it works (from amazon.com): "...Whispersync synchronizes the bookmarks and furthest page read among devices registered to the same account. Whispersync is on by default to ensure a seamless reading experience for a book read across multiple Kindles." Can anyone give some details on how the Whispersync feature is implemented in Kindle and in the Backend of Amazon? I am guessing this implementation involves a very simple hashmap for each user account. Each hashmap maps Books with satellite information about the book. Satellite information contains bookmarks, furthest page read, device on which it was read, etc.. Thanks!

    Read the article

  • NullPointerException using EndlessAdapter with SimpleAdapter

    - by android_dev
    Hello, I am using EndlessAdapter from commonsguy with a SimpleAdapter. I can load data when I make a scroll down without problems, but I have a NullPointerException when I make a scroll up. The problem is in the method @Override public View getView(int position, View convertView,ViewGroup parent) { return wrapped.getView(position, convertView, parent); } from the class AdapterWrapper. The call to wrapped.getView(position, convertView,parent) raises the exception and I don´t know why. This is my implementation of EndlessAdapter: //Inner class in SearchTextActivity class DemoAdapter extends EndlessAdapter { private RotateAnimation rotate = null; DemoAdapter(ArrayList<HashMap<String, String>> result) { super(new SimpleAdapter(SearchTracksActivity.this, result, R.layout.textlist_item, PROJECTION_COLUMNS, VIEW_MAPPINGS)); rotate = new RotateAnimation( 0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); rotate.setDuration(600); rotate.setRepeatMode(Animation.RESTART); rotate.setRepeatCount(Animation.INFINITE); } @Override protected View getPendingView(ViewGroup parent) { View row=getLayoutInflater().inflate(R.layout.textlist_item, null); View child=row.findViewById(R.id.title); child.setVisibility(View.GONE); child=row.findViewById(R.id.username); child.setVisibility(View.GONE); child=row.findViewById(R.id.throbber); child.setVisibility(View.VISIBLE); child.startAnimation(rotate); return row; } @Override @SuppressWarnings("unchecked") protected void rebindPendingView(int position, View row) { HashMap<String, String> res = (HashMap<String, String>)getWrappedAdapter().getItem(position); View child=row.findViewById(R.id.title); ((TextView)child).setText(res.get("title")); child.setVisibility(View.VISIBLE); child=row.findViewById(R.id.username); ((TextView)child).setText(res.get("username")); child.setVisibility(View.VISIBLE); ImageView throbber=(ImageView)row.findViewById(R.id.throbber); throbber.setVisibility(View.GONE); throbber.clearAnimation(); } boolean mFinal = true; @Override protected boolean cacheInBackground() { EditText searchText = (EditText)findViewById(R.id.searchText); String textToSearch = searchText.getText().toString(); Util.getSc().searchText(textToSearch , offset, limit, new ResultListener<ArrayList<Text>>() { @Override public void onError(Exception e) { e.toString(); mFinal = false; } @Override public void onSuccess(ArrayList<Text> result) { if(result.size() == 0){ mFinal = false; }else{ texts.addAll(result); offset++; } } }); return mFinal; } @Override protected void appendCachedData() { for(Text text : texts){ result.add(text.getMapValues()); } texts.clear(); } } And I use it this way: public class SearchTextActivity extends AbstractListActivity { private static final String[] PROJECTION_COLUMNS = new String[] { TextStore.Text.TITLE, TextStore.Text.USER_NAME}; private static final int[] VIEW_MAPPINGS = new int[] { R.id.Text_title, R.id.Text_username}; ArrayList<HashMap<String, String>> result; static ArrayList<Text> texts; static int offset = 0; static int limit = 1; @Override void onAbstractCreate(Bundle savedInstance) { setContentView(R.layout.search_tracks); setupViews(); } private void setupViews() { ImageButton searchButton = (ImageButton)findViewById(R.id.searchButton); updateView(); } SimpleAdapter adapter; void updateView(){ if(result == null) { result = new ArrayList<HashMap<String, String>>(); } if(tracks == null) { texts = new ArrayList<Text>(); } } public void sendQuery(View v){ offset = 0; texts.clear(); result.clear(); setListAdapter(new DemoAdapter(result)); } } Does anybody knows what could be the problem? Thank you in advance

    Read the article

  • changing value of a textview while change in other textview by multiplying

    - by sur007
    Here I am getting parsed data from a URL and now I am trying to change the value of parse data to users only dynamically on an text view and my code is package com.mokshya.jsontutorial; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.HashMap; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; import com.mokshya.jsontutorialhos.xmltest.R; import android.app.AlertDialog; import android.app.ListActivity; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; import android.util.Log; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.EditText; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.SimpleAdapter; import android.widget.TextView; import android.widget.Toast; public class Main extends ListActivity { EditText resultTxt; public double C_webuserDouble; public double C_cashDouble; public double C_transferDouble; public double S_webuserDouble; public double S_cashDouble; public double S_transferDouble; TextView cashTxtView; TextView webuserTxtView; TextView transferTxtView; TextView S_cashTxtView; TextView S_webuserTxtView; TextView S_transferTxtView; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.listplaceholder); cashTxtView = (TextView) findViewById(R.id.cashTxtView); webuserTxtView = (TextView) findViewById(R.id.webuserTxtView); transferTxtView = (TextView) findViewById(R.id.transferTxtView); S_cashTxtView = (TextView) findViewById(R.id.S_cashTxtView); S_webuserTxtView = (TextView) findViewById(R.id.S_webuserTxtView); S_transferTxtView = (TextView) findViewById(R.id.S_transferTxtView); ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>(); JSONObject json = JSONfunctions .getJSONfromURL("http://ldsclient.com/ftp/strtojson.php"); try { JSONArray netfoxlimited = json.getJSONArray("netfoxlimited"); for (inti = 0; i < netfoxlimited.length(); i++) { HashMap<String, String> map = new HashMap<String, String>(); JSONObject e = netfoxlimited.getJSONObject(i); map.put("date", e.getString("date")); map.put("c_web", e.getString("c_web")); map.put("c_bank", e.getString("c_bank")); map.put("c_cash", e.getString("c_cash")); map.put("s_web", e.getString("s_web")); map.put("s_bank", e.getString("s_bank")); map.put("s_cash", e.getString("s_cash")); mylist.add(map); } } catch (JSONException e) { Log.e("log_tag", "Error parsing data " + e.toString()); } ListAdapter adapter = new SimpleAdapter(this, mylist, R.layout.main, new String[] { "date", "c_web", "c_bank", "c_cash", "s_web", "s_bank", "s_cash", }, new int[] { R.id.item_title, R.id.webuserTxtView, R.id.transferTxtView, R.id.cashTxtView, R.id.S_webuserTxtView, R.id.S_transferTxtView, R.id.S_cashTxtView }); setListAdapter(adapter); final ListView lv = getListView(); lv.setTextFilterEnabled(true); lv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { @SuppressWarnings("unchecked") HashMap<String, String> o = (HashMap<String, String>) lv .getItemAtPosition(position); Toast.makeText(Main.this, "ID '" + o.get("id") + "' was clicked.", Toast.LENGTH_SHORT).show(); } }); resultTxt = (EditText) findViewById(R.id.editText1); resultTxt.setOnClickListener(new View.OnClickListener() { public void onClick(View arg0) { // TODO Auto-generated method stub resultTxt.setText(""); } }); resultTxt.addTextChangedListener(new TextWatcher() { public void afterTextChanged(Editable arg0) { // TODO Auto-generated method stub String text; text = resultTxt.getText().toString(); if (resultTxt.getText().length() > 5) { calculateSum(C_webuserDouble, C_cashDouble, C_transferDouble); calculateSunrise(S_webuserDouble, S_cashDouble, S_transferDouble); } else { } } public void beforeTextChanged(CharSequence s, int start, int count, int after) { // TODO Auto-generated method stub } public void onTextChanged(CharSequence s, int start, int before, int count) { // TODO Auto-generated method stub } }); } private void calculateSum(Double webuserDouble, Double cashDouble, Double transferDouble) { String Qty; Qty = resultTxt.getText().toString(); if (Qty.length() > 0) { double QtyValue = Double.parseDouble(Qty); double cashResult; double webuserResult; double transferResult; cashResult = cashDouble * QtyValue; webuserResult = webuserDouble * QtyValue; transferResult = transferDouble * QtyValue; DecimalFormat df = new DecimalFormat("#.##"); String cashResultStr = df.format(cashResult); String webuserResultStr = df.format(webuserResult); String transferResultStr = df.format(transferResult); cashTxtView.setText(String.valueOf(cashResultStr)); webuserTxtView.setText(String.valueOf(webuserResultStr)); transferTxtView.setText(String.valueOf(transferResultStr)); // cashTxtView.setFilters(new InputFilter[] {new // DecimalDigitsInputFilter(2)}); } if (Qty.length() == 0) { cashTxtView.setText(String.valueOf(cashDouble)); webuserTxtView.setText(String.valueOf(webuserDouble)); transferTxtView.setText(String.valueOf(transferDouble)); } } private void calculateSunrise(Double webuserDouble, Double cashDouble, Double transferDouble) { String Qty; Qty = resultTxt.getText().toString(); if (Qty.length() > 0) { double QtyValue = Double.parseDouble(Qty); double cashResult; double webuserResult; double transferResult; cashResult = cashDouble * QtyValue; webuserResult = webuserDouble * QtyValue; transferResult = transferDouble * QtyValue; DecimalFormat df = new DecimalFormat("#.##"); String cashResultStr = df.format(cashResult); String webuserResultStr = df.format(webuserResult); String transferResultStr = df.format(transferResult); S_cashTxtView.setText(String.valueOf(cashResultStr)); S_webuserTxtView.setText(String.valueOf(webuserResultStr)); S_transferTxtView.setText(String.valueOf(transferResultStr)); } if (Qty.length() == 0) { S_cashTxtView.setText(String.valueOf(cashDouble)); S_webuserTxtView.setText(String.valueOf(webuserDouble)); S_transferTxtView.setText(String.valueOf(transferDouble)); } } } and I am getting following error on logcat 08-28 15:04:12.839: E/AndroidRuntime(584): Uncaught handler: thread main exiting due to uncaught exception 08-28 15:04:12.848: E/AndroidRuntime(584): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mokshya.jsontutorialhos.xmltest/com.mokshya.jsontutorial.Main}: java.lang.NullPointerException 08-28 15:04:12.848: E/AndroidRuntime(584): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2401) 08-28 15:04:12.848: E/AndroidRuntime(584): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417) 08-28 15:04:12.848: E/AndroidRuntime(584): at android.app.ActivityThread.access$2100(ActivityThread.java:116) 08-28 15:04:12.848: E/AndroidRuntime(584): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794) 08-28 15:04:12.848: E/AndroidRuntime(584): at android.os.Handler.dispatchMessage(Handler.java:99) 08-28 15:04:12.848: E/AndroidRuntime(584): at android.os.Looper.loop(Looper.java:123) 08-28 15:04:12.848: E/AndroidRuntime(584): at android.app.ActivityThread.main(ActivityThread.java:4203) 08-28 15:04:12.848: E/AndroidRuntime(584): at java.lang.reflect.Method.invokeNative(Native Method) 08-28 15:04:12.848: E/AndroidRuntime(584): at java.lang.reflect.Method.invoke(Method.java:521) 08-28 15:04:12.848: E/AndroidRuntime(584): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791) 08-28 15:04:12.848: E/AndroidRuntime(584): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549) 08-28 15:04:12.848: E/AndroidRuntime(584): at dalvik.system.NativeStart.main(Native Method) 08-28 15:04:12.848: E/AndroidRuntime(584): Caused by: java.lang.NullPointerException 08-28 15:04:12.848: E/AndroidRuntime(584): at com.mokshya.jsontutorial.Main.onCreate(Main.java:111) 08-28 15:04:12.848: E/AndroidRuntime(584): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123) 08-28 15:04:12.848: E/AndroidRuntime(584): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364)

    Read the article

  • XMLRPC Response Using ws-xmlrpc

    - by Dave
    Anyone have experience parsing complex response types using ws-xmlrpc? The service returns a HashMap with one of the values an Array, when I request the key of the array from the hashmap, java just returns "java.lang.Object". How do I access the contents of the array? Any ideas? Thanks in advance for your input.

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >