获取url参数以及出现乱码
//获取url中的参数
function getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
var r = window.location.search.substr(1).match(reg); //匹配目标参
nginx FastCGI 安装配置
yum install epel-release
yum install fcgi-devel //安装fastcgi库
请去 : https://github.com/gnosek/fcgiwrap 下载 fcgiwrap
tar zxf fcgiwrap-1.0.3.tar.gz
cd fcgiwrap-1.0.3
autoreconf -i
./configure
make
Elasticsearch安装及其插件安装
安装
环境必须是java环境;如果设置java环境变量设置之后启动加载不了环境变量,可以打开启动文件在
fi
echo 111
echo $JAVA_HOME
if [ -x "$JAVA_HOME/bin/java" ]; then
JAVA="$JAVA_HOME/bin/java"
else
JAVA=`which java`
fi
if [ ! -x "$JA
hdu-2685 I won't tell you this is about number theory---gcd和快速幂的性质
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=2685 题目大意: 求gcd(am-1,an-1)%k 解题思路: 对于am-1 = (a - 1) * (1 + a + a2 + ... + am-1) 所以最开始的gcd就为a-1 对于两个1 + a + a2 + ... + am-1和1 + a + a2 + ... + an-1来说,可以找出gcd(m, n)那么久就可以提出gcd 比如: 1 + a + a2 + a3 1 + a +
python 面向对象 字典 有序字典
和原来字典一模一样 把dict 传进去 相当于这个类就是一个字典 # 把dict 传进去 相当于这个类就是一个字典
class Mydict(dict):
pass
d = Mydict()
print(Mydict)
print(d)
'''
<class '__main__.Mydict'>
{}
''' 设置字典 # 把dict 传进去 相当于这个类就是一个字典
class Mydict(dict):
pass
d = Mydict()
# 设置字典
the Way of Python Day 3
today,i learned so much knowledge about the basis of python. firstly,i studied methematical operators like '+','/' and so on. for instance,2*3=5 , 4/2=2.0 and so on. And, i also knew about comparison operators like '>','<=','==' and the rest. fo
golang subprocess tests
golang Subprocess tests Sometimes you need to test the behavior of a process, not just a function. func Crasher() {
fmt.Println("Going down in flames!")
os.Exit(1)
} To test this code, we invoke the test binary itself as a subprocess: func T
c++中递归方法问题
怎样用递归方法解决问题 问题: 用一个递归函数计算用户输入的n值的阶乘,并进行输出。 遇到的问题 1、递归理解不够深,首先要想到在满足什么条件下用递归,在满足什么条件下递归结束并接返回一个值。 2、最重要的就是递归的逻辑,比如以下代码 // 实验九(1).cpp: 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include<iostream>
using namespace std;
int factorial(int n)
{
int f=1;
Scrapy爬虫框架第七讲【ITEM PIPELINE用法】
ITEM PIPELINE用法详解: ITEM PIPELINE作用: 清理HTML数据 验证爬取的数据(检查item包含某些字段) 去重(并丢弃)【预防数据去重,真正去重是在url,即请求阶段做】 将爬取结果保存到数据库中 ITEM PIPELINE核心方法(4个) (1)、open_spider(spider) (2)、close_spider(spider) (3)、from_crawler(cls,crawler) (4)、process_item(item,spider) 下面小伙伴
Vagrant 中配置局域网端口
1. 在自己的电脑中想使用Vagrant在局域网中安装centos,并将其ip释放到局域网中提供给自己的机器访问,这种操作需要在VagrantFile中加入如下配置 config.vm.network "private_network", ip: "192.168.21.4"
2. 解决ssh登录不上去的问题 首先vagrant得默认密码为vagrant(不管是root还是vagrant) 链接会出现如下错误 Permission denied (publickey,gssapi-keye
BZOJ 2440 中山市市选2011 完全平方数
2440: [中山市选2011]完全平方数 Time Limit: 10 Sec Memory Limit: 128 MB Submit: 5127 Solved: 2492 [Submit][Status][Discuss] Description 小 X 自幼就很喜欢数。但奇怪的是,他十分讨厌完全平方数。他觉得这些 数看起来很令人难受。由此,他也讨厌所有是完全平方数的正整数倍的数。然而 这丝毫不影响他对其他数的热爱。 这天是小X的生日,小 W 想送一个数给他作为生日礼物。当然他不能送一 个
logback为单独的包或者类配置输出文件
最近接一个这样的需求,为某个类的日志输出到指定的文件。一般都是按日志级别输出到对应的文件中。查阅相关资料和logback教程,写出下面的demo供参考。 1.添加一个appender <!-- jetty日志单独输出 --> <appender name="demo—all" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${rootpath}gateserver_demo-all.log</f
go语言练习:sha256、sha512哈希算法
package main import ( "fmt" "crypto/sha256" ) func main() { str:="test hash..." s_ob:=sha256.New() s_ob.Write([]byte(str)) r:=s_ob.Sum(nil) fmt.Printf("%x\n",r) } //sha256: 59039ef3b6f6ab469c357616b365b4b59a28c32d8ee880160e
牛客网练习赛18 A 【数论/整数划分得到乘积最大/快速乘】
链接:https://www.nowcoder.com/acm/contest/110/A 来源:牛客网 题目描述 这题要你回答T个询问,给你一个正整数S,若有若干个正整数的和为S,则这若干的数的乘积最大是多少?请输出答案除以2000000000000000003(共有17 个零) 的余数。 举例来说,当 S = 5 时,若干个数的和为 5 的情形有以下 7 种(不考虑数字的顺序的话): 1 + 1 + 1 + 1 + 1 1 + 1 + 1 + 2 1 + 1 + 3 1 + 2 + 2 1
elasticsearch 查询删除文档
先安装查询删除插件
Installation
This plugin can be installed using the plugin manager:
sudo bin/plugin
install delete-by-query
The plugin must be installed on every node in the cluster, and each node mus
如何在Centos官网下载所需版本的Centos——靠谱的Centos下载教程
很多小伙伴不知道对应版本的Centos怎么下载,最近小编整理了一份Centos详细的下载教程,希望小伙伴们不在为下不到对应版本的Centos而苦恼。1、进入Centos官网:https://www.centos.org/download/不要点击黄颜色背景的下载框,如:DVD ISO,Everything ISO,Minimal ISO,而是点击红色框框内的alternative download
陆奇离任百度总裁波澜不惊!李彦宏或将开启“御驾亲征”模式
才上任486天的陆奇离职,并不是关键!关键在于,陆奇的离职,或将开启百度董事长兼CEO李彦宏的“御驾亲征”模式。这或许远比百度即将成就的“千亿市值”,更加让人期待!
今日推荐
周排行