-
归档
- 2012 年三月
- 2011 年九月
- 2011 年二月
- 2011 年一月
- 2010 年十二月
- 2010 年十一月
- 2010 年八月
- 2010 年七月
- 2010 年六月
- 2010 年五月
- 2010 年四月
- 2010 年三月
- 2010 年二月
- 2010 年一月
- 2009 年十二月
- 2009 年十一月
- 2009 年十月
- 2009 年九月
- 2009 年八月
- 2009 年七月
- 2009 年六月
- 2009 年五月
- 2009 年三月
- 2009 年二月
- 2009 年一月
- 2008 年十二月
- 2008 年十一月
- 2008 年十月
- 2008 年九月
- 2008 年八月
- 2008 年七月
- 2008 年六月
- 2008 年五月
- 2008 年四月
- 2008 年三月
- 2008 年二月
- 2008 年一月
- 2007 年十二月
- 2007 年十一月
- 2007 年十月
- 2007 年九月
- 2007 年八月
- 2007 年七月
- 2007 年六月
- 2007 年五月
- 2007 年四月
- 2007 年三月
- 2007 年二月
- 2007 年一月
- 2006 年十二月
- 2006 年十一月
- 2006 年十月
- 2006 年九月
- 2006 年八月
- 2006 年七月
- 2006 年六月
- 2006 年五月
- 2006 年四月
- 2006 年三月
- 2006 年二月
- 2006 年一月
- 2005 年十二月
- 2005 年十一月
- 2005 年十月
- 2005 年九月
- 2005 年八月
- 2005 年七月
- 2005 年六月
- 2005 年二月
- 2004 年十月
- 2004 年九月
- 2004 年八月
-
杂项
月归档:十一月 2009
[GTK编程]如何读取网络中的图片创建image控件
发个牢骚,五千万个干!昨天可是想破头了,今天起来翻翻文档就实现了。代码相当的ugly,希望有高手赐教更方便的方法,实现方法很简单就是通过curl访问读取到内存中,然后调用gdk_pixbuf_new_from_stream,最后通过gtk_image_new_from_pixbuf创建。 /*功能:演示在GTK中如何读取网络中的图片创建image控件编译:gcc -Wall -g `pkg-config –cflags –libs gtk+-2.0` pixbuf.c -o pixbuf作者:SuPanYong@Gmail.com主页:http://www.spy8888.com*/#include <stdio.h>#include <stdlib.h>#include <string.h>#include <gtk/gtk.h>#include <curl/curl.h>#include <curl/types.h>#include <curl/easy.h>#include <gio/gio.h> struct MemoryStruct { char *memory; size_t size;}; /* 代码出处http://curl.haxx.se/libcurl/c/getinmemory.html */static void *myrealloc(void *ptr, size_t size){ if(ptr) return realloc(ptr, size); else return malloc(size);} static size_tWriteMemoryCallback(void *ptr, size_t … 继续阅读
[翻译]Linux命令行技巧3
3.将mkdir和cd合并为一条命令 一般你创建一个新的目录后,你想进入这个目录需要在执行cd如下所示: # mkdir -p /tmp/subdir1/subdir2/subdir3# cd /tmp/subdir1/subdir2/subdir3# pwd/tmp/subdir1/subdir2/subdir3 通过下列配置将cd和mkdir合并为一条命令 $ vi .bash_profilefunction mkdircd () { mkdir -p “$@” && eval cd“\”\$$#\””; } 测试一下合并后的命令 # mkdircd /tmp/subdir1/subdir2/subdir3[注意: 此时创建目录并自动进入创建的目录]# pwd/tmp/subdir1/subdir2/subdir3 4.使用“cd-”在最后进入的两个目录中切换如下所示 # cd /tmp/very/long/directory/structure/that/is/too/deep# cd /tmp/subdir1/subdir2/subdir3# cd -# pwd/tmp/very/long/directory/structure/that/is/too/deep# cd -# … 继续阅读
[ARMOURY SQUARE]我想买块石头
官网的活动,买块石头刻上你的名字或祝福铺在ARMOURY SQUARE。价钱也很不错从50欧到595欧不等。秀点图,这是广场全景。再来一张再上一张球员的,A23,安菲尔德大四喜偶今年是买不起了,明年先买块石头铺铺路,然后在买栋海布里的公寓,哈哈哈!
[翻译]Linux命令行技巧2
spy8888.com spy8888.com/wp-admin spy8888.com/wp-admin/post.php 2.cd别名实现快速进入目录 当进入一个非常长的目录之后想要返回到上几层需要连续使用很多次的../ # mkdir -p /tmp/very/long/directory/structure/that/is/too/deep # cd /tmp/very/long/directory/structure/that/is/too/deep # pwd /tmp/very/long/directory/structure/that/is/too/deep # cd ../../../../ # pwd /tmp/very/long/directory/structure 介绍4种别名规则有效实现快速返回上几级目录 方法1:使用“..n” 如下面的例子 ..4 是返回上4级目录 ..3 是返回上3级以此类推 alias ..=”cd ..” alias ..2=”cd ../..” alias ..3=”cd ../../..” alias ..4=”cd ../../../..” … 继续阅读
[翻译]Linux命令行技巧1
spy8888.com spy8888.com/wp-admin spy8888.com/wp-admin/post.php spy8888.com spy8888.com/wp-admin spy8888.com/wp-admin/post.php 1. cd的使用 使用CDPATH定义cd命令的启示目录 [spy8888@spy8888 ~]# pwd /home/spy8888 [spy8888@spy8888 ~]# cd mail -bash: cd: mail: 没有该文件或目录 [注意: 此时查找当前目录下的mail文件夹] [spy8888@spy8888 ~]# export CDPATH=/etc [spy8888@spy8888 ~]# cd mail /etc/mail [注意: 此时查找的是/etc目录下的mail文件夹] [spy8888@spy8888 /etc/mail]# pwd /etc/mail 若要永久改变目录变量,只需添加export CDPATH=/etc到 … 继续阅读