2012年9月27日 星期四

AMD CodeXL: OpenGL and OpenCL Debugger and Profiler


AMD CodeXL is a new tool for OpenGL and OpenCL developers. CodeXL includes a GPU debugger, a profiler for both GPU and CPU and offers OpenCL kernels analysis capabilities. CodeXL is available as a standalone application for Linux (64-bit) and Windows (32 and 64-bit). An extension for Visual Studio is also available. http://developer.amd.com/tools/hc/CodeXL/Pages/default.aspx

2012年9月26日 星期三

Android customized button

drawable/ return_btn.xml values/ style.xml

Create drawable/return_btn.xml in drawable folder


      
     
     

Create values/style.xml in your value folder


    

Add ReturnButton style in your layout
http://jp-lin.blogspot.tw/2010/12/android.html

2012年9月23日 星期日

SQLite

MesaSQLite可以幫助讀入及編輯*.sqlite

讀入已存在的sqlite
    
 private static final String DB_PATH  = "/data/data/com.xxx.xxx/databases/";
 private static final String DB_NAME  = "xxx.sqlite";

 SQLiteDatabase database = this.getReadableDatabase();
  
 try {
  //Open your local db as the input stream
   InputStream myInput = ctx.getAssets().open(DB_NAME);
  
   // Path to the just created empty db
    String outFileName = DB_PATH + DB_NAME;
  
     //Open the empty db as the output stream
     OutputStream myOutput = new FileOutputStream(outFileName);
  
      //transfer bytes from the inputfile to the outputfile
         byte[] buffer = new byte[1024];
      int length;
      while ((length = myInput.read(buffer))>0){
       myOutput.write(buffer, 0, length);
      }
  
      //Close the streams
      myOutput.flush();
      myOutput.close();
      myInput.close();
  
        
  } catch (IOException e) 
  {
      throw new Error("Error copying database");
  }
          
     database.close();

2012年9月11日 星期二

Chat List show/hide keyboard

    
_chatList.setOnTouchListener( new OnTouchListener()
{

      @Override
      public boolean onTouch(View v, MotionEvent event) {
      // TODO Auto-generated method stub
       (
           //close keyboard
            (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(
            _chatText.getWindowToken(), 0);

            //open keyboard
              ((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInput(chatText,
                        InputMethodManager.SHOW_FORCED);

     return false;
 }
         
});

http://stackoverflow.com/questions/1109022/close-hide-the-android-soft-keyboard