- 博客(25)
- 资源 (5)
- 收藏
- 关注
原创 Django Cross Site Request Forgery protection(csrf,csrf_token)
在构建Django应用的时候如果涉及到表单或者一些ajax数据的提交操作,就难免会遇到csrf的问题,一般来说按照官网解说示例走都没啥问题,但是!大部分人不看官网文档,东拼一点,西凑一点,应用是跑起来了,但是出现点相关问题又是摸不着头脑;而且有些时候就算在官网看文档也是找不对地方,比如文档版本和应用框架不匹配,导致部分操作根本对不上。今天我看了一下官网对于Django 2.0中Cross Si...
2018-08-22 19:06:22 593
转载 一个脚本搞定各linux平台下docker安装
以下脚本来自(https://get.docker.com),本人亲自验证通过#!/bin/shset -e#面试会问这里为什么这样写?# This script is meant for quick & easy install via:# $ curl -fsSL get.docker.com -o get-docker.sh# $ sh get-docker.s...
2018-08-20 20:16:15 2569
原创 下载centos7 with python3 docker镜像无法使用yum源的原因以及solution
下载centos7 with python3 docker镜像无法使用yum源的原因以及solution可能大多数人都不知道yum的可执行程序使用什么语言写的,请看:[lockey@7-o-1 ~]# cat /usr/bin/yum#!/usr/bin/pythonimport systry: import yumexcept ImportError: print...
2018-08-20 19:48:35 1290
原创 Spark Machine Learning Error analysis and solution(Error with RDD[Vector];Vector takes type paramet)
While we follow spark example case class model_instance (features: Vector)//andval df = rawData.map(line => | { model_instance( Vectors.dense(line.split(",").filter(p => p.matches("\...
2018-08-20 19:32:33 1156
原创 Git error solution for “unable to resolve reference” “unable to update local ref”
大清早就遇到一个意外的问题,幸好在stackoverflow上找到了对应topicerror: unable to resolve reference refs/remotes/origin/master: No such file or directory! [new branch] master -> origin/master (unable to upda...
2018-08-16 10:19:54 1331
原创 Error solution for polyglot(No module named 'icu'、No module named '_bz2' )
系统环境redhat7.1 python3.6polyglot 16.7.4pip install polyglotimport polyglotfrom polyglot.text import Text, WordError 1 :No module named ‘icu’---> 11 from icu import Locale 12 import ...
2018-08-15 21:43:26 2996
原创 spark2.3.1执行Spark SQL操作Parquet数据源错误解决(UnsatisfiedLinkError:uncompressedLength(Ljava/nio/ByteBuffer)
scala> namesDF.foreach(attributes =>println("Name: " + attributes(0)+" favorite color:"+attributes(1)))[Stage 1:> (0 + 1) / 1]2018-0...
2018-08-14 14:08:28 1812
原创 spark 2.3.1集群搭建(Master,Slave,Slave)
基础配置同上篇博客配置教程请先参阅:厦门大学数据库实验室系列博客 Spark 2.0分布式集群环境搭建需要注意的配置有两个cd /usr/local/spark/cp ./conf/slaves.template ./conf/slaves#slaves文件设置Worker节点。编辑slaves内容,把默认内容localhost替换成如下内容:slave1slave2...
2018-08-10 23:51:37 4272
原创 Hadoop 2.9.1 Fully-Distributed Cluster Setup
环境准备:系统:ubuntu 16.10(3 servers)Virtualization: vmwareOperating System: Ubuntu Zesty Zapus (development branch)Kernel: Linux 4.8.0-22-genericArchitecture: x86-64解析配置:lockey@ubuntu-lockey:~$ ...
2018-08-10 21:24:21 581
原创 用面向对象的思想实现一个有理数以及有理数的加减乘除运算——Python版本
class Rational(object): def __init__(self,a,b=1): if(b ==0 ):#对于分母为0的情况直接举异常 raise Exception("Denominator must not be 0!") else: g = self.gcd(abs(a), abs(b))#求分子分母的最大公约数然后进行约分 ...
2018-08-08 19:08:42 2410
原创 用面向对象的思想实现一个有理数以及有理数的加减乘除运算——Scala版本
有理数有理数是“数与代数”领域中的重要内容之一,在现实生活中有广泛的应用,是继续学习实数、代数式、方程、不等式、直角坐标系、函数、统计等数学内容以及相关学科知识的基础。数学上,有理数是一个整数a和一个正整数b的比,例如3/8,通则为a/b。0也是有理数。有理数是整数和分数的集合,整数也可看做是分母为一的分数。有理数的小数部分是有限或为无限循环的数。不是有理数的实数称为无理数,即无理数的小数部分...
2018-08-08 19:02:41 1033 1
原创 python杂记20180806
python buildin functions: https://www.programiz.com/python-programming/methods/built-in/abssorted() Parameterssorted() takes two three parameters: iterable - sequence (string, tuple, lis...
2018-08-06 20:50:23 316
原创 Codility编程课一MaxProductOfThree
MaxProductOfThreeMaximize A[P] * A[Q] * A[R] for any triplet (P, Q, R).Task descriptionA non-empty array A consisting of N integers is given. The product of triplet (P, Q, R) equates to A[P] ...
2018-08-06 20:46:57 538
原创 Codility编程课一MinAvgTwoSlice
MinAvgTwoSliceFind the minimal average of any slice containing at least two elements.Task descriptionA non-empty array A consisting of N integers is given. A pair of integers (P, Q), such tha...
2018-08-03 18:46:42 848
原创 Codility编程课一GenomicRangeQuery(Find the minimal nucleotide from a range of sequence DNA.)
GenomicRangeQueryFind the minimal nucleotide from a range of sequence DNA.Task descriptionA DNA sequence can be represented as a string consisting of the letters A, C, G and T, which correspo...
2018-08-03 18:37:56 643
原创 Codility编程课一CountDiv(Compute number of integers divisible by k in range [a..b])
CountDivCompute number of integers divisible by k in range [a..b].Task descriptionWrite a function:def solution(A, B, K)that, given three integers A, B and K, returns the number of intege...
2018-08-03 18:36:33 468
原创 有向无环图转换为Excel再到网页呈现
首先我们需要从后端读取Excel然后做一次数据过滤:主要是去除空行以及空列,然后将数据结构转换为二位列表以合理的方式传递到前端>>> import pandas as pd>>> df = pd.read_excel('test.xlsx')>>> df a Unnamed: 1 b d Unnamed:...
2018-08-02 20:28:35 574
原创 Codility编程课一PassingCars(Count the number of passing cars on the road.)
PassingCarsCount the number of passing cars on the road.A non-empty array A consisting of N integers is given. The consecutive elements of array A represent consecutive cars on a road.Array A c...
2018-08-02 20:08:37 755
原创 Codility编程课一MaxCounters
MaxCountersCalculate the values of counters after applying all alternating operations: increase counter by 1; set value of all counters to current maximum.Description:You are given N counters...
2018-08-02 20:02:36 975
原创 Codility编程课一MissingInteger
MissingIntegerFind the smallest positive integer that does not occur in a given sequence.Task descriptionThis is a demo task.Write a function:def solution(A)that, given an array A of N in...
2018-08-01 23:34:56 1810
原创 Codility编程课一FrogRiverOne(Find the earliest time when a frog can jump to the other side of a river.)
FrogRiverOneFind the earliest time when a frog can jump to the other side of a river.Task descriptionA small frog wants to get to the other side of a river. The frog is initially located on o...
2018-08-01 23:31:40 920
原创 Codility编程课一PermCheck(Check whether array A is a permutation.)
PermCheckTask descriptionA non-empty array A consisting of N integers is given.A permutation is a sequence containing each element from 1 to N once, and only once.For example, array A such tha...
2018-08-01 23:29:20 575
原创 Codility编程课一 TapeEquilibrium(Minimize the value |(A[0] + ... + A[P-1]) - (A[P] + ... + A[N-1])|.)
TapeEquilibriumTask descriptionA non-empty array A consisting of N integers is given. Array A represents numbers on a tape.Any integer P, such that 0 < P < N, splits this tape into two n...
2018-08-01 23:26:51 475
原创 Codility编程课一 PermMissingElem(Find the missing element in a given permutation.)
PermMissingElemTask descriptionAn array A consisting of N different integers is given. The array contains integers in the range [1..(N + 1)], which means that exactly one element is missing.Yo...
2018-08-01 23:24:27 475
原创 Codility编程课一 FrogJmp(Count minimal number of jumps from position X to Y.)
FrogJmpTask descriptionA small frog wants to get to the other side of the road. The frog is currently located at position X and wants to get to a position greater than or equal to Y. The small f...
2018-08-01 23:20:16 385
saltstack安装rpm包以及依赖(rhel65)
2017-10-13
Python3.6.2
2017-09-02
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人