1 public static class NetCDF
  2     {
  3         [DllImport("netcdf4.dll")]
  4         public static extern int nc_put_att_uchar(int ncid, int varid, string name, NcType xtype, int len, byte[] op);
  5         [DllImport("netcdf4.dll")]
  6         public static extern int nc_get_att_uchar(int ncid, int varid, string name, byte[] op);
  7 
  8         [DllImport("netcdf4.dll")]
  9         public static extern int nc_get_var_uchar(int ncid, int varid, byte[] ip);
 10         [DllImport("netcdf4.dll")]
 11         public static extern int nc_get_var_text(int ncid, int varid, StringBuilder ip);
 12       
 13 
 14         [DllImport("netcdf4.dll")]
 15         public static extern int nc_open(string path, CreateMode mode, out int ncidp);
 16         [DllImport("netcdf4.dll")]
 17         public static extern int nc_create(string path, CreateMode mode, out int ncidp);
 18         [DllImport("netcdf4.dll")]
 19         public static extern int nc_close(int ncidp);
 20         [DllImport("netcdf4.dll")]
 21         public static extern int nc_sync(int ncid);
 22         [DllImport("netcdf4.dll")]
 23         public static extern int nc_enddef(int ncid);
 24         [DllImport("netcdf4.dll")]
 25         public static extern int nc_redef(int ncid);
 26         [DllImport("netcdf4.dll")]
 27         public static extern string nc_strerror(int ncerror);
 28 
 29         [DllImport("netcdf4.dll")]
 30         public static extern int nc_inq(int ncid, out int ndims, out int nvars, out int ngatts, out int unlimdimid);
 31 
 32         [DllImport("netcdf4.dll")]
 33         public static extern int nc_def_var(int ncid, string name, NcType xtype, int ndims, int[] dimids, out int varidp);
 34         [DllImport("netcdf4.dll")]
 35         public static extern int nc_inq_var(int ncid, int varid, StringBuilder name, out NcType type, out int ndims, int[] dimids, out int natts);
 36         [DllImport("netcdf4.dll")]
 37         public static extern int nc_inq_varids(int ncid, out int nvars, int[] varids);
 38         [DllImport("netcdf4.dll")]
 39         public static extern int nc_inq_vartype(int ncid, int varid, out NcType xtypep);
 40         [DllImport("netcdf4.dll")]
 41         public static extern int nc_inq_varnatts(int ncid, int varid, out int nattsp);
 42         [DllImport("netcdf4.dll")]
 43         public static extern int nc_inq_varid(int ncid, string name, out int varidp);
 44 
 45         [DllImport("netcdf4.dll")]
 46         public static extern int nc_inq_ndims(int ncid, out int ndims);
 47         [DllImport("netcdf4.dll")]
 48         public static extern int nc_inq_nvars(int ncid, out int nvars);
 49         [DllImport("netcdf4.dll")]
 50         public static extern int nc_inq_varname(int ncid, int varid, StringBuilder name);
 51         [DllImport("netcdf4.dll")]
 52         public static extern int nc_inq_varndims(int ncid, int varid, out int ndims);
 53         [DllImport("netcdf4.dll")]
 54         public static extern int nc_inq_vardimid(int ncid, int varid, int[] dimids);
 55         [DllImport("netcdf4.dll")]
 56         public static extern int nc_inq_var_fill(int ncid, int varid, out int no_fill, out object fill_value);
 57 
 58 
 59         [DllImport("netcdf4.dll")]
 60         public static extern int nc_inq_natts(int ncid, out int ngatts);
 61         [DllImport("netcdf4.dll")]
 62         public static extern int nc_inq_unlimdim(int ncid, out int unlimdimid);
 63         [DllImport("netcdf4.dll")]
 64         public static extern int nc_inq_format(int ncid, out int format);
 65 
 66         [DllImport("netcdf4.dll")]
 67         public static extern int nc_inq_attname(int ncid, int varid, int attnum, StringBuilder name);
 68         [DllImport("netcdf4.dll")]
 69         public static extern int nc_inq_att(int ncid, int varid, string name, out NcType type, out int length);
 70         [DllImport("netcdf4.dll")]
 71         public static extern int nc_get_att_text(int ncid, int varid, string name, StringBuilder value);
 72         [DllImport("netcdf4.dll")]
 73         public static extern int nc_get_att_schar(int ncid, int varid, string name, sbyte[] data);
 74         [DllImport("netcdf4.dll")]
 75         public static extern int nc_get_att_short(int ncid, int varid, string name, short[] data);
 76         [DllImport("netcdf4.dll")]
 77         public static extern int nc_get_att_int(int ncid, int varid, string name, int[] data);
 78         [DllImport("netcdf4.dll")]
 79         public static extern int nc_get_att_float(int ncid, int varid, string name, float[] data);
 80         [DllImport("netcdf4.dll")]
 81         public static extern int nc_get_att_double(int ncid, int varid, string name, double[] data);
 82         [DllImport("netcdf4.dll")]
 83         public static extern int nc_get_att_long(int ncid, int varid, string name, long[] data);
 84         [DllImport("netcdf4.dll")]
 85         public static extern int nc_get_att_longlong(int ncid, int varid, string name, long[] data);
 86 
 87         [DllImport("netcdf4.dll")]
 88         public static extern int nc_put_att_text(int ncid, int varid, string name, int len, string tp);
 89         [DllImport("netcdf4.dll")]
 90         public static extern int nc_put_att_double(int ncid, int varid, string name, NcType type, int len, double[] tp);
 91         [DllImport("netcdf4.dll")]
 92         public static extern int nc_put_att_int(int ncid, int varid, string name, NcType type, int len, int[] tp);
 93         [DllImport("netcdf4.dll")]
 94         public static extern int nc_put_att_short(int ncid, int varid, string name, NcType type, int len, short[] tp);
 95         [DllImport("netcdf4.dll")]
 96         public static extern int nc_put_att_float(int ncid, int varid, string name, NcType type, int len, float[] tp);
 97         [DllImport("netcdf4.dll")]
 98         public static extern int nc_put_att_byte(int ncid, int varid, string name, NcType type, int len, sbyte[] tp);
 99         [DllImport("netcdf4.dll")]
         public static extern int nc_put_att_long(int ncid, int varid, string name, NcType type, int len, long[] tp);
         [DllImport("netcdf4.dll")]
         public static extern int nc_put_att_longlong(int ncid, int varid, string name, NcType type, int len, long[] tp);
 
         [DllImport("netcdf4.dll")]
         public static extern int nc_def_dim(int ncid, string name, int len, out int dimidp);
         [DllImport("netcdf4.dll")]
         public static extern int nc_inq_dim(int ncid, int dimid, StringBuilder name, out int length);
         [DllImport("netcdf4.dll")]
         public static extern int nc_inq_dimname(int ncid, int dimid, StringBuilder name);
         [DllImport("netcdf4.dll")]
         public static extern int nc_inq_dimid(int ncid, string name, out int dimid);
         [DllImport("netcdf4.dll")]
         public static extern int nc_inq_dimlen(int ncid, int dimid, out int length);
 
 
         [DllImport("netcdf4.dll")]
         public static extern int nc_get_var_text(int ncid, int varid, byte[] data);
         [DllImport("netcdf4.dll")]
         public static extern int nc_get_var_schar(int ncid, int varid, sbyte[] data);
         [DllImport("netcdf4.dll")]
         public static extern int nc_get_var_short(int ncid, int varid, short[] data);
         [DllImport("netcdf4.dll")]
         public static extern int nc_get_var_int(int ncid, int varid, int[] data);
         [DllImport("netcdf4.dll")]
         public static extern int nc_get_var_long(int ncid, int varid, long[] data);
         [DllImport("netcdf4.dll")]
         public static extern int nc_get_var_float(int ncid, int varid, float[,] data);
         [DllImport("netcdf4.dll")]
         public static extern int nc_get_var_double(int ncid, int varid, double[] data);
 
         [DllImport("netcdf4.dll")]
         public static extern int nc_put_var_ubyte(int ncid, int varid, byte[,] data);
         [DllImport("netcdf4.dll")]
         public static extern int nc_put_var_int(int ncid, int varid, int[,] data);
         [DllImport("netcdf4.dll")]
         public static extern int nc_put_var_text(int ncid, int varid, string op);
         [DllImport("netcdf4.dll")]
         public static extern int nc_put_var_uchar(int ncid, int varid, out byte[] op);
         [DllImport("netcdf4.dll")]
         public static extern int nc_put_var_float(int ncid, int varid, float[,] data);
         [DllImport("netcdf4.dll")]
         public static extern int nc_put_var_long(int ncid, int varid, long[] data);
 
 
         [DllImport("netcdf4.dll")]
         public static extern int nc_put_vara_double(int ncid, int varid, int[] start, int[] count, double[] dp);
         [DllImport("netcdf4.dll")]
         public static extern int nc_put_vara_float(int ncid, int varid, int[] start, int[] count, float[] fp);
         [DllImport("netcdf4.dll")]
         public static extern int nc_put_vara_short(int ncid, int varid, int[] start, int[] count, short[] sp);
         [DllImport("netcdf4.dll")]
         public static extern int nc_put_vara_int(int ncid, int varid, int[] start, int[] count, int[] ip);
         [DllImport("netcdf4.dll")]
         public static extern int nc_put_vara_long(int ncid, int varid, int[] start, int[] count, long[] lp);
         [DllImport("netcdf4.dll")]
         public static extern int nc_put_vara_ubyte(int ncid, int varid, int[] start, int[] count, byte[] bp);
         [DllImport("netcdf4.dll")]
         public static extern int nc_put_vara_schar(int ncid, int varid, int[] start, int[] count, sbyte[] cp);
         [DllImport("netcdf4.dll")]
         public static extern int nc_put_vara_string(int ncid, int varid, int[] start, int[] count, string[] sp);
 
 
         [DllImport("netcdf4.dll")]
         public static extern int nc_get_vara_text(int ncid, int varid, int[] start, int[] count, byte[] data);
         [DllImport("netcdf4.dll")]
         public static extern int nc_get_vara_schar(int ncid, int varid, int[] start, int[] count, sbyte[] data);
         [DllImport("netcdf4.dll")]
         public static extern int nc_get_vara_short(int ncid, int varid, int[] start, int[] count, short[] data);
         [DllImport("netcdf4.dll")]
         public static extern int nc_get_vara_ubyte(int ncid, int varid, int[] start, int[] count, byte[] data);
         [DllImport("netcdf4.dll")]
         public static extern int nc_get_vara_long(int ncid, int varid, int[] start, int[] count, long[] data);
         [DllImport("netcdf4.dll")]
         public static extern int nc_get_vara_int(int ncid, int varid, int[] start, int[] count, int[] data);
         [DllImport("netcdf4.dll")]
         public static extern int nc_get_vara_float(int ncid, int varid, int[] start, int[] count, float[] data);
         [DllImport("netcdf4.dll")]
         public static extern int nc_get_vara_double(int ncid, int varid, int[] start, int[] count, double[] data);
         [DllImport("netcdf4.dll")]
         public static extern int nc_get_vara_string(int ncid, int varid, int[] start, int[] count, string[] data);
    
         ///<summary>
         ///'size' argument to ncdimdef for an unlimited dimension
         ///</summary>
         public const int NC_UNLIMITED = ;
 
         ///<summary>
         ///attribute id to put/get a global attribute
         ///</summary>
         public const int NC_GLOBAL = -;
 
         ///<summary>
         ///The netcdf external data types
         ///</summary>
         public enum NcType : int
         {
             ///<summary>signed 1 byte intege</summary>
             NC_BYTE = ,
             ///<summary>ISO/ASCII character</summary>
             NC_CHAR = ,
             ///<summary>signed 2 byte integer</summary>
             NC_SHORT = ,
             ///<summary>signed 4 byte integer</summary>
             NC_INT = ,
             ///<summary>single precision floating point number</summary>
             NC_FLOAT = ,
             ///<summary>double precision floating point number</summary>
             NC_DOUBLE = ,
             ///<summary>signed 8-byte int</summary>
             NC_INT64 = ,
             ///<summary>string</summary>
             NC_STRING = 
         }
 
         public static Type GetCLRType(NcType ncType)
         {
             switch (ncType)
             {
                 case NcType.NC_BYTE:
                 return typeof(byte);
                 case NcType.NC_CHAR:
                 return typeof(sbyte);
                 case NcType.NC_SHORT:
                 return typeof(short);
                 case NcType.NC_INT:
                 return typeof(int);
                 case NcType.NC_INT64:
                 return typeof(long);
                 case NcType.NC_FLOAT:
                 return typeof(float);
                 case NcType.NC_DOUBLE:
                 return typeof(double);
                 case NcType.NC_STRING:
                 return typeof(string);
                 default:
                 throw new ApplicationException("Unknown nc type");
             }
         }
 
         public static NcType GetNcType(Type type)
         {
             switch (Type.GetTypeCode(type))
             {
                 case TypeCode.Double:
                 return NcType.NC_DOUBLE;
 
                 case TypeCode.Single:
                 return NcType.NC_FLOAT;
 
                 case TypeCode.Int64:
                 return NcType.NC_INT64;
 
                 case TypeCode.Int32:
                 return NcType.NC_INT;
 
                 case TypeCode.Int16:
                 return NcType.NC_SHORT;
 
                 case TypeCode.Byte:
                 return NcType.NC_BYTE;
 
                 case TypeCode.SByte:
                 return NcType.NC_CHAR;
 
                 case TypeCode.String:
                 return NcType.NC_STRING;
 
                 case TypeCode.DateTime:
                 return NcType.NC_INT64;
 
 
                 default:
                 throw new NotSupportedException("Not supported type of data.");
             }
         }
 
         public enum CreateMode : int
         {
             NC_NOWRITE = ,
             ///<summary>read & write</summary>
             NC_WRITE = 0x0001,
             NC_CLOBBER = ,
             ///<summary>Don't destroy existing file on create</summary>
             NC_NOCLOBBER = 0x0004,
             ///<summary>argument to ncsetfill to clear NC_NOFILL</summary>
             NC_FILL = ,
             ///<summary>Don't fill data section an records</summary>
             NC_NOFILL = 0x0100,
             ///<summary>Use locking if available</summary>
             NC_LOCK = 0x0400,
             ///<summary>Share updates, limit cacheing</summary>
             NC_SHARE = 0x0800,
             NC_64BIT_OFFSET = 0x0200,
             ///<summary>Enforce strict netcdf-3 rules</summary>
             NC_CLASSIC = 0x0100,
             ///<summary>causes netCDF to create a HDF5/NetCDF-4 file</summary>
             NC_NETCDF4 = 0x1000
         }
 
         public enum ResultCode : int
         {
             ///<summary>No Error</summary>
             NC_NOERR = ,
             ///<summary>Invalid dimension id or name</summary>
             NC_EBADDIM = -,
             ///<summary>Attribute not found</summary>
             NC_ENOTATT = -,
         }
 
         ///<summary>
         ///    Default fill values, used unless _FillValue attribute is set.
         ///These values are stuffed into newly allocated space as appropriate.
         ///The hope is that one might use these to notice that a particular datum
         ///has not been set.
         ///</summary>
         public static class FillValues
         {
             public const byte NC_FILL_BYTE = ;
             public const char NC_FILL_CHAR = (char);
             public const short NC_FILL_SHORT = -;
             public const int NC_FILL_INT = -;
             public const float NC_FILL_FLOAT = 9.96921E+36f;    /* near 15 * 2^119 */
             public const double NC_FILL_DOUBLE = 9.969209968386869E+36;
         }
 
 
         ///<summary>These maximums are enforced by the interface, to facilitate writing
         ///applications and utilities.  However, nothing is statically allocated to
         ///these sizes internally.</summary>
         public enum Limits
         {
             ///<summary>max dimensions per file </summary>
             NC_MAX_DIMS = ,
             ///<summary>max global or per variable attributes </summary>
             NC_MAX_ATTRS = ,
             ///<summary>max variables per file</summary>
             NC_MAX_VARS = ,
             ///<summary>max length of a name </summary>
             NC_MAX_NAME = ,
             ///<summary>max per variable dimensions </summary>
             NC_MAX_VAR_DIMS = 
         }
     }
 /// <summary>
/// 二维网格数据文件创建、读、写
/// </summary>
class TwoDimDB : IDataBase
{
public TwoDimDB(string filename)
{
dbfile = filename;
} public override bool Create(string[] varname, string xdimname, string ydimname, long[] xdim, long[] ydim)
{
try
{
int ndims = ;
int ncid, res, varid;
int x_dimid, y_dimid;
int[] dimids = new int[ndims]; //创建文件
res = NetCDF.nc_create(dbfile, NetCDF.CreateMode.NC_NETCDF4, out ncid);
if (res != ) return false; int NX = xdim.Length;
int NY = ydim.Length;
int[,] datas = new int[NX, NY]; //定义维度
res = NetCDF.nc_def_dim(ncid, xdimname, NX, out x_dimid);
if (res != ) return false;
res = NetCDF.nc_def_dim(ncid, ydimname, NY, out y_dimid);
if (res != ) return false; res = NetCDF.nc_put_att_longlong(ncid, NetCDF.NC_GLOBAL, xdimname, NetCDF.NcType.NC_INT64, xdim.Length, xdim);
if (res != ) return false;
res = NetCDF.nc_put_att_longlong(ncid, NetCDF.NC_GLOBAL, ydimname, NetCDF.NcType.NC_INT64, ydim.Length, ydim);
if (res != ) return false; dimids[] = x_dimid;
dimids[] = y_dimid; //定义变量
if (varname != null)
{
foreach (var vn in varname)
{
res = NetCDF.nc_def_var(ncid, vn, NetCDF.NcType.NC_FLOAT, , dimids, out varid);
if (res != ) continue; res = NetCDF.nc_enddef(ncid);
if (res != ) continue; NetCDF.nc_put_var_int(ncid, varid, datas);
if (res != ) continue;
}
} //关闭文件
res = NetCDF.nc_close(ncid);
if (res == ) return true;
}
catch (Exception ex)
{ }
return false;
} public override bool Write(string[] varName, string dimName, long dimValue, int[][] value, bool isXdim = false)
{
try
{
int ncid, res, varid; //创建文件
res = NetCDF.nc_open(dbfile, NetCDF.CreateMode.NC_WRITE, out ncid);
if (res != ) return false; #region GetDimIndex int dimIdx = ;
NetCDF.NcType dimXTtype;
int dimAttLen = ; res = NetCDF.nc_inq_att(ncid, NetCDF.NC_GLOBAL, dimName, out dimXTtype, out dimAttLen);
if (res != ) return false;
long[] xdimValue = new long[dimAttLen];
res = NetCDF.nc_get_att_longlong(ncid, NetCDF.NC_GLOBAL, dimName, xdimValue);
dimIdx = Array.IndexOf(xdimValue, dimValue);
if (dimIdx == -) dimIdx = ; #endregion int xdimBeginIndex = isXdim ? dimIdx : ;
int ydimBeginIndex = !isXdim ? dimIdx : ; int xdimNumber = !isXdim ? value.Length : ;
int ydimNumber = isXdim ? value.Length : ; //定义变量
if (varName != null)
{
for (int i = ; i < varName.Length; i++)
{
res = NetCDF.nc_inq_varid(ncid, varName[i], out varid);
if (res != ) continue; var origin = new int[] { xdimBeginIndex, ydimBeginIndex };//第一维的1开始,第二维从0开始
var size = new int[] { xdimNumber, ydimNumber };//数量分别为1,2 NetCDF.nc_put_vara_int(ncid, varid, origin, size, value[i]);
if (res != ) return false;
}
} //关闭文件
res = NetCDF.nc_close(ncid);
if (res == ) return true;
}
catch (Exception ex)
{ }
return false;
} public override int[][] Read(string[] varname, string xdimname, string ydimname, long? xdimValue = null, long? ydimValue = null)
{
long[] xDimValue;
long[] yDimValue;
Dictionary<long, int[][]> dic = new Dictionary<long, int[][]>();
try
{
int ndims = ;
int ncid, res, varid;
int[] dimids = new int[ndims]; //打开文件
res = NetCDF.nc_open(dbfile, NetCDF.CreateMode.NC_NOWRITE, out ncid);
if (res != ) return null; #region XDimIndex int xDimIdx = ;
NetCDF.NcType xDimxtype;
int xDimAttlen = ; res = NetCDF.nc_inq_att(ncid, NetCDF.NC_GLOBAL, xdimname, out xDimxtype, out xDimAttlen);
if (res != ) return null;
xDimValue = new long[xDimAttlen]; res = NetCDF.nc_get_att_longlong(ncid, NetCDF.NC_GLOBAL, xdimname, xDimValue);
if (xdimValue != null)
{
xDimIdx = Array.IndexOf(xDimValue, xdimValue);
if (xDimIdx == -) xDimIdx = ;
}
#endregion #region YDimIndex int yDimIdx = ;
NetCDF.NcType yDimxtype;
int yDimAttlen = ; res = NetCDF.nc_inq_att(ncid, NetCDF.NC_GLOBAL, ydimname, out yDimxtype, out yDimAttlen);
if (res != ) return null;
yDimValue = new long[yDimAttlen];
res = NetCDF.nc_get_att_longlong(ncid, NetCDF.NC_GLOBAL, ydimname, yDimValue);
if (ydimValue != null)
{
yDimIdx = Array.IndexOf(yDimValue, ydimValue);
if (yDimIdx == -) yDimIdx = ;
} #endregion int NX = xDimValue.Length;
int NY = yDimValue.Length; int xdimCount = NX - xDimIdx;
int ydimCount = NY - yDimIdx;
int resCount = xdimCount * ydimCount;
if (xdimValue == null)
{
resCount = xdimCount;
xdimCount = NX;
ydimCount = ;
}
if (ydimValue == null)
{
resCount = ydimCount;
xdimCount = ;
ydimCount = NY - yDimIdx;
} int[] origin = new int[] { xDimIdx, yDimIdx };//第一维的1开始,第二维从0开始
int[] size = new int[] { xdimCount, ydimCount };//数量分别为1,2 int[][] result = new int[varname.Length + ][]; for (int i = ; i < varname.Length; i++)
{
res = NetCDF.nc_inq_varid(ncid, varname[i], out varid);
if (res != ) continue; result[i+] = new int[resCount];
NetCDF.nc_get_vara_int(ncid, varid, origin, size, result[i + ]);
if (res != ) continue;
} res = NetCDF.nc_close(ncid);
if (res == ) return result;
}
catch (Exception ex)
{ }
finally
{
xDimValue = null;
yDimValue = null;
GC.Collect();
}
return null;
}
}

c#中使用NetCDF存储二维数据的读写操作简单应用的更多相关文章

  1. TensorflowTutorial_二维数据构造简单CNN

    使用二维数据构造简单卷积神经网络 觉得有用的话,欢迎一起讨论相互学习~Follow Me 图像和一些时序数据集都可以用二维数据的形式表现,我们此次使用随机分布的二位数据构造一个简单的CNN-网络卷积- ...

  2. PHP二维数据排序,二维数据模糊查询

    一.因为项目中的一个报表需要合并三个表的数据,所以分表查询再合并数据,利用PHP数组函数进行排序,搜索.三表合并后的数组结构如下: Array ( [0] => Array ( [history ...

  3. 妙用Excel数据透视表和透视图向导,将二维数据转换为一维数据

    项目中,每年都会有各种经销商的各种产品目标数据导入,经销商和产品过多,手工操作过于单调和复杂.那有没有一种方式可以将复杂的二维数据转换为一维数据呢? 有,强大的Excel就支持此功能. 常用Excel ...

  4. PCA 实例演示二维数据降成1维

    import numpy as np # 将二维数据降成1维 num = [(2.5, 2.4), (0.5, 0.7), (2.2, 2.9), (1.9, 2.2), (3.1, 3.0), (2 ...

  5. 【Excle数据透视】二维数据如何创建数据透视表

    二维数据在创建数据透视表的时候,可能会给你带来一些麻烦,没法创建,会丢失维度,那怎么办呢? 解决办法:使用数据透视表和数据透视图向导即可创建 具体操作如下: 按下[Alt+D+P],出现如下界面 选择 ...

  6. MVC5中使用jQuery Post 二维数组和一维数组到Action

    很久没有写了,最近在做一个MVC项目,这是我做的第一个MVC项目.之前可以说多MVC一点都不了解,今天把昨天遇到的一个问题记录下来.MVC大神就请飘过吧,跟我遇到同样问题的可以进来看看.遇到的第一个问 ...

  7. python练习 - 系统基本信息获取(sys标准库)+ 二维数据表格输出(tabulate库)

    系统基本信息获取 描述 获取系统的递归深度.当前执行文件路径.系统最大UNICODE编码值等3个信息,并打印输出.‪‬‪‬‪‬‪‬‪‬‮‬‫‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‭‬‪‬‪‬‪‬‪‬‪‬‪‬‮ ...

  8. JAVA中生成、解析二维码图片的方法

    JAVA中生成.解析二维码的方法并不复杂,使用google的zxing包就可以实现.下面的方法包含了生成二维码.在中间附加logo.添加文字功能,并有解析二维码的方法. 一.下载zxing的架包,并导 ...

  9. 在iOS中使用ZBar扫描二维码

    最近在做的项目中需要用到二维码扫描功能,之前在Android中使用过ZXing识别二维码,ZXing也有对应的iOS版本,经过了解,ZBar也是一个常用的二维码识别软件,并分别提供了iOS和Andro ...

随机推荐

  1. python如何连接mysql数据库

    先花点时间来说说一个程序怎么和数据库进行交互1.和数据库建立连接2.执行sql语句,接收返回值3.关闭数据库连接使用MySQLdb也要遵循上面的几步.让我们一步步的进行. 1.MySQL数据库要用My ...

  2. constructors and destructors

    A constructor is a method that gets called immediately when an object is allocated (on the stack or ...

  3. layout折叠后显示标题

    Easyui的layout折叠后显示怎样可以显示标题 //在layout的panle全局配置中,增加一个onCollapse处理title$.extend($.fn.layout.paneldefau ...

  4. Package java.sql

    Provides the API for accessing and processing data stored in a data source (usually a relational dat ...

  5. 使用Salt-ssh部署Salt-minion之源码安装(二)

    二.源码安装篇 使用salt-ssh功能要求客户端系统python版本2.6+ 1.salt-minion端环境: 系统:SUSE SP3 64bit python版本:2.6.6 RPM包:pcre ...

  6. Theano mnist数据集格式

    首先链接一篇大牛的Theano文档翻译:http://www.cnblogs.com/xueliangliu/archive/2013/04/03/2997437.html 里面有mnist.pkl. ...

  7. ios --跳转到支付宝

    //跳转到支付宝 - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request nav ...

  8. 非常实用的JavaScript小技巧

    使用!!操作符转换布尔值 有时候我们需要对一个变量查检其是否存在或者检查值是否有一个有效值,如果存在就返回true值.为了做这样的验证,我们可以使用!!操作符来实现是非常的方便与简单.对于变量可以使用 ...

  9. 使用神器MobaXterm连接远程mysql和redis

    https://mobaxterm.mobatek.net/download-home-edition.html mysql redis 连接测试 mysql 127.0.0.1 3307 密码使用线 ...

  10. TP表单验证

    [表单验证] javascript jquery 在服务器端通过tp框架实现表单验证 用户名.密码.重复密码.邮箱.qq.手机号码.爱好.学历 具体步骤: 制作表单 表单form数据通过create( ...