
C、C++
文章平均质量分 73
elfylin
这个作者很懒,什么都没留下…
展开
-
libstdc++/include/new: No such file or directory
jni/stlport/stl/_new.h:47:50: fatal error: libstdc++/include/new: No such file or directory原创 2014-04-24 23:45:52 · 3504 阅读 · 0 评论 -
C++ "coyp constructor" and webkit's RefPtr useage
C++ constructure and destructureTwo places to call the default construture function.1)it will call the default copy constructure while passing the parameters.2).it will also call the default c原创 2012-05-24 17:06:36 · 753 阅读 · 0 评论 -
C++ cast
c++.static&const1.staticstatic change the field and the life circlea. variable with static in the file, this variable could only used in this file. b. variable with static in the function, the原创 2012-04-19 21:06:31 · 664 阅读 · 0 评论 -
exec and get pid
exec is used for start another program in the c code of linux1.execlint execl(const char*path,const char* arg,...)the last parameter must end up with NULL.#include #include int main(){原创 2012-03-17 00:03:17 · 1016 阅读 · 2 评论 -
socket
simple server and client may be useful for copy in the futureserver:#include #include "sys/types.h"#include "sys/socket.h"#include "sys/stat.h"#include "unistd.h"#include //#in原创 2012-04-04 22:56:29 · 1188 阅读 · 0 评论 -
Android C/CPP log
Android use UNIX Domain Socket for get debug log.usually name "tombstone_0X" and so on in /data/log/logcat/1. Server First , it has a socket server. it's a executable program.The code was原创 2012-03-15 23:34:58 · 3379 阅读 · 0 评论 -
ISO-8859-1 编码
今天遇到一个编码的问题,8859-1。这是一种西文编码方式,占8个字节,兼容ascii编码。官方描述以及演进历史:ISO/IEC 8859-1,又称Latin-1或“西欧语言”,是国际标准化组织内ISO/IEC 8859的第一个8位字符集。它以ASCII为基础,在空置的0xA0-0xFF的范围内,加入192个字母及符号,藉以供使用变音符号的拉丁字母语言使用。法语原创 2010-10-12 23:34:00 · 14394 阅读 · 0 评论 -
UNIX Domain Socket IPC (sockaddr_un )
socket API原本是为网络通讯设计的,但后来在socket的框架上发展出一种IPC机制,就是UNIX Domain Socket。虽然网络socket也可用于同一台主机的进程间通讯(通过loopback地址127.0.0.1),但是UNIX Domain Socket用于IPC更有效率:不需要经过网络协议栈,不需要打包拆包、计算校验和、维护序号和应答等,只是将应用层数据从一个进程拷贝到另一个转载 2012-03-15 23:15:59 · 1251 阅读 · 0 评论 -
ptrace
1. definitionlong ptrace(int request, pid_t pid, void * addr, void * data)request , trace type;the request determine the meaning of the other parameters and return value. 2.possibility of原创 2012-03-09 22:35:43 · 2569 阅读 · 1 评论 -
Polymorphism
Polymorphism happens as program is running , when the type of the parameter passed in is different from it's definition(usually defined as a parent class pass a subclass), and we will call the parame原创 2012-01-31 21:46:54 · 560 阅读 · 0 评论 -
little endian and big endian
There three type of address order in computer1. address order for variablesthere maybe many varaibles in the program, and whose address is higher and whose is lower?general thinking it should in原创 2011-12-04 16:30:58 · 1088 阅读 · 0 评论 -
Webkit HashIterator
HashIterator is a template class (it use the hashtable's parameters to initialize it) for visit hash table.HashTableIteratorAdapter is a template class, for visit hash map (it will use Hasgitera原创 2011-09-29 23:31:43 · 772 阅读 · 0 评论 -
Ref, RefPtr, PassRefPtr" study note
The RefCount,RefPtr,PassRefPtr is something in the WebKit source code.We use RefCount to manage the life circle of a pointer.1 RefCounted/RefCountedBasethis is a basic class , it has a var原创 2011-10-11 23:04:06 · 1861 阅读 · 0 评论 -
pointer to ref of an array, and to the func that return a ref of an array
The expression A->B is exactly equivalent to (*A).B for builtin types. If a user-defined operator-> is provided,operator-> is called again on the value that it returns, recursively, until the原创 2014-02-17 17:33:28 · 865 阅读 · 0 评论 -
notes
好久没有写,不过想想就当个笔记吧!find c definition from java.1. first in os.java implemented in Posix.javaOs2. native file: method:libcore_io_Posix.cppNATIVE_METHOD(Posix, connect, "(Ljava/io/FileDescript原创 2014-02-07 11:18:27 · 2337 阅读 · 0 评论 -
c++ const friend
class COperator{public:int m_x;COperator(){printf("COperator default constructors\n");}//RefPtr& operator=(const PassRefPtr&);COperator(const COperator& src){m_x = src.m_x;printf("COperator copy原创 2012-01-10 22:08:01 · 867 阅读 · 0 评论 -
pthread
1.创建pthread_create( &a_thread, a_thread_attribute, thread_function, (void *)some_argument);pthread_t a_thread; pthread_attr_t a_thread_attribute; void * thread_functio原创 2012-11-30 15:00:28 · 1633 阅读 · 0 评论 -
hash and frame (draft)
1. hashHashMapKeyArgMappedArgHashArgKeyTraitsArg (KeyTraits)MappedTraitsArg (MappedTraits)函数有值参数,模块有类型参数,也可以有值参数。Traits:1.基类GenericHashTraitsBase定义如下:template struct Generi原创 2012-10-28 16:34:08 · 715 阅读 · 0 评论 -
ld and sopath and gdb useage
1. so search path:The necessary shared libraries needed by the program are searched for in the following order a Using the environment variable LD_LIBRARY_PAT原创 2012-10-22 12:43:44 · 816 阅读 · 0 评论 -
arm 汇编学习
一、寄存器和寻址ARM有16个寄存器,R0-R15PC R15LR R14SP R13IP R12(Push sp减少,Pop sp增加)1.寻址方式从操作地址寻找操作数的方式2.ARM的寻址方式a 寄存器寻址, 操作数在寄存器中b 立即寻址,操作数就在指令中SUBS R0,R0,#1;R0-1->R0MOV R0,#0xff00c. 寄原创 2012-06-12 22:07:01 · 927 阅读 · 0 评论 -
c++ to asm
cppint main(int argc, char** argv){ return 0;}asmdump: file format elf32-littlearmDisassembly of section .plt:00008378 : 8378: e52de004 push {lr} ; (str lr, [sp, #-4]!) 837c: e59原创 2012-07-19 19:35:51 · 1550 阅读 · 0 评论 -
C LOG function
Usually we need log to debug our program, usually in log format.Here is a simple but usful log file for C/C++ function.#include #include #include "string.h"int LOGL(char * filename, const cha原创 2011-12-02 21:42:54 · 2062 阅读 · 0 评论 -
CachedResouce
1.LoadProcessway onea.CachedResourceClientb.->CachedResource.load(CachedResourceLoader* cachedResourceLoader)c.->CachedResourceLoader::load(CachedResource* resource, bool incremental, Security原创 2012-06-05 17:20:18 · 1158 阅读 · 0 评论 -
linux 系统 ko模块编译
今天整理以前笔记,发现曾经里面有一个Makefile文件。 仔细一看是以前实习做linux内核程序设计时候写的模块makefile。刚好我电脑也有linux系统,就拿来回顾一下。写个my.c和一个Makefile文件,然后make编译一下,就成功了,生成my.ko 再加载一下insmod my.ko dmesg|grep module 看到模块初始化时候的打印卸载模原创 2010-09-26 21:10:00 · 29642 阅读 · 1 评论 -
Hash study notes
Set, Data structure which does not allow duplicate elements.Map.Entry, is a key/value mapping contained in a Map.Map, is a data structure consisting of a set of keys and values in which each key原创 2012-02-22 23:27:00 · 522 阅读 · 0 评论 -
so into apk
1. use given .soa. make lib dir under the app's dirb.copy your libXX.so into the dir.c.modify the Android.mkadd "COCAL_JNI_SHARED_LIBRARIES :=libXX" LOCAL_PATH:= $(call my-dir)include $(CLEAR原创 2012-01-04 20:47:01 · 1572 阅读 · 0 评论 -
Makefile 详解 2
<br />上面就是一个makefile的概貌,也是makefile的基础,下面还有很多makefile的相关细节,准备好了吗?准备好了就来。<br />一、Makefile里有什么?<br /><br />Makefile里主要包含了五个东西:显式规则、隐晦规则、变量定义、文件指示和注释。<br /><br />1、显式规则。显式规则说明了,如何生成一个或多的的目标文件。这是由Makefile的书写者明显指出,要生成的文件,文件的依赖文件,生成的命令。<br /><br />2、隐晦规则。由于转载 2010-10-20 15:16:00 · 481 阅读 · 0 评论 -
makefile 详解
<br />扫描技术贴,多的不说,先转过来再说。<br /> <br />陈皓<br /><br />概述<br />——<br /><br />什么是makefile?或许很多Winodws的程序员都不知道这个东西,因为那些Windows的IDE都为你做了这个工作,但我觉得要作一个好的和 professional的程序员,makefile还是要懂。这就好像现在有这么多的HTML的编辑器,但如果你想成为一个专业人士,你还是要了解 HTML的标识的含义。特别在Unix下的软件编译,你就不能不自己写ma转载 2010-10-20 15:12:00 · 514 阅读 · 0 评论 -
GNU make中文手册v3.8笔记
记录一些要点。Make --helpUsage: make [options] [target] ...Options:-b, -m Ignored for compatibility.-B, --always-make Unconditionally make all targets.-C DIRECTORY, --directory=DIRECTORY转载 2010-10-20 17:24:00 · 1269 阅读 · 0 评论 -
Windows Socket 程序-- 远程dos shell 服务器和客户端 (1)
前2天看了看网络安全,讲到一种IPC入侵方式,要种植一个网络客户端到被入侵的主机,以实现远程shell的功能,就像自己写一个客户端和服务器。采用原型开发模式,第一步,实现相互通信的服务器和客户端。客户端可以向服务器发送信息,服务器把信息转成大写后回发给服务器。服务器:#include #include #include #include #include #define BUFFERLEN 512#pragma comment(lib, "ws2_32")using namesp原创 2010-10-17 21:32:00 · 3306 阅读 · 0 评论 -
C变参的实现
<br />原帖:http://blog.youkuaiyun.com/xlliu0226/archive/2008/03/31/2233529.aspx<br /> <br />在C语言中,函数参数的传递方式有值传和址传.值传是把实参的一个专用的、临时的复制值给被调函数中相应的形参被调用函数使用、修改这个传来的复制值,不会影响实参的值.址传则是把变量(实参)的地址传给被调函数.被调函数通过这个地址找到该变量的存放位置,直接对该地址中存放的变量的内容进行存取操作.因此,在被调用函数中可以修改实参的值.这转载 2010-10-09 20:17:00 · 2986 阅读 · 1 评论 -
求线性方程组的解
<br />今天写了一个求线性方程组解的程序。<br />从文件中输入矩阵,输出一个进行过变换的矩阵,输入文件为transform.txt 与该文件夹同一个目录,输出至屏幕上。<br /> <br />比如,文本文件中的矩阵为<br />1 2 3 4<br />0 5 6 7<br />2 7 6 8<br />则输出为<br />2 0 0 1<br />0 1 0 0<br />0 0 6 7<br />即2x=1,y=0,6z=7<br /> <br />矩阵为<br />1 2 3 4<br />原创 2010-09-24 21:35:00 · 831 阅读 · 0 评论 -
分解因式
<br />把一个整数分解为素数相乘<br />个人感觉效率还可以。<br /> <br />复杂度,取决于这个整数的组成。<br /> <br />一般情况下就是素数个数+判断最大素数因子为素数 的复杂度吧!<br /> <br />#include <stdio.h>#include <math.h>#define MAX 128#define NUMBER 250int isteps = 0;//分解因式,打印出来void breakNumber(int num){原创 2010-09-25 23:41:00 · 911 阅读 · 0 评论 -
从文件中读取矩阵
<br />其一,文件格式<br />4 6 7 3<br />4 5 6 8<br />7 8 9 0<br />前提是必须知道矩阵大小,在源文件中进行宏定义。优点是,二位数组表示矩阵,容易操作。<br />为readFixMatrixFromFile和showFixMatrix。<br />其二,文件格式<br />3 4<br />4 6 7 3<br />4 5 6 8<br />7 8 9 0<br />只要文件正确,行数和列数从文件中读取,不需要修改源文件宏定义。缺点,矩阵其实是原创 2010-09-22 23:38:00 · 4280 阅读 · 0 评论 -
最小公倍数和最大公约数
支持求2个以上数值的最大公约数和最小公倍数,可以用作通分。#include #include //两个数最大公约数int getMaxDivisor(int large, int little){ int temp = large%little; while(temp) { large = little; little = temp; temp = large%little; } return little;}//两个数最小公倍数int ge原创 2010-09-20 22:47:00 · 618 阅读 · 1 评论 -
C读取配置文件
程序运行的参数比较多,通过手工输入太不现实,所以多数系统都有配置文件。在此就写了一个读取配置文件的小程序。读取文件每行,解析出来key和value。原创 2010-09-20 22:40:00 · 760 阅读 · 0 评论 -
Makefile详解 书写命令
<br />书写命令<br />————<br /><br />每条规则中的命令和操作系统Shell的命令行是一致的。make会一按顺序一条一条的执行命令,每条命令的开头必须以[Tab]键开头,除非,命令是紧 跟在依赖规则后面的分号后的。在命令行之间中的空格或是空行会被忽略,但是如果该空格或空行是以Tab键开头的,那么make会认为其是一个空命令。<br /><br />我们在UNIX下可能会使用不同的Shell,但是make的命令默认是被“/bin/sh”——UNIX的标准Shell解释执行的转载 2010-10-20 15:24:00 · 676 阅读 · 0 评论 -
Windows Socket 程序-- 远程dos shell 服务器和客户端 (2)
<br />前两天在研究makefile,把这个程序给落下了。<br /> <br />今天就抽空完成一下,把代码结构小优化了一下,加了几个测试的桩函数,基本运行正常。<br /> <br />先把代码贴过来吧!<br /> <br />服务器:<br /> <br />#include <iostream>#include <sys/types.h>#include <winsock2.h>#include <string.h>#include <stdarg.h>#include <原创 2010-10-22 23:20:00 · 1139 阅读 · 0 评论 -
Webkit Timer study notes
Timer Class and Timer start1.TimerBaseBase class for timer . has function "start", "stop" and so forth.2.TimerTimer is subclass of TimerBase, it's also Class template." TimerFiredClass" is原创 2011-12-15 00:03:27 · 2494 阅读 · 0 评论 -
module and macro in Android.mk
There are many things in Android.mk especially jni's makefile.here are some key information in the make file.a. target namewhat's the code's target name is defined in "LOCAL_MODULE"for exa原创 2012-01-01 16:05:53 · 1776 阅读 · 0 评论