自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

BrownWong的专栏

数据科学爱好者。Github: https://github.com/wangjiang0624

  • 博客(47)
  • 资源 (8)
  • 收藏
  • 关注

原创 描述符

1. 定义描述符是一个具有绑定行为的对象属性,其属性的访问被描述符协议方法覆写。这些方法是__get__()、__set__()和__delete__(),一个对象中只要包含了这三个方法中的至少一个就称它为描述符。2. 使用场景常见的使用场景是:假设你有一个对象属性叫money,你想在某些方面限制它的取值,比如限制它为int类型,并且是非负数。你应该怎么做?你很可能想着在类的__init__()方法

2016-10-30 11:05:02 403

原创 字典Dict

1. 字典有序我们之前说过:字典是无序的,但其实是有序的,只不过不是我们期待的顺序罢了。请看以下例子:>>> dict1 = {'wang': 1, 'jaing': 2, 'guo': 3, 'han': 4}>>> dict1{'guo': 3, 'jaing': 2, 'wang': 1, 'han': 4}>>> print dict1.keys()['guo', 'jaing',

2016-10-29 11:21:50 488

原创 关于字符串

ljust()函数的使用:左对齐Description: The method ljust() returns the string left justified(左对齐) in a string of length width. Padding is done using the specified fillchar (default is a space). The original stri

2016-10-29 11:03:48 318

原创 Git操作

1. 基本操作git init功能:初始化仓库。要使用 Git 进行版本管理,必须先初始化仓库。如果初始化成功,执行了 git init命令的目录下就会生成 .git 目录。这个 .git 目录里存储着管理当前目录内容所需的仓库数据。在 Git 中,我们将工作目录的内容称为“附属于该仓库的工作树”。文件的编辑等操作在工作树中进行,然后记录到仓库中,以此管理文件的历史快照。如果想将文件恢复到原先的状态

2016-10-24 00:32:05 759

原创 git简单个人工作流(workflow)

适用于开发个人项目场景:在github上新创建一个repo,假设命名为TestGitGit Shell进入你的工作空间,创建目录TestGit,并进入此目录。命令如下: mkdir TestGit cd TestGit 将此目录初始化为repo: git init 如果初始化成功,目录下就会生成 .git 目录。这个 .git 目录里存储着管理当前目录内容所需的仓库数据。我们

2016-10-23 15:37:40 1173

原创 Github简介

1. GitHub 与 Git 的区别在 Git 中,开发者将源代码存入名叫“Git 仓库”的资料库中并加以使用。 而 GitHub 则是在网络上提供 Git 仓库的一项服务。2. Github提供的主要功能Git 仓库一般情况下,我们可以免费建立任意个 GitHub 提供的 Git 仓库。但如果需要建立只对特定人物或只对自己公开的私有仓库,则需要依照套餐类型 B 支付每月最低 7 美元的使用费。

2016-10-23 13:01:17 449

原创 Python OOP

1. 类的声明和创建对于 Python 函数来说,声明与定义类没什么区别,因为他们是同时进行的,定义(类体)紧跟在声明(含 class 关键字的头行[header line])和可选(但总是推荐使用)的文档字符串后面。同时,所有的方法也必须同时被定义。请注意 Python 并不支持纯虚函数(像 C++)或者抽象方法(如在 JAVA 中),这些都强制程序员在子类中定义方法。作为替代方法,你可以简单地在

2016-10-22 00:18:12 3440

原创 子串搜索

>>> import re>>> string = 'test test test test'>>> string.find('test') # 返回匹配字串的第一个下标0>>> string.rfind('test') # 返回匹配字串的最后一个下标15>>> [m.start() for m in re.finditer('test', string)] # 返回所有匹配子串下

2016-10-20 23:02:19 531

原创 Python正则表达式(二)

1. search和match在 Python专门术语中,有两种主要方法完成模式匹配:搜索(searching)和匹配(matching)。搜索,即在字符串任意部分中查找匹配的模式,而匹配是指,判断一个字符串能否从起始处全部或部分的匹配某个模式。搜索通过 search()函数或方法来实现,而匹配是以调用 match()函数或方法实现的。2. re模块函数和方法下表列出了 re 模块最常用的函数和方法

2016-10-20 00:35:03 594

原创 Python正则表达式(一)

这一部分只讲正则表达式,不涉及其在Python中的使用问题。正则表达式的强大之处在于特殊符号的应用,特殊符号定义了字符集合,子组匹配,模式重复次数。1. 特殊符号和字符 特别的:特殊字符 \b and \B 用来匹配单词边界。两者之间的区别是,\b 匹配的模式是一个单词边界,就是说,与之对应的模式一定在一个单词的开头,不论这个单词的前面是有字符(该词在一个字符串的中间), 还是没有字符(该单

2016-10-19 00:32:44 430

原创 RDD

1. RDD基础(1) 概述RDD其实就是分布式的元素集合。在Spark中,对数据的所有操作不外乎创建RDD,转化RDD以及调用RDD操作进行求值。Spark 中的 RDD 就是一个不可变的分布式对象集合。每个 RDD 都被分为多个分区,这些分区运行在集群中的不同节点上。RDD 可以包含 Python、Java、Scala 中任意类型的对象,甚至可以包含用户自定义的对象。(2) 创建RDD用户可以使

2016-10-16 11:45:25 4371

原创 Spark运行及入门

1. 交互式运行Spark(shell)进入spark目录To launch Pyspark,we need to use sudo bin/pyspark(你不一定需要加sudo)To launch spark of scala version, use sudo bin/spark-shell2. 日志设置我们需要在conf目录下创建一个名为log4j.properties的文件来管理日

2016-10-16 01:04:22 709

原创 环境变量相关

环境变量的定义就可以只在/etc/profile文件中。在/etc/environment中定义会在ubuntu 14.04发生登录循环问题,原因不明。

2016-10-16 00:21:09 219

转载 欢迎使用CSDN-markdown编辑器

欢迎使用Markdown编辑器写博客本Markdown编辑器使用StackEdit修改而来,用它写博客,将会带来全新的体验哦:Markdown和扩展Markdown简洁的语法代码块高亮图片链接和图片上传LaTex数学公式UML序列图和流程图离线写博客导入导出Markdown文件丰富的快捷键快捷键加粗 Ctrl + B 斜体 Ctrl + I 引用 Ctrl

2016-10-16 00:07:38 210

原创 导论

1. Spark是什么定义: Spark是一个用来实现快速而通用的集群计算的平台。主要特点: 它的主要特点是能够在内存中进行计算,因而速度更快。总的来说: Spark适用于各种各样原先需要多种不同分布式平台的场景,包括批处理、迭代算法、交互式查询、流处理。2. 组件Spark 项目包含多个紧密集成的组件。 Spark 的核心是一个对由很多计算任务组成的、运行在多个工作机器或者是一个计算集群上的

2016-10-15 19:08:35 326

原创 Spark优点

作为 MapReduce 的继承者, Spark 主要有三个优点。首先, Spark 非常好用。由于高级 API 剥离了对集群本身的关注,你可以专注于你所要做的计算本身, 只需在自己的笔记本电脑上就可以开发 Spark 应用。其次, Spark 很快,支持交互式使用和复杂算法。 最后, Spark 是一个通用引擎,可用它来完成各种各样的运算,包括 SQL 查询、文本处理、机器学习等,而在 Sp

2016-10-15 18:13:41 3735

原创 Pattern Matching

1. Values, Variables, and Types in Matches(1) BasicLet’s cover several kinds of matches. The following example matches on specific values, all values of specific types, and it shows one way of writing

2016-10-15 14:50:05 444

原创 Interpolated Strings

There are three kinds of interpolated strings.A String of the form s"foo ${bar}" will have the value of expression bar, converted to a String and inserted in place of ${bar}. If the expression bar ret

2016-10-13 13:32:30 457

原创 Enumeration

While enumerations are a built-in part of many programming languages, Scala takes a different route and implements them as an Enumeration class in its standard library. You just define an object that

2016-10-12 17:01:55 254

原创 lazy val

1. DescriptionA related scenario to by-name parameters is the case where you want to evaluate an expression once to initialize a value, not repeatedly, but you want to defer that invocation. There are

2016-10-12 15:02:19 461

原创 Call by Name, Call by Value

1. DescriptionTypically, parameters to functions are by-value parameters; that is, the value of the parameter is determined before it is passed to the function. But what if we need to write a functi

2016-10-12 13:10:50 332

原创 Exception Handling

Scala encourages a coding style that lessens the need for exceptions and exception handling. But exceptions are still used, especially where Scala interacts with Java code, where use of exceptions is m

2016-10-11 22:15:54 278

原创 Logical Equality and Compare References

In Java, == compares object references only. It doesn’t perform a logical equality check. You use the equals method for that purpose. In contrast, Scala uses == for logical equality, but it calls the e

2016-10-11 17:07:23 335

原创 Scala for Comprehensions

The term comprehension comes from functional programming. It expresses the idea that we are traversing one or more collections of some kind, “comprehending” what we find, and computing something new fr

2016-10-11 14:38:06 459

原创 Scala if Statements

What’s different in Scala is that if statements and almost all other statements in Scala are actually expressions that return values. If it’s true, then the corresponding block is evaluated. Otherwise

2016-10-10 11:15:53 257

原创 Precedence Rules

If an expression like 2.0 * 4.0 / 3.0 * 5.0 is actually a series of method calls on Doubles.Here they are in order from lowest to highest precedence:1. All letters2. |3. ^5. < >6. = !7. :8. + -9

2016-10-10 10:38:27 354

原创 Methods with Empty/One Argument Lists

1. Methods with Empty Argument ListsIf a method takes no parameters, you can define it without parentheses. Callers must invoke the method without parentheses. Conversely, if you add empty parentheses

2016-10-09 00:45:19 273

原创 Side Effect

When a function returns Unit it is totally side-effecting. There’s nothing useful that can be done with Unit, so the function can only perform side effects on some state, either globally, like performi

2016-10-09 00:07:23 349

原创 Identifiers Characters

What characters can you use in identifiers? Here is a summary of the rules for identifiers, used for method and type names, variables, etc:Characters Scala allows all the printable ASCII characters

2016-10-08 22:49:35 371

原创 Operator Overloading

1. OverviewAlmost all “operators” are actually methods. Consider this most basic of examples: 1 + 2 That plus sign between the numbers? It’s a method.1 + 2 is the same as 1.+(2), because of the “infi

2016-10-08 22:20:56 344

原创 Abstract Types VS Parameterized Types

1. Parameterized typesScala supports parameterized types, which are very similar to generics in Java. Java uses angle brackets (<…>), while Scala uses square brackets ([…]), because < and > are often u

2016-10-07 23:03:13 244

原创 Import

1. Four ways to importThere are four ways to import:Import all types in a package, using the underscore(_) as a wildcard. e.g. import java.awt._Import individual Scala or Java types. e.g. import j

2016-10-07 18:40:39 314

原创 Package and Namespace

Scala adopts the package concept that Java uses for namespaces, but Scala offers more flexibility. Filenames don’t have to match the type names and the package structure does not have to match the dire

2016-10-07 15:48:58 313

原创 Sealed Class Hierarchies

A key point about Option is that there are really only two valid subtypes. Either we have a value, the Some case, or we don’t, the None case. There are no other subtypes of Option that would be valid.

2016-10-07 14:57:25 306

原创 Option,Some and None

Most languages have a special keyword or type instance that’s assigned to reference variables when there’s nothing else for them to refer to. In Java, it’s null, which is a keyword, not an instance of

2016-10-07 12:58:04 212

原创 Literal Values

Integer LiteralsInteger literals can be expressed in decimal, hexadecimal, or octal.You indicate a negative number by prefixing the literal with a – sign.For Long literals, it is necessary to append th

2016-10-06 23:41:17 1257

原创 Scala Reserved Words

Table lists the reserved keywords in Scala. Many are found in Java and they usually have the same meanings in both languages. Word Description abstract Makes a declaration abstract. case Sta

2016-10-06 22:21:59 345

原创 Type Inference

1. OverviewSome functional programming languages, like Haskell, can infer almost all types, because they can perform global type inference. Scala can’t do this, in part because Scala has to support sub

2016-10-06 18:51:21 704

原创 Python尾递归

Python并不支持尾递归优化,我们只是使用其语法来描述这个概念。尾递归就是操作的最后一步是调用自身的递归。它和一般的递归不同在对内存的占用,普通递归创建stack累积而后计算收缩,尾递归只会占用恒量的内存(和迭代一样)。我们看一个对比:普通递归def recsum(x): if x == 1: return x else: return x + recsum(x - 1)调

2016-10-06 15:13:19 1064

原创 A Taste of `Future`

The scala.concurrent.Future API uses implicit arguments to reduce boilerplate in your code. They are another tool for concurrency provided by Scala. Akka uses Futures, but you can use them separately w

2016-10-06 11:21:45 476

邻接表存储的图的DFS,BFS遍历

邻接表存储的图的DFS,BFS遍历。文档描述: http://blog.csdn.net/qq_16912257/article/details/45848935

2017-04-06

AjaxServletDemo增强版

AjaxServletDemo增强版.

2015-09-19

AjaxServletDemo

利用Ajax获取控件内容发送给Servlet。然后servlet将相应值再通过ajax返回给浏览器刷新界面

2015-09-19

My First Hibernate APP

我的第一个Hibernate应用,保存数据到数据库。

2015-09-04

ImageBrowser

监听左右滑动事件实现一个图片浏览器。性能优于ViewPager,但并不如ViewPager美观。

2015-08-26

ShowImage_android小程序

一个很简单的Demo,实现从SD卡读取一张图片,并把它显示在APP中。

2015-07-23

数据结构代码

包含:顺序表,链表,栈,队列,回文,二叉树,图,二叉排序树源码,欢迎下载!

2015-05-31

java语言程序设计复习题和编程练习题答案.zip

本压缩包包含java语言程序设计这本书中2-20章复习题答案以及偶数编程题答案,欢迎下载。

2015-01-18

空空如也

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

TA关注的人

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