Android实现批量照片上传至server,拍照或者从相冊选择
近期因为项目需求,须要完毕批量照片上传,折腾了一段时间,最终完毕了,达到了例如以下效果
主界面主要有GridView组成和button组成,当按下一个格点时,会调用相机或者相冊,拍照或者选择相冊照片,选择完毕之后,将缩略图显示在GridView。在这里说明一下。假设GridView显示不出来。说明图片太大了。须要压缩,在我的上一篇博客,具体解说了图片压缩的原理与过程。这里不再赘述。
以下贴上代码,
主界面:
package com.qian.pos; import java.util.HashMap;
import java.util.Iterator;
import java.util.Map; import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Picture;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast; import com.qian.pos.util.BitmapUtil;
import com.qian.pos.util.FileUtils;
import com.qian.pos.util.PictureUtil;
import com.qian.pos.util.UploadUtil;
import com.qian.pos.util.UploadUtil.OnUploadProcessListener;
import com.qian.servletasynchttp.R; public class ImageUploadActivity extends Activity// implements OnUploadProcessListener
{
private static final String TAG = "uploadImage";
protected static final int TO_UPLOAD_FILE = 1;
protected static final int UPLOAD_FILE_DONE = 2;
public static final int TO_SELECT_PHOTO = 3;
private static final int UPLOAD_INIT_PROCESS = 4;
private static final int UPLOAD_IN_PROCESS = 5;
private static String requestURL = "http://114.55.72.18/UnionPay/UploadAction";
private Button uploadButton;
//private ProgressBar progressBar; private String picPath = null;
private ProgressDialog progressDialog; private GridView list_gv;
private MyAdapter adapter; private HashMap<Integer,Bitmap> imageMap = new HashMap<Integer, Bitmap>();
private HashMap<Integer,String> filePathMap = new HashMap<Integer, String>();
private Handler handler = new Handler(){
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case TO_UPLOAD_FILE:
toUploadFile();
break;
case UPLOAD_INIT_PROCESS:
//progressBar.setMax(msg.arg1);
break;
case UPLOAD_IN_PROCESS:
//progressBar.setProgress(msg.arg1);
break;
case UPLOAD_FILE_DONE:
String result = "响应码:"+msg.arg1+"\n响应信息:"+msg.obj+"\n耗时:"+UploadUtil.getRequestTime()+"秒"; break;
default:
break;
}
super.handleMessage(msg);
} };
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
initView();
}
private void initView() {
uploadButton = (Button) this.findViewById(R.id.uploadImage);
uploadButton.setOnClickListener(new OnClickListener() { @Override
public void onClick(View v) {
if(picPath!=null)
{
handler.sendEmptyMessage(TO_UPLOAD_FILE);
}else{
Toast.makeText(ImageUploadActivity.this, "上传的文件路径出错", Toast.LENGTH_LONG).show();
} }
});
progressDialog = new ProgressDialog(this);
list_gv = (GridView) findViewById(R.id.gv_image);
adapter = new MyAdapter();
list_gv.setAdapter(adapter);
list_gv.setOnItemClickListener(new OnItemClickListener() { @Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
Intent intent;
switch (position) {
case 0:
intent = new Intent(ImageUploadActivity.this,SelectPicActivity.class);
startActivityForResult(intent, 0);
break;
case 1:
intent = new Intent(ImageUploadActivity.this,SelectPicActivity.class);
startActivityForResult(intent, 1);
break;
case 2:
intent = new Intent(ImageUploadActivity.this,SelectPicActivity.class);
startActivityForResult(intent, 2);
break;
case 3:
intent = new Intent(ImageUploadActivity.this,SelectPicActivity.class);
startActivityForResult(intent, 3);
break;
case 4:
intent = new Intent(ImageUploadActivity.this,SelectPicActivity.class);
startActivityForResult(intent, 4);
break;
} } });
} private class MyAdapter extends BaseAdapter { @Override
public int getCount() {
return 5;
} @Override
public Object getItem(int position) {
return null;
} @Override
public long getItemId(int position) {
return 0;
} @Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = View.inflate(ImageUploadActivity.this, R.layout.item_grid, null);
ImageView image = (ImageView) view.findViewById(R.id.item_grida_image); Iterator<Integer> iterator = imageMap.keySet().iterator();
while(iterator.hasNext()) {
Integer next = iterator.next();
if(next.intValue() == position) {
image.setImageBitmap(imageMap.get(next));
}
}
TextView textView = (TextView) view.findViewById(R.id.tv_explain);
switch (position) {
case 0:
textView.setText("照片1");
break;
case 1:
textView.setText("<span style="font-family: 'Microsoft YaHei';">照片2</span>");
break;
case 2:
textView.setText("照片3");
break;
case 3:
textView.setText("照片4");
break;
case 4:
textView.setText("照片5");
break;
default:
break;
} return view;
} } @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if(resultCode==Activity.RESULT_OK) {
picPath = data.getStringExtra(SelectPicActivity.KEY_PHOTO_PATH);
Log.i(TAG, "终于选择的图片="+picPath);
// Toast.makeText(getApplicationContext(), "终于选择的图片="+picPath, 0).show();
Bitmap bm = BitmapFactory.decodeFile(picPath);
//Bitmap tempBitmap = BitmapUtil.createImageThumbnail(picPath,128);//压缩图片
//Bitmap saveBitmap = BitmapUtil.createImageThumbnail(picPath,2048);
Bitmap tempBitmap = PictureUtil.getSmallBitmap(picPath, 128, 128);//压缩图片
Bitmap saveBitmap = PictureUtil.getSmallBitmap(picPath,1280,720);//上传server的bitmap 手机横着拍照
String path = Environment.getExternalStorageDirectory()+ "/pos/"+requestCode+".JPEG";
FileUtils.saveBitmap(saveBitmap, requestCode+"");
filePathMap.put(requestCode, path);
imageMap.put(requestCode, tempBitmap);
//Toast.makeText(ImageUploadActivity.this, "第"+requestCode+"张图片", 0).show();
// System.out.println("imageMap"+imageMap.size());
// System.out.println("filePathMap"+filePathMap.size());
adapter.notifyDataSetChanged();
}
super.onActivityResult(requestCode, resultCode, data);
} private void toUploadFile()
{
progressDialog.setMessage("正在上传文件...");
progressDialog.show();
final String fileKey = "upload";
final UploadUtil uploadUtil = UploadUtil.getInstance();;
uploadUtil.setOnUploadProcessListener(new OnUploadProcessListener() { @Override
public void onUploadProcess(int uploadSize) {
Message msg = Message.obtain();
msg.what = UPLOAD_IN_PROCESS;
msg.arg1 = uploadSize;
handler.sendMessage(msg);
} @Override
public void onUploadDone(int responseCode, String message) { progressDialog.dismiss();
Message msg = Message.obtain();
msg.what = UPLOAD_FILE_DONE;
msg.arg1 = responseCode;
msg.obj = message;
handler.sendMessage(msg);
} @Override
public void initUpload(int fileSize) {
Message msg = Message.obtain();
msg.what = UPLOAD_INIT_PROCESS;
msg.arg1 = fileSize;
handler.sendMessage(msg);
}
}); //设置监听器监听上传状态 final Map<String, String> params = new HashMap<String, String>();
params.put("dpnumber", "13800001111"); System.out.println(filePathMap.size()); new Thread(new Runnable() {
int i = 0;
@Override
public void run() { final boolean uploadFile = uploadUtil.uploadFile(filePathMap,fileKey,requestURL,params); runOnUiThread(new Runnable() { @Override
public void run() {
if(uploadFile) {
Toast.makeText(ImageUploadActivity.this, "上传成功", 0).show();
progressDialog.dismiss();
} else {
Toast.makeText(ImageUploadActivity.this, "上传失败", 0).show();
progressDialog.dismiss();
} }
}); } }).start(); } }
选择照片界面程序:
package com.qian.pos; import com.qian.servletasynchttp.R; import android.app.Activity;
import android.content.ContentValues;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.Toast; public class SelectPicActivity extends Activity implements OnClickListener{ public static final int SELECT_PIC_BY_TACK_PHOTO = 1; public static final int SELECT_PIC_BY_PICK_PHOTO = 2; public static final String KEY_PHOTO_PATH = "photo_path"; private static final String TAG = "SelectPicActivity"; private LinearLayout dialogLayout;
private Button takePhotoBtn,pickPhotoBtn,cancelBtn; /**获取到的图片路径*/
private String picPath; private Intent lastIntent ; private Uri photoUri;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.select_pic_layout);
initView();
}
/**
* 初始化载入View
*/
private void initView() {
dialogLayout = (LinearLayout) findViewById(R.id.dialog_layout);
dialogLayout.setOnClickListener(this);
takePhotoBtn = (Button) findViewById(R.id.btn_take_photo);
takePhotoBtn.setOnClickListener(this);
pickPhotoBtn = (Button) findViewById(R.id.btn_pick_photo);
pickPhotoBtn.setOnClickListener(this);
cancelBtn = (Button) findViewById(R.id.btn_cancel);
cancelBtn.setOnClickListener(this); lastIntent = getIntent();
} @Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.dialog_layout:
finish();
break;
case R.id.btn_take_photo:
takePhoto();
break;
case R.id.btn_pick_photo:
pickPhoto();
break;
default:
finish();
break;
}
} /**
* 拍照获取图片
*/
private void takePhoto() {
//运行拍照前,应该先推断SD卡是否存在
String SDState = Environment.getExternalStorageState();
if(SDState.equals(Environment.MEDIA_MOUNTED))
{ Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);//"android.media.action.IMAGE_CAPTURE"
/***
* 须要说明一下。下面操作使用照相机拍照,拍照后的图片会存放在相冊中的
* 这里使用的这样的方式有一个优点就是获取的图片是拍照后的原图
* 假设不有用ContentValues存放照片路径的话。拍照后获取的图片为缩略图不清晰
*/
ContentValues values = new ContentValues();
photoUri = this.getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, photoUri);
/**-----------------*/
startActivityForResult(intent, SELECT_PIC_BY_TACK_PHOTO);
}else{
Toast.makeText(this,"内存卡不存在", Toast.LENGTH_LONG).show();
}
} /***
* 从相冊中取图片
*/
private void pickPhoto() {
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(intent, SELECT_PIC_BY_PICK_PHOTO);
} @Override
public boolean onTouchEvent(MotionEvent event) {
finish();
return super.onTouchEvent(event);
} @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if(resultCode == Activity.RESULT_OK)
{
doPhoto(requestCode,data);
}
super.onActivityResult(requestCode, resultCode, data);
} /**
* 选择图片后,获取图片的路径
* @param requestCode
* @param data
*/
private void doPhoto(int requestCode,Intent data)
{
if(requestCode == SELECT_PIC_BY_PICK_PHOTO ) //从相冊取图片,有些手机有异常情况,请注意
{
if(data == null)
{
Toast.makeText(this, "选择图片文件出错", Toast.LENGTH_LONG).show();
return;
}
photoUri = data.getData();
if(photoUri == null )
{
Toast.makeText(this, "选择图片文件出错", Toast.LENGTH_LONG).show();
return;
}
}
String[] pojo = {MediaStore.Images.Media.DATA};
Cursor cursor = managedQuery(photoUri, pojo, null, null,null);
if(cursor != null )
{
int columnIndex = cursor.getColumnIndexOrThrow(pojo[0]);
cursor.moveToFirst();
picPath = cursor.getString(columnIndex);
cursor.close();
}
Log.i(TAG, "imagePath = "+picPath);
if (picPath != null
/*&& (picPath.endsWith(".png") || picPath.endsWith(".PNG")
|| picPath.endsWith(".jpg") || picPath.endsWith(".JPG")
|| picPath.endsWith(".JPG") || picPath
.endsWith(".JPEG"))*/)
{
lastIntent.putExtra(KEY_PHOTO_PATH, picPath);
setResult(Activity.RESULT_OK, lastIntent);
finish();
}else{
//Toast.makeText(this, picPath, Toast.LENGTH_LONG).show();
Toast.makeText(this, "选择图片文件不对", Toast.LENGTH_LONG).show();
}
}
}
接下来是程序的核心部分UploadUtil.java
主要实现了图片的上传,上传过程的初始化监听和上传完毕的监听,还有上传耗时的计算。设置的回调接口监听器在主界面能够设置,获得必要的信息。
实现的批量的过程也在当中。使用HashMap将各个图片的路径保存在当中,然后HashMap的迭代器实现循环上传。批量上传的过程中,假设图片过大会抛出异常,载入bitmap手机太多内存,没来得及释放又要载入还有一张图片,单张原图上传能够实现。但不符合市场需求,一般都是批量上传。
程序的具体运行流程就不具体说了。关键部分凝视已经写好了。
package com.qian.pos.util; import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.UUID; import android.content.Context;
import android.util.Log;
import android.widget.Toast; public class UploadUtil {
private static UploadUtil uploadUtil;
private static final String BOUNDARY = UUID.randomUUID().toString(); // 边界标识 随机生成
private static final String PREFIX = "--";
private static final String LINE_END = "\r\n";
private static final String CONTENT_TYPE = "multipart/form-data"; // 内容类型
private UploadUtil() { } /**
* 单例模式获取上传工具类
* @return
*/
public static UploadUtil getInstance() {
if (null == uploadUtil) {
uploadUtil = new UploadUtil();
}
return uploadUtil;
} private static final String TAG = "UploadUtil";
private int readTimeOut = 10 * 10000; // 读取超时
private int connectTimeout = 10 * 10000; // 超时时间
/***
* 请求使用多长时间
*/
private static int requestTime = 0; private static final String CHARSET = "utf-8"; // 设置编码 /***
* 上传成功
*/
public static final int UPLOAD_SUCCESS_CODE = 1;
/**
* 文件不存在
*/
public static final int UPLOAD_FILE_NOT_EXISTS_CODE = 2;
/**
* server出错
*/
public static final int UPLOAD_SERVER_ERROR_CODE = 3;
protected static final int WHAT_TO_UPLOAD = 1;
protected static final int WHAT_UPLOAD_DONE = 2; public boolean uploadFile(HashMap<Integer,String> filePathMap, String fileKey, String RequestURL,
Map<String, String> param) {
String result = null;
requestTime= 0;
String fileName = "";
long requestTime = System.currentTimeMillis();
long responseTime = 0; try { // conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); Iterator<Integer> iterator = filePathMap.keySet().iterator();
boolean isOk = true;
System.out.println("filePathMap.size()"+filePathMap.size());
while(iterator.hasNext()) {
URL url = new URL(RequestURL);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setReadTimeout(readTimeOut);
conn.setConnectTimeout(connectTimeout);
conn.setDoInput(true); // 同意输入流
conn.setDoOutput(true); // 同意输出流
conn.setUseCaches(false); // 不同意使用缓存
conn.setRequestMethod("POST"); // 请求方式
conn.setRequestProperty("Charset", CHARSET); // 设置编码
conn.setRequestProperty("connection", "keep-alive");
conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)");
conn.setRequestProperty("Content-Type", CONTENT_TYPE + ";boundary=" + BOUNDARY);
Integer next = iterator.next();
System.out.println(next+"");
String filepath = filePathMap.get(next);
switch (next.intValue()) {
case 0:
fileName = "IDPositive";
break;
case 1:
fileName = "IDNative";
break;
case 2:
fileName = "BusinessLicense";
break;
case 3:
fileName = "Outdoor";
break;
case 4:
fileName = "Indoor";
break;
default:
break;
}
DataOutputStream dos = new DataOutputStream(conn.getOutputStream());
StringBuffer sb = null;
String params = ""; if (param != null && param.size() > 0) {
Iterator<String> it = param.keySet().iterator();
while (it.hasNext()) {
sb = null;
sb = new StringBuffer();
String key = it.next();
String value = param.get(key);
sb.append(PREFIX).append(BOUNDARY).append(LINE_END);
sb.append("Content-Disposition: form-data; name=\"").append(key).append("\"").append(LINE_END).append(LINE_END);
sb.append(value).append(LINE_END);
params = sb.toString();
Log.i(TAG, key+"="+params+"##");
dos.write(params.getBytes());
// dos.flush();
}
} sb = null;
params = null;
sb = new StringBuffer();
/**
* 这里重点注意: name里面的值为server端须要key 仅仅有这个key 才干够得到相应的文件
* filename是文件的名字,包括后缀名的 比方:abc.png
*/
sb.append(PREFIX).append(BOUNDARY).append(LINE_END);
sb.append("Content-Disposition:form-data; name=\"" + fileKey
+ "\"; filename=\"" + fileName + "\"" + LINE_END);
//+ "\"; filename=\"" + file.getName() + "\"" + LINE_END);
sb.append("Content-Type:image/pjpeg" + LINE_END); // 这里配置的Content-type非常重要的 ,用于server端辨别文件的类型的
sb.append(LINE_END);
params = sb.toString();
sb = null; //Log.i(TAG, filepath.getName()+"=" + params+"##");
//Log.i(TAG, );
dos.write(params.getBytes());
/**上传文件*/
InputStream is = new FileInputStream(filepath);
onUploadProcessListener.initUpload((int)filepath.length());
byte[] bytes = new byte[1024];
int len = 0;
int curLen = 0;
while ((len = is.read(bytes)) != -1) {
curLen += len;
dos.write(bytes, 0, len);
onUploadProcessListener.onUploadProcess(curLen);
}
is.close();
is = null;
dos.write(LINE_END.getBytes());
byte[] end_data = (PREFIX + BOUNDARY + PREFIX + LINE_END).getBytes();
dos.write(end_data);
dos.flush();
dos.close();
dos = null;
// dos.write(tempOutputStream.toByteArray());
/**
* 获取响应码 200=成功 当响应成功,获取响应的流
*/
int res = conn.getResponseCode();
responseTime = System.currentTimeMillis();
this.requestTime = (int) ((responseTime-requestTime)/1000); Log.e(TAG, "response code:" + res); if (res == 200) {
Log.e(TAG, "request success");
InputStream input = conn.getInputStream();
StringBuffer sb1 = new StringBuffer();
int ss;
while ((ss = input.read()) != -1) {
sb1.append((char) ss);
}
result = sb1.toString();
Log.e(TAG, "result : " + result);
sb1 = null;
if(fileName == "Indoor") {
sendMessage(UPLOAD_SUCCESS_CODE, "上传结果:"+ result);
} conn.disconnect();
//return true;
} else {
Log.e(TAG, "request error");
sendMessage(UPLOAD_SERVER_ERROR_CODE,"上传失败:code=" + res);
conn.disconnect();
isOk = false; } }
return isOk;
} catch (MalformedURLException e) {
sendMessage(UPLOAD_SERVER_ERROR_CODE,"上传失败:error=" + e.getMessage());
e.printStackTrace(); return false;
} catch (IOException e) {
sendMessage(UPLOAD_SERVER_ERROR_CODE,"上传失败:error=" + e.getMessage());
e.printStackTrace();
return false;
} } private void sendMessage(int responseCode,String responseMessage)
{
onUploadProcessListener.onUploadDone(responseCode, responseMessage);
} /**
* 以下是一个自己定义的回调函数。用到回调上传文件是否完毕
*
* @author shimingzheng
*
*/
public static interface OnUploadProcessListener { void onUploadDone(int responseCode, String message); void onUploadProcess(int uploadSize); void initUpload(int fileSize);
}
private OnUploadProcessListener onUploadProcessListener; public void setOnUploadProcessListener(
OnUploadProcessListener onUploadProcessListener) {
this.onUploadProcessListener = onUploadProcessListener;
} public int getReadTimeOut() {
return readTimeOut;
} public void setReadTimeOut(int readTimeOut) {
this.readTimeOut = readTimeOut;
} public int getConnectTimeout() {
return connectTimeout;
} public void setConnectTimeout(int connectTimeout) {
this.connectTimeout = connectTimeout;
}
/**
* 获取上传使用的时间
* @return
*/
public static int getRequestTime() {
return requestTime;
} public static interface uploadProcessListener{ } }
Android实现批量照片上传至server,拍照或者从相冊选择的更多相关文章
- Android上传图片之调用系统拍照和从相冊选择图片
Android上传图片之调用系统拍照和从相冊选择图片 本篇文章已授权微信公众号 guolin_blog (郭霖)独家公布 前言: 万丈高楼平底起,万事起于微末.不知不觉距离上篇博文已近四个月,2015 ...
- Base64实现android端图片上传到server端
首先要下载Base64.java文件http://iharder.sourceforge.net/current/java/base64/ 将代码复制到project中. 然后上代码: android ...
- android照相及照片上传
Java代码 package com.android.cist.camera.view; import java.io.ByteArrayOutputStream; import java.i ...
- Android之本地相冊图片选取和拍照以及图片剪辑
转载请注明出处:http://blog.csdn.net/loveyaozu/article/details/51160482 相信有非常多Android开发者在日常开发中,因为项目需求,须要我们的A ...
- Android开发之裁切(拍照+相冊)图像并设置头像小结
先看效果: watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5 ...
- Android中相机和相冊使用分析
Android中相机和相冊使用分析 欢迎转载,但请尊重原创(文章来自不易,转载请标明转载出处,谢谢) 在手机应用程序中,使用自带的相机拍照以及相冊选择喜欢的图片是最常见只是的用户需求,那么怎么合理使用 ...
- android开发——从相冊中选择图片不裁剪
转载请注明出处:http://blog.csdn.net/zhoubin1992/article/details/46864777 问题: 在郭神的第一行代码中,第8章的从相冊中选择图片这块,从相冊选 ...
- android选择图片或拍照图片上传到server(包含上传參数)
在9ria论坛看到的.还没測试,先Mark与大家分享一下. 近期要搞一个项目,须要上传相冊和拍照的图片.不负所望,最终完毕了! 只是须要说明一下,事实上网上非常多教程拍照的图片.都是缩略图不是非常清晰 ...
- Android利用网络编程HttpClient批量上传(一个)
请尊重他人的劳动成果.转载请注明出处:Android网络编程之使用HttpClient批量上传文件 我曾在<Android网络编程之使用HTTP訪问网络资源>一文中介绍过HttpCient ...
随机推荐
- Oracle 10g 安装环境配置脚本
#!/bin/bash #Test in RHEL 5.5 for 10g c=`cat /etc/shadow | grep oracle | wc -l`if [ $c != 0 ]then w ...
- js面向对象编程(二)构造函数的继承(转载)
Javascript面向对象编程(二):构造函数的继承 这个系列的第一部分,主要介绍了如何"封装"数据和方法,以及如何从原型对象生成实例. 今天要介绍的是,对象之间的"继 ...
- 手机端iscoll插件的使用方法
除了以前版本的iScroll的特性以外,iScroll 4还包括如下的特性: (1)缩放(Pinch/Zoom) (2)拉动刷新(Pull up/down to refresh) (3)速度和性能提升 ...
- 消除Git diff中^M的差异
消除Git diff中^M的差异 在Windows上把一个刚commit的文件夹上传到了Ubuntu.在Ubuntu上使用git status查看,发现很多文件都被红色标注,表示刚刚修改未add.在W ...
- ECharts问题--柱状图和折线图中xAxis.data为空时报错问题解决
1. 我们在日常的开发中使用Echarts时,不像在学习的过程中是自己在option中的配置项填写图表需要的参数,而是通过ajax请求后台,获取数据后,使用javascript来动态的修改数据,但是有 ...
- OpenCV——Mat、CvMat、IplImage类型浅析【转】
OpenCV中常见的与图像操作有关的数据容器有Mat,cvMat和IplImage. 一.Mat类型:矩阵类型,Matrix. 在openCV中,Mat是一个多维的密集数据数组.可以用来处理向量和矩阵 ...
- 两个sql设计方案的比较
我有一个买方表Buyer,大概1万条记录:一个卖方表Sale,大概5万条记录.有一些买方和卖方之间是有某种关联的,这种关联关系被记录在Partner表里,Partner表中的关键字段包括BuyerID ...
- poj 3608(旋转卡壳求解两凸包之间的最短距离)
Bridge Across Islands Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 9768 Accepted: ...
- 创建展开行明细编辑表单的 CRUD 应用
http://www.runoob.com/jeasyui/jeasyui-app-crud3.html jQuery EasyUI 应用 - 创建展开行明细编辑表单的 CRUD 应用 当切换数据网格 ...
- NOIP2018提高组模拟题(五)
字符串(string) Description 小林与亮亮正在做一个游戏.小林随意地写出一个字符串,字符串只由大写 字母组成,然后指定一个非负整数 m,亮亮可以进行至多 m 次操作,每次操作 为交换相 ...