Android快速開發框架XUtils

原文地址:http://blog.csdn.net/rain_butterfly/article/details/37812371

點擊閱讀原文

--------------------------------------------


https://github.com/wyouflf/xUtils

https://github.com/wyouflf/xUtils3

XUtils是基于afinal開發的,比afinal穩定性提高了不少,下面是介紹:

xUtils簡介

  • xUtils 包含了很多實用的android工具。
  • xUtils 最初源于Afinal框架,進行了大量重構,使得xUtils支持大文件上傳,更全面的http請求協議支持(10種謂詞),擁有更加靈活的ORM,更多的事件注解支持且不受混淆影響...
  • xUitls最低兼容android 2.2 (api level 8)

  • 目前xUtils主要有四大模塊:
    • DbUtils模塊:

      • android中的orm框架,一行代碼就可以進行增刪改查;
      • 支持事務,默認關閉;
      • 可通過注解自定義表名,列名,外鍵,唯一性約束,NOT NULL約束,CHECK約束等(需要混淆的時候請注解表名和列名);
      • 支持綁定外鍵,保存實體時外鍵關聯實體自動保存或更新;
      • 自動加載外鍵關聯實體,支持延時加載;
      • 支持鏈式表達查詢,更直觀的查詢語義,參考下面的介紹或sample中的例子。
    • ViewUtils模塊:

      • android中的ioc框架,完全注解方式就可以進行UI,資源和事件綁定;
      • 新的事件綁定方式,使用混淆工具混淆后仍可正常工作;
      • 目前支持常用的20種事件綁定,參見ViewCommonEventListener類和包com.lidroid.xutils.view.annotation.event。
    • HttpUtils模塊:

      • 支持同步,異步方式的請求;
      • 支持大文件上傳,上傳大文件不會oom;
      • 支持GET,POST,PUT,MOVE,COPY,DELETE,HEAD,OPTIONS,TRACE,CONNECT請求;
      • 下載支持301/302重定向,支持設置是否根據Content-Disposition重命名下載的文件;
      • 返回文本內容的請求(默認只啟用了GET請求)支持緩存,可設置默認過期時間和針對當前請求的過期時間。
    • BitmapUtils模塊:

      • 加載bitmap的時候無需考慮bitmap加載過程中出現的oom和android容器快速滑動時候出現的圖片錯位等現象;
      • 支持加載網絡圖片和本地圖片;
      • 內存管理使用lru算法,更好的管理bitmap內存;
      • 可配置線程加載線程數量,緩存大小,緩存路徑,加載顯示動畫等...

    使用xUtils快速開發框架需要有以下權限:

    <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 

    混淆時注意事項:

    • 添加Android默認混淆配置${sdk.dir}/tools/proguard/proguard-android.txt
    • 不要混淆xUtils中的注解類型,添加混淆配置:-keep class * extends java.lang.annotation.Annotation { *; }
    • 對使用DbUtils模塊持久化的實體類不要混淆,或者注解所有表和列名稱@Table(name="xxx"),@Id(column="xxx"),@Column(column="xxx"),@Foreign(column="xxx",foreign="xxx");

    DbUtils使用方法:

    DbUtils db = DbUtils.create(this);
    User user = new User(); //這里需要注意的是User對象必須有id屬性,或者有通過@ID注解的屬性
    user.setEmail("wyouflf@qq.com");
    user.setName("wyouflf");
    db.save(user); // 使用saveBindingId保存實體時會為實體的id賦值...
    // 查找
    Parent entity = db.findById(Parent.class, parent.getId());
    List<Parent> list = db.findAll(Parent.class);//通過類型查找Parent Parent = db.findFirst(Selector.from(Parent.class).where("name","=","test"));// IS NULL
    Parent Parent = db.findFirst(Selector.from(Parent.class).where("name","=", null));
    // IS NOT NULL
    Parent Parent = db.findFirst(Selector.from(Parent.class).where("name","!=", null));// WHERE id<54 AND (age>20 OR age<30) ORDER BY id LIMIT pageSize OFFSET pageOffset
    List<Parent> list = db.findAll(Selector.from(Parent.class).where("id" ,"<", 54).and(WhereBuilder.b("age", ">", 20).or("age", " < ", 30)).orderBy("id").limit(pageSize).offset(pageSize * pageIndex));// op為"in"時,最后一個參數必須是數組或Iterable的實現類(例如List等)
    Parent test = db.findFirst(Selector.from(Parent.class).where("id", "in", new int[]{1, 2, 3}));
    // op為"between"時,最后一個參數必須是數組或Iterable的實現類(例如List等)
    Parent test = db.findFirst(Selector.from(Parent.class).where("id", "between", new String[]{"1", "5"}));DbModel dbModel = db.findDbModelAll(Selector.from(Parent.class).select("name"));//select("name")只取出name列
    List<DbModel> dbModels = db.findDbModelAll(Selector.from(Parent.class).groupBy("name").select("name", "count(name)"));
    ...List<DbModel> dbModels = db.findDbModelAll(sql); // 自定義sql查詢
    db.execNonQuery(sql) // 執行自定義sql
    ...

    ViewUtils使用方法

    • 完全注解方式就可以進行UI綁定和事件綁定。
    • 無需findViewById和setClickListener等。
    // xUtils的view注解要求必須提供id,以使代碼混淆不受影響。
    @ViewInject(R.id.textView)
    TextView textView;//@ViewInject(vale=R.id.textView, parentId=R.id.parentView)
    //TextView textView;@ResInject(id = R.string.label, type = ResType.String)
    private String label;// 取消了之前使用方法名綁定事件的方式,使用id綁定不受混淆影響
    // 支持綁定多個id @OnClick({R.id.id1, R.id.id2, R.id.id3})
    // or @OnClick(value={R.id.id1, R.id.id2, R.id.id3}, parentId={R.id.pid1, R.id.pid2, R.id.pid3})
    // 更多事件支持參見ViewCommonEventListener類和包com.lidroid.xutils.view.annotation.event。
    @OnClick(R.id.test_button)
    public void testButtonClick(View v) { // 方法簽名必須和接口中的要求一致...
    }
    ...
    //在Activity中注入:
    @Override
    public void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.main);ViewUtils.inject(this); //注入view和事件...textView.setText("some text...");...
    }
    //在Fragment中注入:
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {View view = inflater.inflate(R.layout.bitmap_fragment, container, false); // 加載fragment布局ViewUtils.inject(this, view); //注入view和事件...
    }
    //在PreferenceFragment中注入:
    public void onActivityCreated(Bundle savedInstanceState) {super.onActivityCreated(savedInstanceState);ViewUtils.inject(this, getPreferenceScreen()); //注入view和事件...
    }
    // 其他重載
    // inject(View view);
    // inject(Activity activity)
    // inject(PreferenceActivity preferenceActivity)
    // inject(Object handler, View view)
    // inject(Object handler, Activity activity)
    // inject(Object handler, PreferenceGroup preferenceGroup)
    // inject(Object handler, PreferenceActivity preferenceActivity)

    HttpUtils使用方法:

    普通get方法

    HttpUtils http = new HttpUtils();
    http.send(HttpRequest.HttpMethod.GET,"http://www.lidroid.com",new RequestCallBack<String>(){@Overridepublic void onLoading(long total, long current, boolean isUploading) {testTextView.setText(current + "/" + total);}@Overridepublic void onSuccess(ResponseInfo<String> responseInfo) {textView.setText(responseInfo.result);}@Overridepublic void onStart() {}@Overridepublic void onFailure(HttpException error, String msg) {}
    });

    使用HttpUtils上傳文件 或者 提交數據 到服務器(post方法)

    RequestParams params = new RequestParams();
    params.addHeader("name", "value");
    params.addQueryStringParameter("name", "value");// 只包含字符串參數時默認使用BodyParamsEntity,
    // 類似于UrlEncodedFormEntity("application/x-www-form-urlencoded")。
    params.addBodyParameter("name", "value");// 加入文件參數后默認使用MultipartEntity("multipart/form-data"),
    // 如需"multipart/related",xUtils中提供的MultipartEntity支持設置subType為"related"。
    // 使用params.setBodyEntity(httpEntity)可設置更多類型的HttpEntity(如:
    // MultipartEntity,BodyParamsEntity,FileUploadEntity,InputStreamUploadEntity,StringEntity)。
    // 例如發送json參數:params.setBodyEntity(new StringEntity(jsonStr,charset));
    params.addBodyParameter("file", new File("path"));
    ...HttpUtils http = new HttpUtils();
    http.send(HttpRequest.HttpMethod.POST,"uploadUrl....",params,new RequestCallBack<String>() {@Overridepublic void onStart() {testTextView.setText("conn...");}@Overridepublic void onLoading(long total, long current, boolean isUploading) {if (isUploading) {testTextView.setText("upload: " + current + "/" + total);} else {testTextView.setText("reply: " + current + "/" + total);}}@Overridepublic void onSuccess(ResponseInfo<String> responseInfo) {testTextView.setText("reply: " + responseInfo.result);}@Overridepublic void onFailure(HttpException error, String msg) {testTextView.setText(error.getExceptionCode() + ":" + msg);}
    });

    使用HttpUtils下載文件:

    • 支持斷點續傳,隨時停止下載任務,開始任務
    HttpUtils http = new HttpUtils();
    HttpHandler handler = http.download("http://apache.dataguru.cn/httpcomponents/httpclient/source/httpcomponents-client-4.2.5-src.zip","/sdcard/httpcomponents-client-4.2.5-src.zip",true, // 如果目標文件存在,接著未完成的部分繼續下載。服務器不支持RANGE時將從新下載。true, // 如果從請求返回信息中獲取到文件名,下載完成后自動重命名。new RequestCallBack<File>() {@Overridepublic void onStart() {testTextView.setText("conn...");}@Overridepublic void onLoading(long total, long current, boolean isUploading) {testTextView.setText(current + "/" + total);}@Overridepublic void onSuccess(ResponseInfo<File> responseInfo) {testTextView.setText("downloaded:" + responseInfo.result.getPath());}@Overridepublic void onFailure(HttpException error, String msg) {testTextView.setText(msg);}
    });...
    //調用cancel()方法停止下載
    handler.cancel();

    BitmapUtils 使用方法

    BitmapUtils bitmapUtils = new BitmapUtils(this);// 加載網絡圖片
    bitmapUtils.display(testImageView, "http://bbs.lidroid.com/static/image/common/logo.png");// 加載本地圖片(路徑以/開頭, 絕對路徑)
    bitmapUtils.display(testImageView, "/sdcard/test.jpg");// 加載assets中的圖片(路徑以assets開頭)
    bitmapUtils.display(testImageView, "assets/img/wallpaper.jpg");// 使用ListView等容器展示圖片時可通過PauseOnScrollListener控制滑動和快速滑動過程中時候暫停加載圖片
    listView.setOnScrollListener(new PauseOnScrollListener(bitmapUtils, false, true));
    listView.setOnScrollListener(new PauseOnScrollListener(bitmapUtils, false, true, customListener));

    輸出日志 LogUtils

    // 自動添加TAG,格式: className.methodName(L:lineNumber)
    // 可設置全局的LogUtils.allowD = false,LogUtils.allowI = false...,控制是否輸出log。
    // 自定義log輸出LogUtils.customLogger = new xxxLogger();
    LogUtils.d("wyouflf");


  • 項目git地址https://github.com/wyouflf/xUtils
    實例:數據傳遞接口定義
    [java] view plaincopy
    print?在CODE上查看代碼片派生到我的代碼片
    1. public?interface?IOAuthCallBack?{??
    2. ????public?void?getIOAuthCallBack(String?result);??
    3. }??
  • 接口調用:
    [java] view plaincopy
    print?在CODE上查看代碼片派生到我的代碼片
    1. new?xUtilsPost().cancelOrder(??
    2. ????????????????????????????????????PZTuanApplication.appUserName,??
    3. ????????????????????????????????????orderId?+?"",?new?IOAuthCallBack()?{??
    4. ??
    5. ????????????????????????????????????????public?void?getIOAuthCallBack(??
    6. ????????????????????????????????????????????????String?result)?{??
    7. ????????????????????????????????????????????//?TODO?Auto-generated?method?stub??
    8. ????????????????????????????????????????????try?{??
    9. ????????????????????????????????????????????????JSONObject?jo?=?new?JSONObject(??
    10. ????????????????????????????????????????????????????????result);??
    11. ????????????????????????????????????????????????Message?msg?=?cancelOrder??
    12. ????????????????????????????????????????????????????????.obtainMessage(id,?jo);??
    13. ????????????????????????????????????????????????cancelOrder.sendMessage(msg);??
    14. ????????????????????????????????????????????}?catch?(JSONException?e)?{??
    15. ????????????????????????????????????????????????//?TODO?Auto-generated?catch??
    16. ????????????????????????????????????????????????//?block??
    17. ????????????????????????????????????????????????e.printStackTrace();??
    18. ????????????????????????????????????????????}??
    19. ??
    20. ????????????????????????????????????????}??
    21. ????????????????????????????????????});??
    實例,BitmapUtils:
  • [java] view plaincopy
    print?在CODE上查看代碼片派生到我的代碼片
    1. public?class?xUtilsImageLoader?{//框架里面設置了緩存和異步操作,不用單獨設置線程池和緩存機制(也可以自定義緩存路徑)??
    2. ??
    3. ????private?BitmapUtils?bitmapUtils;??
    4. ????private?Context?mContext;??
    5. ??
    6. ????public?xUtilsImageLoader(Context?context)?{??
    7. ????????//?TODO?Auto-generated?constructor?stub??
    8. ????????this.mContext?=?context;??
    9. ????????bitmapUtils?=?new?BitmapUtils(mContext);??
    10. ????????bitmapUtils.configDefaultLoadingImage(R.drawable.logo_new);//默認背景圖片??
    11. ????????bitmapUtils.configDefaultLoadFailedImage(R.drawable.logo_new);//加載失敗圖片??
    12. ????????bitmapUtils.configDefaultBitmapConfig(Bitmap.Config.RGB_565);//設置圖片壓縮類型??
    13. ??
    14. ????}??
    15. ????/**?
    16. ?????*??
    17. ?????*?@author?sunglasses?
    18. ?????*?@category?圖片回調函數?
    19. ?????*/??
    20. ????public?class?CustomBitmapLoadCallBack?extends??
    21. ????????????DefaultBitmapLoadCallBack<ImageView>?{??
    22. ??
    23. ????????@Override??
    24. ????????public?void?onLoading(ImageView?container,?String?uri,??
    25. ????????????????BitmapDisplayConfig?config,?long?total,?long?current)?{??
    26. ????????}??
    27. ??
    28. ????????@Override??
    29. ????????public?void?onLoadCompleted(ImageView?container,?String?uri,??
    30. ????????????????Bitmap?bitmap,?BitmapDisplayConfig?config,?BitmapLoadFrom?from)?{??
    31. ????????????//?super.onLoadCompleted(container,?uri,?bitmap,?config,?from);??
    32. ????????????fadeInDisplay(container,?bitmap);??
    33. ????????}??
    34. ??
    35. ????????@Override??
    36. ????????public?void?onLoadFailed(ImageView?container,?String?uri,??
    37. ????????????????Drawable?drawable)?{??
    38. ????????????//?TODO?Auto-generated?method?stub??
    39. ????????}??
    40. ????}??
    41. ??
    42. ????private?static?final?ColorDrawable?TRANSPARENT_DRAWABLE?=?new?ColorDrawable(??
    43. ????????????android.R.color.transparent);??
    44. ????/**?
    45. ?????*?@author?sunglasses?
    46. ?????*?@category?圖片加載效果?
    47. ?????*?@param?imageView?
    48. ?????*?@param?bitmap?
    49. ?????*/??
    50. ????private?void?fadeInDisplay(ImageView?imageView,?Bitmap?bitmap)?{//目前流行的漸變效果??
    51. ????????final?TransitionDrawable?transitionDrawable?=?new?TransitionDrawable(??
    52. ????????????????new?Drawable[]?{?TRANSPARENT_DRAWABLE,??
    53. ????????????????????????new?BitmapDrawable(imageView.getResources(),?bitmap)?});??
    54. ????????imageView.setImageDrawable(transitionDrawable);??
    55. ????????transitionDrawable.startTransition(500);??
    56. ????}??
    57. ????public?void?display(ImageView?container,String?url){//外部接口函數??
    58. ????????bitmapUtils.display(container,?url,new?CustomBitmapLoadCallBack());??
    59. ????}??
    60. }??
  • 實例:HttpGet:
  • [java] view plaincopy
    print?在CODE上查看代碼片派生到我的代碼片
    1. public?class?xUtilsGet?{//自動實現異步處理,自己不用處理??
    2. ??
    3. ????public?void?getJson(String?url,RequestParams?params,final?IOAuthCallBack?iOAuthCallBack){??
    4. ??
    5. ????????HttpUtils?http?=?new?HttpUtils();??
    6. ????????http.configCurrentHttpCacheExpiry(1000?*?10);//設置超時時間??
    7. ????????http.send(HttpMethod.GET,?url,?params,?new?RequestCallBack<String>()?{//接口回調??
    8. ??
    9. ????????????@Override??
    10. ????????????public?void?onFailure(HttpException?arg0,?String?arg1)?{??
    11. ????????????????//?TODO?Auto-generated?method?stub??
    12. ????????????}??
    13. ??
    14. ????????????@Override??
    15. ????????????public?void?onSuccess(ResponseInfo<String>?info)?{??
    16. ????????????????//?TODO?Auto-generated?method?stub??
    17. ????????????????iOAuthCallBack.getIOAuthCallBack(info.result);//利用接口回調數據傳輸??
    18. ????????????}??
    19. ????????});??
    20. ????}??
    21. ????public?void?getCataJson(int?cityId,IOAuthCallBack?iOAuthCallBack)?{//外部接口函數??
    22. ????????String?url?=?"http://xxxxxxxxxx";??
    23. ????????RequestParams?params?=?new?RequestParams();??
    24. ????????params.addQueryStringParameter("currentCityId",?cityId+"");??
    25. ????????getJson(url,params,iOAuthCallBack);??
    26. ????}??
    27. }??
  • 實例:HttpPost(和HttpGet類似):
  • [java] view plaincopy
    print?在CODE上查看代碼片派生到我的代碼片
    1. public?class?xUtilsPost?{//自動實現異步處理??
    2. ??
    3. ????public?void?doPost(String?url,?RequestParams?params,??
    4. ????????????final?IOAuthCallBack?iOAuthCallBack)?{??
    5. ??
    6. ????????HttpUtils?http?=?new?HttpUtils();??
    7. ????????http.configCurrentHttpCacheExpiry(1000?*?10);??
    8. ????????http.send(HttpMethod.POST,?url,?params,?new?RequestCallBack<String>()?{??
    9. ??
    10. ????????????@Override??
    11. ????????????public?void?onFailure(HttpException?arg0,?String?arg1)?{??
    12. ????????????????//?TODO?Auto-generated?method?stub??
    13. ????????????}??
    14. ??
    15. ????????????@Override??
    16. ????????????public?void?onSuccess(ResponseInfo<String>?info)?{??
    17. ????????????????//?TODO?Auto-generated?method?stub??
    18. ????????????????iOAuthCallBack.getIOAuthCallBack(info.result);??
    19. ????????????}??
    20. ????????});??
    21. ????}??
    22. ??
    23. ????public?void?doPostLogin(int?cityId,?IOAuthCallBack?iOAuthCallBack)?{??
    24. ????????String?url?=?"http://xxxxxxxxxxxx";??
    25. ????????RequestParams?params?=?new?RequestParams();??
    26. ????????params.addBodyParameter("currentCityId",?cityId?+?"");??
    27. ????????params.addBodyParameter("path",?"/apps/postCatch");??
    28. ????????doPost(url,?params,?iOAuthCallBack);??
    29. ????}??
    30. }??

-------------

更多的Java,Angular,Android,大數據,J2EE,Python,數據庫,Linux,Java架構師,:

http://www.cnblogs.com/zengmiaogen/p/7083694.html


本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/538857.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/538857.shtml
英文地址,請注明出處:http://en.pswp.cn/news/538857.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

oracle查看序列數據語法,oracle查詢各種數據字典的語法

ORACLE的數據字典是數據庫的重要組成部分之一&#xff0c;它隨著數據庫的產生而產生, 隨著數據庫的變化而變化&#xff0c;體現為sys用戶下的一些表和視圖。數據字典名稱是大寫的英文字符。數據字典里存有用戶信息、用戶的權限信息、所有數據對象信息、表的約束條件、統計分析數…

如何安裝python3.8.1_python3.8.1 安裝

Loading...請注意&#xff0c;本文編寫于 217 天前&#xff0c;最后修改于 217 天前&#xff0c;其中某些信息可能已經過時。系統環境&#xff1a;centos 7 安裝依賴項 bash yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-d…

明年新iphone使用增強版5nm芯片_蘋果A15芯片或將采用臺積電5nm+工藝!性能提升極強...

今年蘋果的iPhone 12系列搭載的A14 仿生芯片是今年智能手機市場推出的第一款5nm工藝處理器&#xff0c;處理器的性能也是用戶有目共睹的&#xff0c;相較于之前的芯片性能提升了一大截&#xff0c;有眾多網友也表示&#xff1a;蘋果芯片最大的敵人就是上一代的自己。當然&#…

php中dump怎么使用,php – 如何正確使用print_r或var_dump?

我在調試時經常使用以下代碼段&#xff1a;echo "" . var_dump($var) . "";而且我發現我通常會得到一個很好的可讀輸出.但有時我卻不這樣做.這個例子我現在特別煩惱&#xff1a;$usernamexxxxxx;$passwordxxxxxx;$data_urlhttp://docs.tms.tribune.com/tec…

Spring Framework 5 中的新特性

https://www.ibm.com/developerworks/cn/java/j-whats-new-in-spring-framework-5-theedom/index.html Spring 5 于 2017 年 9 月發布了通用版本 (GA)&#xff0c;它標志著自 2013 年 12 月以來第一個主要 Spring Framework 版本。它提供了一些人們期待已久的改進&#xff0c;還…

怎么計算一組數據的波動_稅控盤數據和小規模增值稅申報表計算結果不一致怎么辦...

a公司為小規模納稅人&#xff0c;于2020年1月申報2019年第四季度增值稅時&#xff0c;是按照金稅盤的數據實際銷售金額為562,563,13元&#xff0c;實際銷售稅額為16,876.87元填寫小規模納稅人增值稅申報表。申報成功后&#xff0c;稅務系統卻跳出比對異常&#xff0c;戶管員要求…

簡單又好看的按鈕,扁平化按鈕。

原文地址&#xff1a;http://blog.csdn.net/peijiangping1989/article/details/19333779 點擊閱讀原文 ----------------------------------------------------------- 今天分享一下流行的扁平化按鈕。完全不需要用到圖片哦。效果圖如下&#xff1a; 里面有2個按鈕都是一樣的…

python輸入三行、能出來三行數據_python 讀入多行數據的實例

一、前言本文主要使用python 的raw_input() 函數讀入多行不定長的數據&#xff0c;輸入結束的標志就是不輸入數字情況下直接回車&#xff0c;并填充特定的數作為二維矩陣二、代碼def get2dlistdata():res []inputline raw_input() #以字符串的形式讀入一行#如果不為空字符串作…

請問,現在android流行什么開源框架?

retrofit2.0RxjavagreenDao3大流行圖片庫p,g,f&#xff08;Picasso&#xff0c;Fresco&#xff0c;Glide&#xff09; 3分鐘全面了解Android主流圖片加載庫 http://blog.csdn.net/carson_ho/article/details/51939774 Retrofit2使用&#xff08;非常簡潔易懂&#xff09; ht…

matlab 銳化降噪,matlab 圖形銳化 濾波

help imreadhelp fspecial imfilt幫助穩定中有較多的示例fspecial 函數功能&#xff1a;產生預定義濾波器格式&#xff1a;Hfspecial(type)Hfspecial(gaussian,n,sigma) 高斯低通濾波器Hfspecial(sobel) Sobel 水平邊緣增強濾波器Hfspecial…

執行 link.exe 時出錯_在20多歲時應該做什么,以避免在30多歲和40多歲時后悔?...

1. 永遠不要以為自己可以&#xff0c;將會或曾經到達過以為是錯誤的。無論是幸福&#xff0c;收入還是心態。在二十多歲的關鍵時期&#xff0c;我有這種心態&#xff0c;對我自己不利。認為自己“實現”是一種靜態的世界觀&#xff0c;阻礙了您的成長。接受這樣的事實&#xff…

音頻自動增益 與 靜音檢測 算法 附完整C代碼

前面分享過一個算法《音頻增益響度分析 ReplayGain 附完整C代碼示例》 主要用于評估一定長度音頻的音量強度&#xff0c; 而分析之后&#xff0c;很多類似的需求&#xff0c;肯定是做音頻增益&#xff0c;提高音量諸如此類做法。 不過在項目實測的時候&#xff0c;其實真的很難…

python繪制餅狀圖圖例_使用matplotlib的所有餅圖的通用圖例

圖例只需調用一次&#xff0c;否則將顯示7個不同的圖例。我在下面展示了一個例子。請注意&#xff0c;您必須將自己的數據替換為ax.pie()&#xff1a;data1 (10,90) # some data to be plotted data2 (40,50) data3 (70,30) labels [Sending Data, Not Sending Data] #lege…

Android初始化本地數據庫

原文&#xff1a;http://blog.csdn.net/itjavawfc/article/details/50860647 點擊閱讀原文 -------------------------------- 最近遇到一個需求&#xff0c;一個同學不會搭服務器&#xff0c;但是Android課程設計需要用到很多數據&#xff0c;這樣就出現了一個問題&#xff0c…

jsp springmvc 視圖解析器_springMVC配置jsp/html視圖解析器

1、maven項目引入freemark相關jar包freemaker是以個模板引擎&#xff0c;可以根據提供的數據和創建好的模板,去自動的創建html靜態頁面。所以在返回html視圖時可以用這個引擎結合數據生成html靜態頁面。org.springframeworkspring-context-support5.0.7.RELEASEorg.freemarkerf…

php設計模式原型模式,原型模式_設計模式_設計模式之原型模式 - Lane Blog

108Clicks: 6614 Date: 2014-04-21 21:48:35 Power By 李軒Lane原型模式提取重復功能&#xff0c;避免了程序員喜歡復制粘貼的壞習慣。設計模式中的原型模式就是&#xff0c;用原型實例指定創建對象的重力&#xff0c;通過拷貝這些原型來創建新的對象從一個對象再創建另外一個可…

Windows2003如何安裝IIS和ftp

【開始】----【控制面板】----【添加或刪除程序】 出現如下“添加或刪除程序”界面&#xff0c;點擊“添加/刪除windows組件&#xff08;a&#xff09; ” 出現如下“window組件向導”界面 下拉“組件”欄目條&#xff0c;選擇“應用程序服務器” 點擊“應用程序服務器”下的“…

hadoop臨時文件 jar包_hadoop之Mapper/reducer源碼分析之二

若當前JobClient (0.22 hadoop) 運行在YARN.則job提交任務運行在YARNRunnerHadoop Yarn 框架原理及運作機制主要步驟作業提交作業初始化資源申請與任務分配任務執行具體步驟在運行作業之前&#xff0c;Resource Manager和Node Manager都已經啟動&#xff0c;所以在上圖中&#…

ANDROID:SHOWASACTION="NEVER"是做什么用的?

原文地址&#xff1a;http://www.cnblogs.com/android-joker/p/4478491.html 點擊閱讀原文 --------------------------------------------------------- 安卓開發項目文件中有一個目錄叫做menu&#xff0c;里面有tybmain.xml item選項里有一句 android:showAsAction "…

吳恩達ex3_Wu-Enda機器學習編程作業Python實現EX3,吳恩達,machinelearning,python,ex3nn

# -*- coding: utf-8 -*-"""Created on Wed Jul 1 20:28:57 2020author: cheetah023"""import numpy as npimport matplotlib.pyplot as pltimport scipy.io as sciimport random as ra#函數定義def sigmoid(X):return 1 /(1 np.exp(-X))def pr…