自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(99)
  • 资源 (5)
  • 收藏
  • 关注

原创 LeetCode 148: Sort List (链表排序)

Sort a linked list in O(n log n) time using constant space complexity. 分析:题目要求对链表进行排序,如果采用插入、冒泡等排序方式,则时间复杂度将是O(n*n),达不到题目要求的O(n log n)的要求。O(n log n)复杂度的有快排和归并排序,对于链表来说,归并排序更适合一点。这样题目转换为将一个链表拆分成两...

2015-05-07 22:34:53 600

原创 /proc/$pid/maps文件格式解析

/proc/pid/maps文件格式解析以下内容摘录在man手册,可以通过运行命令(man 5 proc)获得。/proc/[pid]/maps A file containing the currently mapped memory regions and their access permissions. See mmap(2) for some further informatio...

2018-11-16 08:58:19 10300

原创 VSS/USS/PSS/RSS的计算

VSS/USS/PSS/RSS的计算VSS/USS/PSS/RSS是什么VSS、USS、PSS、RSS是衡量内存占用的四个指标:VSS:Virtual Set Size, 虚拟内存占用,包括共享库等。RSS:Resident Set Size,实际物理内存占用,包括共享库等。PSS:Proportion Set Size,实际使用的物理内存,共享库等按比例分配。USS:Unique ...

2018-11-16 08:56:24 3018

原创 [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:Input: “hello” Output: “holle” Example 2:Input: “leetcode” Output: “leotcede” Note: The vowel...

2018-08-29 23:55:22 298

原创 [Leetcode] 557. Reverse Words in a String III

Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.Example 1: Input: “Let’s take LeetCode contest” ...

2018-08-29 22:58:01 225

原创 [LeetCode] 151Reverse Words in a String C语言版

Given an input string, reverse the string word by word.Example: Input: “the sky is blue”, Output: “blue is sky the”. Note:A word is defined as a sequence of non-space characters. Input strin...

2018-08-29 22:54:27 479

原创 pagemap和VSS/USS/PSS/RSS的计算

VSS/USS/PSS/RSS的计算VSS/USS/PSS/RSS是什么VSS、USS、PSS、RSS是衡量内存占用的四个指标: - VSS:Virtual Set Size, 虚拟内存占用,包括共享库等。 - RSS:Resident Set Size,实际物理内存占用,包括共享库等。 - PSS:Proportion Set Size,实际使用的物理内存,共享库等按比例分配。...

2018-04-24 19:59:10 2162 1

原创 如何查看ELF文件

查看elf文件以一个简单的C程序为例:#include <stdio.h>#include <string.h>int main(int argc, char**argv){ printf("build date: %s %s\n", __DATE__, __TIME__); return 0;}编译、执行➜ ~ gcc test.c -o test➜ ~ ./tes

2017-11-12 22:23:17 10595

原创 Android平台移植ifstat

ifstat_4_androidifstat是什么ifstat是一个查看网口统计数据的工具,类似于iostat与vmstat。可以用于查看一段时间的网口收发数据的统计信息。 目前Android系统中并没有集成该工具,所以将其移植到Android系统,添加编译脚本,解决编译问题。ifstat的编译下载源码码源码可以直接从GitHub下载:sunao2002002/ifstat4android[dav

2017-08-21 01:31:47 711

原创 bsdiff/bapatch的编译

在Ubuntu14.04 64位系统上编译bsdiff的步骤如下:安装libbz2库sudo apt-get install libbz2-dev从bsdiff官网下载代码包。解压缩、编译tar -zxvf bsdiff-4.3.tar.gzcd bsdiff-4.3make很不幸,编译不通过。问题1:Makefile格式错误~/code/bsdiff-4.3 makeMakef

2017-02-24 20:37:18 2729

原创 Android bsdiff/bspatch imgdiff/applypatch

Android的bsdiff/bspatch算法使用以及针对GZIP文件的优化版本imgdiff/applypatch

2017-02-05 23:48:12 6015

原创 在Linux上运行procmem和procrank

Android系统中提供了两个命令行工具procrank、procmem用于查看系统中的内存使用情况。procrank可以查看系统中所有进程的整体内存占用情况,并按照规则排序。而procmem可以针对某个特定的进程分析其堆、栈、共享库等内存占用情况。这两个工具对于我们分析内存相关问题非常有效。由于Android系统使用的是Linux内核,理论上这样的工具可以在Linux上运行。编译参考Android

2017-01-03 22:54:26 12285

原创 LeetCode 84. Largest Rectangle in Histogram

Given n non-negative integers representing the histogram’s bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.Above is a histogram where width of each bar

2016-10-22 17:04:00 435

原创 LeetCode 6: ZigZag Conversion

The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H N A P L S I I G

2016-10-07 03:53:58 1468

原创 LeetCode172. Factorial Trailing Zeroes

Given an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.题目中要求计算n!末尾0的个数,最笨的方法莫过于首先计算n!,然后再计算结果末尾的0,这样时明显不符合题目算法时间复杂度要求的。我们首先看N比较小的一种情

2016-10-05 22:38:05 440

原创 Leetcode 173: Binary Search Tree Iterator

Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Calling next() will return the next smallest number in the BST.Note: next() and hasN

2016-10-05 21:07:23 475

原创 获取bing背景图片

搜索引擎bing的界面非常简洁,背景图片大气漂亮,非常适合用做桌面背景。于是就参考网上的教程写来一段python脚本,自动抓取bing的背景图片。代码如下:#!/usr/bin/env python#-*-coding: utf-8 -*-import urllib, re, osdef get_bing_wallpaper(): url = "http://cn.bing.com"

2016-09-11 23:38:24 2045

原创 Android 7.0 init.rc的一点改变

在Android 7之前的版本中,系统Native服务,不管它们的可执行文件位于系统什么位置都定义在根分区的init.*.rc文件中。这造成init*.rc文件臃肿庞大,给维护带来了一些不便,而且其中定义的一些服务的二进制文件根本不存在。但在Android 7.0中,对该机制做了一些改变 。单一的init*.rc,被拆分,服务根据其二进制文件的位置(/system,/vendor,/odm)定义到

2016-09-07 00:11:02 10070 1

原创 Android集成lrzsz

为啥要移植lrzsz本文中的lrzsz代码点击此处获取 Hikey开发板有两类USB口,两组USB-TypeA母口作为Host,可以接键盘、鼠标。另一组mini-USB母口,作为devices,可以接到电脑上调试。但目前这两种接口无法同时使用,即通过键盘鼠标操作时不能使用ADB。 虽然可以通过minicom或者putty之类的工具连接串口查看LOG、执行命令。但Android系统中缺少通过串口传

2016-08-20 15:35:48 2951

原创 64位内核能支持32位的应用?

64位内核能支持32位的应用?最近一位同事在调试EVB板时遇到一个很奇怪的问题。 内核:Linux4.4.14 编译器:gcc-linaro-aarch64-linux-gnu-4.9-2014.09_linux 使用cpio生成一个简单的根文件系统,busybox等都运行正常。但以前编译好的一个测试程序无法运行,提示“exec format error” 一开始怀疑是缺少依赖的动态库问题

2016-07-15 15:04:29 5264 2

原创 Android 编译静态链接的可执行文件

Android 编译静态链接的可执行文件在Android 开发与调试过程中往往遇到以下两种场景,导致我们编译的可执行程序无法运行:不支持动态链接,比如系统初始化进程init和Recovery模式下执行的recovery可执行程序,它们在执行的时候,往往不会挂载/system分区,不存在ld和ldd.so等动态加载工具和C库,这样的可执行程序往往需要静态链接。一些辅助测试的工具程序。比如busyb

2016-07-13 23:18:53 5986

原创 Hikey Android 6.0 版本构建

参考Hikey的wiki  https://github.com/96boards/documentation/wiki/LatestSnapshots 从源码构建Hikey Android 6.0版本的流程如下:1、下载vendor.tar.bz2。从如下位置下载 vendor.tar.bz2:    http://snapshots.linaro.org/android/binarie

2016-02-13 00:47:01 2559

原创 TLSF算法分析

注:本文的大部分内容摘录自论文《TLSF: a New Dynamic Memory Allocator for Real-Time Systems》,可以通过“科学上网”访问如下链接阅读原文:http://www.gii.upv.es/tlsf/files/ecrts04_tlsf.pdf。什么是TLSFTLSF是Two Level Segregated Fit memory al

2016-01-30 19:06:13 12323 1

原创 几个有用的Shell别名和函数

注:平时工作过程中收集的一些有用的shell函数和别名,并非原创1、备份文件function backup(){ if [[ -z "$1" ]];then echo "Usage: backup filename" return fi cp -rvf "$1" "$1_bak"}2、交换文件function sw

2015-11-06 23:37:50 1188

原创 如何离线阅读Google SDK帮助文档

做Android开发免不了要阅读Google SDK中的文档。但往往会出现文档打开缓慢,格式错乱、图片确实等问题,给阅读带来很大的不便。通过摸索总结出如下离线阅读Google文档的方法,打开速度飞快,而且排版不会错乱。平台: Windows、mac、Linux都可以。涉及的软件:1、Firefox(其它带有脱机功能的浏览器也可以,不过Firefox对Google文档的支持相当好)2

2015-10-29 23:30:05 1453

翻译 Linux内核编译流程

Process of the Linux kernel building(Linux内核编译流程)Introduction(简介)I won’t tell you how to build and install a custom Linux kernel on your machine. If you need help with this, you can find many resources

2015-10-03 17:51:24 13885 3

原创 如何在ROM中集成可卸载的APK

在Android手机产品化的过程中,常常遇到集成第三方APK的问题,而需要集成的APK又分为可卸载/不可卸载两类,对于不可卸载的APK,比较简单,只需要将其编译到system.img即可,对于可卸载的APK则稍显复杂。方法1:集成到userdata.img该方法十分简单,集成到userdata.img /data/app目录下得apk自然是可以卸载的。但有以下两个问题:       1

2015-09-29 23:41:37 2588

原创 LeetCode 240: Search a 2D Matrix II

Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted in ascending from left to right.Integers in

2015-07-30 19:07:55 1690

原创 LeetCode 14: Longest Common Prefix

Longest Common PrefixWrite a function to find the longest common prefix string amongst an array of strings.求最长公共前缀。代码如下:class Solution {public: string longestCommonPrefix(vect

2015-07-30 19:04:07 1802

原创 LeetCode 238: Product of Array Except Self

Given an array of n integers where n > 1, nums, return an arrayoutput such that output[i] is equal to the product of all the elements ofnums except nums[i].Solve it without division and in O(n).

2015-07-27 18:51:41 4091 3

原创 LeetCode 235: Lowest Common Ancestor of a Binary Search Tree

Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined betwee

2015-07-27 18:41:00 2639

原创 LeetCode 237 : Delete Node in a Linked List

Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node with value

2015-07-27 13:54:09 6781 2

原创 LeetCode 234: Palindrome Linked List (回文链表)

Given a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space?判断一个单向链表是否是回文链表,要求O(n)的时间复杂度和O(1)的空间复杂度。算法有以下几种:1、遍历整个链表,将链表每个节点的值记录在数组中,再判断数组是不是一个回文数

2015-07-16 22:48:30 15836 3

原创 LeetCode 232: Implement Queue using Stacks

Implement the following operations of a queue using stacks.push(x) -- Push element x to the back of queue.pop() -- Removes the element from in front of queue.peek() -- Get the front element.empty(

2015-07-07 19:35:06 5112

原创 LeetCode 231: Power of Two

Given an integer, write a function to determine if it is a power of two.判断一个数是否是2的幂,判断方法主要依据2的N次幂的特点:仅有首位为1,其余各位都为0.方法1: n & n-1 == 0class Solution {public: bool isPowerOfTwo(int n) {

2015-07-06 18:34:20 4352 2

原创 LeetCode 230: Kth Smallest Element in a BST

Given a binary search tree, write a function kthSmallest to find thekth smallest element in it.Note: You may assume k is always valid, 1 ≤ k ≤ BST's total elements.Follow up:What if the BST

2015-07-02 14:27:17 6817 3

原创 LeetCode 208: Implement Trie (Prefix Tree)

Implement a trie with insert, search, and startsWith methods.Note:You may assume that all inputs are consist of lowercase letters a-z.前缀查找树,简单的可以实现为一种26叉树。需要在节点上增加一个字段,标明该节点是否是一个单词,还是仅仅是单词的前缀。代码

2015-06-27 15:32:38 3957

原创 LeetCode 228: Summary Ranges

Given a sorted integer array without duplicates, return the summary of its ranges.For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"].代码要求对数组中的元素进行分段。首先给出字符串格式化函数,如果begin==end, 则输出字

2015-06-26 18:32:00 4120 6

原创 LeetCode 35:Search Insert Position

Given 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 it were inserted in order.You may assume no duplicates in the array.

2015-06-15 19:57:29 574

原创 LeetCode 80:Remove Duplicates from Sorted Array II

Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array nums = [1,1,1,2,2,3],Your function should return length = 5, with the first five e

2015-06-15 19:49:29 604

Monaco字体

Mac系统字体,等宽字体,最佳的编程字体

2016-01-06

The SELinux Notebook 4th Edition

SELinux Notebook对SELinux技术做了详细的介绍,对Linux系统开发,Android安全开发具有很大的帮助。

2015-05-23

效能桌面便签V1.66

即 时贴扔掉了传统的纸张和开始使用完全免费的高效粘滞便笺! “棒”笔记在桌面上,你可以阅读屏幕上的任何重要信息的时间。 可以节省你的钱,可以节省你的时间! 该软件允许不同的背景颜色,可选的渐变效果,必须为便条集。 您还可以自定义每个注意字体,将其设置为半透明因此它不能完全覆盖你的桌面背景或图标。 为了充分保护您的隐私,软件加密与不可逆转SHA算法登录密码,同时也加密数据文件。 此外,它提供了诸如如何管理组便签各种特殊功能,设置注意的重要性,跟踪创建时间和最后修改时间说明,增加附件说明,回收站,所以...不伤害等,使现在 试试。 你会爱她!

2010-10-18

Astyle 1.2.4 Windows

著名的代码自动缩进软件ASTYLE的源码,为1.24版本,支持C/C++/JAVA的各种格式的排版,支持自定的样式,功能强大.

2010-10-18

FsCapture 6.7 for Windows

 FSCapture是一款抓屏工具,附带的其他两个小功能:取色器和屏幕放大镜。对抓取的图像提供缩放、旋转、减切、颜色调整等功能。只要点点鼠标就能随心抓取屏幕上的任何东西,拖放支持可以直接从系统、浏览器或其他程序中导入图片。   取色器   现在网上各式各样的取色器应该不少了,包括之前一直用的蓝色经典推荐的ColorSPY, Firefox下还有一个专门的取色器扩展ColorZilla,这些都是很好的软件。但自从使用了FS Capture之后,这些我都很少用到了。原因很简单,各种取色软件的功能都大同小异,FS Capture非常小巧,既然有这样一个小软件能够包含取色器、屏幕放大镜和截屏的功能,为什么还要为这些功能而分开多个软件呢。FastStone Capture的取色支持RGB、Dec和Hex三种格式的色值,而且还有一个混色器,取到颜色之后可以再编辑。   屏幕放大镜   这确实是一个不错的功能,特别是现在我们已经习惯用DIV来对页面定位,DIV之间的对齐不像表 格那样容易控制,有时为了调整几个象素的偏差,不得不对着屏幕盯很久。有这样一个放大镜就方便多了。使用时只需点击一下FS Capture窗口上的放大镜图标,鼠标变成一个放大镜的样子,然后在需要放大的地方按下左键就可以了,就像手里真的拿着一个放大镜一样。可以设置放大倍 律,放大镜的尺寸,外观(圆形,矩形以及圆角矩形)以及是否平滑显示,按ESC键或单击右键可退出放大镜。   截屏   包括了全屏截取,当前活动窗口截取,截取选定区域,多边形截取和截取滚动页面等,基本上常用的都有了。特别是滚动截取,许多朋友为了这个功能不惜安装各种重量级的截屏软件,甚至四处下载各种软件的破解器——忘了说了,FS Capturte是一款免费软件!   图像浏览/编辑   FS Capture还包括快速浏览/编辑图像的功能,可以点击主窗口的“打开”图标快速打开一幅图片,进行简单的缩放、裁切、旋转、加文字等轻量级的操作。把网页中图片拖到FS Capture的窗口上,会快速打开图像浏览窗口。

2010-10-18

空空如也

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

TA关注的人

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