自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

小猪爱拱地

勤奋和毅力是通向成功的阶梯

  • 博客(16)
  • 资源 (1)
  • 收藏
  • 关注

转载 Thread Safety of shared_ptr

shared_ptr objects offer the same level of thread safety as built-in types. Ashared_ptr instance can be "read" (accessed using only const operations) simultaneously by multiple threads. Differents

2015-05-30 16:51:54 756

原创 使用 shared_ptr

shared_ptr是一個模板類,它保存了一個指向動態分配的對象的指針,當指向這個對象的最後一個shared_ptr被銷燬的時候,這個對象也被銷燬了。有三種使用 shared_ptr的方法:1)使用 std::shared_ptr要用 std::shared_ptr的方式使用。實例代碼:#include #include class A{public: A()

2015-05-30 16:40:54 1523

转载 Stack Types and Instructions

The ARM supports four different stack implementations. These are categorised by two axes, namely Ascending versus Descending and Empty versus Full.An Ascending stack grows upwards. It starts from a

2015-05-28 07:20:26 727

原创 ARM上函数调用参数超过四个的时传递方法

众所周知,ARM架构下,函数参数是通过 r0~r4寄存器传递的;但是如果参数超过四个,就要借助于栈了。下面以一个例子说明。int func(int a1, int a2, int a3, int a4, int a5, int a6){ return a1 + a2 + a3 + a4 + a5;}int main(void){ func(1, 2, 3, 4, 5, 6);

2015-05-28 07:13:31 11960 4

转载 Using GIOChannel

http://www.symlab.org/main/documentation/reference/s3/pdk/GUID-817C43E8-9169-4750-818B-B431D138D71A.htmlGIOChannel provides a portable method for using file descriptors,sockets and pipes and int

2015-05-26 03:26:02 1270

原创 GLIB main event loop

下面是一个小程序,其实是一个简单的事件触发模型:#include #include #include GMainLoop *loop;gboolean callback(GIOChannel *channel){ gchar *str; gsize len; /*stdin*/ g_io_channel_read_line(channel, &st

2015-05-26 03:06:06 1167

原创 查看 pkg-config默认的搜索路径

pkg-config --variable pc_path pkg-config输出结果是:/usr/local/lib/i386-linux-gnu/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/i386-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/sh

2015-05-25 07:02:11 7383 2

原创 编译 EFL代码时的一个错误

在编译 EFL(https://www.enlightenment.org/download)代码,执行  config时,报错:configure: error: pkg-config missing openssl但是openssl 已经安装了:$ dpkg --get-selections | grep openssllibgnutls-openssl27:i386 inst

2015-05-22 05:54:59 1778

转载 A Brief intro to X11 Programming

A Brief intro to X11 ProgrammingThis is meant to be a simple overview of X11 programming. It will contain the basics necessary to create a single window X program. All of the information of this w

2015-05-20 07:22:53 1185

转载 An Introduction to OpenCL Programming

Benedict R. Gaster (AMD Architect) has published on AMD developers website, an introduction to OpenCL programming.I repoduced the complete source code here without the comment (you have to jump to

2015-05-20 07:17:04 876

原创 当debug信息单独存放为一个文件时使用gdb调试CoreDump

为了便于开发,现在经常把可执行文件里的debug信息取出来单独作为一个文件,这样,可以使得可执行文件体积变小很多。比如,rpm包普遍采用这样的方法。这种情况下,如果要对产生的 coredump进行调试,需要做一些特殊的设置。下面以一个简单的例子来说明这种方法。1. 先写几个测试文件:$ cat lib1.c #include void fun1(void){ printf

2015-05-16 13:39:18 2566

原创 Bash shell脚本打印出正在执行的命令

默认情况下,bash脚本不会打印执行的每个命令,这个有时候不太方面。如下的方法可以让bash脚本打印出执行的命令:1) 在脚本里添加 set -v 或者 #!/bin/bash -v以加 set -v 最好。set -v  和set -o verbose是一样的2) 添加set -x 或者#!/bin/bash -x3,

2015-05-16 12:41:12 35840

转载 算法分析: Longest Common Subsequence

LCS Problem Statement: Given two sequences, find the length of longest subsequence present in both of them. A subsequence is a sequence that appears in the same relative order, but not necessarily con

2015-05-10 13:32:36 868

原创 编译器优化对函数的影响

编译器如gcc,可以指定不同的优化参数,在某些条件下,有些函数可能会被优化掉。先写一个简单的测试文件: cat test.c inline void foo(void){}用命令gcc -g -c test.c编译成目标文件。用 nm检查函数符号:$ nm -C test.o 00000000 T foo现在使用 命令gcc -g -c -O2 t

2015-05-08 04:16:27 1425

原创 算法分析: 求最长的递增数列

求最长的递增数列(Longest Increasing sequence,  LIS)是一个比较常见的问题。给定数列 10, 22, 9, 33, 21, 50, 41, 60, 80,那么 LIS 为 10, 22, 33, 50, 60, 80分析思路: 假定 array[0, ..n-1]为输入数据, LIS[i]为array[0, ...i-1]时的LIS (i >0, i

2015-05-08 04:00:14 1758

原创 算法问题分析--邮票问题

问题如下:There are N number kinds of stamps with different worth. At this moment, you are allowed to use the same kinds of stamps several times, but the total number of uses of all stamps is restricted

2015-05-02 18:32:39 3636

Algorithm (4th), by Robert Sedgewick

Amazon 五星书。 Classic Reference The latest version of Sedgewick’s best-selling series, reflecting an indispensable body of knowledge developed over the past several decades. Broad Coverage Full treatment of data structures and algorithms for sorting, searching, graph processing, and string processing, including fifty algorithms every programmer should know. See algs4.cs.princeton.edu/code. Completely Revised Code New Java implementations written in an accessible modular programming style, where all of the code is exposed to the reader and ready to use.

2012-04-07

空空如也

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

TA关注的人

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