6/20/2013

Google Chrome cash directory change.


open Chrome property dialog.

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"

Add cache directory name.

--disk-cache-dir="R:\TEMP\CHROME"


-- complete .

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"  --disk-cache-dir="R:\USERTEMP"


-- remove previous chrome cache dir.

C:\Users\ your name dir \AppData\Local\Google\Chrome\User Data\Default

/Default/Cache

/Default/Media Cache


Round View - android


- android Resource res drawable

rounded_corner_view.xml



http://schemas.android.com/apk/res/android
">   
   
   



Layour background


android:layout_height="wrap_content"
android:background="@drawable/rounded_corner_view"
android:padding="12dip"
android:orientation="vertical">
 

6/10/2013

visual studio 2012 initialize. reset


Visual Studio 2012 too slow.

initialize user data.


start menu --> command   

devenv.exe /resetuserdata 

For more information, http://www.microsoft.com

6/07/2013

serial port cts rts checking signal cable. linux and win32



// win32

int IsCTSEnabled(int handle)
{
  int status;

  GetCommModemStatus(handle, (LPDWORD)((void *)&status));

  if(status&MS_CTS_ON) return(1);
  else return(0);
}

// linux.

// ref
/*
TIOCM_LE  DSR (data set ready/line enable)
TIOCM_DTR DTR (data terminal ready)
TIOCM_RTS RTS (request to send)
TIOCM_ST  Secondary TXD (transmit)
TIOCM_SR  Secondary RXD (receive)
TIOCM_CTS CTS (clear to send)
TIOCM_CAR DCD (data carrier detect)
TIOCM_CD  Synonym for TIOCM_CAR
TIOCM_RNG RNG (ring)
TIOCM_RI  Synonym for TIOCM_RNG
TIOCM_DSR DSR (data set ready)
*/
int RS232_IsCTSEnabled(int handle)
{
  int status;

  ioctl((int handle, TIOCMGET, &status);

  if(status&TIOCM_CTS) return(1);
  else return(0);
}








6/04/2013

lua c/c++ binding. LUNA


LUNA 

Author 

/*
 * Lenny Palozzi - lenny.palozzi@home.com
 */


Code 


/*
 * Lenny Palozzi - lenny.palozzi@home.com
 */
extern "C" {
#include
}

template
class Luna
{
 public:
   /* member function map */
   struct RegType { 
      const char* name; 
      const int(T::*mfunc)(lua_State*);
   };      
   /* register class T */
   static void Register(lua_State* L) {
      lua_pushcfunction(L, &Luna::constructor);
      lua_setglobal(L, T::className);
      
      if (otag == 0) {
otag = lua_newtag(L);
lua_pushcfunction(L, &Luna::gc_obj);
lua_settagmethod(L, otag, "gc"); /* tm to release objects */
      }
   }
 private:
   static int otag; /* object tag */
   
   /* member function dispatcher */
   static int thunk(lua_State* L) {
      /* stack = closure(-1), [args...], 'self' table(1) */
      int i = static_cast(lua_tonumber(L,-1));
      lua_pushnumber(L, 0); /* userdata object at index 0 */
      lua_gettable(L, 1);
      T* obj = static_cast(lua_touserdata(L,-1));
      lua_pop(L, 2); /* pop closure value and obj */
      return (obj->*(T::Register[i].mfunc))(L);
   }
   
   /* constructs T objects */
   static int constructor(lua_State* L) {
      T* obj= new T(L); /* new T */
      /* user is expected to remove any values from stack */
      
      lua_newtable(L); /* new table object */
      lua_pushnumber(L, 0); /* userdata obj at index 0 */
      lua_pushusertag(L, obj, otag); /* have gc call tm */
      lua_settable(L, -3);
      
      /* register the member functions */
      for (int i=0; T::Register[i].name; i++) {
lua_pushstring(L, T::Register[i].name);
lua_pushnumber(L, i);
lua_pushcclosure(L, &Luna::thunk, 1);
lua_settable(L, -3);
      }
      return 1; /* return the table object */
   }

   /* releases objects */
   static int gc_obj(lua_State* L) {
      T* obj = static_cast(lua_touserdata(L, -1));
      delete obj;
      return 0;
   }
 protected: 
   Luna(); /* hide default constructor */
};
template
int Luna::otag = 0;



LICENSE



Copyright (c) 2005 Leonardo Palozzi

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.