码迷,mamicode.com
首页 > 其他好文
重构笔记——搬移函数
本文是在学习中的总结,欢迎转载但请注明出处:http://blog.csdn.net/pistolove/article/details/42679983         我们都知道,类往往因为承担过多的责任而变得臃肿不堪。这种情况下,一般会使用"提炼类"这种手法将一部分责任分离出去。如果一个类变得"不负责任",一般会使用“内联类”这种手法将它融入另一个类。如果一个类使用了另一个类,一般会运用"隐藏委托关系"手法将这种关系隐藏起来通常是有帮助的。有时候隐藏委托关系会导致拥有者的接口经常性地变化,...
分类:其他好文   时间:2015-01-13 19:54:48    阅读次数:280
心跳震动Vibrator使用
设备振动器,可以设置震动的频率,模拟心跳的震动。 获取设备振动器有两种方法: vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE); vibrator = (Vibrator) getApplicationContext().getSystemService(Service.VIBRATOR_SERVICE); 开...
分类:其他好文   时间:2015-01-13 19:55:05    阅读次数:295
LeetCode112——Path Sum
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. For example: Given the below binary tree and sum...
分类:其他好文   时间:2015-01-13 19:55:05    阅读次数:174
scala入门-10 隐式转换、隐式参数、隐式类
scala入门-10 隐式转换、隐式参数、隐式类 scala入门-10 隐式转换、隐式参数、隐式类 scala入门-10 隐式转换、隐式参数、隐式类 scala入门-10 隐式转换、隐式参数、隐式类 scala入门-10 隐式转换、隐式参数、隐式类...
分类:其他好文   时间:2015-01-13 19:55:34    阅读次数:202
Qt递归非递归遍历文件
Qt递归非递归遍历文件...
分类:其他好文   时间:2015-01-13 19:54:27    阅读次数:133
this 指向区分
var x = 1; function f(){ // alert(x); var x = 2; alert(this.x); x = 3; } a = f(); b= new f(); a=f() 这句执行时,函数里的 this 等价于 window,也就是window.x,所以弹出 结果为1 b=new f()会生成一个函数实例,this指向当前实例,...
分类:其他好文   时间:2015-01-13 19:52:44    阅读次数:112
祝贺CSDN学院成功上线
颐和园在C学院也有一个小小的Swift视频课程,总课时19课时,已上传9课时,剩余课时颐和园会抓紧时间完成,免费课程4节。这个课程的内容真的十分简单,因为个人觉得学习语言,应用为王。语法教学,越基础越好,剩下的东西在实践中并不难学习。而且Swift语言的威力,还是只有在iOS8 SDK下才能体现。如果时间允许,我还会出一系列关于Swift+iOS8的课程,届时大家还可以学习新SDK的过程中,学习到...
分类:其他好文   时间:2015-01-13 19:54:13    阅读次数:124
sgu213-Strong Defence
题目大意: 给你一个无向图,然后一个s,t表示起点和终点,然后输入n,m,s,t,将m条无相边分成L个集合,使得任意一个集合的边被去掉后,都不能从t到达s(或者是s到达t,具体不记得了,但是差不多吧。。。。。),然后要你求出最大的L,然后输出每一个边集。 解题思路: 首先看到要使得不能到达,我想到了网络流,但是后来想想发现,其实很简单。 先以s为起点跑一遍最短路,然后会得到一个di...
分类:其他好文   时间:2015-01-13 19:53:41    阅读次数:151
LeetCode--Reverse Linked List II
Reverse a linked list from position m to n. Do it in-place and in one-pass. For example: Given 1->2->3->4->5->NULL, m = 2 and n = 4, return 1->4->3->2->5->NULL. Note: Given m, n satisfy the...
分类:其他好文   时间:2015-01-13 19:52:19    阅读次数:124
如何读取代码行数
使用 CLOC (Count Line of Code) 前提条件:1. 预装有perl                   2. 下载CLOC. http://cloc.sourceforge.net/ 解压安装包,得到cloc-version.pl 打开命令行,定位到解压文件的文件夹,然后敲入命令 perl cloc-version.pl YourProject.tar.gz...
分类:其他好文   时间:2015-01-13 19:51:19    阅读次数:327
假设有50瓶饮料,喝完3个空瓶可以换一瓶饮料,依次类推,请问总共喝了多少瓶饮料?
这大家可以这么想 一共有50瓶, 喝完三瓶 + 1 喝完三瓶 + 1 那么 50 - 3 + 1 -3 + 1 以此类推知道。。。最后剩余的可乐数小于3退出。那么依旧题意可以写出。 package cccc; public class Buy { public static void main(String[] args) { int number = 50;         /...
分类:其他好文   时间:2015-01-13 19:50:47    阅读次数:795
利用随机数生成方法产生激活码,形如12HJ-9Hjf-HHTY-KK8G
产生一个激活码 package jihuoma; //产生激活码:类似于2Hs0-ssKj-9HHo-A55D public class Test { public static void main(String[] args) { String str=""; for (int i = 1; i <= 16; i++) { int a=(int)(Math.random()*3...
分类:其他好文   时间:2015-01-13 19:50:58    阅读次数:157
hdu 1222 Wolf and Rabbit (GCD)
Wolf and Rabbit Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 5502    Accepted Submission(s): 2765 Problem Description There is...
分类:其他好文   时间:2015-01-13 19:53:05    阅读次数:134
LeetCode--Binary Tree Inorder Traversal
Given a binary tree, return the inorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1 2 / 3 return [1,3,2]. Note: Recursive solutio...
分类:其他好文   时间:2015-01-13 19:51:27    阅读次数:142
记安装hadoop-2.3.0-cdh5.1.2全过程
工欲善其事,必先利其器,啥都不说,hadoop下载:http://archive.cloudera.com/cdh5/cdh/5/  选择好相应版本搞起 在本文讲述的是 围绕hadoop-2.3.0-cdh5.1.2版本安装过程。(安装环境为自己在VMWare 10里面搭建的三台linux 虚拟机) 1、hadoop 是大apache开源的分布式离线计算框架,语言:java,既然这样,要想搭建...
分类:其他好文   时间:2015-01-13 19:49:37    阅读次数:340
LeetCode--Unique Binary Search Trees
Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example, Given n = 3, there are a total of 5 unique BST's. 1 3 3 2 1 \ ...
分类:其他好文   时间:2015-01-13 19:50:02    阅读次数:147
[leetcode]103 Binary Tree Zigzag Level Order Traversal
问题描述: Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between). For example: Given ...
分类:其他好文   时间:2015-01-13 19:49:51    阅读次数:152
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!