读属性文件,操作数据库

使用 SQLite 数据库实现简单的数据管理系统 本项目的目的是利用 SQLite 数据库构建一个简单的数据管理系统。SQLite 是一种轻量级的嵌入式数据库,无需单独的服务器进程,非常适合小型应用程序。本数据管理系统将涵盖基本的数据操作,如数据的插入、查询、更新和删除,适用于需要对少量数据进行简单管理的场景,例如个人信息管理、小型业务数据记录等。本文将首先介绍 SQLite 的核心概念和相关联系,包括其架构和工作原理。接着详细讲解使用 Python 操作 SQLite 数据库的核心算法原理和具体步骤。 阅读详情

读属性文件,操作数据库

/*
 * 创建日期 2005-1-13
 *
 * TODO 要更改此生成的文件的模板,请转至
 * 窗口 - 首选项 - Java - 代码样式 - 代码模板
 */
package com.wen.db;

import java.sql.*;
import com.wen.work.ConfigResource;

/**
 * @author explorerwen
 *
 * TODO 要更改此生成的类型注释的模板,请转至 窗口 - 首选项 - Java - 代码样式 - 代码模板
 */
public final class DbConnection {
 private static DbConnection DBconn = null;
 private Statement stmt;
 private ResultSet rset;
 private Connection conn;
 private DbConnection() {
  stmt = null;
  rset = null;
  conn = null;
 }

 public synchronized static DbConnection getDbConnection() {
  if (DBconn == null)
   DBconn = new DbConnection();
  return DBconn;
 }

 /**
  * 返回数据库的连接
  *
  * @param realPath
  *            配置文件的绝对路径
  * @return
  * @throws Exception
  */
 public Connection getConnection(String realPath) throws Exception {
  try {
   ConfigResource.getConfigResource().setRealPath(realPath);
   Class.forName("com.mysql.jdbc.Driver").newInstance();
   conn = DriverManager.getConnection(ConfigResource
     .getConfigResource().getProperty("DB.Url"), ConfigResource
     .getConfigResource().getProperty("DB.User"), ConfigResource
     .getConfigResource().getProperty("DB.Pass"));
   conn.setAutoCommit(false);
   return conn;
  } catch (SQLException ex) {
   ex.printStackTrace();
   return conn = null;
  } catch (Exception ex) {
   ex.printStackTrace();
   return conn = null;
  }

 }

 /**
  * 提交conn
  *
  * @throws SQLException
  */
 public void commit() throws SQLException {
  conn.commit();
 }

 /**
  * 回滚conn
  *
  * @throws SQLException
  */
 public void rollback() throws SQLException {
  conn.rollback();
 }

 /**
  * 查询,返回ResultSet
  *
  * @param query
  * @return
  * @throws SQLException
  */
 public ResultSet executeQuery(String query) throws SQLException {
  try {
   stmt = conn.createStatement();
   rset = stmt.executeQuery(query);
  } catch (SQLException e) {
   System.out.println(query);
   throw new SQLException(e.toString());
  }
  return rset;
 }

 /**
  * 更新,返回更新的记录数
  *
  * @param query
  * @return
  * @throws SQLException
  */
 public int executeUpdate(String query) throws SQLException {
  stmt = conn.createStatement();
  int count = stmt.executeUpdate(query);
  if (stmt != null)
   stmt.close();
  return count;
 }
 /**
  * 返回记录集的列数
  * @return
  * @throws SQLException
  */
 public int getColumnCount() throws SQLException {
  ResultSetMetaData rsmd = rset.getMetaData();
  return rsmd.getColumnCount();
 }
 /**
  * 根据索引返回列名
  * @param index
  * @return
  * @throws SQLException
  */
 public String getColumnName(int index) throws SQLException {
  ResultSetMetaData rsmd = rset.getMetaData();
  return rsmd.getColumnName(index);
 }
 /**
  * 根据索引返回列值
  * @param index
  * @return
  * @throws SQLException
  */
 public String getData(int index) throws SQLException {
  return rset.getString(index).trim();
 }
 /**
  * 根据列名返回列值
  * @param columnName
  * @return
  * @throws SQLException
  */
 public String getData(String columnName) throws SQLException {
  return rset.getString(columnName).trim();
 }
 /**
  * 查找记录集的下一行
  * @return
  * @throws SQLException
  */
 public boolean next() throws SQLException {
  return rset.next();
 }
 /**
  * 关闭记录集
  * @throws SQLException
  */
 public void rsclose() throws SQLException {
  if (stmt != null)
   stmt.close();
  if (rset != null)
   rset.close();
 }
 /**
  * 关闭记录集和连接
  * @throws SQLException
  */
 public void close() throws SQLException {

  if (stmt != null)
   stmt.close();
  if (rset != null)
   rset.close();
  if (conn != null)
   conn.close();
 }
 /**
  * 关闭记录集和连接
  */
 protected void finalize() throws Throwable {
  close();
 }

}

================================================================
/*
 * 创建日期 2005-1-15
 *
 * TODO 要更改此生成的文件的模板,请转至
 * 窗口 - 首选项 - Java - 代码样式 - 代码模板
 */
package com.wen.db;

import java.util.*;
import java.sql.*;
/**
 * @author explorerwen
 *
 * TODO 要更改此生成的类型注释的模板,请转至
 * 窗口 - 首选项 - Java - 代码样式 - 代码模板
 */
public class DbOpr {
 private static DbOpr dbOpr = null;
 private DbOpr(){
  
 }
 public static DbOpr getDbOpr(){
  if(dbOpr == null)
   dbOpr = new DbOpr();
  return dbOpr;
 }
 /**
  * 执行查询将结果集转化为HashMap返回
  * @param sqlStr 查询语句
  * @param realPath 配置文件绝对路径
  * @return HashMap
  * @throws Exception
  */
 public HashMap runQueryHm(String sqlStr,String realPath)throws Exception{
  DbConnection DbConn = DbConnection.getDbConnection();
  DbConn.getConnection(realPath);
  int colCount = 0;
  HashMap hm = new HashMap();
  try{
   if(DbConn.executeQuery(sqlStr) != null && DbConn.next()){
    colCount = DbConn.getColumnCount();
    for(int i=1;i<=colCount;i++){
     hm.put(DbConn.getColumnName(i),DbConn.getData(i));
    }
   }
   DbConn.close();
   return hm;
  }catch(SQLException ex){
   ex.printStackTrace();
   DbConn.close();
   return hm = null;   
  }catch(Exception ex){
   ex.printStackTrace();
   DbConn.close();
   return hm = null;
  }
 }
 /**
  * 执行查询,将记录集转化为Vector返回
  * @param sqlStr 查询语句
  * @param realPath 配置文件绝对路径
  * @return Vector
  * @throws Exception
  */
 public Vector runQueryVc(String sqlStr,String realPath)throws Exception{
  DbConnection DbConn = DbConnection.getDbConnection();
  DbConn.getConnection(realPath);
  int colCount = 0;
  Vector vc = new Vector();
  HashMap hm = new HashMap();
  try{
   if(DbConn.executeQuery(sqlStr)!=null){
    colCount = DbConn.getColumnCount();
    while(DbConn.next()){
     for(int i=1;i<colCount;i++){
      hm.put(DbConn.getColumnName(i),DbConn.getData(i));
     }
     vc.add(hm);
    }
   }
   DbConn.close();
   return vc;
  }catch(SQLException ex){
   ex.printStackTrace();
   DbConn.close();
   return vc = null;
  }catch(Exception ex){
   ex.printStackTrace();
   DbConn.close();
   return vc = null;
  } 
 }
 /**
  * 更新或者删除成功返回true,否则返回false
  * @param sqlStr 更新或者删除语句
  * @param realPath 配置文件绝对路径
  * @return boolean
  * @throws Exception
  */
 public boolean runUpdate(String sqlStr,String realPath)throws Exception{
  DbConnection DbConn = DbConnection.getDbConnection();
  DbConn.getConnection(realPath);
  boolean flag = false;
  try{
   if(DbConn.executeUpdate(sqlStr)>0){
    DbConn.commit();
    flag = true;
   }else{
    DbConn.rollback();
    flag = false;
   } 
   DbConn.close();
   return flag;
  }catch(SQLException ex){
   ex.printStackTrace();
   DbConn.rollback();
   DbConn.close();
   return false;
  }catch(Exception ex){
   ex.printStackTrace();
   DbConn.rollback();
   DbConn.close();
   return false;   
  }
 }

}
===============================================================================
/*
 * 创建日期 2005-1-13
 *
 * TODO 要更改此生成的文件的模板,请转至
 * 窗口 - 首选项 - Java - 代码样式 - 代码模板
 */
package com.wen.work;

import java.util.Properties;
import java.io.InputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
/**
 * @author Administrator
 *
 * TODO 要更改此生成的类型注释的模板,请转至
 * 窗口 - 首选项 - Java - 代码样式 - 代码模板
 */
public final class ConfigResource {
 /**
  * 构造函数
  */
 private static ConfigResource config = null;
 private String realPath = null;
 private ConfigResource() {
 }
 /**
  * 返回实例
  * @return
  */
 public synchronized static ConfigResource getConfigResource(){
  if(config == null)
   config = new ConfigResource();
  return config;
 }
 /**
  * 设置绝对路径
  * @param realPath
  */
 public void setRealPath(String realPath){
  this.realPath = realPath;
 }
 /**
  * 返回数据库配置文件的属性值
  * @param key 配置文件键值
  * @return
  * @throws Exception
  */
 public String getProperty(String key)throws Exception{
  if(realPath == null || realPath.equals(""))
   throw new Exception("请先设置realPath属性");
  String path = realPath+"/WEB-INF/classes/com/wen/work/DBConfig.properties";
  try{
   InputStream in = new FileInputStream(path);
   Properties pop = new Properties();
   pop.load(in);
   return pop.getProperty(key);
  }catch(FileNotFoundException ex){
   ex.printStackTrace();
   return "文件没有发现异常!";
  }catch(Exception ex){
   ex.printStackTrace();
   return "读配置文件异常!";
  }  
 }
 public static void main(String []arg)throws Exception{
  System.out.println("3333");
 }

}
===========================================================================================
属性文件DBConfig.properties格式:
#=========================================================
#  DB Config properties
#    explorerwen 2005-1-13
#---------------------------------------------------------
# 说明:
# DB.Name 数据库名
# DB.User 用户名
# DB.Pass 用户密码
#=========================================================

DB.Name=
DB.User=
DB.Pass=

【知识图谱】Neo4j基本操作及数据库文件导入(graph.db.dump) 初探Neo4j导入数据备份数据客户端操作导入csv文件指定csv文件格式使用命令行导入csv文件附录 请读者参考上篇博文 Neo4j安装教程 导入数据 若开启服务,先在终端停止 Neo4j 服务 ./neo4j stop 接下来,下载射雕三部曲的数据库文件 wget https://labfile.oss.aliyuncs.com/courses/1354/graph.db.dump 下载完将出现 graph.db.dump 文件: 将数据库文件导入到 Neo4j 中 首先进入neo4j 根目录下: 阅读详情

相关推荐

Unity VR 零基础开发之 Pico4 MR

2、弹出弹窗后,点击Android选项,然后再点击Switch Platform按钮切换成安卓平台。3、切换完成后Android选项后面会显示unity图标。

十画的博客 5110

读取属性配置文件

一. Properties读取配置文件 1、从目标路径test.properites中获取输入流对象 2、使用Properties类的load()方法从字节输入流中获取数据 3、直接打印Properties对象 4、使用Properties类的getProperty(String key)方法,根据参数key获取value public void readProperties(Stri...

小白的博客 341

手把手教你用SNAP做全极化SAR图像分类

引言 最近在研究极化SAR图像分类方面的内容,发现用SNAP软件可以很方便的实现图像的分类。因为在入门过程中踩了很多坑,浪费了一些时间,为了不让大家踩坑,所以决定写下这篇教程。 前期准备 软件下载 SNAP是欧空局旗下的一个SAR图像处理软件,可以点击下载地址进行下载。 数据下载 数据下载地址:https://mdacorporation.com/sample_data/RS2_OK76385_...

zz651044657的博客 1万+

比较简单的 读属性文件中的内容

比较简单的 读属性文件中的内容

一个不合格的小码农 790

開機自動進入UEFI Interactive Shell無法正常開機怎麼辦?

BIOS/UEFI,啟動後進入UEFI Interactive Shell大多數人都告訴你沒有安裝系統去裝系統吧,但你明明昨天還在運行系統?今天就這樣?有沒有解決辦法?

sheaahhoi1的博客 7745

国内网络环境下Calico v3.26.4安装避坑指南(附华为云镜像加速脚本)

本文为国内开发者提供Calico v3.26.4的高效部署指南,重点介绍如何通过华为云镜像加速服务解决Kubernetes集群网络插件镜像拉取问题。文章包含详细的镜像加速脚本、部署清单修改方法及深度排错技巧,帮助开发者快速完成Calico网络插件的安装与配置。

brown的博客 289

读取属性配置文件的方法

1.Properties与ResourceBundle两个类都可以读取属性文件中以key/value形式存储的键值对,ResourceBundle读取属性文件时操作相对简单。2. Java中有个比较重要的类Properties(Java.util.Properties),主要用于读取Java的配置文件,各种语言都有自己所支持的配置文件,配置文件中很多变量是经常改变的,这样做也是为了方便用户,让用户...

chenxue843400447的博客 928

Node-RED教程(二):Node-RED的面板的操作

Node-RED系列(二):Node-RED的面板的操作 要使用Node-RED去搭建一个物联网平台,链接设备,设备通信,就必须要先熟悉Node-RED的这种面板,对于一个新的项目,在动手做之前一点想对这个的技术的文档有足够的了解做起来才能游刃有余。本期我给大家介绍一下Node-RED的各种面板,熟悉这些面板后,在后续的搭建Iot服务中,会举重若轻,同时该系列的文档,难度会逐步加深,知道了本章解释的名称后对后续文章的理解有很大帮助。 面板1:默认节点选项列表 安装Node-RED后默认的节点分为这5大类

知无涯 1万+

Spring读取属性文件

一、背景  最近,在项目开发的过程中,遇到需要在properties文件中定义一些自定义的变量,以供java程序动态的读取,修改变量,不再需要修改代码的问题。就借此机会把Spring+SpringMVC+Mybatis整合开发的项目中通过java程序读取properties文件内容的方式进行了梳理和分析,先和大家共享。二、项目环境介绍    Spring 4.2.6.RELEASE    Spri...

Oukoumin的博客 605

【机器视觉】基于深度学习的托盘PCB识别与计数(有无、正反)

工业机器视觉是指在制造业和工业环境中使用计算机视觉技术来执行检测、测量、识别和控制任务。它结合了硬件(如相机、镜头、光源)与软件(图像处理算法)来自动完成传统上需要人工视觉的任务,从而提高生产效率、产品质量以及工作安全性。工业机器视觉系统通常具有高精度、高速度和高可靠性,能够适应恶劣的工作环境。

专注上位机开发、机器视觉、机器学习、嵌入式软硬件开发 1万+

基于Simulink进行步进电机的重复控制仿真建模

目的:通过引入一个周期延迟环节来补偿系统的周期性误差,从而提高系统对周期性参考信号或扰动的跟踪性能。方法内部模型原理:在控制器中嵌入一个与周期性信号相关的模型(例如周期延迟环节),以实现对周期性误差的零稳态误差控制。滤波器设计:为了避免高频噪声放大,通常会在重复控制器中加入低通滤波器。优势对周期性信号具有良好的跟踪性能。不需要精确的数学模型即可实现高性能控制。挑战:需要合理设计重复控制器的参数以避免系统不稳定。

MHD0815的博客 382

读取属性文件

[size=large]private static void readProperties() throws IOException { Properties props = new Properties(); InputStream inStream = Spike.class.getResourceAsStream("Test.properti...

liuxingyu3000的专栏 229

大数据利器Hadoop:从基础到实战,一篇文章掌握大数据处理精髓!

在当今大数据时代,数据量的爆炸式增长对企业和技术提出了前所未有的挑战。如何高效地存储、处理和分析这些庞大的数据集,成为了亟待解决的问题。Hadoop作为一种分布式计算框架,应运而生,为大数据处理提供了有效的解决方案。Hadoop是一个由Apache软件基金会维护的开源项目,它基于Google的分布式文件系统(Google File System,GFS)和MapReduce计算模型设计。Hadoop的主要目标是处理大规模数据集,它可以在普通硬件集群上运行,从而降低了大数据处理的成本。

邓邓子的博客 8282

日志型的 数据 mysql_一种日志型数据库的实现

在《LSM存储组织结构介绍》一文中,我们了解了LSM存储结构,同时提到针对不同的业务场景,可能需要选择不同的数据库实现。假如需要存储语音、视频或图片,你会选择怎样的实现方式?不需要对类数据进行修改,也不需要排序与范围查找,下面我们来看一种日志型数据库实现方式,因其用于存储语音、图片,我们称其为media数据库。存储格式media数据库以数字命名数据文件,每个数据文件大小上限为FileSize左右,...

weixin_36042436的博客 864

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

数据库隔离性分析之为什么会产生脏读?

数据库的物理存储会分成许多个页(Page),记录都存储在页中,数据每一次IO,操作的最小单位是一个页。数据库运行时,会在内存中维护一个缓冲区(Buffer Pool)。缓冲区缓存部分的页(因为内存有限,所有不能把所有数据都缓存进来)。每次对数据的操作,都需要把磁盘中的页读入缓冲区,然后再进行操作;如果缓冲区中有对应的页,就不需要读磁盘。

weixin_44939424的博客 1373

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

iOS 开发中的那些坑(1)

今天在用fmdb对数据库进行操作的时候 一直无法在表中插入数据 最后才发现 NSBundle中的db文件是read-only属性  不能进行写操作!需要先拷贝到应用文件夹中 #define DBPATH [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] s

oldcatwarrior的博客 428

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

数据库日志满 引发的拒绝操作

经过排查 是 数据库还原模式设置问题: 数据库的三个模式:简单,批量更新和完全,简单模式LOG文件不会自动增大或不会自动增大很多,因为每当发生一个检查点,它就可以覆盖以前的日志空间;批量和完全,只有当你备份了日志内容后,日志空间才可以被覆盖利用,因此,如果你当你的数据库在完全模式时,你限制了日志文件的大小,那么如果你的数据库日志文件不及时备份,可能会导致系统挂起。另外,如果你限制日志文件增长,那...

weixin_33713503的博客 438

哈尔滨工业大学深圳数据库简答题预测

并发操作可能会产生哪几类数据不一致?用什么方法能避免各种不一致的情况? 并发操作带来的数据不一致性包括三类:丢失修改、不可重复读和读“脏’夕数据。(l)丢失修改(lostupdate)两个事务Tl和T2读入同一数据并修改,T2提交的结果破坏了(覆盖了)Tl提交的结果,导致Tl的修改被丢失。 (2)不可重复读(Non一RepeatableRead)不可重复读是指事务Tl读取数据后,事务几执行更新操作,使Tl无法再现前一次读取结果。 (3)读“脏”数据(DirtyRead)读“脏’夕数据是指事务Tl修改某一数据

skywf的博客 978

数据仓库与数据库Day3

面向主题的(Subject-Oriented )、集成的(Integrated)、非易失的(Non-Volatile)和时变的(Time-Variant )为临时存储层,是接口数据的临时存储区域,为后一步的数据处理做 准备。:也称为细节层,DW层的数据应该是一致的、准确的、干 净的数据,即对源系统数据进行了清洗(去除了杂质)后的数据。,也可以称面向用户交易的 处理系统,它是针对具体业务在数据库联机的日常操作,通常进行增删改查操作。:前端应用直接读取的数据源;仅仅是删除元数据,存储的业务数据并不会被删除。

2301_77954571的博客 2066

Hive基本操作——Database

目录1.创建数据库 Create Database2.删除数据库 Drop Database3.修改数据库 Alter Database4. 使用数据库 Use Database5.其他常用操作 1.创建数据库 Create Database CREATE (DATABASE|SCHEMA) [IF NOT EXISTS] database_name [COMMENT database_com...

x12345_的博客 803

一文搞懂什么是数据仓库(Data Warehouse)数据仓库与数据库区别有哪些?什么是元数据?

前期回顾: ⼤数据是如何产⽣的?大数据的特点是什么?什么是埋点?如何进行数据埋点?【超详细介绍】 对于这么多种类,这么大体量的数据是如何存储的呢? 所以数据仓库就应景而生了。 目录数据仓库(数据是如何存储的)1 什么是数据仓库?2 数据仓库解决什么问题?3 数据仓库的主要特征4 数据仓库与数据库区别5 数据仓库架构6 数据仓库元数据管理什么是元数据?元数据具体的工作内容元数据分为技术元数据和业务元数据7 数据治理脏数据的种类数据治理原则知识拓展(数据集市)结束语 数据仓库(数据是如何存储的) 1 什么是数据

w0714的博客 5万+

db.properties属性文件的用法

db.properties 在eclipse中,此文件必须放项目的src文件夹下 jdbc.className=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://localhost:3306/test02?useSSL=true jdbc.user=root jdbc.password=123456 JdbcUtil.java package cn.tedu.shopping.util; import java.io.IOException; import java.

BY_WJL的博客 1192

使用GreenDao操作已有的 .db 数据库

使用GreenDao操作已有的 .db 数据库 编者序 如果你项目中使用了GreenDao的话其实一些建库、建表的操作都对你隐藏了,你只根据XXXDao类就可以为所欲为的增删改查了。本篇不会花篇幅讲解如何配置GreenDAO,现在的GreenDAO配置起来简直比之前版本的舒服太多了,不会的自己爬文章学习下,不下十分钟你就可以配置完成。然后再稍微理解下ORM(对象关系映射)框架是个啥就可以开始本文的...

乐翁龙 2268

如何查看sqlite数据库的 .db文件中的表的内容数据

数据库、sqlite、qt

weixin_45825875的博客 1万+

直接保存对象的数据库——db4o

在实际开发中,数据的存储是必不可少的,常用的有数据库存储和文件存储。数据库目前有关系型数据库和文档型数据库(No-SQL)。关系型数据库以字段、类型、约束、表关系来存储和管理数据,比较常见的比如Oracle、MySql等都属于RDBMS,文档型数据库是一种可分布式的文档结构数据库,没有关系型数据库中传统意义上的表,比较常见的比如MongoDB、CouchDB等。 今天主要介绍下,在java开发中

Ryan's zone 8593
上一篇: 将当前时间转化为星期
下一篇: Junit FAQ(001-016)
Explorerwen
博客等级 码龄23年 4粉丝 41原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值