创建

if [ ! -d /opt/dbspace ]
then
mkdir /opt/dbspace
fi if [ -f /opt/dbspace/.memo.db ]
then
rm /opt/dbspace/.memo.db;
fi if [ -f /opt/dbspace/.memo.db-journal ]
then
rm /opt/dbspace/.memo.db-journal
fi sqlite3 /opt/dbspace/.memo.db 'PRAGMA journal_mode = PERSIST;
create table memo_list (
memo_id INTEGER PRIMARY KEY AUTOINCREMENT,
is_selected INTEGER default ,
time INTEGER default ,
year INTEGER default ,
month INTEGER default ,
day INTEGER default ,
hour INTEGER default ,
minute INTEGER default ,
wday INTEGER default ,
thumb_path TEXT NOT NULL,
memo_text TEXT,
image_path TEXT,
image_x INTEGER,
image_y INTEGER,
image_w INTEGER,
image_h INTEGER,
handwrite_path TEXT,
record_path TEXT,
record_length INTEGER,
UNIQUE (memo_id)
);
' chown : /opt/dbspace/.memo.db
chown : /opt/dbspace/.memo.db-journal
chmod /opt/dbspace/.memo.db
chmod /opt/dbspace/.memo.db-journal
chsmack -a 'memo::db' /opt/dbspace/.memo.db*

cmake

CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(memo-database CXX) INCLUDE(FindPkgConfig)
pkg_check_modules(pkgs REQUIRED
sqlite3
dlog
) INCLUDE_DIRECTORIES(${pkgs_INCLUDE_DIRS})
LINK_DIRECTORIES(${pkgs_LIBRARY_DIRS}) FOREACH(flag ${pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag) SET(CMAKE_CXX_FLAGS "${EXTRA_CFLAGS} -O2 -Wall -Wcast-align -Wcast-qual -Werror -Wextra -Wnon-virtual-dtor -Wno-unused-parameter -Wshadow -Wwrite-strings -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-strict-aliasing -fsigned-char -fstrict-overflow -Wno-ignored-qualifiers -Wno-array-bounds -Wno-empty-body -Wno-error") SET(LIB_NAME "${PROJECT_NAME}")
SET(LIB_PREFIX ${CMAKE_INSTALL_PREFIX})
SET(LIB_DIR "${LIB_PREFIX}/lib")
SET(LIB_INCLUDE_DIR "${LIB_PREFIX}/include")
SET(LIB_PKGCONFIG_DIR "/usr/lib/pkgconfig") SET(SRCS
src/MemoDb.cpp
) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) ADD_LIBRARY( ${LIB_NAME} SHARED ${SRCS} )
TARGET_LINK_LIBRARIES(${LIB_NAME} ${pkgs_LDFLAGS}) CONFIGURE_FILE(${LIB_NAME}.pc.in ${LIB_NAME}.pc @ONLY)
INSTALL(TARGETS ${LIB_NAME} DESTINATION ${LIB_DIR})
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LIB_NAME}.pc DESTINATION ${LIB_PKGCONFIG_DIR})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/MemoDb.h DESTINATION ${LIB_INCLUDE_DIR} )

spec

Name: memo-database
Summary: app control api
Version: 0.1.
Release:
License: Flora License
Source0: %{name}-%{version}.tar.gz BuildRequires: cmake
BuildRequires: pkgconfig(sqlite3)
BuildRequires: pkgconfig(dlog)
Provides: libmemo-database.so %description
App Control API Library %package devel
Summary: app control api (devel)
Requires: %{name} = %{version} %description devel
App Control API devel package %prep
%setup -q %build
cmake . -DVERSION=%{version} \
-DCMAKE_INSTALL_PREFIX=%{_prefix} make %{?jobs:-j%jobs} %install
%make_install %files
%{_libdir}/*.so
%manifest memo-database.manifest %files devel
%{_libdir}/pkgconfig/%{name}.pc
%{_includedir}/* %post
/sbin/ldconfig if [ ! -d /opt/dbspace ]
then
mkdir /opt/dbspace
fi if [ -f /opt/dbspace/.memo.db ]
then
rm /opt/dbspace/.memo.db;
fi if [ -f /opt/dbspace/.memo.db-journal ]
then
rm /opt/dbspace/.memo.db-journal
fi sqlite3 /opt/dbspace/.memo.db 'PRAGMA journal_mode = PERSIST;
create table memo_list (
memo_id INTEGER PRIMARY KEY AUTOINCREMENT,
is_selected INTEGER default 0,
time INTEGER default 0,
year INTEGER default 0,
month INTEGER default 0,
day INTEGER default 0,
hour INTEGER default 0,
minute INTEGER default 0,
wday INTEGER default 0,
thumb_path TEXT NOT NULL,
memo_text TEXT,
image_path TEXT,
image_x INTEGER,
image_y INTEGER,
image_w INTEGER,
image_h INTEGER,
handwrite_path TEXT,
record_path TEXT,
record_length INTEGER,
UNIQUE (memo_id)
);
' chown :5000 /opt/dbspace/.memo.db
chown :5000 /opt/dbspace/.memo.db-journal
chmod 660 /opt/dbspace/.memo.db
chmod 660 /opt/dbspace/.memo.db-journal
chsmack -a 'memo::db' /opt/dbspace/.memo.db*

头文件

#ifndef __MEMO_DB_H__
#define __MEMO_DB_H__ #include <errno.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <sqlite3.h> using std::vector; #define DBDIR "/opt/dbspace"
#define DBFILE ".memo.db"
#define DBPATH DBDIR"/"DBFILE
#define MEMO_EMPTY_STR ""
#define MEMO_CHECK_STR(p) ((p) ? (p) : MEMO_EMPTY_STR) typedef enum _memo_db_error
{
MEMO_ERROR_NONE = ,/**< Success */
MEMO_ERROR_INVALID_DATA = -,/**< Invalid parameter */
MEMO_ERROR_NO_MEMORY = -,/**< No memory */
MEMO_ERROR_FROM_DB = -,/**< Error from DB query */
MEMO_ERROR_ALREADY_EXIST_ID = -,/**< Already exist private ID */
MEMO_ERROR_FROM_DBUS = -,/**< Error from DBus */
MEMO_ERROR_NOT_EXIST_ID = -,/**< Not exist private ID */
MEMO_ERROR_IO = -,/**< disk i/o error */
MEMO_ERROR_SERVICE_NOT_READY = -,/**< no reponse from master */
} memo_db_error_e; typedef struct
{
int nMemoId;
bool bIsSelected;
long int nTime;
int nYear;
int nMonth;
int nDay;
int nHour;
int nMinute;
int nWeekday;
const char *strThumbPath;
const char *strMemoText;
char *strImagePath;
int nImageX;
int nImageY;
int nImageW;
int nImageH;
const char *strHandwritePath;
const char *strRecordPath;
int nRecordLength;
}MemoDbData; class CMemoDb
{
public:
CMemoDb() {};
virtual ~CMemoDb() {}; int OpenMemoDb();
int CloseMemoDb(); int InsertMemoDb(MemoDbData *MemoData);
int UpdateMemoDb(MemoDbData *MemoData);
int DelMemoDb(int nMemoId);
int GetDataFromDb(vector<MemoDbData> *MemoVector);
int GetDataById(int nMemoId, MemoDbData *MemoData);
static CMemoDb* GetInstance();
int GetFirstData(MemoDbData *MemoData);
int GetTop3Memo(vector<MemoDbData> *MemoVector); private:
int m_ExecMemoDb(const char *query);
char *m_GetColumnText(sqlite3_stmt *stmt, int col);
static CMemoDb* m_pMemoDbInstance;
sqlite3 *db;
}; #endif/* __EPG_DB_H__ */

src文件

#include "MemoDb.h"
#include "dbg.h" CMemoDb* CMemoDb::m_pMemoDbInstance = NULL; CMemoDb* CMemoDb::GetInstance()
{
if(m_pMemoDbInstance == NULL)
{
m_pMemoDbInstance = new CMemoDb();
} return m_pMemoDbInstance;
} int CMemoDb::OpenMemoDb()
{
_DBG("OpenMemoDb------------------------------0"); int ret = ; ret = sqlite3_open(DBPATH, &db);
if (ret != SQLITE_OK)
{
_ERR("DB open error(%d), %s", ret, DBPATH);
return -;
}
_DBG("OpenMemoDb------------------------------1"); return ;
} int CMemoDb::CloseMemoDb()
{
int ret = ; if (!db)
{
return MEMO_ERROR_INVALID_DATA;
} ret = sqlite3_close(db);
if (ret != SQLITE_OK)
{
_ERR("DB close error(%d)", ret);
return MEMO_ERROR_FROM_DB;
} db = NULL; _DBG("CloseMemoDb################################");
return MEMO_ERROR_NONE;
} int CMemoDb::m_ExecMemoDb( const char *query)
{
_DBG("m_ExecMemoDb, query is %s", query);
int ret = ;
char *err_msg = NULL; if (!db)
{
return MEMO_ERROR_INVALID_DATA;
} ret = sqlite3_exec(db, query, NULL, NULL, &err_msg); if (ret != SQLITE_OK)
{
_ERR("SQL error(%d) : %s", ret, err_msg);
sqlite3_free(err_msg);
return MEMO_ERROR_FROM_DB;
}
_DBG("m_ExecMemoDb finish");
return MEMO_ERROR_NONE;
} char *CMemoDb::m_GetColumnText(sqlite3_stmt *stmt, int col)
{
const unsigned char *col_text = NULL; col_text = sqlite3_column_text(stmt, col);
if (!col_text || col_text[] == '\0')
{
return NULL;
} return strdup((char *)col_text);
} int CMemoDb::InsertMemoDb(MemoDbData *MemoData)
{
_DBG("InsertMemoDb");
char *query = NULL; if (!db)
{
return MEMO_ERROR_FROM_DB;
} query = sqlite3_mprintf("insert into memo_list("
"memo_id, is_selected, "
"time, year, month, day, hour, minute, wday, "
"thumb_path, memo_text, image_path, "
"image_x, image_y, image_w, image_h, "
"handwrite_path, "
"record_path,record_length) values ("
"null, %d, "
"%ld, %d, %d, %d, %d, %d, %d, "
"'%s', '%s', '%s', "
"%d, %d, %d, %d, "
"'%s', "
"'%s', %d)",
MemoData->bIsSelected,
MemoData->nTime,
MemoData->nYear,
MemoData->nMonth,
MemoData->nDay,
MemoData->nHour,
MemoData->nMinute,
MemoData->nWeekday,
MemoData->strThumbPath,
MemoData->strMemoText,
MemoData->strImagePath,
MemoData->nImageX,
MemoData->nImageY,
MemoData->nImageW,
MemoData->nImageH,
MemoData->strHandwritePath,
MemoData->strRecordPath,
MemoData->nRecordLength); if (m_ExecMemoDb((const char *)query) != MEMO_ERROR_NONE)
{
return MEMO_ERROR_FROM_DB;
} return MEMO_ERROR_NONE;
} int CMemoDb::UpdateMemoDb(MemoDbData *MemoData)
{
_DBG("here should implement");
char *query = NULL; if (!db)
{
return MEMO_ERROR_FROM_DB;
} query = sqlite3_mprintf("update memo_list set "
"is_selected = %d, "
"time = %ld, year = %d, month = %d, day = %d, hour = %d, minute = %d, wday = %d, "
"thumb_path = '%s', memo_text = '%s', image_path = '%s', "
"image_x = %d, image_y = %d, image_w = %d, image_h = %d, "
"handwrite_path = '%s', "
"record_path = '%s', record_length = %d "
"where memo_id = %d",
MemoData->bIsSelected,
MemoData->nTime,
MemoData->nYear,
MemoData->nMonth,
MemoData->nDay,
MemoData->nHour,
MemoData->nMinute,
MemoData->nWeekday,
MemoData->strThumbPath,
MemoData->strMemoText,
MemoData->strImagePath,
MemoData->nImageX,
MemoData->nImageY,
MemoData->nImageW,
MemoData->nImageH,
MemoData->strHandwritePath,
MemoData->strRecordPath,
MemoData->nRecordLength,
MemoData->nMemoId); if (m_ExecMemoDb((const char *)query) != MEMO_ERROR_NONE)
{
return MEMO_ERROR_FROM_DB;
} return MEMO_ERROR_NONE;
}
int CMemoDb::DelMemoDb(int nMemoId)
{
char *query = NULL; if (!db)
{
return MEMO_ERROR_FROM_DB;
} query = sqlite3_mprintf("delete from memo_list where memo_id = %d",
nMemoId); if (m_ExecMemoDb( query) != MEMO_ERROR_NONE)
{
return MEMO_ERROR_FROM_DB;
} return MEMO_ERROR_NONE;
} int CMemoDb::GetDataById(int nMemoId, MemoDbData *MemoData)
{
sqlite3_stmt *stmt;
char *query = NULL;
int ret; if (!db)
{
return MEMO_ERROR_FROM_DB;
} query = sqlite3_mprintf("select memo_id, is_selected, "
"time, year, month, day, hour, minute, wday, "
"thumb_path, "
"memo_text, "
"image_path, "
"image_x, "
"image_y, "
"image_w, "
"image_h, "
"handwrite_path, "
"record_path, "
"record_length "
"from memo_list where memo_id = %d", nMemoId); ret = sqlite3_prepare(db, query, strlen(query), &stmt, NULL);
if (ret != SQLITE_OK)
{
_ERR("Get count DB err(%d) : %s", ret, sqlite3_errmsg(db));
return MEMO_ERROR_FROM_DB;
} if (sqlite3_step(stmt) == SQLITE_ROW)
{
MemoData->bIsSelected = sqlite3_column_int(stmt, );
MemoData->nTime = sqlite3_column_int(stmt, );
MemoData->nYear = sqlite3_column_int(stmt, );
MemoData->nMonth = sqlite3_column_int(stmt, );
MemoData->nDay = sqlite3_column_int(stmt, );
MemoData->nHour = sqlite3_column_int(stmt, );
MemoData->nMinute = sqlite3_column_int(stmt, );
MemoData->nWeekday = sqlite3_column_int(stmt, );
MemoData->strThumbPath = m_GetColumnText(stmt, );
MemoData->strMemoText= m_GetColumnText(stmt, );
MemoData->strImagePath = m_GetColumnText(stmt, );
MemoData->nImageX = sqlite3_column_int(stmt, );
MemoData->nImageY = sqlite3_column_int(stmt, );
MemoData->nImageW = sqlite3_column_int(stmt, );
MemoData->nImageH = sqlite3_column_int(stmt, );
MemoData->strHandwritePath = m_GetColumnText(stmt, );
MemoData->strRecordPath = m_GetColumnText(stmt, );
MemoData->nRecordLength= sqlite3_column_int(stmt, );
} sqlite3_finalize(stmt); return MEMO_ERROR_NONE;
} int CMemoDb::GetDataFromDb(vector<MemoDbData> *MemoVector)
{
sqlite3_stmt *stmt;
char *query = NULL;
MemoDbData MemoData;
int ret; if (!db)
{
return MEMO_ERROR_FROM_DB;
} query = sqlite3_mprintf("select memo_id, is_selected, "
"time, year, month, day, hour, minute, wday, "
"thumb_path, "
"memo_text, "
"image_path, "
"image_x, "
"image_y, "
"image_w, "
"image_h, "
"handwrite_path, "
"record_path, "
"record_length "
"from memo_list order by time desc"); ret = sqlite3_prepare(db, query, strlen(query), &stmt, NULL);
if (ret != SQLITE_OK)
{
_ERR("Get count DB err(%d) : %s", ret, sqlite3_errmsg(db));
return MEMO_ERROR_FROM_DB;
} while(sqlite3_step(stmt) == SQLITE_ROW)
{
MemoData.nMemoId = sqlite3_column_int(stmt , );
MemoData.bIsSelected = sqlite3_column_int(stmt, );
MemoData.nTime = sqlite3_column_int(stmt, );
MemoData.nYear = sqlite3_column_int(stmt, );
MemoData.nMonth = sqlite3_column_int(stmt, );
MemoData.nDay = sqlite3_column_int(stmt, );
MemoData.nHour = sqlite3_column_int(stmt, );
MemoData.nMinute = sqlite3_column_int(stmt, );
MemoData.nWeekday = sqlite3_column_int(stmt, );
MemoData.strThumbPath = m_GetColumnText(stmt, );
MemoData.strMemoText= m_GetColumnText(stmt, );
MemoData.strImagePath = m_GetColumnText(stmt, );
MemoData.nImageX = sqlite3_column_int(stmt, );
MemoData.nImageY = sqlite3_column_int(stmt, );
MemoData.nImageW = sqlite3_column_int(stmt, );
MemoData.nImageH = sqlite3_column_int(stmt, );
MemoData.strHandwritePath = m_GetColumnText(stmt, );
MemoData.strRecordPath = m_GetColumnText(stmt, );
MemoData.nRecordLength= sqlite3_column_int(stmt, ); MemoVector->push_back(MemoData);
} sqlite3_finalize(stmt); return MEMO_ERROR_NONE;
} int CMemoDb::GetFirstData(MemoDbData *MemoData)
{
sqlite3_stmt *stmt;
char *query = NULL;
int ret; if (!db)
{
return MEMO_ERROR_FROM_DB;
} query = sqlite3_mprintf("select memo_id, is_selected, "
"time, year, month, day, hour, minute, wday, "
"thumb_path, "
"memo_text, "
"image_path, "
"image_x, "
"image_y, "
"image_w, "
"image_h, "
"handwrite_path, "
"record_path, "
"record_length "
"from memo_list order by time desc"); ret = sqlite3_prepare(db, query, strlen(query), &stmt, NULL);
if (ret != SQLITE_OK)
{
_ERR("Get count DB err(%d) : %s", ret, sqlite3_errmsg(db));
return MEMO_ERROR_FROM_DB;
} if (sqlite3_step(stmt) == SQLITE_ROW)
{
MemoData->bIsSelected = sqlite3_column_int(stmt, );
MemoData->nTime = sqlite3_column_int(stmt, );
MemoData->nYear = sqlite3_column_int(stmt, );
MemoData->nMonth = sqlite3_column_int(stmt, );
MemoData->nDay = sqlite3_column_int(stmt, );
MemoData->nHour = sqlite3_column_int(stmt, );
MemoData->nMinute = sqlite3_column_int(stmt, );
MemoData->nWeekday = sqlite3_column_int(stmt, );
MemoData->strThumbPath = m_GetColumnText(stmt, );
MemoData->strMemoText= m_GetColumnText(stmt, );
MemoData->strImagePath = m_GetColumnText(stmt, );
MemoData->nImageX = sqlite3_column_int(stmt, );
MemoData->nImageY = sqlite3_column_int(stmt, );
MemoData->nImageW = sqlite3_column_int(stmt, );
MemoData->nImageH = sqlite3_column_int(stmt, );
MemoData->strHandwritePath = m_GetColumnText(stmt, );
MemoData->strRecordPath = m_GetColumnText(stmt, );
MemoData->nRecordLength= sqlite3_column_int(stmt, );
} sqlite3_finalize(stmt); return MEMO_ERROR_NONE;
} int CMemoDb::GetTop3Memo(vector<MemoDbData> *MemoVector)
{
sqlite3_stmt *stmt;
char *query = NULL;
MemoDbData MemoData;
int ret; if (!db)
{
return MEMO_ERROR_FROM_DB;
} query = sqlite3_mprintf("select memo_id, is_selected, "
"time, year, month, day, hour, minute, wday, "
"thumb_path, "
"memo_text, "
"image_path, "
"image_x, "
"image_y, "
"image_w, "
"image_h, "
"handwrite_path, "
"record_path, "
"record_length "
"from memo_list where is_selected = 1 order by time desc"); ret = sqlite3_prepare(db, query, strlen(query), &stmt, NULL);
if (ret != SQLITE_OK)
{
_ERR("Get count DB err(%d) : %s", ret, sqlite3_errmsg(db));
return MEMO_ERROR_FROM_DB;
} while(sqlite3_step(stmt) == SQLITE_ROW)
{
MemoData.nMemoId = sqlite3_column_int(stmt , );
MemoData.bIsSelected = sqlite3_column_int(stmt, );
MemoData.nTime = sqlite3_column_int(stmt, );
MemoData.nYear = sqlite3_column_int(stmt, );
MemoData.nMonth = sqlite3_column_int(stmt, );
MemoData.nDay = sqlite3_column_int(stmt, );
MemoData.nHour = sqlite3_column_int(stmt, );
MemoData.nMinute = sqlite3_column_int(stmt, );
MemoData.nWeekday = sqlite3_column_int(stmt, );
MemoData.strThumbPath = m_GetColumnText(stmt, );
MemoData.strMemoText= m_GetColumnText(stmt, );
MemoData.strImagePath = m_GetColumnText(stmt, );
MemoData.nImageX = sqlite3_column_int(stmt, );
MemoData.nImageY = sqlite3_column_int(stmt, );
MemoData.nImageW = sqlite3_column_int(stmt, );
MemoData.nImageH = sqlite3_column_int(stmt, );
MemoData.strHandwritePath = m_GetColumnText(stmt, );
MemoData.strRecordPath = m_GetColumnText(stmt, );
MemoData.nRecordLength= sqlite3_column_int(stmt, ); MemoVector->push_back(MemoData);
} sqlite3_finalize(stmt); return MEMO_ERROR_NONE;
}

数据库 --> sqlite3之api使用的更多相关文章

  1. sqlite3 C API编程

    1,创建测试数据库,表;

  2. Linux下用到数据库sqlite3

    最近在Linux下用到数据库sqlite3,于是开始了该方面的学习. 0. 引言 我们这篇文章主要讲述了如何在C/C++语言中调用 sqlite 的函数接口来实现对数据库的管理, 包括创建数据库.创建 ...

  3. iOS开发中的4种数据持久化方式【二、数据库 SQLite3、Core Data 的运用】

                   在上文,我们介绍了ios开发中的其中2种数据持久化方式:属性列表.归档解档.本节将继续介绍另外2种iOS持久化数据的方法:数据库 SQLite3.Core Data 的运 ...

  4. 数据库(SQLITE3函数总结): sqlite3_open, sqlite3_exec, slite3_close,sqlite3_prepare_v2,sqlite3_column_text,

    Sqlite3 的确非常好用.小巧.速度快.近期研究它,有一些收获,这里把我对 sqlite3 的研究列出来,以备忘记. 导入SQLLite library并引入头文件. libsqlite3.dyl ...

  5. 应用程序员眼中的数据库管理系统:API+数据库语言

    应用程序员眼中的数据库管理系统:API+数据库语言 sqlite3_open_v2 https://www.cnblogs.com/cchust/p/5121559.html

  6. beego的orm ,用的数据库sqlite3

    测试 beego的orm ,用的数据库sqlite3 1 package main import ( "fmt" "github.com/astaxie/beego/or ...

  7. 数据库sqlite3在linux中的使用

    在linux下我们首先要获取root权限 当然也可是使用 sudo命令 接着让我们来安装sqlite3吧!博主当然是已经安装好了! 别急,的确你是安装好了sqlite3但是有一点必须要记住,你还没有安 ...

  8. 如何在Linux下用C/C++语言操作数据库sqlite3(很不错!设计编译链接等很多问题!)

    from : http://blog.chinaunix.NET/uid-21556133-id-118208.html 安装Sqlite3: 从www.sqlite.org上下载Sqlite3.2. ...

  9. HTML5权威指南--Web Storage,本地数据库,本地缓存API,Web Sockets API,Geolocation API(简要学习笔记二)

    1.Web Storage HTML5除了Canvas元素之外,还有一个非常重要的功能那就是客户端本地保存数据的Web Storage功能. 以前都是用cookies保存用户名等简单信息.   但是c ...

随机推荐

  1. API接口签名校验

    在开发app中,我们经常要为app提供接口.但是为了保证数据的安全,我们通常会对接口的参数进行加密. 1.不验证的接口api api接口请求,"http://www.xx.com/getUs ...

  2. Naive Bayes (NB Model) 初识

    1,Bayes定理 P(A,B)=P(A|B)P(B); P(A,B)=P(B|A)P(A); P(A|B)=P(B|A)P(A)/P(B);    贝叶斯定理变形 2,概率图模型 2.1  定义 概 ...

  3. TypeError:_12.store.query is not a function

    1.错误描述 TypeError:_12.store.query is not a function                              _SearchMixin.js(第62行 ...

  4. 在Visual Studio 2012中使用GSL

    1. 下载GSL http://gnuwin32.sourceforge.net/packages/gsl.htm 下载 Complete package, except sources和Source ...

  5. C# 获取一个独一无二的字符串 GUID

    在保存文件,创建目录时,为了保证名称不重复,经常使用Random产生一个随机数,有更简单且不会重复的办法是: Guid.NewGuid().ToString() 就会生成一个类似 37c1acec-4 ...

  6. jquery回调函数的一个案例

    1.引言 今天在学习<jQuery基础教程>在学习编写插件的时候,书中说利用回调函数来当参数,会极大的提高程序的灵活性.对回调函数很陌生.研究了一下给的示例程序.感觉对回调函数有了基本的了 ...

  7. ASP.NET CSS 小结

    1.ASP.NET 引用CSS 1.Site.master里面设置webopt <webopt:bundlereferencerunat="server"path=" ...

  8. [Luogu4230]连体病原体

    题面戳我 sol 很好想+很好写的一道题,然而比赛中我还是没有切掉qaq. LCT 枚举左端点\(i\),向右移动右端点指针\(j\)找到第一个成环的位置.此时\([i,j],[i,j+1]...[i ...

  9. [BZOJ1004] [HNOI2008] Cards (Polya定理)

    Description 小春现在很清闲,面对书桌上的N张牌,他决定给每张染色,目前小春只有3种颜色:红色,蓝色,绿色.他询问Sun有多少种染色方案,Sun很快就给出了答案.进一步,小春要求染出Sr张红 ...

  10. js中url跳转问题

    问题描述:列表中有不同的企业名字,每个企业名字都有一个不同的链接,用id做为参数区分.点击不同的名字,根据id的不同跳转到对应的详情页,设置连接如下: 1. url = http://localhos ...