自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(35)
  • 收藏
  • 关注

转载 104. 二叉树的最大深度

LeetCode地址:https://leetcode-cn.com/problems/maximum-depth-of-binary-tree/题目描述:给定一个二叉树,找出其最大深度。二叉树的深度为根节点到最远叶子节点的最长路径上的节点数。说明:叶子节点是指没有子节点的节点。示例:给定二叉树[3,9,20,null,null,15,7],   3 ...

2019-05-25 13:14:00 149

转载 237. 删除链表中的节点

LeetCode地址:https://leetcode-cn.com/problems/delete-node-in-a-linked-list/描述:请编写一个函数,使其可以删除某个链表中给定的(非末尾)节点,你将只被给定要求被删除的节点。现有一个链表 --head =[4,5,1,9],它可以表示为:示例 1:输入: head = [4,5,1,...

2019-05-23 16:28:00 128

转载 Leetcode-167. Two Sum II - Input array is sorted

地址:描述:Given an array of integers that is alreadysorted in ascending order, find two numbers such that they add up to a specific target number.The function twoSum should return indices of t...

2019-04-30 22:43:00 129

转载 Leetcode-215. Kth Largest Element in an Array

地址:https://leetcode.com/problems/kth-largest-element-in-an-array/描述:Find thekth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth...

2019-04-30 22:07:00 111

转载 Leetcode-88. Merge Sorted Array

地址:https://leetcode.com/problems/merge-sorted-array/描述:Given two sorted integer arraysnums1andnums2, mergenums2intonums1as one sorted array.Note:The number of elements initialize...

2019-04-30 21:51:00 147

转载 Leetcode-75.Sort Colors

地址:https://leetcode.com/problems/sort-colors/描述:Given an array withnobjects colored red, white or blue, sort themin-placeso that objects of the same color are adjacent, with the colors in...

2019-04-29 23:05:00 124

转载 Leetcode-27.Remove Element

地址:https://leetcode.com/problems/remove-element/描述:Given an arraynumsand a valueval, remove all instances of that valuein-placeand return the new length.Do not allocate extra space for...

2019-04-29 00:46:00 115

转载 Leetcode-283. Move Zeroes

地址:https://leetcode.com/problems/move-zeroes/项目描述:Given an arraynums, write a function to move all0's to the end of it while maintaining the relative order of the non-zero elements.给定一个数组...

2019-04-28 23:21:00 96

转载 Leetcode-1.两数之和

题目描述:给定一个整数数组nums和一个目标值target,请你在该数组中找出和为目标值的那两个整数,并返回他们的数组下标。你可以假设每种输入只会对应一个答案。但是,你不能重复利用这个数组中同样的元素。示例:给定 nums = [2, 7, 11, 15], target = 9因为 nums[0] + nums[1] = 2 + 7 = 9所以...

2019-02-13 19:20:00 110

转载 Leetcode-35.搜索插入位置

题目描述:给定一个排序数组和一个目标值,在数组中找到目标值,并返回其索引。如果目标值不存在于数组中,返回它将会被按顺序插入的位置。你可以假设数组中无重复元素。示例 1:输入: [1,3,5,6], 5输出: 2示例2:输入: [1,3,5,6], 2输出: 1示例 3:输入: [1,3,5,6], 7输出: 4示例 4:输...

2019-02-13 19:11:00 93

转载 Python爬虫从入门到进阶(4)之xpath的使用

官网地址:https://lxml.de/xpathxslt.html导入: from lxml import etreelxml.tree 支持 ElementTree 和 Element 上的 find,findall,findtext方法的简单路径语法,作为特定的 lxml 扩展,这些类提供了 xpath()方法,该方法支持完整xpath语法中的表达式,以及定制...

2019-01-25 21:32:00 189

转载 Python爬虫从入门到进阶(3)之requests的使用

快速上手(官网地址:http://www.python-requests.org/en/master/user/quickstart/)发送请求首先导入Requests模块import requests试着获取一个网页r = requests.get('https://api.github.com/events')返回的 r 是 Response ...

2019-01-24 02:10:00 150

转载 Python爬虫从入门到进阶(2)之urllib库的使用

1.什么是Urllib(官网地址:https://docs.python.org/3/library/urllib.html#module-urllib)Urllib是python内置的HTTP请求库包括以下模块:  urllib.request 请求模块  urllib.error 异常处理模块  urllib.parse url解析模块  urllib.rob...

2019-01-19 01:54:00 188

转载 Mac环境下Redis的安装

1.下载官网下载地址:https://redis.io/download,选择对应的下载版本,我下载的是4.0.122.安装1)下载文件解压后复制到/usr/local/目录下(快速找到路径小技巧:终端输入:cd /usr/local/ 打开open .)若复制过程中有验证提示,输入电脑密码即可2)切换到相应目录cd /usr/local/redis-4...

2018-12-22 21:57:00 157

转载 Mac环境下Vagrant的安装

1.安装Vagrant下载地址:https://www.vagrantup.com/downloads.html下载好pkg包后,点击安装即可。2.安装 VirtualBox下载地址:https://www.virtualbox.org/wiki/Downloads下载好pkg包后,点击安装即可。Vagrant依赖现有的虚拟机软件来管理虚拟机,如Virtualbo...

2018-12-19 02:54:00 142

转载 Mac环境下Scrapy的安装

直接命令安装:$ easy_install scrapy从 GitHub 安装:$ git clonehttps://github.com/scrapy/scrapy.git $ cd scrapy$ python setup.py installScrapy升级:$ sudo pip install 或者:$ ...

2018-12-19 01:19:00 98

转载 Python爬虫从入门到进阶(1)之Python概述及爬虫入门

一、Python 概述1.计算机语言概述(1).语言:交流的工具,沟通的媒介(2).计算机语言:人跟计算机交流的工具(3).Python是计算机语言的一种2.Python编程语言  代码:人类的语言,同代码命令机器,跟机器交(2).python解释器:担任翻译工作(3)流程:  写代码 --> 执行:由翻译官(Python解释器)把命令(Code)翻译给...

2018-12-19 00:33:00 252

转载 Mac环境下的mongodb的安装

1.安装MongoDBbrew install mongodb这个是默认安装最新版本的 mogodb,如果想安装指定版本可以先查看 mongodb 版本brew search mongodbmongodb ✔ [email protected] [email protected]@3...

2018-12-18 22:18:00 267

转载 python开发遇到的坑(2)mongodb安装路径权限问题

个人比较懒,Mac 电脑直接使用命令行安装,brew install mongodb,但是遇到两个问题,其一:1 Error: The following directories are not writable by your user:2 /usr/local/share/man/man53 4 You should change the ownership of...

2018-12-18 21:40:00 133

转载 python开发遇到的坑(1)xpath解析ValueError: Unicode strings with encoding declaration are not supported...

Traceback (most recent call last): File "/Users/*******.py", line 37, in <module> BtcSpider().run() File "/Users/******.py", line 34, in run self.parse_data(data) File ...

2018-12-18 19:46:00 679

转载 Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'

Information:Gradle tasks [:app:assembleDebug]Error:Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.> More than one file was found with OS independent path 'assets/i...

2018-03-09 21:48:00 114

转载 在Android library中不能使用switch-case语句访问资源ID的原因分析及解决方案

报错是因为case分支后面跟的参数必须是常数,也就是说library中的R.java的资源ID不是常数,public static final class animator { public static int design_appbar_state_list_animator = 0x7f020001;}public static final class array {...

2017-12-07 23:02:00 207

转载 Android获取虚拟软键盘高度

1 public static int getDpi(Context context) { 2 int dpi = 0; 3 WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); 4 D...

2017-02-07 10:25:00 201

转载 android Button上面的英文字符串自动大写的问题解决

xml文件中加入:android:textAllCaps="false"  转载于:https://www.cnblogs.com/zimengfang/p/6297735.html

2017-01-18 18:08:00 77

转载 Android WebView重定向问题的解决方案

当WebView在加载网页时,有时会有重定向问题,返回键回退怎么也回退不掉,怎么办?WebView有一个getHitTestResult():返回的是一个HitTestResult,一般会根据打开的链接的类型,返回一个extra的信息,如果打开链接不是一个url,或者打开的链接是JavaScript的url,他的类型是UNKNOWN_TYPE,这个url就会通过request...

2016-12-15 16:47:00 427

转载 Android 控件背景选择图片还是drawable XML资源

1 决定一个控件应该是否用Drawable XML渲染,应考虑以下几个因素:2 * App是否要支持多分辨率;3 * App是否有瘦身的需要;4 * 图案是否足够简单;5 * 图案需要自由缩放;6 * 设计开发工作流程是否容许开发人员跨界;7 * 开发人力相对于设计人力更充足。8 9 否则,应该考虑以图片方式渲染。转载于:https://...

2016-12-13 13:47:00 105

转载 Android AlertDialog 绝对位置计算

public class Main2Activity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setConten...

2016-12-09 14:45:00 194

转载 Android 5.0以上Material Design 沉浸式状态栏

偶然在知乎上看到这个问题,Android 5.0 如何实现将布局的内容延伸到状态栏,之前也见过多个应用的这个功能,但是知乎上的答案却没有一个真正实现此功能的一类是把标题栏设置App主题颜色,一类是提取App主题颜色然后设置成状态栏的颜色,这两种方法都只是设置了状态栏的背景色,而没有实现布局延伸到状态栏这个功能下面是综合网上的一些东西整理的,废话不说,看代码 1 public...

2016-07-26 15:28:00 148

转载 Android 6.0系统动态请求系统相机权限

1 private static final int TAKE_PHOTO_REQUEST_CODE = 1; 2 3 public static String takePhoto(Context context, int requestCode) { 4 String filePath = ""; 5 if (Contex...

2016-07-19 18:06:00 175

转载 Android软键盘在清单文件中所有配置含义

android:windowSoftInputMode活动的主窗口如何与包含屏幕上的软键盘窗口交互。这个属性的设置将会影响两件事情:1> 软键盘的状态——是否它是隐藏或显示——当活动(Activity)成为用户关注的焦点。2> 活动的主窗口调整——是否减少活动主窗口大小以便腾出空间放软键盘或是否当活动窗口的部分被软键盘覆盖时它的内容的当前焦点是可见...

2016-07-15 13:56:00 148

转载 引入第三方SDK allowBackup value不一致引起的编译异常

项目中要引入一个客服的SDK,项目中<application android:name=".AppApplication" android:allowBackup="false" android:hardwareAccelerated="false" android:icon="@mipmap/ic_l...

2016-06-20 18:08:00 234

转载 Android JS 交互出现 Uncaught Error: Error calling method on NPObject

由于HTML5的功能越来越强大,native app的一些功能逐步被html页面代替,不可避免的JS交互也用到的也越来越多.在第一个版本向第二个版本迭代的过程中却发生了莫名其妙的问题,第一个版本JS调用的方法如下:1 public void gotoAdvisorDetail(String id) {2 if (!TextUtils.isEmpty(id)) {...

2016-06-14 10:03:00 231

转载 adapter.notifydatasetchanged()没有效果

项目中有个列表的处理,通过一个参数判断是下拉刷新数据还是加载更多数据,结果下拉刷新就是显示不出来界面,数据是有,就开始searching~,搜出很多相关问题,大意如下:1 当数据源发生变化的时候,我们会调用adaper的notifyDataSetChanged()方法2 当直接将从数据库或者其他方式获取的数据源集合或者数组直接赋值给当前数据源时,相当于当前数据源的对象发生了变化,...

2016-06-12 16:08:00 114

转载 Android 正则表达式验证手机号码

方案一:比较精准的判断手机段位,但是随着手机号段的增多要不断的修改正则1 public boolean isPhoneNumber1(String phone) {2 String regExp = "^[1]([3][0-9]{1}|50|51|52|53|54|55|56|57|58|59|47|77|80|81|82|83|84|85|86|87|88...

2016-05-30 16:22:00 138

转载 Android SpannableString实现TextView的点击事件

最近项目中遇到一个问题,就是一段文字中股票可点击并跳到股票详情,只记得SpannableString可以实现富文本功能,但并不知道可实现的富文本有点击功能,就开始借助万能搜索引擎,结果不出意料,的确有ClickableSpan这个类可实现点击功能,于是就开始查找Android apiClickableSpan,废话不说了上代码public class MainActivity ...

2016-05-25 15:45:00 179

空空如也

空空如也

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

TA关注的人

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