1.判断浏览器是否启用cookie:

if (navigator.cookieEnabled==true)
{
alert("已启用 cookie")
}
else
{
alert("未启用 cookie")
}
}

1.从url中获取参数的值:

<script type="text/javascript">
function getQueryString( name ){
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if( r!=null ) return unescape(r[2]); return null;
}
</script>

代码解释:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>js正则表达式</title>
<link rel="stylesheet" type="text/css" href="bootstrap/bootstrap.min.css">
<style type="text/css">
</style>
</head>
<body> </body>
<script type="text/javascript">
function getQueryString(name){
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); var r = window.location.search.substr(1);
var result = r.match(reg); console.log(r);
console.log(reg);
console.log(result); if(result!=null){
return unescape(result[2]);
} return null; } var age = getQueryString("age"); console.log(age); //代码解释:
正则表达式为:/(^|&)age=([^&]*)(&|$)/
分析它匹配的:
^age=10&
^age=10$
&age=10&
&age=10$ 待匹配的字符串:
id=123&age=10&sb=1&hu=abc 匹配的结果:
&age=10&
整个&age=10&为第0组;
第1组为&
第2组为10
第3组为& </script>
</html>

本地调试,浏览器输入:file:///G:/test_demo/queryString.html?id=123&age=10&sb=1&hu=abc

console打印:

unescape函数:

escape("Visit W3School!")
"Visit%20W3School%21"
unescape("Visit W3School!")
"Visit W3School!"
unescape("Visit%20W3School%21")
"Visit W3School!"
encodeURIComponent("Visit W3School!")
"Visit%20W3School!"
decodeURIComponent("Visit W3School!")
"Visit W3School!"
encodeURI("Visit W3School!")
"Visit%20W3School!" 注释:ECMAScript v3 已从标准中删除了 unescape() 函数,并反对使用它,因此应该用 decodeURI() 和 decodeURIComponent() 取而代之。

2.改变窗口大小、触发改变窗口大小事件:

<body id="box">

</body>
<script type="text/javascript">
var winWidth = 0;
function addEventOnResize() {
$(window).resize(function () {
winWidth = $(this).width();
var dom = document.getElementById('box');
if (!dom) {
return;
}
if (winWidth > 1366) {
dom.className = 'box1240';
} else {
dom.className = 'box1000';
}
}).resize();
}
addEventOnResize(); </script>

w3上介绍resize的用法:

<html>
<head>
<script type="text/javascript" src="/jquery/jquery.js"></script>
<script type="text/javascript">
x=0;
$(document).ready(function(){
$(window).resize(function() {
$("span").text(x+=1);
});
$("button").click(function(){
$(window).resize();
});
});
</script>
</head>
<body>
<p>窗口的大小被调整了 <span>0</span> 次。</p>
<p>请试着调整浏览器窗口的大小。</p>
<button>触发窗口的 resize 事件</button>
</body>
</html>

3.动态加载js代码:            

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>js代码学习</title>
<link rel="stylesheet" type="text/css" href="bootstrap/bootstrap.min.css">
<style type="text/css">
</style>
</head>
<body> <script type="text/javascript">
(function() {
var hm = document.createElement("script");
hm.src = "//hm.baidu.com/hm.js?df0a72cf81dd321c00f5baefc3c4855d";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})(); </script>
</body>
</html>

运行完成之后:

insertBefore用法:http://www.w3school.com.cn/jsref/met_node_insertbefore.asp

insertBefore() 方法在您指定的已有子节点之前插入新的子节点。

<!DOCTYPE html>
<html>
<body> <ul id="myList"><li>Coffee</li><li>Tea</li></ul> <p id="demo">请点击按钮向列表插入一个项目。</p> <button onclick="myFunction()">试一下</button> <script>
function myFunction()
{
var newItem=document.createElement("LI")
var textnode=document.createTextNode("Water")
newItem.appendChild(textnode) var list=document.getElementById("myList")
list.insertBefore(newItem,list.childNodes[0]);
}
</script> <p><b>注释:</b><br>首先请创建一个 LI 节点,<br>然后创建一个文本节点,<br>然后向这个 LI 节点追加文本节点。<br>最后在列表中的首个子节点之前插入此 LI 节点。</p> </body>
</html>

再来一个动态加载css的代码:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>动态加载js和css</title>
</head>
<body> <button class="btn btn-danger">bootstrap样式按钮</button> <script src="jquery/jquery.min.js"></script>
<script type="text/javascript">
//动态加载os.js
var js = document.createElement("script");
js.type = "text/javascript";
js.src="os.js";
document.getElementsByTagName("head")[0].appendChild(js); //动态加载css
var css = document.createElement("link");
css.type = "text/css";
css.href = "bootstrap/bootstrap.min.css";
css.rel = "stylesheet";
document.getElementsByTagName("head")[0].appendChild(css); </script>
</body>
</html>

其外链接的os.js:

/**
* 判断客户端操作系统类型
*/
(function() {
var agent = navigator.userAgent.toLowerCase();
var os_type = "";
if (/android/i.test(navigator.userAgent)) {
var index = agent.indexOf("android");
version = agent.substr(index + 8, 3);
os_type = "Android " + version;
}
if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
var index = agent.indexOf("os");
version = agent.substr(index + 3, 3);
os_type = "iOS " + version;
}
if (/Linux/i.test(navigator.userAgent) && !/android/i.test(navigator.userAgent) && !/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
os_type = "Linux";
}
if (/windows|win32/i.test(navigator.userAgent)) {
os_type = "windows32";
}
if (/windows|win64/i.test(navigator.userAgent)) {
os_type = "windows64";
}
console.log("客户端类型:" + os_type);
})();

运行结果,观察console和bootstrap样式是否生效:

4.获取客户端操作系统类型

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>js代码学习</title>
<link rel="stylesheet" type="text/css" href="bootstrap/bootstrap.min.css">
<style type="text/css">
</style>
</head>
<body> <script type="text/javascript">
var OSType = detectOS(); //操作系统 console.log(OSType); //获取客户端操作系统类型
function detectOS() {
var sUserAgent = navigator.userAgent;
var isWin = (navigator.platform === "Win32") || (navigator.platform === "Windows");
var isMac = (navigator.platform === "Mac68K") || (navigator.platform === "MacPPC") || (navigator.platform === "Macintosh") || (navigator.platform === "MacIntel");
var bIsIpad = sUserAgent.match(/ipad/i) === "ipad";
var bIsIphoneOs = sUserAgent.match(/iphone os/i) === "iphone os";
var isUnix = (navigator.platform === "X11") && !isWin && !isMac;
var isLinux = (String(navigator.platform).indexOf("Linux") > -1);
var bIsAndroid = sUserAgent.toLowerCase().match(/android/i) === "android";
var bIsCE = sUserAgent.match(/windows ce/i) === "windows ce";
var bIsWM = sUserAgent.match(/windows mobile/i) === "windows mobile";
if(isMac) return "Mac";
if(isUnix) return "Unix";
if(isLinux) {
if(bIsAndroid) {
return "Android";
} else {
return "Linux";
}
}
if(bIsCE || bIsWM) {
return 'wm';
}
if(isWin) {
var isWin2K = sUserAgent.indexOf("Windows NT 5.0") > -1 || sUserAgent.indexOf("Windows 2000") > -1;
if(isWin2K) return "Win2000";
var isWinXP = sUserAgent.indexOf("Windows NT 5.1") > -1 || sUserAgent.indexOf("Windows XP") > -1;
if(isWinXP) return "WinXP";
var isWin2003 = sUserAgent.indexOf("Windows NT 5.2") > -1 || sUserAgent.indexOf("Windows 2003") > -1;
if(isWin2003) return "Win2003";
var isWinVista = sUserAgent.indexOf("Windows NT 6.0") > -1 || sUserAgent.indexOf("Windows Vista") > -1;
if(isWinVista) return "WinVista";
var isWin7 = sUserAgent.indexOf("Windows NT 6.1") > -1 || sUserAgent.indexOf("Windows 7") > -1;
if(isWin7) return "Win7";
var isWin8 = sUserAgent.indexOf("Windows NT 6.2") > -1 || sUserAgent.indexOf("Windows 8") > -1;
if(isWin8) return "Win8";
var isWin10 = sUserAgent.indexOf("Windows NT 10.0") > -1 || sUserAgent.indexOf("Windows 10") > -1;
if(isWin10) return "Win10";
}
return "other";
} /*
代码解释:
sUserAgent:
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36" navigator.platform:
"Win32" */
</script>
</body>
</html>

运行后,console打印:

5.判断浏览器类型和版本:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>js代码学习</title>
<link rel="stylesheet" type="text/css" href="bootstrap/bootstrap.min.css">
<style type="text/css">
</style>
</head>
<body> <script src="jquery/jquery.min.js"></script>
<script type="text/javascript">
var browserType = explorerType(); //浏览器 console.log(browserType); //判断浏览器
function explorerType() {
var brow = getBrowser();
var mozilla = /firefox/.test(navigator.userAgent.toLowerCase());
// $.browser.mozilla = /firefox/.test(navigator.userAgent.toLowerCase());
// $.browser.webkit = /webkit/.test(navigator.userAgent.toLowerCase());
// $.browser.opera = /opera/.test(navigator.userAgent.toLowerCase());
// $.browser.msie = /msie/.test(navigator.userAgent.toLowerCase());
var bInfo = "非主流浏览器"; if(brow.msie) {
bInfo = "MicrosoftInternetExplorer" + brow.version;
}
if(brow.mozilla) {
bInfo = "MozillaFirefox" + brow.version;
}
if(brow.safari) {
bInfo = "AppleSafari" + brow.version;
}
if(brow.opera) {
bInfo = "Opera" + brow.version;
}
if(brow.chrome) {
bInfo = "chrome" + brow.version;
}
return bInfo;
} //navigator.userAgent中取浏览器和版本
function uaMatch(e){
e=e.toLowerCase();
console.log(e); var t=/(chrome)[\/]([\w.]+)/.exec(e)
||/(webkit)[\/]([\w.]+)/.exec(e)
||/(opera)(?:.*version|)[\/]([\w.]+)/.exec(e)
||/(msie) ([\w.]+)/.exec(e)
||e.indexOf("compatible")<0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)
||[]; console.log(t); return {
browser:t[1]||"",
version:t[2]||"0"
}
} //获取浏览器信息
function getBrowser(){
var e = uaMatch(navigator.userAgent);
var t = {};
if(e.browser){
t[e.browser] = !0;
t.version = e.version;
} if(t.chrome){
t.webkit = !0;
}else{
t.webkit&&(t.safari=!0); //这句话有点问题,因为我是从min.js中翻译出来的,这句话不懂。应该是判断safari
} console.log(t); return t;
}
</script>
</body>
</html>

运行,console打印:

6.获取网站来源,从哪个网站跳转过来的:

<script type="text/javascript">
var from = ''; //来源(备选参数) var to = window.location.host + window.location.pathname; //当前url
if(to.indexOf("http://") <= -1) {
to = "http://" + to;
}
var fr_url = document.referrer; //来源
if(fr_url == '' || fr_url == 'null') {
fr_url = 'null';
} else {
fr_url = fr_url.split("?");
fr_url = String(fr_url[0]);
}
from = fr_url; console.log(from); </script>

7.获取uid的一种写法:

<script type="text/javascript">
var uid = uid(); console.log(uid); //打印 15062136704724854 //获取UID
function uid() {
u_id = (+new Date()) + Math.random().toString(10).substring(2, 6);
return u_id;
} /*
(+new Date()):
1506213347503 Math.random().toString(10):
"0.44199265208142435" toString()函数用于将当前对象以字符串的形式返回。 该方法属于Object对象,由于所有的对象都"继承"了Object的对象实例,因此几乎所有的实例对象都可以使用该方法。 所有主流浏览器均支持该函数。 number.toString(radix)
radix: 可选。规定表示数字的基数,使 2 ~ 36 之间的整数。若省略该参数,则使用基数 10。但是要注意,如果该参数是 10 以外的其他值,则 ECMAScript 标准允许实现返回任意值。
2 - 数字以二进制值显示
8 - 数字以八进制值显示
16 - 数字以十六进制值显示 例子:
var num = 15; num.toString();
"15"
var num = 15; num.toString(2);
"1111"
var num = 15; num.toString(8);
"17" */ </script>

8.体育网站上写的一种ajax请求,jsonp,error函数中的处理:

//请求传递数据
function getData_ajax(url) {
$.ajax({
type: 'get',
url: url + '?param=' + encodeURI(param),
dataType: 'jsonp',
jsonp: 'callback',
timeout: 6000,
beforeSend: function() {
// 加载提示
$('#ajax_tips').show();
},
success: function(data) {
//数据传递验证成功后执行的操作
console.log("scc-data="+JSON.stringify(data));
},
complete: function() {},
error: function(jqXHR, textStatus, errrorThrown) {
if(errrorThrown == 'Not Found') {
console.log('Your requested address is not found.');
} else if(textStatus == 'timeout') {
console.log('Verify the request timeout, please refresh the page and try again');
} else {
console.log('Your requested address is not found.');
}
}
});
}

9.效仿体育网站动态加载js,加载js完成后 执行回调函数;

加载广告js等:

<script type="text/javascript">

/**
* type 为广告类型
* 0:百度ssp正常加载方式
* 1:淘宝afp加载
* 2:防屏蔽代码加载方式
* 3:百度ssp广告异步加载方式
* 4:防屏蔽广告立即加载方式
* @type type
*/
function getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null)
return unescape(r[2]);
return null;
} $.eastday = {
qid: function () {
return getQueryString('qid') ? getQueryString('qid') : "";
},
//加载js,并且js加载完成后执行回调函数
getScript: function(url, callback, element) {
var head = document.getElementsByTagName('head')[0],
js = document.createElement('script'); js.setAttribute('type', 'text/javascript');
js.setAttribute('src', url);
if(element){
element.appendChild(js);
} else {
head.appendChild(js);
}
//执行回调
var callbackFn = function(){
if(typeof callback === 'function'){
callback();
}
}; if (document.all) { // IE
js.onreadystatechange = function() {
if (js.readyState === 'loaded' || js.readyState === 'complete') {
callbackFn();
}
};
} else {
js.onload = function() {
callbackFn();
};
}
},
//ssp正常加载方式
ssp_writer:function (corp_id,data_id) {
var s = "_" + Math.random().toString(36).slice(2);
document.write('<div class="eastday_da" data_id="' + data_id + '" id="' + s + '"></div>');
(window.slotbydup=window.slotbydup || []).push({id: corp_id, container: s, display: 'display'});
},
//ssp普通加载方式
ssp_normal : function (corp_id,data_id){
if(data_id == 'news_content_ad_top'){
this.ssp_writer(corp_id,data_id)
return
}
var width = parseInt(__da_size[data_id]["width"]) || 0;
if(!width){
this.ssp_writer(corp_id,data_id)
return
}
document.write('<iframe class="iframeDA" style="border:0 none; width:'+__da_size[data_id].width+'px; height:'+0+'px; " frameborder="0" scrolling=no src="/asspd.html?corp_id='+corp_id+'&data_id='+data_id+'"></iframe>')
},
//ssp JS动态加载方式
ssp_dynamic : function (corp_id,data_id){
return '<iframe style="border:0 none; width:'+__da_size[data_id].width+'px; height:'+__da_size[data_id].height+'px;" frameborder="0" scrolling=no src="/asspd.html?corp_id='+corp_id+'&data_id='+data_id+'"></iframe>';
},
//afp JS动态加载方式
afp_dynamic : function(corp_id,data_id){
//淘宝AFP广告
var width = parseInt(__da_size[data_id]["width"]) || 0;
var height = parseInt(__da_size[data_id]["height"]) || 0;
var dom = $('<iframe style=" width:'+__da_size[data_id].width+'px; height:'+__da_size[data_id].height+'px;" frameborder="0" scrolling="no" src="/mmad.html?mmid='+corp_id+'"></iframe>');
return dom;
},
//防屏蔽代码正常加载方式,本身为异步
fangpingbi : function (corp_id,data_id){
document.write('<script type="text/javascript" src="//tt123.eastday.com/' + corp_id + '.js"></script>');
},
//防屏蔽代码JS动态加载方式,本身为异步
fangpingbi_dynamic: function (corp_id,data_id){
var s = "_" + Math.random().toString(36).slice(2);
var dom = $('<div id="'+data_id+'+s+'"></div>');
dom.ready(function () {
$.eastday.getScript('//tt123.eastday.com/' + corp_id + '.js', function(){}, dom[0]);
});
return dom;
}
}; // 广告位高度自适应
window.setInterval(function () {
$('.iframeDA').each(function (k,iframe) {
if(iframe.contentWindow.document.body){
var bHeight = iframe.contentWindow.document.body.scrollHeight;
var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
var height = Math.max(bHeight, dHeight);
iframe.style.height = height+'px';
}
});
}, 200); </script>

代码解释:

appendChild() 方法:

<!DOCTYPE html>
<html>
<body> <ul id="myList"><li>Coffee</li><li>Tea</li></ul> <p id="demo">请点击按钮向列表中添加项目。</p> <button onclick="myFunction()">亲自试一试</button> <script>
function myFunction()
{
var node=document.createElement("LI");
var textnode=document.createTextNode("Water");
node.appendChild(textnode);
document.getElementById("myList").appendChild(node);
}
</script> <p><b>注释:</b>首先创建 LI 节点,然后创建文本节点,然后把这个文本节点追加到 LI 节点。最后把 LI 节点添加到列表中。</p> </body>
</html>

scrollHeight:  参考网站 http://www.cnblogs.com/nanshanlaoyao/p/5964730.html

10.另一种获取客户端操作系统的方法:

<script type="text/javascript">
/**
* 判断客户端操作系统类型
* 不过没有看到windows xp的。不是很全
*/
function getOsType() {
var agent = navigator.userAgent.toLowerCase(); console.log(agent); var os_type = "";
if (/android/i.test(navigator.userAgent)) {
var index = agent.indexOf("android");
version = agent.substr(index + 8, 3);
os_type = "Android " + version;
}
if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
var index = agent.indexOf("os");
version = agent.substr(index + 3, 3);
os_type = "iOS " + version;
}
if (/Linux/i.test(navigator.userAgent) && !/android/i.test(navigator.userAgent) && !/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
os_type = "Linux";
}
if (/windows|win32/i.test(navigator.userAgent)) {
os_type = "windows32";
}
if (/windows|win64/i.test(navigator.userAgent)) {
os_type = "windows64";
}
return os_type;
}; var a = getOsType(); console.log(a); </script>

11.效仿体育网站,一个回到顶部的例子:

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>js代码学习</title>
<link rel="stylesheet" type="text/css" href="bootstrap/bootstrap.min.css">
<style type="text/css">
body{
height: 2000px;
}
.back-top {
position: fixed;
left: 50%;
z-index: 99;
bottom: 50px;
}
.back-top .zd {
width: 68px;
height: 68px;
float: left;
text-align: center;
line-height: 68px;
border: 1px solid #ccc;
} </style>
</head>
<body>
<div class="back-top">
<a class="zd" id="gotop_btn">回到顶部</a>
</div> <script src="jquery/jquery.min.js"></script>
<script type="text/javascript">
//global_sider 全局侧边栏
(function () {
//绑定页面滚动事件
$(window).bind('scroll', function () {
var len = $(this).scrollTop();
if (len >= 400) { //显示回到顶部按钮
$('.back-top').show();
} else {
//影藏回到顶部按钮
$('.back-top').hide();
}
});
//顶部
$('body').on('click', '#gotop_btn', function () {
$('html').animate({scrollTop: 0})
$("html, body").filter(':not(:animated)').animate({
scrollTop: 0
});
});
})(); </script>
</body>
</html>

12.jsonp怎么用呢?

1.
adAjax: function () {
var self = this;
$.ajax({
type: 'get',
url: self.recommend_param(),
timeout: 3000,
dataType: 'jsonp',
jsonp: 'jsonp',
success: function (data) {
self.addDom(data, self)
}
})
}

13.比较两个数组是否完全相等:

<script type="text/javascript">
var array1 = ['a', 'c', 'b'];
var array2 = ['a', 'c', 'b'];
console.log(isArrayEql(array1, array2));
console.log(array1); //true
//["a", "b", "c"] /* 比较两个数组是否完全相等 */
function isArrayEql(arr1, arr2){
if(arr1 instanceof Array && arr2 instanceof Array){
var len1 = arr1.length;
var len2 = arr2.length;
if(len1 == len2){
arr1 = arrSort(arr1);
arr2 = arrSort(arr2);
return arr1.toLocaleString() == arr2.toLocaleString();
}else{
return false;
}
}else{
return false;
}
} /*
* 对数组排序
* order排序规则,asc- 升序,默认 desc - 倒序
*/
function arrSort(arr, order){
if(arr instanceof Array){
arr.sort(function(v1, v2){
if(v1 < v2){
return order=='desc'? 1:-1;
}else if(v1 > v2){
return order=='desc'? -1:1;
}else{
return 0;
}
});
return arr;
}else{
return arr;
}
}
</script>

注意:上面代码的一个弊端也是:比较完大小之后,把array1的顺序排序了。

14.

---------

《js笔记》的更多相关文章

  1. 简单物联网:外网访问内网路由器下树莓派Flask服务器

    最近做一个小东西,大概过程就是想在教室,宿舍控制实验室的一些设备. 已经在树莓上搭了一个轻量的flask服务器,在实验室的路由器下,任何设备都是可以访问的:但是有一些限制条件,比如我想在宿舍控制我种花 ...

  2. 利用ssh反向代理以及autossh实现从外网连接内网服务器

    前言 最近遇到这样一个问题,我在实验室架设了一台服务器,给师弟或者小伙伴练习Linux用,然后平时在实验室这边直接连接是没有问题的,都是内网嘛.但是回到宿舍问题出来了,使用校园网的童鞋还是能连接上,使 ...

  3. 外网访问内网Docker容器

    外网访问内网Docker容器 本地安装了Docker容器,只能在局域网内访问,怎样从外网也能访问本地Docker容器? 本文将介绍具体的实现步骤. 1. 准备工作 1.1 安装并启动Docker容器 ...

  4. 外网访问内网SpringBoot

    外网访问内网SpringBoot 本地安装了SpringBoot,只能在局域网内访问,怎样从外网也能访问本地SpringBoot? 本文将介绍具体的实现步骤. 1. 准备工作 1.1 安装Java 1 ...

  5. 外网访问内网Elasticsearch WEB

    外网访问内网Elasticsearch WEB 本地安装了Elasticsearch,只能在局域网内访问其WEB,怎样从外网也能访问本地Elasticsearch? 本文将介绍具体的实现步骤. 1. ...

  6. 怎样从外网访问内网Rails

    外网访问内网Rails 本地安装了Rails,只能在局域网内访问,怎样从外网也能访问本地Rails? 本文将介绍具体的实现步骤. 1. 准备工作 1.1 安装并启动Rails 默认安装的Rails端口 ...

  7. 怎样从外网访问内网Memcached数据库

    外网访问内网Memcached数据库 本地安装了Memcached数据库,只能在局域网内访问,怎样从外网也能访问本地Memcached数据库? 本文将介绍具体的实现步骤. 1. 准备工作 1.1 安装 ...

  8. 怎样从外网访问内网CouchDB数据库

    外网访问内网CouchDB数据库 本地安装了CouchDB数据库,只能在局域网内访问,怎样从外网也能访问本地CouchDB数据库? 本文将介绍具体的实现步骤. 1. 准备工作 1.1 安装并启动Cou ...

  9. 怎样从外网访问内网DB2数据库

    外网访问内网DB2数据库 本地安装了DB2数据库,只能在局域网内访问,怎样从外网也能访问本地DB2数据库? 本文将介绍具体的实现步骤. 1. 准备工作 1.1 安装并启动DB2数据库 默认安装的DB2 ...

  10. 怎样从外网访问内网OpenLDAP数据库

    外网访问内网OpenLDAP数据库 本地安装了OpenLDAP数据库,只能在局域网内访问,怎样从外网也能访问本地OpenLDAP数据库? 本文将介绍具体的实现步骤. 1. 准备工作 1.1 安装并启动 ...

随机推荐

  1. UVA 11019 Matrix Matcher(二维hash + 尺取)题解

    题意:在n*m方格中找有几个x*y矩阵. 思路:二维hash,总体思路和一维差不太多,先把每行hash,变成一维的数组,再对这个一维数组hash变成二维hash.之前还在想怎么快速把一个矩阵的hash ...

  2. Mac下安装hexo Error: Cannot find module './build/Release/DTraceProviderBindings 解决

    参考: Github:Mac 下已经装了hexo,仍旧报错 官方文档 $ npm install hexo --no-optional if it doesn't work try $ npm uni ...

  3. Docker:Err http://archive.ubuntu.com trusty InRelease & E: Unable to locate package [name] 问题

    参考: Docker containers can't resolve DNS on Ubuntu 14.04 Desktop Host Unable to locate package错误解决办法 ...

  4. Win10累积更新KB3081424安装失败的解决方法

    我在个人的PC上多次更新KB3081424都失败了,后来按照网上给出的删除注册表残留项的方法后更新成功了(删除注册表残留项后我还执行了从微软帐户切换到本地帐户的操作,有兴趣的朋友可以试试不切换能否更新 ...

  5. hiho一下 第二周 trie树

    Trie树 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 小Hi和小Ho是一对好朋友,出生在信息化社会的他们对编程产生了莫大的兴趣,他们约定好互相帮助,在编程的学习道路 ...

  6. pairs 和 ipairs区别

    local tab= { [] = "a", [] = "b", [] = "c" } for i,v in pairs(tab) do - ...

  7. 【Python】实现将testlink上的用例指定格式保存至Excel,用于修改上传

    背景 前一篇博客记录的可以上传用例到testlink指定用例集的脚本,内部分享给了之后,同事希望能将testlink上原有的用例下载下来,用于下次修改上传,所有有了本文脚本. 具体实现 获取用例信息 ...

  8. UVA-1336 Fixing the Great Wall(区间DP)

    题目大意:长城(视作x正半轴)有n处破损.有一个智能修复机器人,它的初始位置和移动速度已知.每处破损处都有一组参数(x,c,d),x表示位置,c.d表示在时间t后再修复该处破损的花费为d*t+c.求用 ...

  9. restframework api (二)权限

    一 添加权限 (1)API/utils文件夹下新建premission.py文件,代码如下: message是当没有权限时,提示的信息 # utils/permission.py class SVIP ...

  10. [转]Ubuntu默认root用户密码

    Ubuntu默认root用户密码 在试验的过程中,安装完Ubuntu后忽然意识到没有设置root密码,不知道密码自然就无法进入根用户下. 到网上搜了一下,原来是这么回事:Ubuntu的默认root密码 ...