自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(445)
  • 资源 (5)
  • 收藏
  • 关注

原创 Linux 技巧:让进程在后台运行更可靠的几种方法

开始概念之前首先上几个实战问答:1 .如何过滤占用某个端口的进程并且kill掉?例答: kill -9 lsof -n -P -i TCP -s TCP:LISTEN | grep 8000 | awk '{print $2}'简答: kill -9 lsof -i:8000 | grep 8000 | awk '{print $2}'2 .如何过滤出带有某些关键字符的运行程序并且kil...

2019-06-20 20:17:09 715

原创 React循环遍历渲染数组和对象元素

遍历渲染数组1.单纯数组const pureArr = ['a','b','c','d']//假如我们想将上面的数组利用react渲染成一个列表,代码如下:{{pureArr.map(item => (<li key={item}>item</li>))}以上代码在codesandbox中运行结果如下:2. 对象数组const objArr =...

2019-04-28 10:22:51 43493 2

原创 关于bash数组的几道面试笔试题—航班延误5h的郁闷都在此文

数组作为最常使用和最基本的数据结构存在于各种编程语言中,但各语言里数组的定义、使用以及对应的属性方法各不相同,本文将从面试的角度出发,带领大家一同走近那个最熟悉又陌生的Bash Array【ə’reɪ】1. 如何定义一个包含多种数据类型元素的数组虽然很基础,但是其他语言写久了很多人忘了括号包围,忘了空格分割元素,忘了混合类型arr=(Hello World 'Hello World' 1 2...

2019-08-28 23:07:22 615

转载 javascript atob()函数和 btoa()函数-Base64的编码与解码

在 JavaScript 中,有两个函数被分别用来处理解码和编码 base64 字符串:atob() //ASCII to Base64btoa() //Base64 to ASCIIatob() 函数能够解码通过base-64编码的字符串数据。相反地,btoa() 函数能够从二进制数据“字符串”创建一个base-64编码的ASCII字符串。Encoded size increase...

2019-06-13 08:31:57 17332 1

原创 迭代修改javascript对象的每一个属性值或者返回一个新对象

使用map方法迭代修改原有对象var myObject = { 'a': 1, 'b': 2, 'c': 3 };Object.keys(myObject).map(function(key, index) { myObject[key] *= 2;});console.log(myObject);// => { ‘a’: 2, ‘b’: 4, ‘c’: 6 }使用 fo...

2019-06-13 08:09:03 5813

转载 Javascript arrow function--箭头函数

箭头函数有别于函数表达式,它更加简洁,并且没有自己的this,arguments,super或 new.target。箭头函数更适用于那些本来需要匿名函数的地方,并且它们不能用作构造函数。基本语法(参数1, 参数2, …, 参数N) => { 函数声明 }//相当于:(参数1, 参数2, …, 参数N) =>{ return 表达式; }(参数1, 参数2, …, 参数N) ...

2019-04-21 23:28:45 688

原创 Javascript读取上传文件内容/类型/字节数

在网站开发的某些情况下我们需要上传文件到服务器,在这个过程中可能会对文件做一定的限制,比如说文件格式,文件大小等,在一些情况下我们上传文件其实是为了获取其中的内容在前端区域展示,这个时候就不需要将文件上传到服务器,完全可以通过Javascript来获取上传文件内容然后进行展示,既加快了操作速度,也减轻了服务器的负载和存储。接下来就是一个实际操作的过程:首先来看一下一个上传文件对象的属性:UI...

2019-03-22 15:52:34 1388

原创 React搭配好用的图表模块Recharts

如果你正在寻找一个图表库||插件||模块来为你的React应用绘制一些统计||分析图表,那么本文可能会给你一些解决方法,并且你会看到一个本人正在使用的插件效果示例。福利推荐:一个拥有多个10+主题的网站,such as:Top 10+ React Graph Chart Libraries with Demo正题:Recharts, 基于 React 的组合式图表基本的使用方法就不多说了,官...

2019-03-16 16:01:22 3128 2

原创 Linux Screen 命令使用笔记

OverviewScreen is a full-screen window manager(窗口管理器) that multiplexes a physical terminal between several processes, typically interactive shells. Each virtual terminal provides the functions of the...

2019-02-11 21:28:30 1324 1

翻译 authentication in Django

Customizing authentication in Django-结合Django的认证机制添加自定义的认证后端Django有一套自己的认证机制,一般默认设置(在setting.py中)为:AUTHENTICATION_BACKENDS = ['django.contrib.auth.backends.ModelBackend']其主要使用了自带的User模型来进行一些验证,我们也...

2018-10-15 23:50:57 453

原创 Django Cross Site Request Forgery protection(csrf,csrf_token)

在构建Django应用的时候如果涉及到表单或者一些ajax数据的提交操作,就难免会遇到csrf的问题,一般来说按照官网解说示例走都没啥问题,但是!大部分人不看官网文档,东拼一点,西凑一点,应用是跑起来了,但是出现点相关问题又是摸不着头脑;而且有些时候就算在官网看文档也是找不对地方,比如文档版本和应用框架不匹配,导致部分操作根本对不上。今天我看了一下官网对于Django 2.0中Cross Si...

2018-08-22 19:06:22 557

转载 一个脚本搞定各linux平台下docker安装

以下脚本来自(https://get.docker.com),本人亲自验证通过#!/bin/shset -e#面试会问这里为什么这样写?# This script is meant for quick &amp; easy install via:# $ curl -fsSL get.docker.com -o get-docker.sh# $ sh get-docker.s...

2018-08-20 20:16:15 2533

原创 下载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 1244

原创 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 =&gt; | { model_instance( Vectors.dense(line.split(",").filter(p =&gt; p.matches("\...

2018-08-20 19:32:33 1118

原创 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 -&gt; origin/master (unable to upda...

2018-08-16 10:19:54 1250

原创 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’---&amp;gt; 11 from icu import Locale 12 import ...

2018-08-15 21:43:26 2876

原创 spark2.3.1执行Spark SQL操作Parquet数据源错误解决(UnsatisfiedLinkError:uncompressedLength(Ljava/nio/ByteBuffer)

scala&gt; namesDF.foreach(attributes =&gt;println("Name: " + attributes(0)+" favorite color:"+attributes(1)))[Stage 1:&gt; (0 + 1) / 1]2018-0...

2018-08-14 14:08:28 1759

原创 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 4182

原创 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 561

原创 用面向对象的思想实现一个有理数以及有理数的加减乘除运算——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 2349

原创 用面向对象的思想实现一个有理数以及有理数的加减乘除运算——Scala版本

有理数有理数是“数与代数”领域中的重要内容之一,在现实生活中有广泛的应用,是继续学习实数、代数式、方程、不等式、直角坐标系、函数、统计等数学内容以及相关学科知识的基础。数学上,有理数是一个整数a和一个正整数b的比,例如3/8,通则为a/b。0也是有理数。有理数是整数和分数的集合,整数也可看做是分母为一的分数。有理数的小数部分是有限或为无限循环的数。不是有理数的实数称为无理数,即无理数的小数部分...

2018-08-08 19:02:41 1004 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 296

原创 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 512

原创 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 819

原创 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 612

原创 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 439

原创 有向无环图转换为Excel再到网页呈现

首先我们需要从后端读取Excel然后做一次数据过滤:主要是去除空行以及空列,然后将数据结构转换为二位列表以合理的方式传递到前端&gt;&gt;&gt; import pandas as pd&gt;&gt;&gt; df = pd.read_excel('test.xlsx')&gt;&gt;&gt; df a Unnamed: 1 b d Unnamed:...

2018-08-02 20:28:35 548

原创 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 728

原创 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 944

原创 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 1772

原创 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 882

原创 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 544

原创 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 &lt; P &lt; N, splits this tape into two n...

2018-08-01 23:26:51 452

原创 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 431

原创 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 366

原创 Codility编程课一 Find unpaired element

Task descriptionA non-empty array A consisting of N integers is given. The array contains an odd number of elements, and each element of the array can be paired with another element that has the sam...

2018-07-31 23:05:57 514

原创 Codility编程课一 Array Rotation

Task descriptionAn array A consisting of N integers is given. Rotation of the array means that each element is shifted right by one index, and the last element of the array is moved to the first pla...

2018-07-31 20:11:48 682 1

原创 Codility编程课一binary gap

Task descriptionA binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N.For example, number ...

2018-07-31 19:53:28 583

原创 python 使用xlsxwriter 实现有向无环图到Excel的转换

本程序假定有向无环图已经存在def generate_excel(dag, row_start,col_start,excel_file):#参数分别为有向无环图图、开始写入的行,开始写入列,以及文件名 import xlsxwriter#导入Excel操作模块 workbook = xlsxwriter.Workbook(excel_file)#创建Excel文件 w...

2018-07-27 21:51:59 410

原创 Python implementation of directed acyclic graph(python实现的有向无环图)

Python implementation of directed acyclic graph(python实现的有向无环图)关于此实现可以在GitHub上找到开源模块缘由:项目中用到了dag来表示某个数据分析的结果,然后需要转换成Excel来显示(此话题将在下一篇博客中) 然后又要将Excel内容以原样展示到网页中(此话题将在下下一篇博客中) python实现此数据结构的时候...

2018-07-27 21:15:03 1237

codis3.2.0-go1.7.5-linux.tar.gz安装包

codis3.2.0-go1.7.5-linux.tar.g安装包,我也不知道50个字符要写什么

2017-10-18

saltstack安装rpm包以及依赖(rhel65)

saltstack,saltstack-yum-install,this is a rpm package for saltstack install based on rhel65 os, once you download it, you can create a local rpm dir for yum installation

2017-10-13

Python3.6.2

This is a python source package with .tgz format 这是.tgz格式的python源码安装包,如果嫌弃官网的下载速度太慢的话可以从这里下载,这是本人在安装python过程中从官网下载的,安全和完整性可以保证!

2017-09-02

iptables简介文档

iptables

2017-08-20

Python3.5.4

python3.5.4源码包

2017-08-13

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除