Thursday, July 15, 2010

String → int

1. int i = Integer.parseInt(str);

2. int i = Integer.parseInt(str[, int radix]);

3. int i = Integer.valueOf(str).intValue();

int → String

1. String s = String.valueOf(i);

2. String s = Integer.toString(i);

3. String s = "" + i;

Labels:

Saturday, May 29, 2010

Monday, May 24, 2010

mAlarmManager = (AlarmManager)mContext.getSystemService(Context.ALARM_SERVICE);
Intent alintent =
new Intent("com.android.alarmclock.ALARM_ALERT");
PendingIntent sender = PendingIntent.getBroadcast (mContext/*getBaseContext()*/,0,alintent,0);
long currt = System.currentTimeMillis();
float timetoDisable = getTimeToDisable();
long delay = (long)(timetoDisable *60 *60 *1000);
mAlarmManager.setRepeating(AlarmManager.RTC_WAKEUP, currt + delay,12 *60 *60 *1000 ,sender);

Wednesday, October 28, 2009

// ANSI(char) to Unicode(WCHAR)
char* pAnsi = "你好";
int nIndex = MultiByteToWideChar(CP_ACP, 0, pAnsi, -1, NULL, 0);
TCHAR *pUnicode = new TCHAR[nIndex + 1];
MultiByteToWideChar(CP_ACP, 0, pAnsi, -1, pUnicode, nIndex);
delete pUnicode;


// Unicode(WCHAR) to ANSI(char)
TCHAR *pUnicode = _T("你好");
int nIndex = WideCharToMultiByte(CP_ACP, 0, pUnicode, -1, NULL, 0, NULL, NULL);
char *pAnsi = new char[nIndex + 1];
WideCharToMultiByte(CP_ACP, 0, pUnicode, -1, pAnsi, nIndex, NULL, NULL);
delete pAnsi;

Saturday, October 17, 2009

轉貼:Feeyon隨寫 http://www.wretch.cc/blog/firkissing/9169152
無聊,翻譯成英文:

Some beginners of DSLR may find this,
Waht is x1.6? x1.5?Why Canon uses x1.6? Nikon uses x1.5? and x2 in Olympus?
What the hell is that?

Before we talk about that, we should to recognize the tranditional 135 film.The 135 film is used by 35mm camera. It can be seem as usual. From here, somebody may ask, why we call that 35mm?I have a reason of it.
Long long ago, it was named by Lica(the first camera creater).Why? Because the gear gap of the film is 35mm. Another reason is the width of the film is 35mm. I don't know the reasons are true or false. It is welcome to correct me if you knew that.

Back to the subjet APS-C, APS-H, FS. What is the different between them? What is the relationship of CCD/CMOS size and transition rate?Due to cost and process issue. Today, almost DSLRs use APS-C spec. APS-C is the regular spec. as usual. The focus transition rate is around 1.3 ~ 1.72. It has a spec.(APS-H) between APS-C and FS(Full Size) as well.

For an instance(Canon):
APS-C was used in low-midd level Canon body.(350D, 40D, 450D, 20D, 30D, 400D...)
The APS-H was used in 1D or after.
The FS was used in 1Ds and 5D.

BTW, there is a noun "FF", it should be the 4/3" CCD of Olympus system. The dimension only has half of the 135 film, we called that Full Frame CCD. We called that 4/3 system and it doesn't belong to above.

We take a break in here.(to avoid misunderstanding) The picture shows the differences of APS-C/H and FS.

1) The RED boundary is FS, the largest, equl to the dimension of 135 film's.
2) The GREEN boundary is APS-H.
3) The ORANGE boundary is APS-C, it is used in low-mid camera usually.





Could you see something in this picture? Why do we want to use the transition rate exactly?

I am starting to bla-bla-bla....:)

Long long ago, the film was developed from glass to plastic to CCD/CMOS. We called that "digitize" as well. This revolution can't be follwed by the tranditional guys. Then they made a consensus, the translation should be done by original vocabulary. So, we have the first problem:
APS-C spec. is used for tranditional camera, but it is not the regular spec. To Develop or to buy was not convenient and it was eliminated through competition. But in the digital age, the CCD size couldn't be made as 135 film's due to technical and cost..etc. In the beginning, DSLRs used the size of APS-C spec.

Now, the problem is,
If DSLR use the lens of 35mm, the picture boundary would larger than 35mm(refer to RED boundary). To solve this, we made the transition rate for the adaptation.
For an instance:
Using a 50mm len of 35mm system on APS-C DSLR to take a pic(called A pic in here).
Using a 80mm len of 35mm system on 35mm camera to take a pic(called B pic in here).
A pic's boundary is equal to B pic's:
We got 80mm/50mm = 1.6

so......that is it!

Labels: , ,

Monday, September 14, 2009

The RIL driver which handles phone related functions on Windows mobile system. We had re-designed the architecture of the code and I was responsible for Data Connection portion as you can see in the function stacks(VSP, Data Stack).

Sample code:

Labels: ,

Friday, September 11, 2009


The MUX plays a middle layer role between M-cpu and A-cpu. It handles the commands from A-cpu (RIL driver)to M-cpu, and vice versa the responses. The diagram briefly shows the design idea and the READ working flow of my MUX in the Windows mobile system. (July, 2007)

Sample Code: (password needed)

Labels:

Download testing:

1) rapidshare, pic of IP Header,
http://rapidshare.de/files/48323971/IP_Header.png.html
D me on: http://rapidshare.de/files/48323971/IP_Header.png?killcode=162137959
Comment: No!! I don't like to share my files like this.

2) keepandshare, pic of shaun the sheep,
http://www.keepandshare.com/doc/view.php?id=1374743&da=y
Comment: Yes!! This is what i want.
The ways of files sharing on web,
1) http://rapidshare.de/
2) http://www.keepandshare.com/
The first post.