ITeye博客

好记性不如烂博客

cryolite · 共 139 篇文章

静态链接与动态链接

基于gmp开发第三方库,后者以动态链接库(静态库?)对方式发布, 为了效率gmp建议对该库采用静态链接, 所以,目的是生成静态链接gmp库的库文件(动态库?静态库?) 一、生成可执行文件 动态链接库的编译 Mac和linux都是: gcc -o param_convention1 param_convention.c -lgmp 静态链接库的编译 Mac是: gcc -o param_convention2 param_convention.c -Wl,-no_pie /usr/local/lib/libgmp.a linux是: gcc -o param_convention2 param…

2014-09-06 03:24 · 我的备忘录 · 评论(0)

在macbook上安装linux

安装最新的rEFInd > 0.8.2 http://sourceforge.net/projects/refind/postdownload?source=dlp 用u盘引导安装 制作usb启动盘的方法见 https://help.ubuntu.com/community/How%20to%20install%20Ubuntu%20on%20MacBook%20using%20USB%20Stick freebsd参考 http://www.freebsd.org/doc/handbook/bsdinstall-pre.html 配置无线网卡 a) 查看无线网卡型号 lspci -vvnn…

2014-06-12 10:29 · 我的备忘录 · linux · 评论(0)

NIF与OS线程

NIF的OS线程编程模型可以参考The Art of Multiprocessor Programming第八章Monitors and Blocking Synchronization

2013-08-31 01:29 · Erlang · 评论(0)

小备忘录

像素坐标与地理坐标转换关系为 X=A1+ PA2+ LA3 Y=A4+ PA5+ LA6 其中X为所求像素点地理坐标 Y为所求像素点地理 坐标 P为图像像素点列号 L为行号 A1 至 A6 六个参数为Tiff格式影像数据起始参数 可通过GDAL 的GetGeoTransform函数获取 参数1~6含义分别为左上角起点地理坐标 东西方向上每个像素代表的地理距离 南北方向旋转参数 左上角起点地理Y坐标 南北方向上每个像素点代表的地理距离 一般为负值 东西方向旋转参数

2013-08-29 10:24 · GDAL · 评论(0)

关于nif

一、NIF的误用问题 使用NIF是很危险的,一不小心它就会搞垮你的erlang VM,还会堵塞erlang调度器使VM进入假死状态。 平均每20个使用NIF的项目,就有19个滥用了NIF。参考: NIF Abuse NIF官方手册 其实有所提示: Avoid doing lengthy work in NIF calls as that may degrade the responsiveness of the VM. NIFs are called directly by the same scheduler thread that executed the calling Erlang …

2013-08-19 10:28 · 我的备忘录 · Erlang · 评论(0)

自建riak帮助文档

riak的文档越来越丰富了,如果要离线看,可以自建一个riak doc 一、安装ruby 前提, 需要ruby 1.9,Mac10.6.8 32bit Snow Leopard 自带的ruby 1.8版本太低 可能还要装port 1。安装rvm: 用rvm装ruby 1.9.3是最方便的,参考 http://ruby-china.org/wiki/rvm-guide curl -L https://get.rvm.io | bash -s stable 下载、安装成功后,新开一个shell窗口 修改 RVM 的 Ruby 安装源到国内的 淘宝镜像服务器,这样能提高安装速度 $ sed -i …

2013-08-12 21:39 · 评论(0)

riak的用户库模块加载问题

基于riak core/pipe构建自己的应用时会遇到如何加载自己的应用模块的问题。在此收集一些常用方法备忘。 指定用户自定义模块的路径 编译好的erlang模块由 Erlang code server 负责加载到Erlang运行时。code server可以在启动时自动加载基本库模块,也可以在运行时动态加载模块。 当调用某个函数时,如果该函数所在模块没有装载,则code server会自动的装载该模块。 code server会维护一个代码搜索路径(code path),它会在这个路径中搜索erlang模块代码。 code:get_path()可以查看这个搜索路径。 这个路径可以通过cod…

2013-08-04 13:32 · 评论(0)

遇到的riak性能问题

1。 遇到一个奇怪的性能问题,多个进程中用riakc_pb_socket put和get有着不同的性能表现。 我的情况是put还好,但是get老是超时(60秒)。 有人在邮件上提到了这个问题,不过和我相反。在这里记录下备忘。 http://lists.basho.com/pipermail/riak-users_lists.basho.com/2013-July/012669.html 查看riak的console.log日志,如果有busy_dist_port记录,说明是erlang节点的缓存被耗尽。 遇到这个问题修改vm.args参数+zdbbl, 增加缓冲容量,容量单位是KB http…

2013-07-23 10:59 · 我的备忘录 · Erlang · riak · 评论(0)

作为内存数据库的riak

riak的邮件列表最近的讨论 riak_kv_memory_backend in production Here are some suggestions for running the memory backend in production: Since you are running a single node cluster, set your n_val to 1 Make sure you set the max_memory parameter to prevent the node from OOM'ing. In order to get greater concurren…

2013-07-19 21:28 · 评论(0)

dialyzer使用备忘

一、构建PLT文件: 新构建 dialyzer --build_plt --apps $(APPS) --apps参数对命令指定的应用构建PLT,缺省的PLT文件是~/.dialyzer_plt文件 如果要生成自己的plt文件,使用--output参数指定 dialyzer --build_plt --apps $(APPS) --output_plt my_abc.plt 一个例子: dialyzer --build_plt --output_plt ~/.my_abc.plt --apps kernel stdlib sasl erts ssl tools os_mon runtime_…

2013-07-04 12:36 · 我的备忘录 · 评论(0)

CRDT: 分布式环境下的数据结构

Strong Eventual Consistency and Confilict-free Replicated Data Types SEC & CRDT

2013-07-02 10:06 · 评论(0)

Erlang应用打包工具:node_package

node_package 是一个制作 erlang应用 安装包的脚本/模版集合。支持的平台包括deb(ubuntu), MacOSX, FreeBSD。 这里记录我使用过程中遇到的一些问题,备忘。 一、前提 rebar.config中添加对node_package的依赖。 使用前保证rebar generate能正确打包。 另外,generate出来的应用目录下要有个data目录,可以在reltool.config目录里配置: {overlay, 二、起步 要想写自己的配置文件,可以拷贝 stanchion应用 ,也可以参考riak,但是后者要复杂许多。 例如直接抄stanchion的Mak…

2013-07-01 17:15 · 评论(0)

手工从源码制作一个riak安装包

riak的Makefile文件提供了各个平台上的安装包的生成脚本。因此自己制作一个特定版本的riak安装文件是很方便的。 一、前提 0. git 没错,打包需要git build-essential工具要安装,它包括了gcc编译器,在build leveldb时需要。 sudo apt-get install build-essential ubuntu要有安装deb打包工具: sudo apt-get install devscripts debhelper 二、步骤 在本地clone riak git clone git://github.com/basho/riak 检出要打包的特定版…

2013-06-22 18:47 · 我的备忘录 · 评论(0)

folsom_metrics使用备忘

folsom是一个通用的统计度量工具。使用很简单,关键是搞清它的度量方式的含义。 有如下几种度量器(metrics): counter, gauge, histogram, histories, meter 有些还可以往下细分。 使用方法都是先new一个度量器(metric),然后每来一个数据,notify一下这个metric: 例如gauge类型的时速表的使用。 新建一个时速表: folsom_metrics:new_gauge(velocity). 更新当前车速: folsom_metrics:notify(velocity, 40). folsom_metrics:notify(vel…

2013-06-07 15:41 · 我的备忘录 · Erlang · my tool box · 评论(0)

ubuntu上安装systemtap

因为Ubuntu没有提供kernel debug symbols,systemtap安装后是不能直接在ubuntu上正常使用的。 有人提供了一个安装脚本 https://bitbucket.org/sentimental/poc_stap 为12.04添加apt-get源: sudo tee /etc/apt/sources.list.d/ddebs.list << EOF deb http://ddebs.ubuntu.com/ precise main restricted universe multiverse deb http://ddebs.ubuntu.com/ precise-…

2013-03-13 12:32 · 评论(0)