实现这样的效果

圆角图片的自定义控件直接拷进来,和com一个等级
想要弹出内容可以使用悬浮窗
layout_pupup

  1. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  2. android:id="@+id/pop_layout"
  3. android:layout_width="fill_parent"
  4. android:layout_height="wrap_content"
  5. android:layout_alignParentBottom="true"
  6. android:background="@drawable/btn_style_alert_dialog_background"
  7. android:gravity="center_horizontal"
  8. android:orientation="vertical" >
  9. <Button
  10. android:id="@+id/btn_take_photo"
  11. android:layout_width="fill_parent"
  12. android:layout_height="wrap_content"
  13. android:layout_marginLeft="20dip"
  14. android:layout_marginRight="20dip"
  15. android:layout_marginTop="20dip"
  16. android:background="@drawable/btn_style_alert_dialog_button"
  17. android:text="拍照"
  18. android:textStyle="bold" />
  19. <Button
  20. android:id="@+id/btn_pick_photo"
  21. android:layout_width="fill_parent"
  22. android:layout_height="wrap_content"
  23. android:layout_marginLeft="20dip"
  24. android:layout_marginRight="20dip"
  25. android:layout_marginTop="5dip"
  26. android:background="@drawable/btn_style_alert_dialog_button"
  27. android:text="从相册选择"
  28. android:textStyle="bold" />
  29. <Button
  30. android:id="@+id/btn_cancel"
  31. android:layout_width="fill_parent"
  32. android:layout_height="wrap_content"
  33. android:layout_marginBottom="15dip"
  34. android:layout_marginLeft="20dip"
  35. android:layout_marginRight="20dip"
  36. android:layout_marginTop="15dip"
  37. android:background="@drawable/btn_style_alert_dialog_cancel"
  38. android:text="取消"
  39. android:textColor="#ffffff"
  40. android:textStyle="bold" />
  41. </LinearLayout>

activity_main:view是阴影

  1. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  2. xmlns:tools="http://schemas.android.com/tools"
  3. xmlns:app="http://schemas.android.com/apk/res-auto"
  4. android:id="@+id/rl_root"
  5. android:layout_width="match_parent"
  6. android:layout_height="match_parent"
  7. android:background="#fff"
  8. tools:context=".MainActivity" >
  9. <CheckBox
  10. android:id="@+id/cb"
  11. android:layout_width="wrap_content"
  12. android:layout_height="wrap_content"
  13. android:text="显示对话框的形式" />
  14. <de.hdodenhof.circleimageview.CircleImageView
  15. android:id="@+id/civ"
  16. android:layout_width="100dp"
  17. android:layout_height="100dp"
  18. android:layout_centerHorizontal="true"
  19. android:layout_marginTop="10dp"
  20. android:src="@drawable/man"
  21. app:border_color="#ccc"
  22. app:border_width="2dp" >
  23. </de.hdodenhof.circleimageview.CircleImageView>
  24. <View
  25. android:id="@+id/viewMask"
  26. android:layout_width="match_parent"
  27. android:layout_height="match_parent"
  28. android:background="#20000000"
  29. android:visibility="gone" >
  30. </View>
  31. </RelativeLayout>

push_bottom_in

  1. <!-- 上下滑入式 -->
  2. <set xmlns:android="http://schemas.android.com/apk/res/android" >
  3. <translate
  4. android:duration="200"
  5. android:fromYDelta="100%p"
  6. android:toYDelta="0"
  7. />
  8. <alpha
  9. android:fromAlpha="0.0"
  10. android:toAlpha="1.0"
  11. android:duration="200"
  12. />
  13. </set>

push_bottom_in2

  1. <!-- 上下滑入式 -->
  2. <set xmlns:android="http://schemas.android.com/apk/res/android" >
  3. <alpha
  4. android:startOffset="200"
  5. android:fromAlpha="0.0"
  6. android:toAlpha="1.0"
  7. android:duration="200"
  8. />
  9. </set>

  push_bottom_out

  1. <!-- 上下滑入式 -->
  2. <set xmlns:android="http://schemas.android.com/apk/res/android" >
  3.  
  4. <translate
  5. android:duration="200"
  6. android:fromYDelta="0"
  7. android:toYDelta="50%p" />
  8. <alpha
  9. android:fromAlpha="1.0"
  10. android:toAlpha="0.0"
  11. android:duration="200"
  12. />
  13. </set>

styles

  1. <resources>
  2. <style name="AppTheme" parent="android:Theme.Light" />
  3. <style name="AnimBottom" parent="@android:style/Animation">
  4. <item name="android:windowEnterAnimation">@anim/push_bottom_in</item>
  5. <item name="android:windowExitAnimation">@anim/push_bottom_out</item>
  6. </style>
  7. <style name="PopupAnimation" parent="android:Animation">
  8. <item name="android:windowEnterAnimation">@anim/push_bottom_in</item>
  9. <item name="android:windowExitAnimation">@anim/push_bottom_out</item>
  10. </style>
  11. </resources>

  SelectPhotoPopupWindow

  1. public class SelectPhotoPopupWindow extends PopupWindow {
  2. private Button btn_take_photo, btn_pick_photo, btn_cancel;
  3. public SelectPhotoPopupWindow(Context context, OnClickListener onClickListener) {
  4. View contentView = View.inflate(context, R.layout.layout_pupup, null);
  5. /*
  6. * View contentView = View.inflate(MainActivity.this, R.layout.file_item_pop, null);
  7. int width = ViewGroup.LayoutParams.MATCH_PARENT;
  8. int height = itemView.getHeight();
  9. System.out.println("height:" + height);
  10. popupWindow = new PopupWindow(contentView, width, height);
  11. /*点击popupWindow范围以外的地方,让popupWindow消失*/
  12. // popupWindow.setOutsideTouchable(true);
  13. // popupWindow.setBackgroundDrawable(new BitmapDrawable());
  14. // */
  15. this.setContentView(contentView);
  16. this.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
  17. this.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
  18. /**点击popupWindow范围以外的地方,让popupWindow消失*/
  19. this.setOutsideTouchable(true);
  20. this.setBackgroundDrawable(new BitmapDrawable());
  21. //找到对应的控件
  22. btn_take_photo = (Button) contentView.findViewById(R.id.btn_take_photo);
  23. btn_pick_photo = (Button) contentView.findViewById(R.id.btn_pick_photo);
  24. btn_cancel = (Button) contentView.findViewById(R.id.btn_cancel);
  25.  
  26. btn_take_photo.setOnClickListener(onClickListener);
  27. btn_pick_photo.setOnClickListener(onClickListener);
  28. btn_cancel.setOnClickListener(onClickListener);
  29. //加入动画
  30. this.setAnimationStyle(R.style.AnimBottom);
  31. }
  32. }

MainActivity

  1. public class MainActivity extends Activity implements OnClickListener {
  2. protected static final int CODE_TAKE_PHOTO = 100;
  3. protected static final int CODE_PICK_PHOTO = 101;
  4. private static final int CODE_ZOOM_PHOTOT = 102;
  5. private String sdCardPath = Environment.getExternalStorageDirectory().getAbsolutePath();
  6. private File tempFile = new File(sdCardPath + "/" + "tempFile.jpg");
  7. private View root;
  8. private SelectPhotoPopupWindow selectPhotoPopupWindow;
  9. private View viewMask;
  10. private CheckBox cb;
  11. private CircleImageView civ;
  12. @Override
  13. protected void onCreate(Bundle savedInstanceState) {
  14. super.onCreate(savedInstanceState);
  15. setContentView(R.layout.activity_main);
  16. viewMask = findViewById(R.id.viewMask);
  17. root = findViewById(R.id.rl_root);
  18. cb = (CheckBox) findViewById(R.id.cb);
  19. civ = (CircleImageView) findViewById(R.id.civ);
  20. civ.setOnClickListener(new OnClickListener() {
  21. @Override
  22. public void onClick(View v) {
  23. if (cb.isChecked()) {
  24. PhotoUtilChange.getPhotoDialog(MainActivity.this, CODE_TAKE_PHOTO, CODE_PICK_PHOTO, tempFile);
  25. } else {
  26. selectPhotoPopupWindow = PhotoUtilChange.getPicPopupWindow(MainActivity.this, MainActivity.this,
  27. root);
  28. AnimationUtils.showAlpha(viewMask);
  29. }
  30. }
  31. });
  32. viewMask.setOnClickListener(new OnClickListener() {
  33. @Override
  34. public void onClick(View v) {
  35. if (selectPhotoPopupWindow != null) {
  36. selectPhotoPopupWindow.dismiss();
  37. AnimationUtils.hideAlpha(viewMask);
  38. }
  39. }
  40. });
  41. }
  42. @Override
  43. public void onClick(View v) {
  44. selectPhotoPopupWindow.dismiss();
  45. switch (v.getId()) {
  46. case R.id.btn_cancel:
  47. Toast.makeText(getApplicationContext(), "cancle", 0).show();
  48. AnimationUtils.hideAlpha(viewMask);
  49. break;
  50. case R.id.btn_take_photo://拍照
  51. //1.发起拍照的intent
  52. PhotoUtilChange.takePhoto(MainActivity.this, CODE_TAKE_PHOTO, tempFile);
  53. break;
  54. case R.id.btn_pick_photo://从相册选择
  55. //1.发起从相册选择的intent
  56. PhotoUtilChange.pickPhoto(MainActivity.this, CODE_PICK_PHOTO, tempFile);
  57. break;
  58. default:
  59. break;
  60. }
  61. }
  62. @Override
  63. protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  64. switch (requestCode) {
  65. case CODE_TAKE_PHOTO://拍照
  66. //2.处理拍照的结果-->去裁剪
  67. PhotoUtilChange.onPhotoFromCamera(MainActivity.this, CODE_ZOOM_PHOTOT, tempFile.getAbsolutePath(), 1, 1);
  68. break;
  69. case CODE_PICK_PHOTO://从相册选择
  70. //2.处理从相册选择的结果-->去裁剪
  71. PhotoUtilChange.onPhotoFromPick(MainActivity.this, CODE_ZOOM_PHOTOT, tempFile.getAbsolutePath(), data, 50,
  72. 50);
  73. break;
  74. case CODE_ZOOM_PHOTOT://裁剪
  75. //3.裁剪完成
  76. Bitmap zoomBitMap = PhotoUtilChange.getZoomBitMap(data, MainActivity.this);
  77. //4.修改头像
  78. civ.setImageBitmap(zoomBitMap);
  79. break;
  80. default:
  81. break;
  82. }
  83. super.onActivityResult(requestCode, resultCode, data);
  84. }
  85. }

PhotoUtilChange

  1. /***
  2. * billy修改版
  3. * 头像上传工具类 调用 getPhoto 在onactivityResult 调用
  4. * onPhotoFromCamera
  5. * onPhotoFromPick
  6. */
  7. public class PhotoUtilChange {
  8. /**
  9. * 因为处理不同
  10. *
  11. * @param takePhotoCode
  12. * Uri originalUri = data.getData();
  13. * image=ImageUtil.getBitmapFromUrl(originalUri.toString());
  14. **********************************************************************************
  15. * @param pickPhotoCode
  16. * Bundle extras = data.getExtras(); image = (Bitmap)
  17. * extras.get("data");
  18. * @param tempFile
  19. * 拍照时的临时文件 需要zoom时
  20. * **/
  21. public static boolean getPhotoDialog(final Activity activity, final int takePhotoCode, final int pickPhotoCode,
  22. final File tempFile) {
  23. final CharSequence[] items = { "相册", "拍照" };
  24. AlertDialog dlg = new AlertDialog.Builder(activity).setTitle("选择图片")
  25. .setItems(items, new DialogInterface.OnClickListener() {
  26. public void onClick(DialogInterface dialog, int item) {
  27. if (item == 1) {
  28. Intent getImageByCamera = new Intent("android.media.action.IMAGE_CAPTURE");
  29. getImageByCamera.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(tempFile));
  30. activity.startActivityForResult(getImageByCamera, takePhotoCode);
  31. } else {
  32. Intent getImage = new Intent(Intent.ACTION_GET_CONTENT);
  33. getImage.addCategory(Intent.CATEGORY_OPENABLE);
  34. getImage.setType("image/jpeg");
  35. activity.startActivityForResult(getImage, pickPhotoCode);
  36. }
  37. }
  38. }).create();
  39. dlg.show();
  40. return true;
  41. }
  42. public static SelectPhotoPopupWindow getPicPopupWindow(Context context, OnClickListener itemsOnClick,
  43. View viewAttach) {
  44. //实例化SelectPicPopupWindow
  45. SelectPhotoPopupWindow menuWindow = new SelectPhotoPopupWindow(context, itemsOnClick);
  46. //显示窗口
  47. menuWindow.showAtLocation(viewAttach, Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0); //设置layout在PopupWindow中显示的位置
  48. return menuWindow;
  49. }
  50. public static boolean takePhoto(Activity activity, int takePhotoCode, File tempFile) {
  51. Intent getImageByCamera = new Intent("android.media.action.IMAGE_CAPTURE");
  52. getImageByCamera.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(tempFile));
  53. activity.startActivityForResult(getImageByCamera, takePhotoCode);
  54. return true;
  55. }
  56. public static boolean pickPhoto(Activity activity, int imageCode, File tempFile) {
  57. Intent getImage = new Intent(Intent.ACTION_GET_CONTENT);
  58. getImage.addCategory(Intent.CATEGORY_OPENABLE);
  59. getImage.setType("image/jpeg");
  60. activity.startActivityForResult(getImage, imageCode);
  61. return true;
  62. }
  63. /**
  64. * 拍照获取图片的方式 用于切割的图片大小被限制在500,500
  65. *
  66. * @param context
  67. * @param zoomCode
  68. * @param temppath
  69. * 拍照前生成的临时路劲
  70. * @return 新的路劲
  71. */
  72. public static String onPhotoFromCamera(final Activity context, final int zoomCode, final String temppath,
  73. final int aspectX, final int aspectY) {
  74. try {
  75. Bitmap btp = getLocalImage(new File(temppath), 1000, 1000);
  76. compressImage(btp, new File(temppath + "temp.jpg"), 30);
  77. photoZoom(context, Uri.fromFile(new File(temppath + "temp.jpg")), Uri.fromFile(new File(temppath)),
  78. zoomCode, aspectX, aspectY);
  79. } catch (Exception e) {
  80. Toast.makeText(context, "图片加载失败", 1000).show();
  81. }
  82. return temppath;
  83. }
  84. /**
  85. * 图片切割完调用 如果还需要 Bitmap 调用getLocalImage
  86. *
  87. * @param path
  88. * @param rw
  89. * @param rh
  90. * @param compress
  91. * @return
  92. */
  93. public static File onPhotoZoom(String path, int rw, int rh, int compress) {
  94. File f = new File(path);
  95. Bitmap btp = PhotoUtilChange.getLocalImage(f, rw, rh);
  96. compressImage(btp, f, compress);
  97. return f;
  98. }
  99. /**
  100. * 相册获取图片,用于切割的图片大小被限制在500,500
  101. *
  102. * @param context
  103. * @param zoomCode
  104. * @param temppath
  105. * 希望生成的路劲
  106. * @param data
  107. */
  108. public static void onPhotoFromPick(final Activity context, final int zoomCode, final String temppath,
  109. final Intent data, final int aspectX, final int aspectY) {
  110. try {
  111. Bitmap btp = checkImage(context, data);
  112. compressImage(btp, new File(temppath + "temp.jpg"), 30);
  113. PhotoUtilChange.photoZoom(context, Uri.fromFile(new File(temppath + "temp.jpg")),
  114. Uri.fromFile(new File(temppath)), zoomCode, aspectX, aspectY);
  115. } catch (Exception e) {
  116. Toast.makeText(context, "图片加载失败", 1000).show();
  117. }
  118. }
  119. /**
  120. * data 中检出图片
  121. *
  122. * @param activity
  123. * @param data
  124. * @return
  125. */
  126. public static Bitmap checkImage(Activity activity, Intent data) {
  127. Bitmap bitmap = null;
  128. try {
  129. Uri originalUri = data.getData();
  130. String path = getRealPathFromURI(activity, originalUri);
  131. File f = activity.getExternalCacheDir();
  132. String pp = f.getAbsolutePath();
  133. if (path.indexOf(pp) != -1) {
  134. path = path.substring(path.indexOf(pp), path.length());
  135. }
  136. bitmap = getLocalImage(new File(path), 1000, 1000);
  137. } catch (Exception e) {
  138. } finally {
  139. return bitmap;
  140. }
  141. }
  142. /**
  143. * 通过URI 获取真实路劲
  144. *
  145. * @param activity
  146. * @param contentUri
  147. * @return
  148. */
  149. public static String getRealPathFromURI(Activity activity, Uri contentUri) {
  150. Cursor cursor = null;
  151. String result = contentUri.toString();
  152. String[] proj = { MediaStore.Images.Media.DATA };
  153. cursor = activity.managedQuery(contentUri, proj, null, null, null);
  154. if (cursor == null)
  155. throw new NullPointerException("reader file field");
  156. if (cursor != null) {
  157. int column_index = cursor.getColumnIndexOrThrow(MediaColumns.DATA);
  158. cursor.moveToFirst();
  159. result = cursor.getString(column_index);
  160. if (Integer.parseInt(Build.VERSION.SDK) < 14) {
  161. cursor.close();
  162. }
  163. }
  164. return result;
  165. }
  166. /**
  167. * 图片压缩 上传图片时建议compress为30
  168. *
  169. * @param bm
  170. * @param f
  171. */
  172. public static void compressImage(Bitmap bm, File f, int compress) {
  173. if (bm == null)
  174. return;
  175. File file = f;
  176. try {
  177. if (file.exists()) {
  178. file.delete();
  179. }
  180. file.createNewFile();
  181. OutputStream outStream = new FileOutputStream(file);
  182. bm.compress(android.graphics.Bitmap.CompressFormat.JPEG, compress, outStream);
  183. outStream.flush();
  184. outStream.close();
  185. } catch (FileNotFoundException e) {
  186. e.printStackTrace();
  187. } catch (IOException e) {
  188. e.printStackTrace();
  189. }
  190. }
  191. /**
  192. * 由本地文件获取希望大小的文件
  193. *
  194. * @param f
  195. * @return
  196. */
  197. public static Bitmap getLocalImage(File f, int swidth, int sheight) {
  198. File file = f;
  199. if (file.exists()) {
  200. try {
  201. file.setLastModified(System.currentTimeMillis());
  202. FileInputStream in = new FileInputStream(file);
  203. BitmapFactory.Options options = new BitmapFactory.Options();
  204. options.inJustDecodeBounds = true;
  205. BitmapFactory.decodeStream(in, null, options);
  206. int sWidth = swidth;
  207. int sHeight = sheight;
  208. int mWidth = options.outWidth;
  209. int mHeight = options.outHeight;
  210. int s = 1;
  211. while ((mWidth / s > sWidth * 2) || (mHeight / s > sHeight * 2)) {
  212. s *= 2;
  213. }
  214. options = new BitmapFactory.Options();
  215. options.inSampleSize = s;
  216. options.inPreferredConfig = Bitmap.Config.RGB_565;
  217. options.inPurgeable = true;
  218. options.inInputShareable = true;
  219. try {
  220. // 4. inNativeAlloc 属性设置为true,可以不把使用的内存算到VM里
  221. BitmapFactory.Options.class.getField("inNativeAlloc").setBoolean(options, true);
  222. } catch (Exception e) {
  223. }
  224. in.close();
  225. // 再次获取
  226. in = new FileInputStream(file);
  227. Bitmap bitmap = BitmapFactory.decodeStream(in, null, options);
  228. in.close();
  229. return bitmap;
  230. } catch (FileNotFoundException e) {
  231. e.printStackTrace();
  232. } catch (Exception e) {
  233. e.printStackTrace();
  234. } catch (Error e) {
  235. System.gc();
  236. return null;
  237. }
  238. }
  239. return null;
  240. }
  241. /**
  242. * aspectY Y对于X的比例 outputX X 的宽
  243. * **/
  244. public static void photoZoom(Activity activity, Uri uri, Uri outUri, int photoResoultCode, int aspectX, int aspectY) {
  245. Intent intent = new Intent("com.android.camera.action.CROP");
  246. intent.setDataAndType(uri, "image/*");
  247. intent.putExtra("crop", "true");
  248. // aspectX aspectY 是宽高的比例
  249. if (aspectY > 0) {
  250. intent.putExtra("aspectX", aspectX);
  251. intent.putExtra("aspectY", aspectY);
  252. }
  253. intent.putExtra("scale", aspectX == aspectY);
  254. intent.putExtra("return-data", true);
  255. intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString());
  256. intent.putExtra(MediaStore.EXTRA_OUTPUT, outUri);
  257. intent.putExtra("noFaceDetection", true); //
  258. activity.startActivityForResult(intent, photoResoultCode);
  259. }
  260. /**
  261. * 保存zoom之后的图片
  262. * @param data zoom后的intent
  263. * @param context 上下文
  264. * @return
  265. */
  266. public static Bitmap getZoomBitMap(Intent data, Context context) {
  267. try {
  268. Bundle extras = data.getExtras();
  269. if (extras != null) {
  270. Bitmap bitmap = extras.getParcelable("data");
  271. return bitmap;
  272. }
  273. } catch (Exception e) {
  274. e.printStackTrace();
  275. Toast.makeText(context, "出现未知异常,请尝试其他图片", Toast.LENGTH_SHORT).show();
  276. }
  277. return null;
  278. }
  279. }

  

PopupWindow 以及拍照、裁剪的更多相关文章

  1. Intent 常用场景 FileProvider 拍照 裁剪 MD

    Markdown版本笔记 我的GitHub首页 我的博客 我的微信 我的邮箱 MyAndroidBlogs baiqiantao baiqiantao bqt20094 baiqiantao@sina ...

  2. 3.PopupWindow 、拍照、裁剪

    实现这样的效果 圆角图片的自定义控件直接拷进来,和com一个等级 想要弹出内容可以使用悬浮窗 layout_pupup <LinearLayout xmlns:android="htt ...

  3. Android调用系统拍照裁剪和选图功能

    最近项目中用到修改用户头像的功能,基本上都是模板代码,现在简单记录一下. 调用系统拍照 private fun openCamera() { //调用相机拍照 // 创建File对象,用于存储拍照后的 ...

  4. 4.4系统,拍照-裁剪,resultCode返回0

    问题描述: take photo -> 拍照 -> 确定 -> 截图 -> 保存,此时返回给onActivityResult的resultCode是0,截图无效.我查看图片储存 ...

  5. iOS自定义拍照框拍照&裁剪(一)

    卡片机时代 很重要的一点是,相机本身是没有方向概念的,它不理解拍摄的内容,只会以相机自己的坐标系去保存数据,下图展示了相机对"F"进行四个角度拍摄时返回的图片数据. 最初的卡片机时 ...

  6. 手机调用系统的拍照和裁剪功能,假设界面有输入框EditText,在一些手机会出现点击EditText会弹出输入法,却不能输入的情况。

    1. 拍照裁剪后 点击EditText会弹出输入法,却不能输入.可是点击点一EdtiText就能够输入了,所以我就写了一个看不见的EdtiText,切换焦点,这样就攻克了这个奇怪的这问题,应该是and ...

  7. Android开发技巧——定制仿微信图片裁剪控件

    拍照--裁剪,或者是选择图片--裁剪,是我们设置头像或上传图片时经常需要的一组操作.上篇讲了Camera的使用,这篇讲一下我对图片裁剪的实现. 背景 下面的需求都来自产品. 裁剪图片要像微信那样,拖动 ...

  8. Android上传图片之调用系统拍照和从相冊选择图片

    Android上传图片之调用系统拍照和从相冊选择图片 本篇文章已授权微信公众号 guolin_blog (郭霖)独家公布 前言: 万丈高楼平底起,万事起于微末.不知不觉距离上篇博文已近四个月,2015 ...

  9. 转--2014年最新810多套android源码2.46GB免费一次性打包下载

    转载自:http://www.eoeandroid.com/thread-497046-1-1.html 感谢该博客主人无私奉献~~ 下面的源码是从今年3月份开始不断整理源码区和其他网站上的安卓例子源 ...

随机推荐

  1. 机器学习入门-BP神经网络模型及梯度下降法-2017年9月5日14:58:16

    BP(Back Propagation)网络是1985年由Rumelhart和McCelland为首的科学家小组提出,是一种按误差逆传播算法训练的多层前馈网络,是目前应用最广泛的神经网络模型之一. B ...

  2. Java-Oracle数据库连接

    Oracle数据库先创建一个表和添加一些数据,下面是连接数据库的具体实现.(导入jar包:ojdbc14.jar) import java.sql.Connection; import java.sq ...

  3. hbase-数据恢复流程

    引用<https://blog.csdn.net/nigeaoaojiao/article/details/54909921> hlog介绍: hlog构建: 从图中可以看出,对于一个hl ...

  4. 配置GitHub的SSH key

    配置GitHub的SSH key 生成密钥对 打开git bash工具(Windows环境),Linux则直接打开命令行,执行下面的命令生成密钥文件 ssh-Keygen -t rsa -C &quo ...

  5. 1,fiddler的工作原理和安装

    1,工作原理就是通过设置代理监控客户端和服务端的协议 2,fiddler的安装 1,官方的下载地址:https://www.telerik.com/download/fiddler 一步步安装即可 2 ...

  6. 关于tomcat7配置maxPostSize=“0”时,后台无法接收前台参数的问题

    Post提交参数时,如果参数值的长度太长,后台通过Map<String, String[]> requestParameterMap=request.getParameterMap();获 ...

  7. Mysql数据库每天定时执行备份方法

    此数据库备份方法是简单的数据库备份方法,就是从Mysql的数据文件下,将数据库文件拷贝到指定的文件夹目录下 1.创建txt文件,添加脚本 net stop mysql xcopy D:\MySql\D ...

  8. HDU-4763 Theme Section KMP

    题意:求最长的子串E,使母串满足EAEBE的形式,A.B可以任意,并且不能重叠. 题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=4763 思 ...

  9. fiddler不能抓某些的包的原因

    用fiddler抓某app的包时,死活抓不到,确定自己设置的没有错,并且让小A同事也看了一遍我的设置,确认没错后,又在小A同事那儿试了下还是抓不到 后来在网上找了很多资料,才发现是因为一些app使用了 ...

  10. 学习笔记整理之StringBuffer与StringBulider的线程安全与线程不安全

    关于线程和线程不安全: 概述 编辑 如果你的代码所在的进程中有多个线程在同时运行,而这些线程可能会同时运行这段代码.如果每次运行结果和单线程运行的结果是一样的,而且其他的变量的值也和预期的是一样的,就 ...