2013年3月17日 星期日

[送修] SENNHEISER森海爾耳機 px200II

陪了我一年多的px200II,經過我的細心拉扯、壓迫、狂聽的殘酷環境下,終於在上個月月底一邊耳機聽不到了...(哭泣)
My headphone has been with me for one more years was broken last month.

於是我馬上上了pchome...是上google查詢中壢哪裡有送修SENNHEISER的經銷商,皇心不負苦心人,很快的就找到了中壢NOVA一樓的耀德。
I went to surf "px200II" on pchome(like Amazon)...no..I was surfing where I could send it to fix on google immediately. I found a store named "耀德" in JhoneLi NOVA(like computer department store).

一到現場就很客氣的詢問是否有幫忙送修px200II,店員說有,並跟我要了宙宣的保證卡,當然!! 為了讓我的耳機起死回生,保證卡是一定要從家裡某個角落翻出來用!
When I arrived there, I asked them if you could help me to fix px200II. they answered me Yes and took the guarantee form me. By the way, I rummaged around my house for fixing it.

跟我酌收了NT$ 300,並告知我約三個星期才會送修回來。
I paid NT$300 for that. They told me it will come back in 3 weeks.

就在上星期,打電話通知我送修好了!! Yeah~~~~
Last week, they called me my headphone back. Yeah~~~

以下就是浴火鳳凰的浴血照了~~
then...I show you the photo about my "new px200II"...


哇~~看起來真的亮晶晶~~
shining~~shining


連音量控制都換新了
it's so new....


變身~~摺疊!!
It can be folded..


變身~~打開...
open it...

以上是我的開心耳機復活記。
well, that's my happy diary

C透過http request到php

遇到一個C語言要傳值到php的問題,這可難倒我了...專科畢業後就幾乎沒碰過C語言了呀~~~

不過網路神人很多,找到一位神人寫好了function,直接拿來套用就幾乎可以用了...

程式如連結

不過卻遇上一個問題,就是當我字串超過60位元時,server就會回傳http 500的錯誤訊息,慘了...我可以肯定php的接收沒有問題,要來複習C語言了...。



既然是字串的問題,那我就從跟字串有關的變數下手了,找了許久,終於找到兇手:




#define MAXSUB 200
ssize_t process_http(int sockfd, char *host, char *page, char *poststr)
{
char sendline[MAXLINE + 1], recvline[MAXLINE + 1];
ssize_t n;
snprintf(sendline, MAXSUB,
"POST %s HTTP/1.0\r\n"
"Host: %s\r\n"
"Content-type: application/x-www-form-urlencoded\r\n"
"Content-length: %d\r\n\r\n"
"%s", page, host, strlen(poststr), poststr);

write(sockfd, sendline, strlen(sendline));
while ((n = read(sockfd, recvline, MAXLINE)) > 0) {
recvline[n] = '\0';
printf("%s", recvline);
}
return n;
}


關鍵在於以上的變數中,答案是MAXSUB,簡單說這個值給得太少,所以我改成了
snprintf(sendline, sizeof(sendline),



就降...