Search This Blog

Monday, November 4, 2013

Using the GNU C/C++ compiler on AIX

very good article to people who want to port their C++ code that compiled under XLC compiler to work and compile via gcc/g++.

Using the GNU C/C++ compiler on AIX:

from internal test ...( not scientific tests)- its seems like the test program i used for my performence testing run faster when compile with g++  !!!!

FYI
Yaniv Tzanany

Thursday, October 10, 2013

Wednesday, October 9, 2013

Passing jstring to JAVA from C++ - the right way.

hi
i used to use this function
m_env->NewStringUTF(formattedMsg);

and one day i saw that the string i passed in my case it was huge more than 500k, cut in the end.
so i replcae this function with this one ... and its worked !!

jstring WindowsToJstring(JNIEnv* pEnv, LPCTSTR cstr) {
jstring retJstring = NULL;
int slen = strlen(cstr);
int length = MultiByteToWideChar( CP_ACP, 0, (LPCSTR)cstr, slen, NULL, 0 );
unsigned short* tempbuffer = (unsigned short *)malloc( length*2 + 1 );
MultiByteToWideChar( CP_ACP, 0, (LPCSTR)cstr, slen, (LPWSTR)tempbuffer, length );
retJstring = (pEnv)->NewString((jchar*)tempbuffer, length );
free( tempbuffer );
return retJstring;
}

more details could be found here
http://www.anyang-window.com.cn/between-java-and-c-transmission-through-jni-chinese-string-and-hash-issues/

and
http://stackoverflow.com/questions/8258834/sending-utf-chars-to-java-from-c-using-jni

Sunday, September 29, 2013

Friday, September 6, 2013

Android change time zone - programmatically

i use the next code to change OS time zone ... seems to be working

AlarmManager alarm = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
alarm.setTimeZone("Europe/Athens");

add the next permisiion :
android.permission.SET_TIME_ZONE


Sunday, September 1, 2013

SVN - for dummies

Create TAG , is good idea when you have like a big delivery to client.
TAG is like base line.
while Brunch is like a Stream.

Trunk is the main development stream , Usually you will have Tags on the trunk.

you can Merge stuff from brunch to trunk - with the merge options.