自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

菜园子

Cufer->NJUer ->Alibaba

  • 博客(53)
  • 问答 (1)
  • 收藏
  • 关注

原创 React-blog 搭建属于自己的博客

写在前面:用烦了wordpress,hexo和其他各种各样的博客框架,是时候该从桎梏中跳出,写一个自己的博客了!我的博客 www.panyunyi.cn博客的github地址 https://github.com/panyunyi97/react-blog欢迎 star & pr在试图搭建一个完全属于自己且自主可控的博客之前,我使用过 wordpress 和 Hexo 等傻瓜式的博客。但这类可少量客制化的博客并不能完完全全满足我的需求,我希望我自己的博客在我手中完全可控,一丝一毫都可以.

2020-12-11 21:31:54 1010 2

原创 Java 代理机制

学习心得:相关问题探索:关于静态代理和动态代理:静态代理和动态代理问题是一个很重要也很难准确理解的定义。静态代理:静态代理是指 在程序运行之前就已经存在代理类的字节码文件,代理类和委托类的关系在运行前就已经确定了。缺陷: 一个接口只能服务一种类型的对象,当代理的方法很多时,很难扩展动态代理:在程序运行期间由JVM根据反射机制动态生成。package cglib;/** * Created by

2017-09-11 16:42:31 341

原创 LeetCode 669. Trim a Binary Search Tree

Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree so that all its elements lies in [L, R] (R >= L). You might need to change the root of the tree, so the result

2017-09-08 18:19:08 703

原创 LeetCode 617. Merge Two Binary Trees

Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not.You need to merge them into a new binary tree. T

2017-09-08 17:53:04 298

原创 LeetCode 94. Binary Tree Inorder Traversal

Given a binary tree, return the inorder traversal of its nodes’ values.For example: Given binary tree [1,null,2,3], 1 \ 2 /

2017-07-28 19:19:08 275

原创 值传递、引用传递、地址传递辨析

写在前面:其实这是大一的知识,但是很久了也有一点淡忘,加上复习编译原理又捡起来看了看,写个简单的程序帮助理解吧。值传递、引用传递、地址传递:#include<iostream>//值传递int get_val(int arg){ arg+=1; return arg;}//引用传递int get(int &arg){ arg+=1; return arg;

2017-06-18 14:46:56 486

原创 Android Intent 跳转 发送朋友圈

写在前面2016年7 月份 微信封了几乎所有的deeplink URL Scheme ,现在基本上不可以直接通过deeplink 跳转到微信去执行相应的操作,但是很多时候我们还是不希望集成 SDK去获取接口,毕竟既有65535 方法数限制,又有引包麻烦,更新迭代麻烦等相应问题,我尝试着 使用传统的直接Intent 调相应的action 执行相关操作。问题原因:网上很多相关的教程,但是在我这边测试

2017-06-13 01:46:15 1677

原创 Hibernate 配置键生成器

需要 @ Id注解来标识 主键,当不使用 系统内置的@Generated Value 时,将有开发者自己进行主键的设置,这时需要保证主键字段值的唯一性使用自动生成的几种内置策略:GenerationType.AUTO Hibernate 选择一种合适的策略,这等同于 不进行任何设置的@GeneratedValue()GenerationType.SEQUENCE Hibernate 生成顺序

2017-06-12 09:53:53 448

原创 Java中的join和yield辨识

join等待线程结束,一个线程的输入可能非常依赖于另外一个线程或者多个线程的输出,那么就需要等待线程执行完成。 public final void join()throws InterruptedException public final synchronized void join(long millis)throws InterruptedException第一个join方法表示无

2017-05-27 01:01:28 307

原创 自定义圆形Drawable

一个自定义的drawable主要做的工作是将一张正常的图片转化成为一个椭圆形或者圆形的图片。达到所要的效果。这里的这段代码来自于https://github.com/venshine/RoundImageView 我只是对其不清楚的地方做了一些注释,方便自己看,可以说是一篇推介文章吧。import android.graphics.Bitmap;import android.graphics.

2017-05-26 17:56:40 488

原创 Scala学习笔记系列<1>

Scalca 基础Scala的类定义和Java比较像,以class开始,但是不同的是,Scala的缺省修饰符为public,也就是不带访问类型的修饰符,类的定义方法以def定义开始,方法的参数都是 val类型的也就是不可以手动修改的类型。类的方法分两种,一种是有返回值的,一种是不含返回值的,没有返回值的主要使用代码的副作用,比如修改类的成员变量的值或者读写文件等,Scala内部其实将这种函数的返回值

2017-05-19 15:57:45 341

原创 PicWordView 图文混排自定义View

PicWordView 简介picWordView是我在金山工作时趁着闲暇功夫写的一个自定义View,当然你也可以叫它库?好吧,其实比较简单,纯粹是因为太无聊了最近。(因为工作真的很闲)设计理念这个类库是我在找寻了很多图文混排库之后写出来的,主要是我觉得他们的东西都略显麻烦,不容易上手使用,有的写的真的是一团糟,很多都是简单加载html或者自定义一个RelativeLayout做ImageView和

2017-04-28 11:46:04 478

原创 LeetCode 118. Pascal's Triangle

Given numRows, generate the first numRows of Pascal’s triangle.For example, given numRows = 5, Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]]class Solution {public: vector<

2017-04-22 01:24:30 278

原创 LeetCode 101. Symmetric Tree

Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree [1,2,2,3,4,4,3] is symmetric:

2017-04-09 13:05:22 397

原创 LeetCode 367. Valid Perfect Square

Given a positive integer num, write a function which returns True if num is a perfect square else False.Note: Do not use any built-in library function such as sqrt.Example 1:Input: 16 Returns: True E

2017-04-09 12:19:29 214

原创 LeetCode 27. Remove Element

Given an array and a value, remove all instances of that value in place and return the new length.Do not allocate extra space for another array, you must do this in place with constant memory.The order

2017-04-09 12:07:29 210

原创 LeetCode 345. Reverse Vowels of a String

Write a function that takes a string as input and reverse only the vowels of a string.Example 1: Given s = “hello”, return “holle”.Example 2: Given s = “leetcode”, return “leotcede”.Note: The vowels

2017-04-09 11:53:24 210

原创 LeetCode 342.Power of Four

Given an integer (signed 32 bits), write a function to check whether it is a power of 4.Example: Given num = 16, return true. Given num = 5, return false.Follow up: Could you solve it without loops/re

2017-04-08 19:43:42 193

原创 LeetCode 501.Find Mode in Binary Search Tree

Given a binary search tree (BST) with duplicates, find all the mode(s) (the most frequently occurred element) in the given BST.Assume a BST is defined as follows:The left subtree of a node contains onl

2017-04-08 19:21:07 341

原创 Java 爬虫解决readline 读取缓慢问题

传统的使用URLconnection做连接之后通常使用in.readline()来获取网页代码。显而易见的是这种方法效率奇低。我简单的做了一下比较 Python time:0.205786745268 s =205ms 传统 readline() time: 1975ms charBuffer time: 265 mstry { // 将s

2017-03-29 01:47:16 2875

原创 Android 实现listview 分页加载和下拉刷新

众所周知,在Android应用中,下拉刷新和上拉加载非常普遍,我们可以在任何一款应用上发现它的踪迹,现在提供一款能够完整实现的源代码和思路。提供源码下载地址:(希望star一下 https://github.com/panyunyi97/CUFE_TRIP)首先我们来看一下相关代码(完整代码请见上述地址)贴上一个自定义的listview 文件public class MyListView exte

2017-03-27 01:39:12 571

原创 Python MySQLdb 操作

对mysqldb做了一个简单的封装,以减少重复代码的书写权当是一个适用于我的小工具类

2017-03-23 02:35:57 278

原创 单一职责原则 开闭原则

首先奉上维基百科:The single responsibility principle states that every module or class should have responsibility over a single part of the functionality provided by the software, and that responsibility shoul

2017-03-09 07:25:39 938

原创 带登录注册功能的material design 云端日历备忘

项目简介:(地址:【https://github.com/panyunyi97/New-Event】)这个小程序本来是因为老是有次组会提过这个需求,所以我就想着把它做出来做好。 后来也感谢很多同学给我做测试,提意见,终于算是告一段落。 这个app 也是我在北森离开的时候就在做得,参考了一些北森的编码规则,用上了一些本森italent和Tita的目录和编写思想。 算是给自己的Android 开发

2017-03-04 02:22:53 559

原创 LeetCode 263. Ugly Number

Write a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is not ugly since it in

2017-01-16 10:31:23 198

原创 LeetCode 191. Number of 1 Bits

Write a function that takes an unsigned integer and returns the number of ’1’ bits it has (also known as the Hamming weight).For example, the 32-bit integer ’11’ has binary representation 0000000000000

2017-01-16 09:58:22 185

原创 LeetCode 70. Climbing Stairs

You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Note: Given n will be a positive inte

2017-01-16 09:47:37 208

原创 DecorView、PhoneWindow、ViewRootlmpl的关系

Window 类 位于 /frameworks/base/core/java/android/view/Window.java。该类是一个抽象类,提供了绘制窗口的一组通用API。可以将之理解为一个载体,各种View在这个载体上显示。PhoneWindow类

2017-01-16 01:59:47 1057

原创 数据挖掘笔记

关联规则挖掘是数据挖掘中研究最早而且至今仍然活跃的方法之一 成果颇丰,数据挖掘里程碑 一个事物数据库可以被用来刻画 给定一个全局项目集I和数据库D,支持度是包含I1的事物在D中所占的百分比关联规则挖掘问题可以划分为两个子问题:1.发现频繁项目集通过给定的最小支持度去寻找所有频繁项目集。 2.生成关联规则通过给定的最小可信度,寻找满足条件的关联规则。 规则可信度是指包含i1和i2的实物数与包

2017-01-03 01:33:51 1386

原创 LeetCode 434. Number of Segments in a String

Count the number of segments in a string, where a segment is defined to be a contiguous sequence of non-space characters.Please note that the string does not contain any non-printable characters.Exampl

2016-12-23 14:42:19 208

原创 LeetCode 202. Happy Number

Write an algorithm to determine if a number is “happy”.A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of i

2016-12-22 17:36:45 368

原创 LeetCode 326. Power of Three Add to List QuestionEditorial

Total Accepted: 76257 Total Submissions: 194942 Difficulty: Easy Contributors: Admin Given an integer, write a function to determine if it is a power of three. class Solution { public:

2016-12-20 17:54:21 408

原创 LeetCode 405. Convert a Number to Hexadecimal

Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method is used.Note:All letters in hexadecimal (a-f) must be in lowercase. The hexadecimal str

2016-12-17 21:15:07 364

原创 Python +FLask 环境搭建(Centos 6.5)

最近这段时间想搞个个人博客,但是又不想用wordpress觉得没啥技术含量,所以就用python+flask搭了一个网站准备自己建站。推荐大家使用阿里云,腾讯云的学生特权真的都是骗人的,完全抢不到。阿里云9.9/月,很划算,就是centos 默认是 6.5 需要更一下python 也不是很麻烦。写在前面(用腾讯云centos 7.2 请自动忽略以下内容) python升级: 1.下载P

2016-12-12 01:42:40 7554 2

原创 操作系统中 信号量和自旋锁的区别

信号量:信号量作为在多核和单核操作系统中都广泛使用的一种处理机制,在处理冲突问题上有重要作用。信号量仅仅是与一个数据结构有关的计数器,所有内核线程在试图访问这个数据结构之前,都需要检查这个信号量,可以把每个信号量看成一个对象。组成如下:一个整数变量一个等待进程的链表两个原子方法down()和up()down()对于信号量的值-1,up+1,如果新的值小于0,就把正在运行的进程加入到这个信号量

2016-11-20 20:57:59 989

原创 动态规划相关知识笔记

动态规划动态规划是一种算法设计艺术。通常用来解决交叠的子问题构成的大问题。一般来说子问题都符合一定的递推关系,动态规划是将这些子问题的解存下来,这样从记录表中就可以得到原始解。首先我们来看一个简单的例子:1.币值最大化问题给定一排n个硬币,其面值均为正整数 c1,c2,c3,···cn,这些整数不一定两两不同。如何选择硬币使得在其原始位置互不相邻的条件下所选硬币金额最大。分两种情况讨论:设 F(

2016-11-12 13:43:01 428

原创 LeetCode 387. First Unique Character in a String

Given a string, find the first non-repeating character in it and return it’s index. If it doesn’t exist, return -1.s = "leetcode"return 0.s = "loveleetcode",return 2.class Solution {public: int

2016-11-01 02:23:05 206

原创 LeetCode 171. Excel Sheet Column Number

Related to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example:A -> 1B -> 2C -> 3...Z -> 26AA -> 27AB -> 28 题解:联想

2016-11-01 01:37:37 278

原创 LeetCode 100. Same Tree

Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value./** * Definition f

2016-11-01 01:22:00 218

原创 LeetCode 349. Intersection of Two Arrays

Given two arrays, write a function to compute their intersection.Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2].Note: - Each element in the result must be unique. - The result can b

2016-11-01 00:51:01 212

空空如也

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

TA关注的人

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