- 博客(121)
- 资源 (10)
- 收藏
- 关注
原创 ARM指令复习
1. 加法指令mvn r0, #0mov r1, #1mov r2, #3mov r3, #2 add r0, r0, r2adc r1, r1, r3
2016-03-06 16:10:58
707
原创 AIDL使用及Binder连接池
1. AIDL使用 AIDL是Android中一种特有的进程间通信手段,看完AIDL的使用后,感觉和当前比较流行的RPC框架比较相似。RPC也需要使用接口定义语言去声明接口对象和接口定义。以便生成相应的远程调用代码。 假设有这么一个场景,进程A提供了两个服务: 1. 查询图书列表 2. 添加图书 我们首先需要声明一个图书类:package co
2016-01-31 16:39:08
1649
原创 onMeasure方法的使用和字体的baseline, ascent, descent
今天在学习Android下拉列表实现时,发现理解onMeasure方法的原理对自定义View尤为重要。在View绘制过程中,系统通常会调用measure, layout, draw方法去进行控件的大小计算,布局及绘制,这些方法里面分别会调用下面三个方法。1. onMeasure 用来决定View的实际大小(包括宽和高),View的大小由父View和当前View自身的大小共同决定。2.
2016-01-23 21:34:26
2625
1
原创 ARM函数调用过程分析
最近回家学驾照了,没有什么时候学习,趁着空隙看下arm平台的逆向,可一上来就发现arm平台的函数调用和x86还是有很大的区别的。 ARM有16个32位的寄存器(r0到r15)。R15充当程序寄存器PCR14(link register)存储子程序的返回地址R13存储的是堆栈地址ARM有一个当前程序状态寄存器:CPSR 一些寄存器(r13,r14)在异常发生时会产生新
2014-12-12 21:00:29
2255
原创 C++逆向之switch-case
很长时间没有写日志了,前阵子看了下python,发现了python的无边无际,感觉继续学下去就没办法学习逆向相关的内容了。Switch-Case在编译器编译后主要有三种形式:1.有序,分支数小于3个2.有序,但是MaxValue-MinValue小于255的有序3.无序1.有序,分支数少于3个这种方式比较简单,编译器直接使用cmp reg32, mem这种类似于if
2014-12-03 12:57:24
907
原创 Smali入门之HelloWorld
编写HelloWorld.smali文件:.class public LHelloWorld;.super Ljava/lang/Object;.method public static main([Ljava/lang/String;)V .registers 2 sget-object v0, Ljava/lang/System;->out:Ljava/io/Print
2014-09-15 22:50:32
2217
原创 Python中的文件存储
#!/usr/bin/pythonpoem = '''\Programming is runWhen the work is doneif you wanna make your work also fun: using python'''f = file('poem.txt', 'w')f.write(poem)f.close()f = file('poe
2014-09-03 14:59:32
1023
原创 Python中的类和继承
class SchoolMember: '''Represents any school member''' def __init__(self, name, age): self.name = name self.age = age def tell(self):
2014-09-03 14:46:45
627
原创 Python中的Sequence
#coding=utf-8s1 = (1, 2, 3)s2 = [s1, 1, 2]print type(s1), s1print type(s2), s2s2.append(2)print type(s2), s2s2.append(s1)print type(s2), s2print s1[0:2]print s2[0:2]
2014-09-03 00:03:26
628
原创 Python中的时间转换
#coding=utf-8from time import strptime, strftimedateStr = '2014-09-02 11:30'# 将dateStr转化为时间的结构体parseStr = strptime(dateStr, '%Y-%m-%d %H:%M')# 将parseStr格式化为字符串coverted = strftime('%Y/%m/%d %H
2014-09-02 23:57:39
605
原创 jQuery学习-DOM节点操作
运行效果如下:代码: <html> <head> <script type="text/javascript" src="jquery-1.9.1.js"></script> </head> <body> <form id="
2014-07-19 23:58:23
176
原创 SpringMVC中ModelAndView无法传值的问题
这两天调试一个SpringMVC的程序,一直找不到原因,在后台传递一个链表到前台的jsp页面。各种
2014-06-26 19:54:30
2108
原创 BFS与DFS的区别
广度优先搜索的性质:当问题有解时,一定能找到解当问题为单位耗散值,且问题有解时,一定能找到最优解方法与问题无关,具有通用性效率较低属于图搜索方法深度优先搜索的性质:一般不能保证找到最优解当深度限制不合理时,可能找不到解,可以将算法改为可变深度限制最坏情况时,搜索空间等同于穷举与回溯法的差别:图搜索是一个通用的与问题无关的方法
2014-04-27 23:44:08
1222
转载 traits:Traits技术初探
概述:traits是一种特性萃取技术 color: #663300; font-family: 宋体; padding: 0px; margin: 0px;">,它在Generic Programming中被广泛运用,常常被用于使不同的类型可以用于相同的操作,或者针对不同类型提供不同的实现.traits在实现过程中往往需要用到以下三种C++的基本特性:enumtypedeftemp
2014-04-21 09:38:11
659
转载 蓄水池抽样——《编程珠玑》读书笔记
http://blog.youkuaiyun.com/huagong_adu/article/details/7619665
2014-04-09 13:18:29
617
原创 最长公共子序列
参考 http://blog.youkuaiyun.com/steven30832/article/details/8260189#include #include #include #include #include static bool LCS(const std::string & str1, const std::string & str2, std::stri
2014-04-08 21:36:46
752
原创 Linux按键驱动程序、定时器消抖
使用定时器可以防止因为按键抖动产生的多次 #include #include #include #include #include #include #include #include #include #include #include #include #include #define BUT_NAME "buttons"#define DEVCOU
2014-04-07 23:07:05
1195
原创 最短路径(Dijikstra和Floyed)
#include #include #include #include typedef unsigned int ssize_t;const ssize_t MAXSIZE = 20;static ssize_t graph [MAXSIZE][MAXSIZE];static ssize_t node_num;static char node [MAXSIZE];
2014-04-01 16:07:15
897
原创 C++中的强制类型转换 static_cast reinterpret_cast dynamic_cast const_cast
#include using namespace std;class A{public: operator int() {return 1;} operator char * () {return NULL;} virtual ~A(){}};class B:public A{};int main(int argc, char * argv[]){ A a;
2014-03-31 23:46:36
730
原创 C++之模板特化
关于C++中的模板,一直只会用最基础的部分。今天从网上找了一个文档,总结如下函数模板特化其实就是针对一个函数模板,定义一个特定类型的函数,函数模板更加具有通用性。#include #include template int compare( T const & l, T const & r){ return l < r ? -1 : ( l == r ? 0 : 1);}
2014-03-30 14:43:06
677
原创 使用STL实现LRU缓存
仿照http://blog.youkuaiyun.com/l402398703/article/details/22012551写了一遍LRUCache,自己对LRUCache的理解确实深刻了不少。cached_map :使用hash_map,便于根据用户提供的Key来找到相应的datahead,tail :表示所有当前已经使用的node节点,这里面的节点和cached_map中是一样的
2014-03-30 13:10:59
948
原创 C语言中的排序、二分查找
#include #include #include #include #include #include #include using namespace std;static void swap(int * const var1, int * const var2){ int tmp_val = *var1; *var1 = *var2; *var2 = tmp_v
2014-03-18 09:11:05
698
原创 观察者模式
#include #include #include using namespace std;class Blog;class Observer;class BlogObserver;class Observer{protected: Blog * blog;public: Observer(Blog * b):blog(b){} virtual void u
2014-03-05 21:34:36
664
原创 职责链模式
#include #include using namespace std;class Manager{protected: Manager * m_manager; string m_name;public: Manager(Manager * manager, string name):m_manager(manager), m_name(name){} virtual
2014-03-05 20:58:50
542
原创 STL中map的使用
#include #include using namespace std;class Student{public: string name; int age; string id;public: Student(string n, int a, string i):name(n),age(a),id(i){} /* 作为map中的key,必须可以比较大小 */ fri
2014-03-05 18:33:08
693
原创 Nett初步使用
import java.net.InetSocketAddress;import java.util.concurrent.Executors;import org.jboss.netty.bootstrap.ClientBootstrap;import org.jboss.netty.bootstrap.ServerBootstrap;import org.jboss.n
2014-03-02 11:29:54
805
转载 Ubuntu安装配置Mysql
三种安装方式: 1. 从网上安装 sudo apt-get install mysql-server。装完已经自动配置好环境变量,可以直接使用mysql的命令。 注:建议将/etc/apt/source.list中的cn改成us,美国的服务器比中国的快很多。 2. 安装离线包,以mysql-5.0.45-linux-i686-icc-glibc23.tar.gz为
2014-02-20 09:49:49
607
原创 八皇后问题
#include #include #include typedef int bool;#define true 1#define false 0#define M (8)#define OK(x, y) ((x) >= 0 && (x) = 0 && (y) < M)static int board[M][M]; /* 棋盘 */int cnt = 0; /* 记录解法种
2014-02-15 06:12:42
708
原创 微软面试100题系列-数组连续和最大
题目:输入一个整形数组,数组里有正数也有负数。数组中连续的一个或多个整数组成一个子数组,每个子数组都有一个和。求所有子数组的和的最大值。要求时间复杂度为 O(n)。例如输入的数组为 1, -2, 3, 10, -4, 7, 2, -5,和最大的子数组为 3, 10, -4, 7, 2,因此输出为该子数组的和 18。#include #include #define MIN
2014-02-15 03:05:12
661
原创 微软面试100题系列-设计包含 min 函数的栈
定义栈的数据结构,要求添加一个 min 函数,能够得到栈的最小元素。要求函数 min、push 以及 pop 的时间复杂度都是 O(1)。#define STACK_SZ 10struct stack{ int buf[STACK_SZ]; int top_index; int min_index;};int is_empty(struct stack *
2014-02-15 02:44:06
826
原创 Linux内核中的内存分配
虽然Linux的内存管理相当复杂,但是使用起来还是比较简单的。Linux内存分配器(__get_free_pages alloc_pages),基于伙伴系统,其中alloc_pages可以在分配高端内存。而__get_free_pages只能分配低端内存。并且他们分配的内存在物理上都是连续的。使用alloc_pages分配的高端内存需要通过kmap建立映射以获得内核虚拟地址进行访问,而分配的低
2014-02-12 22:54:13
992
原创 Linux内核中的per-CPU变量
per-CPU变量时linux内核中一个非常有趣的特性,他为系统中每个处理器都分配了变量的一个副本。这样做的好处是,在多处理器的系统中,当处理器操作属于他的变量副本时,不需要考虑与其他处理器竞争的问题,同时该副本还可以充分利用处理器本地的硬件以提高访问速度。基于per-CPU的以上特性,其最典型的使用场合是在统计计数方面。例如在网络系统中,内核需要跟踪已经接收到的各类数据包的数量,而这些数量在
2014-02-12 22:13:17
1091
Android AIDLDemo
2016-01-31
sql脚本 数据库系统概论(杨冬青译)
2013-10-05
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人