在github网站搜索Zxing

详见:https://github.com/yipianfengye/android-zxingLibrary

在module的build.gradle中执行compile操作

  1. compile 'cn.yipianfengye.android:zxing-library:2.1'

在Activity或者Application onCreate()中执行初始化操作

  1.   @Override
  2. public void onCreate() {
  3. super.onCreate();
  4.  
  5. ZXingLibrary.initDisplayOpinion(this);
  6. }

添加权限:

  1. <uses-permission android:name="android.permission.CAMERA"/>
  2. <uses-permission android:name="android.permission.INTERNET"/>
  3. <uses-permission android:name="android.permission.VIBRATE"/>
  4. <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

代码实现:

  1. package com.loaderman.zxingdemo;
  2.  
  3. import android.content.ContentResolver;
  4. import android.content.Intent;
  5. import android.graphics.Bitmap;
  6. import android.net.Uri;
  7. import android.os.Bundle;
  8. import android.provider.MediaStore;
  9. import android.support.v7.app.AppCompatActivity;
  10. import android.view.View;
  11. import android.widget.Toast;
  12.  
  13. import com.uuzuche.lib_zxing.activity.CaptureActivity;
  14. import com.uuzuche.lib_zxing.activity.CodeUtils;
  15. import com.uuzuche.lib_zxing.activity.ZXingLibrary;
  16.  
  17. public class MainActivity extends AppCompatActivity {
  18.  
  19. private static final int REQUEST_CODE = 10;
  20. private static final int REQUEST_IMAGE = 20;
  21.  
  22. @Override
  23. protected void onCreate(Bundle savedInstanceState) {
  24. super.onCreate(savedInstanceState);
  25. setContentView(R.layout.activity_main);
  26. ZXingLibrary.initDisplayOpinion(this);
  27. findViewById(R.id.btn_create).setOnClickListener(new View.OnClickListener() {
  28. @Override
  29. public void onClick(View v) {
  30. startActivity(new Intent(MainActivity.this,CreateActviity.class));
  31.  
  32. }
  33. });
  34. findViewById(R.id.btn_open).setOnClickListener(new View.OnClickListener() {
  35.  
  36. @Override
  37. public void onClick(View v) {//集成默认的二维码扫描页面
  38. Intent intent = new Intent(MainActivity.this, CaptureActivity.class);
  39. startActivityForResult(intent, REQUEST_CODE);
  40. }
  41. });
  42. findViewById(R.id.btn_openPictrue).setOnClickListener(new View.OnClickListener() {
  43. @Override
  44. public void onClick(View v) {//集成对二维码图片的解析功能
  45. Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
  46. intent.addCategory(Intent.CATEGORY_OPENABLE);
  47. intent.setType("image/*");
  48. startActivityForResult(intent, REQUEST_IMAGE);
  49. }
  50. });
  51. findViewById(R.id.btn_zidingyi).setOnClickListener(new View.OnClickListener() {
  52.  
  53. @Override
  54. public void onClick(View v) {
  55. startActivity(new Intent(MainActivity.this,MyZxingActviity.class));//定制化显示扫描UI
  56. }
  57. });
  58. }
  59.  
  60. @Override
  61. protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  62.  
  63. if (requestCode == REQUEST_CODE) {
  64. //处理扫描结果(在界面上显示)
  65. if (null != data) {
  66. Bundle bundle = data.getExtras();
  67. if (bundle == null) {
  68. return;
  69. }
  70. if (bundle.getInt(CodeUtils.RESULT_TYPE) == CodeUtils.RESULT_SUCCESS) {
  71. String result = bundle.getString(CodeUtils.RESULT_STRING);
  72. Toast.makeText(this, "解析结果:" + result, Toast.LENGTH_LONG).show();
  73. } else if (bundle.getInt(CodeUtils.RESULT_TYPE) == CodeUtils.RESULT_FAILED) {
  74. Toast.makeText(MainActivity.this, "解析二维码失败", Toast.LENGTH_LONG).show();
  75. }
  76. }
  77. }
  78. if (requestCode == REQUEST_IMAGE) {
  79. if (data != null) {
  80. Uri uri = data.getData();
  81. ContentResolver cr = getContentResolver();
  82. try {
  83. Bitmap mBitmap = MediaStore.Images.Media.getBitmap(cr, uri);//显得到bitmap图片
  84. String path = ImageUtil.getImageAbsolutePath(this, uri);
  85. CodeUtils.analyzeBitmap(path, new CodeUtils.AnalyzeCallback() {
  86. @Override
  87. public void onAnalyzeSuccess(Bitmap mBitmap, String result) {
  88. Toast.makeText(MainActivity.this, "解析结果:" + result, Toast.LENGTH_LONG).show();
  89. }
  90.  
  91. @Override
  92. public void onAnalyzeFailed() {
  93. Toast.makeText(MainActivity.this, "解析二维码失败", Toast.LENGTH_LONG).show();
  94. }
  95. });
  96.  
  97. if (mBitmap != null) {
  98. mBitmap.recycle();
  99. }
  100. } catch (Exception e) {
  101. e.printStackTrace();
  102.  
  103. }
  104. }
  105. }
  106. }
  107. }

activity_main.xml

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout
  3. xmlns:android="http://schemas.android.com/apk/res/android"
  4. xmlns:tools="http://schemas.android.com/tools"
  5. android:id="@+id/activity_main"
  6. android:layout_width="match_parent"
  7. android:layout_height="match_parent"
  8. android:orientation="vertical"
  9. android:gravity="center"
  10. tools:context="com.loaderman.zxingdemo.MainActivity">
  11. <Button
  12. android:id="@+id/btn_open"
  13. android:layout_width="wrap_content"
  14. android:layout_height="wrap_content"
  15. android:text="开始扫描二维码"/>
  16. <Button
  17. android:layout_width="wrap_content"
  18. android:id="@+id/btn_openPictrue"
  19. android:text="打开图库解析图片二维码"
  20. android:layout_height="wrap_content"/>
  21. <Button
  22. android:layout_width="wrap_content"
  23. android:id="@+id/btn_zidingyi"
  24. android:text="自定义布局UI扫描二维码"
  25. android:layout_height="wrap_content"/>
  26. <Button
  27. android:layout_width="wrap_content"
  28. android:id="@+id/btn_create"
  29. android:text="生成二维码"
  30. android:layout_height="wrap_content"/>
  31. </LinearLayout>
  1. package com.loaderman.zxingdemo;
  2.  
  3. import android.annotation.TargetApi;
  4. import android.content.ContentUris;
  5. import android.content.Context;
  6. import android.database.Cursor;
  7. import android.net.Uri;
  8. import android.os.Environment;
  9. import android.provider.DocumentsContract;
  10. import android.provider.MediaStore;
  11.  
  12. public class ImageUtil {
  13. /**
  14. * 根据Uri获取图片绝对路径,解决Android4.4以上版本Uri转换
  15. *
  16. * @param context
  17. * @param imageUri
  18. */
  19. @TargetApi(19)
  20. public static String getImageAbsolutePath(Context context, Uri imageUri) {
  21. if (context == null || imageUri == null)
  22. return null;
  23. if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT && DocumentsContract.isDocumentUri(context, imageUri)) {
  24. if (isExternalStorageDocument(imageUri)) {
  25. String docId = DocumentsContract.getDocumentId(imageUri);
  26. String[] split = docId.split(":");
  27. String type = split[0];
  28. if ("primary".equalsIgnoreCase(type)) {
  29. return Environment.getExternalStorageDirectory() + "/" + split[1];
  30. }
  31. } else if (isDownloadsDocument(imageUri)) {
  32. String id = DocumentsContract.getDocumentId(imageUri);
  33. Uri contentUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), Long.valueOf(id));
  34. return getDataColumn(context, contentUri, null, null);
  35. } else if (isMediaDocument(imageUri)) {
  36. String docId = DocumentsContract.getDocumentId(imageUri);
  37. String[] split = docId.split(":");
  38. String type = split[0];
  39. Uri contentUri = null;
  40. if ("image".equals(type)) {
  41. contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
  42. } else if ("video".equals(type)) {
  43. contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
  44. } else if ("audio".equals(type)) {
  45. contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
  46. }
  47. String selection = MediaStore.Images.Media._ID + "=?";
  48. String[] selectionArgs = new String[]{split[1]};
  49. return getDataColumn(context, contentUri, selection, selectionArgs);
  50. }
  51. } // MediaStore (and general)
  52. else if ("content".equalsIgnoreCase(imageUri.getScheme())) {
  53. // Return the remote address
  54. if (isGooglePhotosUri(imageUri)) {
  55. return imageUri.getLastPathSegment();
  56. }
  57. //return getDataColumn(context, imageUri, null, null);
  58. return getRealPathFromUri(context, imageUri);
  59. }
  60. // File
  61. else if ("file".equalsIgnoreCase(imageUri.getScheme())) {
  62. return imageUri.getPath();
  63. }
  64. return null;
  65. }
  66.  
  67. public static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) {
  68. Cursor cursor = null;
  69. String column = MediaStore.Images.Media.DATA;
  70. String[] projection = {column};
  71. try {
  72. cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null);
  73. if (cursor != null && cursor.moveToFirst()) {
  74. int index = cursor.getColumnIndexOrThrow(column);
  75. return cursor.getString(index);
  76. }
  77. } finally {
  78. if (cursor != null)
  79. cursor.close();
  80. }
  81. return null;
  82. }
  83.  
  84. public static String getRealPathFromUri(Context context, Uri contentUri) {
  85. Cursor cursor = null;
  86. try {
  87. String[] proj = { MediaStore.Images.Media.DATA };
  88. cursor = context.getContentResolver().query(contentUri, proj, null, null, null);
  89. int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
  90. cursor.moveToFirst();
  91. return cursor.getString(column_index);
  92. } finally {
  93. if (cursor != null) {
  94. cursor.close();
  95. }
  96. }
  97. }
  98.  
  99. /**
  100. * @param uri The Uri to check.
  101. * @return Whether the Uri authority is ExternalStorageProvider.
  102. */
  103. public static boolean isExternalStorageDocument(Uri uri) {
  104. return "com.android.externalstorage.documents".equals(uri.getAuthority());
  105. }
  106.  
  107. /**
  108. * @param uri The Uri to check.
  109. * @return Whether the Uri authority is DownloadsProvider.
  110. */
  111. public static boolean isDownloadsDocument(Uri uri) {
  112. return "com.android.providers.downloads.documents".equals(uri.getAuthority());
  113. }
  114.  
  115. /**
  116. * @param uri The Uri to check.
  117. * @return Whether the Uri authority is MediaProvider.
  118. */
  119. public static boolean isMediaDocument(Uri uri) {
  120. return "com.android.providers.media.documents".equals(uri.getAuthority());
  121. }
  122.  
  123. /**
  124. * @param uri The Uri to check.
  125. * @return Whether the Uri authority is Google Photos.
  126. */
  127. public static boolean isGooglePhotosUri(Uri uri) {
  128. return "com.google.android.apps.photos.content".equals(uri.getAuthority());
  129. }
  130. }
  1. package com.loaderman.zxingdemo;
  2.  
  3. import android.content.Intent;
  4. import android.graphics.Bitmap;
  5. import android.os.Bundle;
  6. import android.support.v7.app.AppCompatActivity;
  7. import android.view.View;
  8. import android.widget.Button;
  9.  
  10. import com.uuzuche.lib_zxing.activity.CaptureFragment;
  11. import com.uuzuche.lib_zxing.activity.CodeUtils;
  12.  
  13. public class MyZxingActviity extends AppCompatActivity {
  14. private boolean flag = false;
  15. private Button btnLight;
  16.  
  17. @Override
  18. protected void onCreate(Bundle savedInstanceState) {
  19. super.onCreate(savedInstanceState);
  20. setContentView(R.layout.activity_my_zxing_actviity);
  21. btnLight = (Button) findViewById(R.id.btn_light);
  22.  
  23. btnLight.setOnClickListener(new View.OnClickListener() {
  24. @Override
  25. public void onClick(View v) {
  26. if (flag) {
  27. //关闭闪光灯
  28. CodeUtils.isLightEnable(false);
  29. flag = false;
  30. } else {
  31. // 打开闪光灯
  32. flag = true;
  33. CodeUtils.isLightEnable(true);
  34.  
  35. }
  36. }
  37. });
  38. findViewById(R.id.btn_cancel).setOnClickListener(new View.OnClickListener() {
  39. @Override
  40. public void onClick(View v) {
  41. finish();
  42. }
  43. });
  44. /**
  45. * 执行扫面Fragment的初始化操作
  46. */
  47. CaptureFragment captureFragment = new CaptureFragment();
  48. // 为二维码扫描界面设置定制化界面
  49. CodeUtils.setFragmentArgs(captureFragment, R.layout.my_camera);
  50.  
  51. captureFragment.setAnalyzeCallback(analyzeCallback);
  52. /**
  53. * 替换自定义扫描控件
  54. */
  55. getSupportFragmentManager().beginTransaction().replace(R.id.fl_my_container, captureFragment).commit();
  56. }
  57.  
  58. /**
  59. * 二维码解析回调函数
  60. */
  61. CodeUtils.AnalyzeCallback analyzeCallback = new CodeUtils.AnalyzeCallback() {
  62. @Override
  63. public void onAnalyzeSuccess(Bitmap mBitmap, String result) {
  64. Intent resultIntent = new Intent();
  65. Bundle bundle = new Bundle();
  66. bundle.putInt(CodeUtils.RESULT_TYPE, CodeUtils.RESULT_SUCCESS);
  67. bundle.putString(CodeUtils.RESULT_STRING, result);
  68. resultIntent.putExtras(bundle);
  69. MyZxingActviity.this.setResult(RESULT_OK, resultIntent);
  70. MyZxingActviity.this.finish();
  71. }
  72.  
  73. @Override
  74. public void onAnalyzeFailed() {
  75. Intent resultIntent = new Intent();
  76. Bundle bundle = new Bundle();
  77. bundle.putInt(CodeUtils.RESULT_TYPE, CodeUtils.RESULT_FAILED);
  78. bundle.putString(CodeUtils.RESULT_STRING, "");
  79. resultIntent.putExtras(bundle);
  80. MyZxingActviity.this.setResult(RESULT_OK, resultIntent);
  81. MyZxingActviity.this.finish();
  82. }
  83. };
  84. }

activity_my_zxing_actviity.xml

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout
  3. xmlns:android="http://schemas.android.com/apk/res/android"
  4. xmlns:tools="http://schemas.android.com/tools"
  5. android:id="@+id/activity_my_zxing_actviity"
  6. android:layout_width="match_parent"
  7. android:layout_height="match_parent"
  8. android:orientation="vertical"
  9. tools:context="com.loaderman.zxingdemo.MyZxingActviity">
  10. <FrameLayout
  11. android:layout_weight="1"
  12. android:id="@+id/fl_my_container"
  13. android:layout_width="match_parent"
  14. android:layout_height="match_parent"
  15. ></FrameLayout>
  16. <Button
  17. android:id="@+id/btn_cancel"
  18. android:layout_width="wrap_content"
  19. android:layout_height="wrap_content"
  20. android:text="取消"
  21. android:layout_marginTop="20dp"
  22. android:layout_marginLeft="20dp"
  23. android:layout_marginRight="20dp"
  24. android:layout_marginBottom="10dp"
  25. android:layout_gravity="bottom|center_horizontal"
  26. />
  27. <Button
  28. android:id="@+id/btn_light"
  29. android:layout_width="wrap_content"
  30. android:layout_height="wrap_content"
  31. android:text="闪光灯控制"
  32. android:layout_marginTop="20dp"
  33. android:layout_marginLeft="20dp"
  34. android:layout_marginRight="20dp"
  35. android:layout_marginBottom="10dp"
  36. android:layout_gravity="bottom|center_horizontal"
  37. />
  38. </LinearLayout>

my_camera.xml

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. xmlns:app="http://schemas.android.com/apk/res-auto"
  4. android:layout_width="fill_parent"
  5. android:layout_height="fill_parent" >
  6. <SurfaceView
  7. android:id="@+id/preview_view"
  8. android:layout_width="wrap_content"
  9. android:layout_height="wrap_content"
  10. />
  11. <com.uuzuche.lib_zxing.view.ViewfinderView
  12. android:id="@+id/viewfinder_view"
  13. android:layout_width="wrap_content"
  14. android:layout_height="wrap_content"
  15. app:inner_width="200dp"
  16. app:inner_height="200dp"
  17. app:inner_margintop="150dp"
  18. app:inner_corner_color="#f00"
  19. app:inner_corner_length="30dp"
  20. app:inner_corner_width="5dp"
  21. app:inner_scan_bitmap="@drawable/ic_launcher"
  22. app:inner_scan_speed="10"
  23. app:inner_scan_iscircle="false"
  24. />
  25.  
  26. </FrameLayout>

生成二维码图片

  1. package com.loaderman.zxingdemo;
  2.  
  3. import android.graphics.Bitmap;
  4. import android.graphics.BitmapFactory;
  5. import android.os.Bundle;
  6. import android.support.v7.app.AppCompatActivity;
  7. import android.text.TextUtils;
  8. import android.view.View;
  9. import android.widget.ImageView;
  10. import android.widget.TextView;
  11. import android.widget.Toast;
  12.  
  13. import com.uuzuche.lib_zxing.activity.CodeUtils;
  14.  
  15. public class CreateActviity extends AppCompatActivity {
  16.  
  17. private TextView editText;
  18. private ImageView iv;
  19. private Bitmap mBitmap;
  20.  
  21. @Override
  22. protected void onCreate(Bundle savedInstanceState) {
  23. super.onCreate(savedInstanceState);
  24. setContentView(R.layout.activity_create_actviity);
  25. editText = (TextView) findViewById(R.id.et_text);
  26. iv = (ImageView) findViewById(R.id.iv);
  27. findViewById(R.id.btn_logo).setOnClickListener(new View.OnClickListener() {
  28. @Override
  29. public void onClick(View v) {//生成带Logo的二维码图片
  30. String textContent = editText.getText().toString();
  31. if (TextUtils.isEmpty(textContent)) {
  32. Toast.makeText(CreateActviity.this, "您的输入为空!", Toast.LENGTH_SHORT).show();
  33. return;
  34. }
  35. editText.setText("");
  36. mBitmap = CodeUtils.createImage(textContent, 400, 400, BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher));
  37. iv.setImageBitmap(mBitmap);
  38. }
  39. });
  40. findViewById(R.id.btn_no_logo).setOnClickListener(new View.OnClickListener() {
  41. @Override
  42. public void onClick(View v) {//生成不带logo的二维码图片
  43. String textContent = editText.getText().toString();
  44. if (TextUtils.isEmpty(textContent)) {
  45. Toast.makeText(CreateActviity.this, "您的输入为空!", Toast.LENGTH_SHORT).show();
  46. return;
  47. }
  48. editText.setText("");
  49. mBitmap = CodeUtils.createImage(textContent, 400, 400, null);
  50. iv.setImageBitmap(mBitmap);
  51. }
  52. });
  53.  
  54. }
  55. }

activity_create_actviity.xml

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout
  3. android:orientation="vertical"
  4. xmlns:android="http://schemas.android.com/apk/res/android"
  5. xmlns:tools="http://schemas.android.com/tools"
  6. android:id="@+id/activity_create_actviity"
  7. android:layout_width="match_parent"
  8. android:layout_height="match_parent"
  9. tools:context="com.loaderman.zxingdemo.CreateActviity">
  10. <EditText
  11. android:id="@+id/et_text"
  12. android:layout_width="match_parent"
  13. android:text="输入要生成的二维码内容"
  14. android:layout_height="wrap_content"/>
  15. <Button
  16. android:id="@+id/btn_logo"
  17. android:text="生成带Logo的二维码"
  18. android:layout_width="match_parent"
  19. android:layout_height="wrap_content"/>
  20. <Button
  21. android:id="@+id/btn_no_logo"
  22. android:text="生成不带logo的二维码"
  23. android:layout_width="match_parent"
  24. android:layout_height="wrap_content"/>
  25. <ImageView
  26. android:id="@+id/iv"
  27. android:layout_width="wrap_content"
  28. android:layout_height="wrap_content"/>
  29. </LinearLayout>

效果图:

Zxing二维码的集成使用的更多相关文章

  1. 程序猿媛 九:Adroid zxing 二维码3.1集成(源码无删减)

    Adroid zxing 二维码3.1集成 声明:博文为原创,文章内容为,效果展示,思路阐述,及代码片段. 转载请保留原文出处“http://my.oschina.net/gluoyer/blog”, ...

  2. Android项目实战(二十八):Zxing二维码实现及优化

    前言: 多年之前接触过zxing实现二维码,没想到今日项目中再此使用竟然使用的还是zxing,百度之,竟是如此牛的玩意. 当然,项目中我们也许只会用到二维码的扫描和生成两个功能,所以不必下载完整的ja ...

  3. Android之Zxing二维码扫描图片拉伸

    还是这个接手项目,二维码扫描集成的是zxing,扫描界面的图像有明显的拉伸变形. 这种问题,根据以往的经验,一般是x,y轴错位引起的,处理好x,y轴的问题,一般可以解决问题. 由于这个问题,之前有很多 ...

  4. (转载)Android项目实战(二十八):Zxing二维码实现及优化

    Android项目实战(二十八):Zxing二维码实现及优化   前言: 多年之前接触过zxing实现二维码,没想到今日项目中再此使用竟然使用的还是zxing,百度之,竟是如此牛的玩意. 当然,项目中 ...

  5. Atitit zxing二维码qr码识别解析

    Atitit zxing二维码qr码识别解析 1.1. qr码识别解析 by zxing1 1.2. 解码lib:qrcode.jar  2 1.3. atitit.二维码生成总结java zxing ...

  6. 谷歌zxing 二维码生成工具

    一.加入maven依赖 <!-- 谷歌zxing 二维码 --> <dependency> <groupId>com.google.zxing</groupI ...

  7. Android项目实战(四十四):Zxing二维码切换横屏扫描

    原文:Android项目实战(四十四):Zxing二维码切换横屏扫描 Demo链接 默认是竖屏扫描,但是当我们在清单文件中配置横屏显示的时候: <activity android:name=&q ...

  8. android开发之集成zxing,二维码,以及扫描二维码的功能实现。带源代码下载

    package cc.jiusansec.www; import com.google.zxing.WriterException; import com.zxing.activity.Capture ...

  9. zxing 二维码扫描 配置和使用

    本文转载至 http://blog.csdn.net/a6472953/article/details/8796501   二维码扫描使用最多的主要有两个库:zbarSDK 和zxing 关于zbar ...

随机推荐

  1. rabbitmq一键部署脚本

    1.新建一个名字叫 auto_install_rabbitmq.sh  的文件 2.将下面脚本拷贝到文件中,具体操作步骤在注释里面 #环境 linux #一键安装rabitmq,在linux环境中使用 ...

  2. poj 2081 Recaman's Sequence (dp)

    Recaman's Sequence Time Limit: 3000MS   Memory Limit: 60000K Total Submissions: 22566   Accepted: 96 ...

  3. libusb-test

    /******************************************************************************** * * File Name : li ...

  4. 同步windows时间到linux服务器

    输入date -R 查看系统时间 输入命令  ntpdate time.windows.com 同步windows时间到linux

  5. [uboot] (番外篇)uboot relocation介绍(转)

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明.本文链接:https://blog.csdn.net/ooonebook/article/det ...

  6. 程序包管理工具yum

    yum 首先要有一个网络上或本地或远程的yum仓库.然后需要yum安装程序的机器去yum仓库下载yum元数据(包括包信息和依赖信息)到本地的cache里.当需要安装程序的时候,会查看yum源数据里是否 ...

  7. 杀掉nginx进程

    ps aux | grep nginx kill -INT 进程号(例如:2661)

  8. 开始PHP,常量/变量与内存间的关系--传值

    一.常见的PHP代码嵌入式方式,与html结合 要注意:文件名后缀必须形如xxx.php否则html将无法解析 二.php脱离html代码独立工作,没有其他代码 不需要借助Apache工作,只需要ph ...

  9. k8s-wordpress

    将数据库的密码写入wordpress的yaml配置文件不行,额外输入可以初始化数据成功,好奇怪 mysql 配置yamL cat mysql.yml --- apiVersion: apps/v1be ...

  10. the nearest point/vertex point of linestring

    引用https://github.com/Toblerity/Shapely/issues/190 snorfalorpagus commented on 18 Oct 2014 The point ...