- 博客(29)
- 资源 (8)
- 收藏
- 关注
原创 sudo: add-apt-repository: command not found
在安装Vim 8.0的时候,需要执行:sudo add-apt-repository ppa:jonathonf/vim但是执行的时候报错:sudo: add-apt-repository: command not found实际上add-apt-repository是由Python-software-properties这个工具包提供的,所以安装一下python-software-properti
2017-02-28 17:25:54 3008
原创 Ubuntu-Could not get lock /var/lib/dpkg/lock
今天想在Linux上装一个工具,没想到安装的时候竟然报错:E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)E: Unable to lock the administration directory (/var/lib/dpkg/), is another process u
2017-02-27 18:48:07 301
原创 Find Largest Value in Each Tree Row
You need to find the largest value in each row of a binary tree.Example:Input: 1 / \ 3 2 / \ \ 5 3 9 Output: [1, 3, 9]还是做好行遍历就行了,代码与[Find Bottom Left T
2017-02-27 16:18:19 245
原创 Find Bottom Left Tree Value
题目地址:https://leetcode.com/problems/find-bottom-left-tree-value/?tab=DescriptionGiven a binary tree, find the leftmost value in the last row of the tree.Example 1:Input: 2 / \ 1 3Output:1Exam
2017-02-27 10:51:07 343
原创 Counting Bits
题目地址:https://leetcode.com/problems/counting-bits/?tab=DescriptionGiven a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1’s in their binary repres
2017-02-27 09:54:41 229
原创 Ransom Note
题目地址:https://leetcode.com/problems/ransom-note/?tab=DescriptionGiven an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true
2017-02-24 18:28:50 249
原创 Detect Capital
题目地址:https://leetcode.com/problems/detect-capital/?tab=DescriptionGiven a word, you need to judge whether the usage of capitals in it is right or not.We define the usage of capitals in a word to be rig
2017-02-24 17:51:04 313
原创 Valid Perfect Square
题目地址:https://leetcode.com/problems/valid-perfect-square/?tab=DescriptionGiven a positive integer num, write a function which returns True if num is a perfect square else False.Note: Do not use any buil
2017-02-24 17:15:51 211
原创 Search Insert Position
题目地址:https://leetcode.com/problems/search-insert-position/?tab=DescriptionGiven a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if
2017-02-24 15:46:05 221
转载 MyBatis(一)
简介什么是MyBatis ?MyBatis是支持定制化 SQL、存储过程以及高级映射的优秀的持久层框架。MyBatis避免了几乎所有的 JDBC 代码和手动设置参数以及获取结果集。MyBatis可以对配置和原生Map使用简单的 XML 或注解,将接口和 Java 的 POJOs(Plain Old Java Objects,普通的 Java对象)映射成数据库中的记录。入门安装要使用MyBatis,
2017-02-21 11:17:36 890
原创 高斯混合模型(Gaussian Mixture Model,GMM)
先从简单的离散型随机变量看起离散型随机变量P{X=ak}=pk,k=1,2,3,...,nP\{X=a_k\} = p_k, k = 1, 2, 3, ..., n 其中:∑i=1npi=1\sum_{i=1}^n p_i=1 那么它的期望值是:E(X)=∑kakpkE(X)=\sum_k a_kp_k以上都是中学数学知识,那么到了高等数学的概率论与数理统计这门课才开始讨论连续随机变量的情况。如
2017-02-17 18:24:09 11988
原创 K-means聚类算法
K-means算法又称K均值算法,它是聚类算法中最为简单的算法,也是最为常用的聚类算法。K-means算法主要用于对已知数据集进行非监督聚类,聚类效果的好坏不仅与数据样本有关,而且与聚类质心的选取,以及质心的数目也有很大关系。在聚类算法中,我们已知训练集{x(1),...,x(m)}\{x^{(1)}, ..., x^{(m)}\},我们想把这些数据聚合成一些比较集中的“聚类”。在这里,一般情况下x
2017-02-17 12:59:07 977
原创 Python将主机名转换为IP地址
关于主机名转IP地址只记住两点即可:英特网协议一直都是用4字节的IP将包转发给目的地;至于主机名是如何转换成IP地址的,这是操作系统关心的事情;import sockethostname = 'www.baidu.com'addr = socket.gethostbyname(hostname)print 'The address of', hostname, 'is', addr输出:T
2017-02-16 15:19:22 4326
转载 HTTP状态码
1 消息100:继续客户端应当继续发送请求。客户端应当继续发送请求的剩余部分,或者如果请求已经完成,忽略这个响应。101: 转换协议在发送完这个响应最后的空行后,服务器将会切换到在Upgrade 消息头中定义的那些协议。只有在切换新的协议更有好处的时候才应该采取类似措施。102:继续处理由WebDAV(RFC 2518)扩展的状态码,代表处理将被继续执行。2 成功200:请求成功处理方式:获得响应的
2017-02-16 10:28:35 339
原创 PyCharm切换Python版本
由于代码格式问题,很多情况下需要我们去切换Python版本,那么在当下火爆的PyCharm中是如何切换Python版本的呢?打开File菜单,选择Settings: 打开Settings窗口后,选择Project: prjectName下面的Porject Interpreter,然后出现下图: 最后在该窗口的右面Porject Interpreter下拉菜单中选择想要的Python版本
2017-02-16 09:57:12 40013 2
原创 OSI各层功能及协议
OSI中的层 功能 TCP/IP协议族 应用层 文件传输,电子邮件,文件服务,虚拟终端 TFTP,HTTP,SNMP,FTP,SMTP,DNS,Telnet 表示层 数据格式化,代码转换,数据加密 没有协议 会话层 解除或建立与别的接点的联系 没有协议 传输层 提供端对端的接口 TCP,UDP 网络层 为数据包选择路由 IP,ICMP
2017-02-15 22:58:55 534
原创 C/C++中的堆栈分配情况
一般而言,C/C++程序占用的内存分为以下几个部分:1、栈区(stack)— 由编译器自动分配释放 ,存放函数的参数值,局部变量的值等。其操作方式类似于数据结构中的栈。2、堆区(heap) — 一般由程序员分配释放, 若程序员不释放,例如malloc、free,程序结束时可能由OS回收 。注意它与数据结构中的堆是两回事,分配方式倒是类似于链表。3、全局区(静态区)(static)—,全局变量和静态变
2017-02-15 21:12:12 710
原创 ImportError: No module named 'urllib2'
今天试了一下一段简单的代码:import urllib2response = urllib2.urlopen("http://www.baidu.com")print response.read()运行后报错:Traceback (most recent call last): File "D:/PycharmProjects/network_test/scrapy.py", line 1,
2017-02-15 09:36:23 13202 4
原创 Convert Sorted Array to Binary Search Tree
题目地址:https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/Given an array where elements are sorted in ascending order, convert it to a height balanced BST.题目要求将一个有序数组转换为一个平衡二叉树,很明显题
2017-02-13 19:27:52 453
原创 Base 7
题目地址:https://leetcode.com/problems/base-7/Given an integer, return its base 7 string representation.Example 1: Input: 100 Output: “202”Example 2: Input: -7 Output: “-10”Note: The input will
2017-02-13 18:50:35 723
原创 Two Sum II - Input array is sorted
题目地址:https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target num
2017-02-13 15:48:18 200
原创 Construct the Rectangle
题目地址:https://leetcode.com/problems/construct-the-rectangle/For a web developer, it is very important to know how to design a web page’s size. So, given a specific rectangular web page’s area, your job
2017-02-13 13:54:45 243
原创 Relative Ranks
原文地址:https://leetcode.com/problems/relative-ranks/Given scores of N athletes, find their relative ranks and the people with the top three highest scores, who will be awarded medals: “Gold Medal”, “Silv
2017-02-13 13:22:29 772
原创 Next Greater Element I
You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1’s elements in the corresponding places of nums2.The
2017-02-13 12:16:49 461
原创 Java运行时数据区
在《Java虚拟机规范》中,将Java运行时数据区分为六个部分:PC计寄存器,Java虚拟机栈,Java堆,方法区,运行时常量池,本地方法栈。PC寄存器PC寄存器(Program Counter Register),在大学期间《计算机体系结构》这门课中有介绍过这个概念,简单地讲可以看做是指向当前执行指令的指示器,在Java虚拟机中,这个概念也类似,如果线程正在执行一个Java方法,那么它指向的正是这
2017-02-12 15:47:58 492
转载 《Java编程思想》中的代理模式
原文:《Java编程思想 第四版》P.337代理是基本的设计模式之一,它是你为了提供额外的或不同的操作,而插入的用来代替“实际”对象的对象。这些操作通常涉及与“实际”对象的通信,因此代理通常充当着中间人的角色。下面是一个用来展示代理结构的简单示例://: typeinfo/SimpleProxyDemo.javapackage typeinfo;import static net.mindview
2017-02-12 12:25:20 942
翻译 计算三角阵的最大路径和
原文地址:Maximum path sum in a triangle已知一个由数字组成的三角,从三角的顶部数字开始移动到下一层的相邻元素,找出从顶部到底部的最大和。例如:输入: 3 7 4 2 4 68 5 9 3输出:23解释:3 + 7 + 4 + 9 = 23 输入: 8 -4 4 2 2 61 1 1 1输出:19解释:8 + 4 + 6 + 1 = 19
2017-02-10 14:56:36 810
翻译 计算一个数组中相同元素对的数目
原文地址:Count of index pairs with equal elements in an array已知一个数组有n个元素,任务是计算下标(i,j)(i, j)的总数,其中arr[i] = arr[j]并且i != j。例子:输入:arr[] = {1, 1, 2}输出:1因为arr[0] = arr[1],所以下标对是(0, 1)输入:arr[] = {1, 1, 1}输出:3
2017-02-10 14:42:32 4633
转载 CentOS、Ubuntu、Debian的区别
第一篇Linux有非常多的发行版本,从性质上划分,大体分为由商业公司维护的商业版本与由开源社区维护的免费发行版本。商业版本以Redhat为代表,开源社区版本则以debian为代表。这些版本各有不同的特点,在不同的应用领域发挥着不同的作用,不能一概而论。而绝大多数VPS上只提供开源社区维护的发行版本。下面就这些不同的Linux发行版进行简单的分析。UbuntuUbuntu近些年的粉丝越来越多,Ubun
2017-02-09 10:24:55 5560
OSGi in Action
2017-10-05
apt-mirror-api-0.1.jar
2016-11-15
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人