HttpClient client = new DefaultHttpClient();
HttpPost httppost = new HttpPost(url);
//送出請求時在header加上
httppost.addHeader("Accept-Encoding", "gzip");
HttpResponse response = client.execute(httppost);
HttpClient client = new DefaultHttpClient();
HttpPost httppost = new HttpPost(url);
//送出請求時在header加上
httppost.addHeader("Accept-Encoding", "gzip");
HttpResponse response = client.execute(httppost);
當用HttpClient 下載檔案時,需要取得header 中 Content-Disposition:attachment的filename
但如果filename有中文時會出現亂碼
解決方法如下
HttpParams params = new BasicHttpParams();
params.setParameter(CoreProtocolPNames.HTTP_ELEMENT_CHARSET,
今天拿到一台山寨機,我的nb無法識別,用Eclipse 沒辦法Debug
Google了一下,找到了方法
如果電腦可以識別裝置為Android Phone第一步可以省略
1. 開啟android sdk下usb_driver的android_winusb.inf (每個人路徑可能不同,我的是C:\eclipse\android-sdk-windows\extras\google\usb_driver)
裝置管理員查看你裝置的內容,選詳細資料, 屬性的地方選硬體識別碼
Intent i = new Intent(Intent.ACTION_SEND_MULTIPLE);
try {
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//預設使用Gmail 發送
i.setClassName("com.google.android.gm","com.google.android.gm.ComposeActivityGmail");
因為要測試USB OTG,所以需要用無線的方式來Debug,上網找了一下,還蠻簡單的
1. 先連接USB
2. 開啟網路
3.在電腦上開啟cmd
4.輸入指令 cd C:\eclipse\android-sdk-windows\platform-tools (看您的platform-tools資料夾位置而定)
這兩天發布了個APK,測試都沒問題,但是上傳至Play下載後會錯誤,經過一翻查詢是proguard 搞的鬼
如果你有用到jsoup 的第三方jar
需要以下的動作
打開 proguard-project.txt 這個檔案
加入以下的內容

先在drawable 加入4個xml檔案
list_top_selector.xml (第一筆資料)
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"><shape>
最近在寫報表的東西,在網路上看到取得目前的日期是第幾週和該年有幾週的函數
首先要 using System.Globalization;
//取得目前週數
public int GetWeekOfYear(DateTime dt)
{
這功能GridView是可以分頁,匯出時excel不分頁
protected void BtQuery_Click(object sender, EventArgs e)
{
if (sender.ToString() == "Exp_Excel")
{
在網路上找了一個跑馬燈的範例,結果發現在FireFox下無法正常運作,不果發現只要刪除<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">就可以正常運作了,另外一個方法是將Script中的marqueeBox更改為document.getElementById('marqueeBox')也可以喔!
例如:
if(marqueeBox.childNodes.length==1) {
var nextLine=document.createElement('DIV');
nextLine.innerHTML=str;
最近因為專案需要將資料會出EXCEL,所以上網找了資料寫出個匯出的功能,並且可以設定每個Sheet的資料數量
首先要 using Microsoft.Office.Interop.Excel;
/// <summary>
/// 匯出資料至EXCEL表並分頁
/// </summary>
今天要用ASP.NET 取得store procedure返回得值,找了一下資料,終於寫出來了,這是利用store procedure來驗證登入的帳號密碼是否正確,返回值=0代表失敗,=1則是成功
db_conn connectdb = new db_conn();
SqlConnection oConn = connectdb.opendb("billing");
SqlCommand cmd = new SqlCommand("CheckLogin", oConn);
cmd.CommandType = CommandType.StoredProcedure;