Monday, April 22, 2013

Mxdperfstat 10.1 Download MXD Performance Statistics

If you are here chances that you were like me searching for an ArcGIS 10.1 version of this wonderful tool. Well, there isn't any, but I managed to make it work by copying some 10 dependency dlls. (Version , System and few others, took me awhile to figure them out)

If you don't know what this tool is, this is it's description from ESRI site

MXDPERFSTAT (ArcGIS 10 and 93) can help diagnose typical MXD document performance problems, e.g. 
• Inefficient scale dependency 
• Slow symbology 
• Large features 
• Projection on the fly 
• Potential database tuning 

System Requirements: 
1. Microsoft .Net Framework 
2. ESRI .NET Assembly 10 or 9.3.1 
a. ArcGIS Desktop with .Net support or 
b. ESRI Engine Runtime 
3. ESRI license: 
a. ArcGIS Engine runtime or 
b. ArcGIS Desktop

This tool will work on ArcGIS 10.1, extract and use,

Download here

If you want the 9.3 or 10 version of this tool click here.

Friday, April 19, 2013

Fetch URL Text from Android/Java Application

I searched a lot for a straight forward clean multithreaded code to do this simple task, read data from a URL and get the output. All I found were segments of codes that force close.

So I wrote a simple class do this task.

Create a new Class name it FetchURL and past this whole thing into it.

//Hussein Nasser 19-4-2013
//www.husseinnasser.com 
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
 public class FetchURL {

 private String output;
 private String url;
 
 public FetchURL()
 {
  output = "";
 }
 
 public String getOutput()
 {
  return output;
 }
 
 
 public void Run(String u)
 {
   url = u;
    Thread t =  new Thread() {
         
       public void run() {
                   
         // Toast.makeText( mycontext , "running thread bitch", Toast.LENGTH_LONG).show();
                   
                    URL textUrl;
               try {
                 
                textUrl = new URL(url);
                
                BufferedReader bufferReader = new BufferedReader(new InputStreamReader(textUrl.openStream()));
                 
                String StringBuffer;
                      String stringText = "";
                while ((StringBuffer = bufferReader.readLine()) != null) {
                 stringText += StringBuffer;
                }
                      bufferReader.close();
                 
                      output = stringText;
                    
               } catch (Exception e) {
                // TODO Auto-generated catch block
                //e.printStackTrace();
                 
                output= e.toString();
               }
              
                }
            };
             
           t.start();
      try {
   t.join();
  } catch (InterruptedException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  }
  
 }
 
 
 
 
}



To use the code in your main activity

//Create an Instance of our Class
     FetchURL fu = new FetchURL();
     
     //run this shit (this will pause your current activity until you get the result, this should return 123 
     fu.Run("http://geshout.com/version.txt"); 
     
     //You are clear, your activity is now active and get your string and do Whatever you want 
     String o = fu.getOutput();
     
     //Cheers!
     Toast.makeText(this, "output " +   fu.getOutput(), Toast.LENGTH_LONG).show();
     

This code allows you to read and execute PHP URL, almost anything that returns HTML I guess, anyway report any bugs to me. This code uses threading to execute the network capability And oh, make sure you have the internet permission on your Android Manifest.