easyui+nodejs+sqlserver增删改查实现
用到的模块或者技术:
Express: http://www.expressjs.com.cn/4x/api.html#express
Easyui: http://www.jeasyui.com/documentation/index.php#
express-session:https://www.npmjs.com/package/express-session#resave
node-mssql: http://csdoc.org/
Redis: http://redis.io/
art-Template:http://www.jq22.com/jquery-info1097(一种高性能js模板引擎)
connect-redis:https://www.npmjs.com/package/connect-redis(用来将服务端session同步至分布式redis缓存)
先来看下整体效果:
图1 登录页面
图2 用户管理主界面
图3 系统设置-密码修改
图4 系统设置-退出系统
1、项目结构
routes下user.js作为控制器负责请求分发处理,views下存放user文件夹存放user模块全部视图html资源,系统入口为login.html文件,进行登录操作。
2、数据库模块
数据库连接使用node-mssql实现sqlserver数据库连接,对增删改查做了简单封装,没有统一整理显得比较凌乱,详细代码如下:
var node_mssql = require('node-mssql');
var express = require('express'); /* add configuration to query object */
var queryObj = new node_mssql.Query({
host: 'localhost',
port: 1433,
username: 'sa',
password: 'sa123456',
db: 'mydatabase'
}); var insert = function (data, insertTable,callback) { queryObj.table(insertTable);
queryObj.data(data);
queryObj.insert(function (results) {
callback(results);
}, function (err, sql) {
if (err) {
console.log(err);
}
});
}; var list = function (successCallback, option, listTable) { queryObj.table(listTable);
queryObj.where(option);
queryObj.select(function (results) {
successCallback(results);
}, function (err, sql) {
if (err)
console.log(err);
}); }; var update = function (data, option, updateTable,successCallback) { queryObj.table(updateTable);
queryObj.data(data);
queryObj.where(option); queryObj.update(function (results) {
successCallback(results);
}, function (err, sql) {
if (err)
console.log(err);
//console.log(sql);
}); }; var del = function (ids, table,successCallback,failedCallback) { queryObj.query("delete from " + table + " where id in ( " + ids + " )",successCallback,failedCallback); }; var list_sql = function(sql,successCallback){
queryObj.query(sql, successCallback,function(err){
console.log(err);
});
}; var total = function(sql,callback){
queryObj.query(sql,callback,function(err){
console.log(err);
});
}; var findUserById = function(sql,successCallback,failedCallback){
queryObj.query(sql,successCallback,failedCallback);
}; exports.list = list;
exports.list_sql = list_sql;
exports.insert = insert;
exports.update = update;
exports.del = del;
exports.total = total;
exports.findUserById = findUserById;
3、修改默认引擎
修改默认引擎为html而非ejs,修改操作如下,具体可查询官网说明:
// view engine setup
var template = require('art-template');
template.config('base', '');
template.config('extname', '.html');
app.engine('.html', template.__express);
app.set('view engine', 'html');
app.set('views', __dirname + '/views');
4、connect-redis的使用
var express = require('express');
var session = require("express-session");
var cookieParser = require('cookie-parser');
var RedisStore = require("connect-redis")(session); //用于将session保存至redis中
var app = express();
app.use(session({
store: new RedisStore({
host: 'localhost',
port: 6379
}),
secret: '1234567890QWERTY'
}));
在app.js中加入该设置后,在js代码中通过req.session.key= value,可以直接保存key:value的数值对保存至session从而直接同步至redis中,方便分布式下实现session会话的统一管理不丢失。
5、登录处理
router.post("/user/login", function (req, res) { var username = req.param("username");
var password = req.param("password");
var obj = {"username": username, "password": password}; dbConn.list(function (results) {
if (results == "") {
res.render("login", {"err": "用户名或密码错误"});
} else {
dbConn.findUserById("select * from dbo.t_user where id = " + results[0].id, function(recordset){
req.session.user = recordset[0];
console.log(recordset[0]);
res.render("user/userMain",{"currentUser":recordset[0]});
},function(err,sql){
console.log(err);
});
}
},obj, "dbo.t_user"); });
判断results是否为空,如果为空则表示用户名或者密码错误(前台已进行非空校验),直接跳转至login界面,显示:用户名或密码错误;
如果results非空,一是将用户信息存至session,二是将用户信息render至跳转页面,这样直接在页面中可以显示当前用户登录信息。
6、url控制拦截
app.use('/', user); app.use(function (req, res, next) {
var url = req.originalUrl;
console.log("############" + url);
if (url != "/" && !req.session.user) {
return res.redirect("/");
}
next();
});
在业务拦截处理后面加入以上代码片段进行url拦截,防止非法登录访问。如果请求的url非根目录并且当且用户没有session(表示未登录访问),直接redirect至登录页面。
7、user.js请求处理模块
/**
* Created by Administrator on 2015/8/28.
*/
var express = require('express');
var dbConn = require("./dbConn.js");
var router = express.Router(); /* GET home page. */
//路由分发登录请求
router.get('/', function (req, res, next) { res.render('login'); }); //登录处理
router.post("/user/login", function (req, res) { var username = req.param("username");
var password = req.param("password");
var obj = {"username": username, "password": password}; dbConn.list(function (results) {
if (results == "") {
res.render("login", {"err": "用户名或密码错误"});
} else {
dbConn.findUserById("select * from dbo.t_user where id = " + results[0].id, function(recordset){
req.session.user = recordset[0];
console.log(recordset[0]);
res.render("user/userMain",{"currentUser":recordset[0]});
},function(err,sql){
console.log(err);
});
}
},obj, "dbo.t_user"); }); router.get("/user/userManage.html", function (req, res) {
res.render("user/userManage", {"msg": "hello userManage"});
}); //查询
router.post("/user/list", function (req, res) {
console.dir(req.session.user);
var count = 0;
var page = req.param("page");
var rows = req.param("rows");
var username = req.body.username;
if(typeof(username) == "undefined"){
username = "";
}
console.log(page + ">" + rows + ">" + username);
var options = {page:page,rows:rows,username:username};
var jsonArray,sql;
if (options != "") {
if (options.username != "") {
//sql = "select top(" +rows+ ") * from dbo.t_user where username like '%"+options.username+"%' and id not in(select top(" + (page-1) * rows + ") id from dbo.t_user ) "; /*最后一页查询数据有误,还需改进*/
sql = "select top(" +rows+ ") * from (select ROW_NUMBER() over( order by id) as row,* from dbo.t_user where username like '%"+options.username+"%' ) a where a.row > " + (page-1)*rows;
console.log(sql);
dbConn.list_sql(sql,function(recordset){
dbConn.list_sql("select * from dbo.t_user where username like '%" + options.username + "%'",function(result){
jsonArray = {rows:recordset,total:result.length};
res.json(jsonArray);
});
});
}
if (options.username == "") {
sql = "select top(" +rows+ ") * from dbo.t_user where id not in(select top(" + (page-1) * rows + ") id from dbo.t_user )";
//sql = "select top(" +rows+ ") * from (select ROW_NUMBER() over( order by id) as row,* from dbo.t_user) a where a.row > " + (page-1)*rows;
console.log(sql);
dbConn.list_sql(sql,function(recordset){
dbConn.list_sql("select * from dbo.t_user where username like '%" + options.username + "%'",function(result){
jsonArray = {rows:recordset,total:result.length};
res.json(jsonArray);
});
});
}
}
}); //添加或者修改
router.post("/user/add/:id(\\d+)",function(req,res){
var obj = req.body;
dbConn.update(obj,{id:req.params.id},"dbo.t_user",function(results){
res.json({success:true});
}); }); router.post("/user/add",function(req,res){
var obj = req.body;
dbConn.insert(obj,"dbo.t_user",function(results){
res.json({success:true});
});
}); //删除
router.post("/user/delete",function(req,res){
var ids = req.param("ids");
console.log(ids);
dbConn.del(ids,"dbo.t_user",function(recordset){
res.json({success:true});
},function(err,sql){
console.log(err);
}); }); router.get("/user/exit",function(req,res){
//清除系统session
req.session.destroy(function(err) {
console.log(err);
});
res.redirect("/");
}); router.post("/user/modifyPass",function(req,res){
var user = req.session.user;
var oldPwd = req.body.oldPwd;
dbConn.list(function(results){
if(results.length == 0){
res.json({success:false});
}else{
var id = user.id;
var data = {password:req.body.rPwd};
//console.log(req.body);
dbConn.update(data,{id:id},"dbo.t_user",function(results){
res.json({success:true});
});
}
},{username:user.username,password:oldPwd},"dbo.t_user"); }); module.exports = router;
8、userMain.html用户页面主模块
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<title>Full Layout - jQuery EasyUI Demo</title> <link rel="stylesheet" type="text/css" href="/javascripts/jquery-easyui-1.4.3/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="/javascripts/jquery-easyui-1.4.3/themes/icon.css">
<link rel="stylesheet" type="text/css" href="/javascripts/jquery-easyui-1.4.3/demo/demo.css">
<script type="text/javascript" src="/javascripts/jquery-easyui-1.4.3/jquery.min.js"></script>
<script type="text/javascript" src="/javascripts/jquery-easyui-1.4.3/jquery.easyui.min.js"></script>
<script type="text/javascript" src="/javascripts/jquery-easyui-1.4.3/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="/javascripts/disableMove.js"></script>
<script> var url;
function openTab(text,url,iconCls){
if($("#tabs").tabs("exists",text)){
$("#tabs").tabs("select",text);
}else{
var content = "<iframe frameborder=0 scrolling='auto' style='width:100%;height:100%;' src='/user/"+url+"'></iframe>";
$("#tabs").tabs("add",{
title:text,
iconCls:iconCls,
closable:true,
content:content
});
}
} function openModifyPassDlg(){
$("#fm").form("reset");
$("#dlg").dialog("open").dialog("setTitle","修改密码");
} function savePass(){
//save处理
$("#fm").form("submit",{
url: "/user/modifyPass",
onSubmit:function(){
if($("#oldPwd").val() == ""){
$.messager.alert("系统提示","请输入您的原密码");
return false;
}
if($("#newPwd").val() == ""){
$.messager.alert("系统提示","请输入新密码");
return false;
}
if($("#rPwd").val() == ""){
$.messager.alert("系统提示","请再次确认密码");
return false;
}
if($("#newPwd").val() != $("#rPwd").val()){
$.messager.alert("系统提示","两次输入密码不匹配,请重新输入");
return false;
}
return $(this).form("validate");
},
success:function(result){
var result = eval('('+result+')');
if(result.success){
$.messager.alert("系统提示","密码修改成功,下次重启生效");
$("#dlg").dialog("close");
$("#fm").form("reset");
}else{
$.messager.alert("系统提示","密码修改失败");
return;
}
}
});
} function userExit(){
$.messager.confirm('确认退出','您确定退出系统?',function(r){
if (r){
window.location.href = "/user/exit"; //跳转
}
return false;
});
} function closePassModifyDialog(){
$("#dlg").dialog("close");
$("#fm").form("reset");
} </script>
</head> <body class="easyui-layout"> <div region="north" style="height:78px;background-color: #E0ECFF;">
<table style="padding:5px;width:100%;">
<tr>
<td> </td>
</tr>
<tr>
<td valign="bottom" align="right" width="80%"> <strong>欢迎 {{currentUser.username}}</strong>
</td>
</tr>
</table>
</div> <div region="center">
<div class="easyui-tabs" fit="true" id="tabs">
<div title="首页" data-options="iconCls:'icon-home'">
<iframe frameborder=0 scrolling='auto' style='width:100%;height:100%;' src='http://www.cnblogs.com/caiya928/'></iframe>
</div>
</div>
</div> <div region="west" style="width:200px;" title="导航菜单" split="true">
<div class="easyui-accordion" data-options="fit:true,border:false"> <div title="用户管理" data-options="iconCls:'icon-user',selected:true"
style="padding:5px;">
<a href="javascript:openTab('用户管理','userManage.html','icon-user_comment')"
class="easyui-linkbutton"
data-options="plain:true,iconCls:'icon-user_comment'">用户管理</a>
</div> <div title="系统设置" data-options="iconCls:'icon-wrench',selected:true"
style="padding:5px;">
<a href="javascript:openModifyPassDlg()" class="easyui-linkbutton"
data-options="plain:true,iconCls:'icon-vcard_key'">密码修改</a></br>
<a href="javascript:userExit()" class="easyui-linkbutton"
data-options="plain:true,iconCls:'icon-2012080412301'">退出系统</a>
</div>
</div>
</div> <div region="south" style="height:25px;padding:5px;" align="center">
@copyright 博客园 <a href="http://www.cnblogs.com/caiya928/">http://www.cnblogs.com/caiya928/</a>
</div> <div id="dlg" class="easyui-dialog"
style="width: 400px;height:300px;padding: 10px 20px" closed="true"
buttons="#dlg-buttons">
<form id="fm" method="post">
<table cellspacing="10px">
<tr>
<td>用户名:</td>
<td><input type="text" id="username" name="username" value="{{currentUser.username}}"
class="easyui-validatebox" readonly="readonly" style="width: 230px"/></td>
</tr>
<tr>
<td>当前密码:</td>
<td><input type="password" id="oldPwd" name="oldPwd"
class="easyui-validatebox" required="true" style="width: 100%;"/></td>
</tr>
<tr>
<td>新密码:</td>
<td><input type="password" id="newPwd"
name="newPwd" class="easyui-validatebox" required="true"
style="width: 100%;"/></td>
</tr>
<tr>
<td>确认密码:</td>
<td>
<input id="rPwd" name="rPwd" type="password" class="easyui-validatebox" data-options=""
required="required" style="width: 100%">
</td>
</tr>
</table>
</form>
</div> <div id="dlg-buttons">
<a href="javascript:savePass()" class="easyui-linkbutton"
iconCls="icon-ok">保存</a> <a
href="javascript:closePassModifyDialog()"
class="easyui-linkbutton" iconCls="icon-cancel">关闭</a>
</div> </body> </html>
9、userManage.html用户管理模块详细
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="/javascripts/jquery-easyui-1.4.3/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="/javascripts/jquery-easyui-1.4.3/themes/icon.css">
<link rel="stylesheet" type="text/css" href="/javascripts/jquery-easyui-1.4.3/demo/demo.css">
<script type="text/javascript" src="/javascripts/jquery-easyui-1.4.3/jquery.min.js"></script>
<script type="text/javascript" src="/javascripts/jquery-easyui-1.4.3/jquery.easyui.min.js"></script>
<script type="text/javascript" src="/javascripts/jquery-easyui-1.4.3/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="/javascripts/disableMove.js"></script>
<script type="text/javascript"> var url;
function saveUser(){
$('#fm').form('submit', {
url:url,
onSubmit:function(){
if($("#username").val() == ""){
$.messager.alert("系统提示","请填写用户名");
return false;
}
if($("#password").val() == ""){
$.messager.alert("系统提示","请填写密码");
return false;
}
if($("#sex").combobox("getValue") == ""){
$.messager.alert("系统提示","请选择性别");
return false;
}
if($("#birthday").datebox("getValue") == ""){
$.messager.alert("系统提示","请选择出生日期");
return false;
}
if($("#email").val() == ""){
$.messager.alert("系统提示","请输入您的邮箱");
return false;
}
if($("#address").val() == ""){
$.messager.alert("系统提示","请输入您的地址");
return false;
}
return $(this).form("validate");
},
success: function(result){
var result = eval('('+result+')');
if(result.success){
$.messager.alert("系统提示","保存成功");
$("#fm").form("reset");
$("#dlg").dialog("close");
$("#dg").datagrid("reload");
}else{
$.messager.alert("系统提示","保存失败");
return;
}
}
});
} function openUserAddDialog(){
$("#fm").form("reset"); //打开之前先清空数据
$("#dlg").dialog("open").dialog("setTitle","添加用户");
url = "/user/add";
} function searchUser(){
$("#dg").datagrid("load",{
"username":$("#s_userName").val()
});
} function deleteUser(){
var selectedRows=$("#dg").datagrid('getSelections');
if(selectedRows.length==0){
$.messager.alert("系统提示","请选择要删除的数据!");
return;
}
var strIds=[];
for(var i=0;i<selectedRows.length;i++){
strIds.push(selectedRows[i].id);
}
var ids=strIds.join(",");
$.messager.confirm("系统提示","您确认要删除这<font color=red>"+selectedRows.length+"</font>条数据吗?",function(r){
if(r){
$.post("/user/delete",{ids:ids},function(result){ //result直接返回Object,所以无需转换为json
if(result.success){
$.messager.alert("系统提示","数据已成功删除!");
$("#dg").datagrid("reload");
}else{
$.messager.alert("系统提示","数据删除失败!");
}
},"json");
}
});
} function openUserModifyDialog(){
var selectedRows=$("#dg").datagrid('getSelections');
if(selectedRows.length != 1){
$.messager.alert("系统提示","请选择一条数据进行修改");
return;
}
var row = selectedRows[0];
$("#dlg").dialog("open").dialog("setTitle","修改用户信息");
dispValue(row);
url = "/user/add/"+row.id;
} function dispValue(row){
$("#username").val(row.username);
$("#password").val(row.password);
$("#sex").combobox("setValue",row.sex);
$("#birthday").datebox("setValue",row.birthday);
$("#email").val(row.email);
$("#address").val(row.address);
} function closeUserDialog(){
$("#dlg").dialog("close");
$("#fm").form("reset");
} function formatEmail(value,rowData,rowIndex){
return value.substr(0,10);
} </script> <title>用户管理</title>
</head>
<body style="margin: 1px"> <table id="dg" title="用户管理" class="easyui-datagrid" fitColumns="true" pagination="true" rownumbers="true"
url="/user/list" fit="true" toolbar="#tb">
<thead>
<tr>
<th field="cb" checkbox="true" align="center"></th>
<th field="id" width="50" align="center">编号</th>
<th field="username" width="100" align="center">用户名</th>
<th field="sex" width="50" align="center">性别</th>
<th field="birthday" width="100" align="center" formatter="formatEmail">出生日期</th>
<th field="email" width="100" align="center">邮箱</th>
<th field="address" width="100" align="center">收货地址</th>
</tr>
</thead>
</table> <div id="tb">
<div>
<a href="javascript:openUserAddDialog()" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-user_add'">添加用户</a>
<a href="javascript:openUserModifyDialog()" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-user_edit'">修改用户</a>
<a href="javascript:deleteUser()" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-user_delete'">删除用户</a>
</div>
<div>
用户名:<input type="text" id="s_userName" size="20" onkeydown="if(event.keyCode == 13) searchUser();">
<a href="javascript:searchUser()" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-search'">查询</a>
</div>
</div> <div class="easyui-dialog" id="dlg" style="width:480px;height:330px;padding:10px 10px;" closed="true" buttons="#dlg-buttons" data-options="" >
<form action="" method="post" id="fm">
<table cellspacing="8px" align="center">
<tr>
<td>用户名:</td>
<td><input type="text" id="username" name="username" class="easyui-validatebox" required="true" style="width: 300px;"/></td>
<td> </td>
</tr>
<tr>
<td>密 码:</td>
<td><input type="password" id="password" name="password" class="easyui-validatebox" required="true"/></td>
<td> </td>
</tr>
<tr>
<td>性 别:</td>
<td colspan="2">
<select class="easyui-combobox" id="sex" name="sex" style="width:30%" editable="false" panelHeight="auto">
<option value="">请选择性别</option>
<option value="男">男</option>
<option value="女">女</option>
</select>
</td>
</tr>
<tr>
<td>出生日期:</td>
<td><input type="text" id="birthday" name="birthday" class="easyui-datebox" editable="false" required="true"/></td>
<td> </td>
</tr>
<tr>
<td>邮 箱:</td>
<td><input type="text" id="email" name="email" class="easyui-validatebox" required="true" data-options="validType:'email'" style="width: 300px;"/></td>
<td> </td>
</tr>
<tr>
<td>收货地址:</td>
<td>
<input type="text" valign="top" id="address" name="address" class="easyui-validatebox" required="true" style="width: 306px;"/>
</td>
</tr>
</table>
</form>
</div> <div id="dlg-buttons">
<a href="javascript:saveUser();" class="easyui-linkbutton" iconCls="icon-ok">保存</a>
<a href="javascript:closeUserDialog();" class="easyui-linkbutton" iconCls="icon-cancel">取消</a>
</div> </body>
</html>
10、处理easyui中dialog、window、panel等窗体拖动时超出父窗体不能拖回的问题
/**
* Created by Administrator on 2015/8/31.
*/
var easyuiPanelOnMove = function(left, top) {
var parentObj = $(this).panel('panel').parent();
if (left < 0) {
$(this).window('move', {
left : 1
});
}
if (top < 0) {
$(this).window('move', {
top : 1
});
}
var width = $(this).panel('options').width;
var height = $(this).panel('options').height;
var right = left + width;
var buttom = top + height;
var parentWidth = parentObj.width();
var parentHeight = parentObj.height();
if(parentObj.css("overflow")=="hidden"){
if(left > parentWidth-width){
$(this).window('move', {
"left":parentWidth-width
});
}
if(top > parentHeight-height){
$(this).window('move', {
"top":parentHeight-height
});
}
}
};
$.fn.panel.defaults.onMove = easyuiPanelOnMove;
$.fn.window.defaults.onMove = easyuiPanelOnMove;
$.fn.dialog.defaults.onMove = easyuiPanelOnMove;
将以上代码保存为任意js文件,在需要处理的页面中直接引入即可。
详细代码设计已完毕,改进的地方还有很多,比如:
1、数据库操作代码凌乱,不是很方便后期维护
2、没有加入登录时的验证码输入操作,具体可以参考这篇博客https://cnodejs.org/topic/50f90d8edf9e9fcc58a5ee0b
easyui+nodejs+sqlserver增删改查实现的更多相关文章
- nodejs+easyui(抽奖活动后台)增删改查
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfAAAAJACAIAAAD97KNZAAAgAElEQVR4nO2daXxb5Z2o7w+dO1/ufL ...
- JavaWeb程序利用Servlet的对SQLserver增删改查操作
声明:学了几天终于将增删改查的操作掌握了,也发现了一些问题,所以总结一下. 重点:操作数据库主要用的是SQL语句跟其他无关. 一:前提知识:PreparedStatement PreperedStat ...
- Sqlserver 增删改查----增
注意我说的常见查询,可不是简单到一个表得增删改查,做过实际开发得人都知道,在实际开发中,真正牵扯到一个表得增删改查只能说占很小得一部分,大多都是好几个表的关联操作的. 下面我就说一下我在实际开发中经常 ...
- Sqlserver 增删改查----改
--我们就以院系,班级,学生来举例. create TABLE [dbo].YuanXi ( Id ,) NOT NULL,--学校id 自增量 YuanXiName varchar() null, ...
- easyui表格的增删改查
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- [jQuery EasyUI系列] 创建增删改查应用
一.数据收集并妥善管理数据是网络应用共同的必要.CRUD允许我们生产页面列表并编辑数据库记录. 本文主要演示如何使用jQuery EasyUI实现CRUD DataGrid. 将使用到的插件有: da ...
- asp.net EasyUI DataGrid 实现增删改查
转自:http://www.cnblogs.com/create/p/3410314.html 前台代码: <!DOCTYPE html> <html xmlns="htt ...
- Sqlserver 增删改查----删
--我们就以院系,班级,学生来举例. create TABLE [dbo].YuanXi ( Id ,) NOT NULL,--学校id 自增量 YuanXiName varchar() null, ...
- maven+springMVC+mybatis+easyUI管理用户增删改查
1.项目演示图 2.项目简单介绍 项目分为两个projectdomain和manager.project结构例如以下图所看到的.当中domain是Maven javaproject主要完毕对数据库的操 ...
随机推荐
- pos机代理行业
传统模式(代理):代理商线性分润,代理商或营运商给一代大量的机器及要求,而且这个要求公对公结算(必须要有公司),分润也是直接给一代.然后一代找二代推广,层层发展.这样你会很担心你的上家的上家突 ...
- “全栈2019”Java第九章:解释第一个程序
难度 初级 学习时间 10分钟 适合人群 零基础 开发语言 Java 开发环境 JDK v11 IntelliJ IDEA v2018.3 文章原文链接 "全栈2019"Java第 ...
- selenium爬取qq空间,requests爬取雪球网数据
一.爬取qq空间好友动态数据 # 爬取qq空间好友状态信息(说说,好友名称),并屏蔽广告 from selenium import webdriver from time import sleep f ...
- CSS3过渡效果 兼容IE6、IE7、IE8
<style> .box{ width:120px;height:40px;background:yellowgreen;line-height:40px;transition:width ...
- java反射介绍
反射是java中的非常重要的一项机制,也称做reflection.它让java在运行中对自身进行检查,并能直接操作程序的内部属性或方法. 反射机制中常用的类 Reflection api中的内部信息有 ...
- NVIDIA TX1/TX2 对比
处理器方面,TX2由TX1的Tegra X1升至Tegra Parker处理器,该处理器由16nm工艺制造,6核心设计,CPU部分由2个丹佛+4个A57核心共同组成. GPU则采用Pascal架构,拥 ...
- dw cs6设置字体样式
1 编辑->首选参数->字体 改代码试图的字体和大小.点确定即可.
- 【算法笔记】B1049 数列的片段和
1049 数列的片段和 (20 分) 给定一个正数数列,我们可以从中截取任意的连续的几个数,称为片段.例如,给定数列 { 0.1, 0.2, 0.3, 0.4 },我们有 (0.1) (0.1, ...
- Go语言字符串
Go语言的字符串是一个用UTF-8编码的变宽字符序列,它的每一个字符都用一个或多个字节表示 . 在Go语言中,没有字符类型,字符类型是rune类型,rune是int32的别称.可使用 []byte() ...
- Python下使用 redis数据库
初识Rdeis数据库 简介 redis是一个key-value存储系统.和Memcached类似,它支持存储的value类型相对更多,包括string(字符串).list(链表).set(集合).zs ...