Saturday, September 25, 2010

Unix Incompatibility Notes: String and Memory Functions

Unix Incompatibility Notes:
String and Memory Functions
一些 String and Memory的函式介紹
有strstr memmem strcasecmp etc .

參考來源: Unix Incompatibility Notes: String and Memory Functions (在「Google 網頁註解」中檢視)

Thursday, September 23, 2010

GENTOO - APACHE, PHP, MYSQL

GENTOO - APACHE, PHP, MYSQL
By: John McFarlane
Abstract:
This document outlines the installation of a web server running Apache, PHP, and Mysql.

參考來源:

"GENTOO - APACHE, PHP, MYSQL By: John McFarlane <john.mcfarlane@rockfloat.com> Abstract: This document outlines the installation of a web server running Apache, PHP, and Mysql."
- Rockfloat Howto: Gentoo - Apache, PHP, Mysql (在「Google 網頁註解」中檢視)

Wednesday, September 22, 2010

libmysqlclient.so.15: cannot open shared object file: No such file or directory

libmysqlclient.so.15: cannot open shared object file: No such file or directory
裏面提供一些共享庫的概念,值得一讀,補充比較底層的資訊。以後比較有能去debug

參考來源:

"运行时使用非标准位置/usr/lib和/lib下的库的方式有三种: (1) 设置$LD_LIBRARY_PATH=库所在目录(多个目录用:分隔),系统加载工具ld.so/ld-linux.so将顺序搜索变量指定的目录。例如#$LD_LIBRARY_PATH=/usr/local/mysql/lib ./test_mysql (2) 以root身份把库路径加入/etc/ld.so.conf或在/etc/ld.so.conf.d中创建特定的.conf文件,然后运行ldconfig更新/etc/ld.so.cache。例如:在/etc/ld.so.conf.d下创建文件mysql.conf写入/usr/local/mysql/lib (3) 另一种办法就是把需要的库copy到/usr/lib或/lib,但这不是建议的方法,特别是尽量避免copy发到/lib。但这种方法可以在编译时免去用-L选项。"
- libmysqlclient.so.15: cannot open shared object file: No such file or directory - 最实用的Linux博客 - CSDN博客 (在「Google 網頁註解」中檢視)

怎样对一个链表排序

14.8 怎样对一个链表排序?

有时侯, 有时侯, 在建立链表时就一直保持链表的顺序要简单些 (或者用树代替)。 插入排序和归并排序算法用在链表最合适了。
如果你希望用标准库函数, 你可以分配一个暂时的指针数组, 填入链表 中所有节点的地址, 再调用 qsort(), 最后依据排序后的数组重新建立 链表。

參考來源:

"14.8 怎样对一个链表排序? 有时侯, 有时侯, 在建立链表时就一直保持链表的顺序要简单些 (或者用树代替)。 插入排序和归并排序算法用在链表最合适了。 如果你希望用标准库函数, 你可以分配一个暂时的指针数组, 填入链表 中所有节点的地址, 再调用 qsort(), 最后依据排序后的数组重新建立 链表。"
- 14.8 怎样对一个链表排序? (在「Google 網頁註解」中檢視)

qsort

qsort不能對鏈表做排序

參考來源:

"qsort的确好  但是不能对链表排序!哎 2叉FIND TREE好 Blog作者的回复: 库函数设计时一般只会包含最常用的功能,所以不可能做到面面俱到。 二叉搜索树实现简单,平均深度为O(logN),这是它的优点;但经过O(N*N)次插入/删除后,它的缺点就暴露出来了,那就是二叉树将严重失衡,甚至演化成了一棵单支树。因此,在一些应用中,常用AVL树或splay树代替二叉搜索树。"
- C语言中用qsort()快速排序 - C&C++ - Welcome to my blog (在「Google 網頁註解」中檢視)

Monday, September 20, 2010

Daily Bookmarks 20100920

Google Dev Fest 10
http://code.google.com/intl/zh-TW/events/devfests/2010/

懌飛blog taobao 工程師 給了DevFest 10 Beijing 一場talk
http://www.planabc.net/

資料
http://www.google.com/intl/zh-CN/events/devfests/2010/resources.html

Linked List part2
http://finalfrank.pixnet.net/blog/post/23074005

How to write a search engine in 9 lines of Shell
http://www.computing.dcu.ie/~humphrys/Notes/CGI/search.engine.html

Linux -裝Tex中文
http://blog.punkid.org/2008/05/31/latex-cjk-support-on-linux/

facebook social plugin
http://developers.facebook.com/docs/reference/plugins/live-stream
這個非常有參考價值的一些social plugin

D2前端技術論壇視頻

D2前端技術論壇視頻
http://www.d2forum.org/

滿值得看的
還有影片,有空閒時間可以邊消化。

參考來源:

"第四届D2前端技术论坛视频 2009-12-30 第四届D2宣传片"
- D2 前端技术论坛 (在「Google 網頁註解」中檢視)

Sunday, September 19, 2010

VIM兩個不錯的教學

Vim 內建視窗分割功能,可於編輯器內分割多重視窗及分頁來並行編輯檔案。

各編輯視窗 (Window) 可載入不同編輯緩衝區 (Buffer) 來進行編輯,不限於當前的編輯緩衝區。 編輯視窗也可載入共同的編輯緩衝區來編輯。 事實上編輯視窗基本上就是一個編輯緩衝區的觀察窗口 (viewport)。

由於可開啟多重編輯視窗來並行編輯,因此若能善用編輯視窗及編輯緩衝區等功能,便可提高編輯效率。

http://www.openfoundry.org/en/tech-article/2383
vi vim指令整理
http://www.vixual.net/blog/archives/234

參考來源:

"Vim 內建視窗分割功能,可於編輯器內分割多重視窗及分頁來並行編輯檔案。 各編輯視窗 (Window) 可載入不同編輯緩衝區 (Buffer) 來進行編輯,不限於當前的編輯緩衝區。 編輯視窗也可載入共同的編輯緩衝區來編輯。 事實上編輯視窗基本上就是一個編輯緩衝區的觀察窗口 (viewport)。 由於可開啟多重編輯視窗來並行編輯,因此若能善用編輯視窗及編輯緩衝區等功能,便可提高編輯效率。"
- Vim - 編輯緩衝區以及編輯視窗 (Buffers and Windows) (在「Google 網頁註解」中檢視)

Saturday, September 18, 2010

Sunday, September 12, 2010

DOCKAPPS Date / Time apps

Date / Time apps



wmtimer



Page: 1 2 3

參考來源:

"Date / Time apps  Page: 1 2 3"
- dockapps.org (在「Google 網頁註解」中檢視)

Saturday, September 11, 2010

6cooltoostoTrack your time

6cooltoostoTrack your time

參考來源:

"Whatever your needs, here are 6 of the coolest tools for tracking your time. Most of them aren’t free, but then the best tools often aren’t."
- 6 Cool Tools to Track Your Time (在「Google 網頁註解」中檢視)

python range() xrange()比較

參閱

參考來源:

"在Python中提供了range() function,可以建立出一個數字 list 。 Ex: range(1, 10) #>>> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] range(1, 10, 2) #>>> [1,  3, 5, 7, 9]"
- Falldog的程式戰場 (在「Google 網頁註解」中檢視)

yaTimmer

Timers and Countdowns

yaTimer fully supports both normal timers and countdowns.

Countdown times are logged in exactly the same way as normal timers and is included on all reports.

Countdowns have a progress bar so you can see how much time is leftat a glance and you can set a sound to play when the countdown ends.

參考來源:

"Timers and Countdowns yaTimer fully supports both normal timers and countdowns. Countdown times are logged in exactly the same way as normal timers and is included on all reports. Countdowns have a progress bar so you can see how much time is leftat a glance and you can set a sound to play when the countdown ends."
- yaTimer Product Tour (在「Google 網頁註解」中檢視)

Monday, September 06, 2010

perl -MCPAN -e 'install LWP::Simple'

perl -MCPAN -e 'install LWP::Simple'

參考來源:

"perl -MCPAN -e 'install LWP::Simple'"
- punkcoder: slack-get::Can't locate LWP/Simple.pm (在「Google 網頁註解」中檢視)

991選課參考

1 4105400 01 電腦網路
Computer Networks
林柏青 3
3/0/0 3 必修 三B,C 教學大樓507 0 連結 碩博合開 ,列入電子商務學程科目 ,列入資通安全學程科目

1 4105476 01 網際網路資料庫系統
Web-based Database System
吳昇 3
3/0/0 3 選修 三E,F 工學院A館205 0 連結 碩博合開,開放資工系大三大四同學選修



-------------------cf.

1 4105402 01 網路安全攻防技術
Techniques of Network Attacks and Defenses
林柏青 3
3/0/0 3 選修 二E四E 工學院A館101 0 連結 碩博合開

參考來源:

"1 4105402 01 網路安全攻防技術 Techniques of Network Attacks and Defenses 林柏青 3 3/0/0 3 選修 二E四E 工學院A館101 0 連結 碩博合開"
- 國立中正大學開排選課系統 99學年度第1學期課程表--資訊工程研究所 (在「Google 網頁註解」中檢視)

Saturday, September 04, 2010

Perl學習網站收集

這支程式主要是用到perl 的二個module: Crypt::SSLeay 和 WWW::Mechanize,前者是為了讓LWP::UserAgent能作https的表單認證登入,後者則是為了用機器人填表。比較需要注意的是 WWW::Mechanize目前尚未支援JavaScript,所以有些用JavaScript的機器人動作都必須再以Form的Submit()方式來達成(叫用WWW::Mechanize中的form_submit())。

參考來源: Perl 手札-jiing's blog (jiing.org)-新浪部落 (在「Google 網頁註解」中檢視)

Wednesday, September 01, 2010

winestricks

winestricks

參考來源:

"用 WINE 裝 IE6, WMP10, hifree, or KKBOX KKBOX 有 Mac 版本,這邊只是裝好玩的,其實是可以用在 Linux 上。 以下是憑記憶所寫的步驟: 下載 Darwine,把 Darwine 和 TRiX.app 複製到 /Applications 下載 winetricks curl -o winetricks http://winezeug.googlecode.com/svn/trunk/winetricks chmod +x winetricks"
- jclin.org: 用 WINE 裝 IE6, WMP10, hifree, or KKBOX (在「Google 網頁註解」中檢視)

MonkeyGTD介紹

"GTD"是一门高效实用的工作信念,而"MonkeyGTD3"则是实现GTD的工具。
本文将基于GTD学习与实现的一些经验基础上,介绍MonkeyGTD3的基本概念与新增功能。适用对象:了解GTD,具有强烈工作优化欲望,使用Firefox作为主浏览器。
MonkeyGTD介紹

參考來源:

""GTD"是一门高效实用的工作信念,而"MonkeyGTD3"则是实现GTD的工具。 本文将基于GTD学习与实现的一些经验基础上,介绍MonkeyGTD3的基本概念与新增功能。适用对象:了解GTD,具有强烈工作优化欲望,使用Firefox作为主浏览器。"
- 欢迎使用MonkeyGTD 3.0 | GTD Life (在「Google 網頁註解」中檢視)

Wednesday, August 25, 2010

youwei web for co-traveling. build with

youwei web for co-traveling. build with

first class UI design
smarty
php
mysql
Smart guys
Source Code

參考來源:

"youwei web for co-traveling. build with first class UI design smarty php mysql Smart guys Source Code"
- youweinet - Project Hosting on Google Code (在「Google 網頁註解」中檢視)

Thursday, August 19, 2010

getopt

字符串optstring可以下列元素,
1.单个字符,表示选项,
2.单个字符后接一个冒号:表示该选项后必须跟一个参数。参数紧跟在选项后或者以空格隔开。该参数的指针赋给optarg。
3 单个字符后跟两个冒号,表示该选项后必须跟一个参数。参数必须紧跟在选项后不能以空格隔开。该参数的指针赋给optarg。(这个特性是GNU的扩张)。

參考來源:

"字符串optstring可以下列元素, 1.单个字符,表示选项, 2.单个字符后接一个冒号:表示该选项后必须跟一个参数。参数紧跟在选项后或者以空格隔开。该参数的指针赋给optarg。 3 单个字符后跟两个冒号,表示该选项后必须跟一个参数。参数必须紧跟在选项后不能以空格隔开。该参数的指针赋给optarg。(这个特性是GNU的扩张)。"
- getopt的用法 - 嵌入式 - IT博客 (在「Google 網頁註解」中檢視)

Tuesday, August 17, 2010

Alphabetical sort using strcmp question

Alphabetical sort using strcmp question

參考來源:

"for (i = 0; i < MAXLINE - 1; ++i)     {         for (j = i; j < MAXLINE; ++j)         {             if (strcmp(m[i], m[j]) > 0)             {                 const char *swap = m[i];                 m[i] = m[j];                 m[j] = swap;             }         }     }"
- Alphabetical sort using strcmp question - C / C++ answers (在「Google 網頁註解」中檢視)

缺盆这条道

《黄帝内经》里有“五脏六腑,心为之主”的说法,就是五脏六腑是由心来统摄的,心为君主。而心又靠什么来统摄五脏六腑呢?——“缺盆为之道”,就是缺盆是心统摄五脏六腑的通路。所以即使心这个君主能发布政令,假如通路受阻,也无法管好五脏六腑这些百姓。那么我们人体就必须要保证缺盆这条道路的通畅。凡是走肩膀的经脉,全部都走缺盆,所以缺盆的重要性不言而喻。

參考來源:

"《黄帝内经》里有“五脏六腑,心为之主”的说法,就是五脏六腑是由心来统摄的,心为君主。而心又靠什么来统摄五脏六腑呢?——“缺盆为之道”,就是缺盆是心统摄五脏六腑的通路。所以即使心这个君主能发布政令,假如通路受阻,也无法管好五脏六腑这些百姓。那么我们人体就必须要保证缺盆这条道路的通畅。凡是走肩膀的经脉,全部都走缺盆,所以缺盆的重要性不言而喻。"
- 18.肩部的保健 - 文化频道 - 西部网(陕西新闻网)WWW.CNWEST.COM (在「Google 網頁註解」中檢視)

缺盆穴

Sunday, August 15, 2010

4年前在做什麼

在google lucene 與gais搜尋到一個有趣的事情。
原來有這段歷史。

參考來源:

"回想起来:从Jack Xu确定我们使用Lucene这个方向到项目上线:我们用了将近4个月左右的时间:而当时Lucene 1.2还是一个在SourceForge孵化的项目。还要感谢当时网易的搜索产品经理:肖尚雷给我的机会,是他带我进入这个行业,让我能有时间从头到尾学习了Lucene这个项目的源代码。在Lucene之前,各个门户网站的搜索用的还是台湾中正大学中正大学资工所创立的一个索引/查询引擎GAIS,GAIS不提供源代码,只有可执行版本的工具包(有不同平台下的binary发布版)。四年过去了:Lucene项目发展很快并应用到大量的WEB和桌面应用中。网易也许是第一个使用Lucene引擎的,我也很高兴将Lucene推广并应用到了更多的项目中,包括:"
- 911 四年前的今天你在做什么? (车东[Blog^2]) (在「Google 網頁註解」中檢視)

socialtext介紹-價值中國

socialtext介紹-價值中國
唐鳳講到socialtext
很好奇

參考來源: “商业开源”的创新者 - 人物专访 - 价值中国网 (在「Google 網頁註解」中檢視)

Saturday, August 14, 2010

NodeJS探索

NodeJS探索

一、什么是NodeJS?
第一眼看到这个词,估计你和我一样,以为它不过是一个JavaScript框架吧?如果是,那么首先恭喜你,说明你的思维是正常的。其次鄙视你:凭什么带 JS的就一定是JavaScript框架?你丫做技术的吧?最看不起你们这帮做技术的了,跟姓韩的那谁似的,没一点文化。
生活经验告诉我们,牛人往往都不怎么正常,正常人往往都成不了牛人。比如说NodeJS的发明者,这家伙就曾叫嚣说:其实JavaScript更适合做服务器端的并发编程。估计很多人听到这话都笑了,嗯,原谅我的可耻,我也笑了。令人欣慰的是上帝没有笑。当年上帝说要光,于是就有人脱了个精光。今天,上帝说我相信这个人能成,于是这个人还真成了,他弄了这么个东西:NodeJS--基于V8引擎的,使用事件驱动模型而不是复杂的多线程来获得可伸缩性,类似 Ruby的EventMachine和Python的Twisted的轻量级WEBServer。
是不是很有意思?这意味着什么我想大伙都清楚吧?嗯,如果这东东真的可用,那就是说,以后前段后端都可以都用JavaScript来编程了,这对于JS程序员来说,真是一个莫大的福音,因为你们再也不用看着那帮做后台的孙子的脸色干活了,可以翻身做后端了。
好,废话到此,那接下来就请跟着我,开始NodeJS的探索之旅。

參考來源: NodeJS探索 « 老韩 (在「Google 網頁註解」中檢視)

Friday, August 06, 2010

Quanta Plus簡介

簡介

參考來源:

"一直都想介绍一下Quanta Plus这款linux下的IDE (基于Qt的程序)。这是我目前使用过的最好用,最上手的网页编辑器了,D.K的所有代码也都是在这个编辑器下写的。我曾经推荐过另一款linux下的IDE: Aptana。那相比Aptana,Quanta Plus有什么优势呢?"
- Quanta Plus : A Brief Review of an IDE under Linux (在「Google 網頁註解」中檢視)

Linux下Web開發工作介紹

Using Linux for Web Design and Development (Ubuntu)
Tags:

* Web Design Tools
* Linux
* Ubuntu

2006, August 28 - 12:48pm — Webmaster Tips

[Note: to install the following programs on Ubuntu, make sure that you have the Universe repository enabled. You can either use the terminal, or Synaptic. For more information on how to install software on Ubuntu, see this article. Generally you can just type the following in the terminal:

參考來源:

"Using Linux for Web Design and Development (Ubuntu)"
- Using Linux for Web Design and Development (Ubuntu) | Webmaster Tips (在「Google 網頁註解」中檢視)

Thursday, August 05, 2010

strcasestr

类似的还有strcasestr,是strstr的忽略大小写版本
memmem,是对付内部包含0值字节的版本,因为0会被str族函数认为是结束符

參考來源:

"类似的还有strcasestr,是strstr的忽略大小写版本 memmem,是对付内部包含0值字节的版本,因为0会被str族函数认为是结束符"
- strstr函数的功能 - C语言论坛 - 编程论坛 (在「Google 網頁註解」中檢視)

mememe1 like strstr

#include

/* ----------------------------------------------------------------------------
* memmem()
* ----------------------------------------------------------------------------
* function
* Like strstr(), but for binary data -- seeks to find 'tofind' in 'source'.
*
* returns
* A pointer to the matching data.
* NULL if not found.
*/
const void* memmem(
const void* source, size_t sourcesize,
const void* tofind, size_t tofindsize
) {
int value;
const void* found;

/* If either 'source' or 'tofind' are missing or blank then we are done */
if (!source || !tofind || !sourcesize || !tofindsize) return source;

value = *(const unsigned char*)tofind;

/* While we can find potential matches */
while ((found = memchr( source, value, sourcesize )))
{
/* Keep track of what amount remains of the source */
sourcesize -= (const unsigned char*)found - (const unsigned char*)source;

/* If there isn't enough of the source left to match, then return 'not found' */
if (sourcesize < tofindsize) return NULL;

/* Did we find an exact match? */
if (memcmp( found, tofind, tofindsize ) == 0) return found;

/* Ready to find the next potential match */
source = (const unsigned char*)found + 1;
sourcesize--;
}

/* No match found */
return NULL;
}

參考來源:

"Since you are working with binary data, you should avoid using string functions. Unfortunately, there is no equivalent of strstr() for binary memory, but it is easy enough to construct one:"
- Checking for null characters in the midd... - C++ Forums (在「Google 網頁註解」中檢視)

memmem strstr

strstr這個fucntion是針對搜尋C字串設計的
而memmem是針對搜尋某個character buffer設計的
聽出來有什麼不一樣了嗎
如果你的character buffer裡面包含有多個null terminator的話
用strstr就有可能會搜尋不到substring
因為strstr只會搜尋第一個null terminator之前的字串內容
這時候就需要memmem啦
不過這個function是GNU的extension喔
所以記得要定義#define _GNU_SOURCE才可以使用喔
又學到一課啦~

參考來源:

"strstr這個fucntion是針對搜尋C字串設計的 而memmem是針對搜尋某個character buffer設計的 聽出來有什麼不一樣了嗎 如果你的character buffer裡面包含有多個null terminator的話 用strstr就有可能會搜尋不到substring 因為strstr只會搜尋第一個null terminator之前的字串內容 這時候就需要memmem啦 不過這個function是GNU的extension喔 所以記得要定義#define _GNU_SOURCE才可以使用喔 又學到一課啦~"
- Infinite Waiting: strstr與memmem有啥差別!? - yam天空部落 (在「Google 網頁註解」中檢視)

Reading image file in binary mode

#include
#include
#include
#include

int main()
{
int rc = 0;
char buffer[BUFSIZ] = {0};

FILE* p_infile = 0;
FILE* p_outfile = 0;

int length = 0;
int done = 0;

printf( "Enter the file name for the input file to be copied: " );
fgets( buffer, BUFSIZ, stdin );
buffer[ strlen( buffer ) -1 ] = 0;

p_infile = fopen( buffer, "rb" ); /* the b is added for Windoze/DOS systems... */
if( !p_infile )
{
rc = errno;
printf( "error opening %s for reading\n", buffer );
}
else
{
printf( "Enter the file name for the output file to be written: " );
fgets( buffer, BUFSIZ, stdin );
buffer[ strlen( buffer ) -1 ] = 0;

p_outfile = fopen( buffer, "wb" ); /* the b is added for Windoze/DOS systems... */
if( !p_outfile )
{
rc = errno;
printf( "error opening %s for writing\n", buffer );
}
else
{
do
{
length = fread( buffer, 1, sizeof( buffer ), p_infile );
done = length < (int)sizeof( buffer );
fwrite( buffer, 1, length, p_outfile );
}
while( !done );
}
}

if( p_infile )
{
fclose( p_infile );
p_infile = 0;
}

if( p_outfile )
{
fclose( p_outfile );
p_outfile = 0;
}
return rc;
}

參考來源:

"Here is an example that may help if all you're doing is looking to copy the file. I call this code filecopy.c, but you can call it anything that you want."
- Please Help - Reading image file in binary mode - GIDForums (在「Google 網頁註解」中檢視)

my_strlen

unsigned int my_strlen(const char *szString)
{
unsigned int iBytes = 0;
while(*szString++ != '\0')
iBytes++;
return iBytes;
}

參考來源:

"unsigned int my_strlen(const char *szString) { unsigned int iBytes = 0; while(*szString++ != '\0') iBytes++; return iBytes; }"
- Explanation on strlen(buffer) (在「Google 網頁註解」中檢視)

Wednesday, August 04, 2010

範例:有一個檔案(points.bin)用整數記錄全班50位同學的成績, 寫一程式讓使用者查尋學生成績

範例:有一個檔案(points.bin)用整數記錄全班50位同學的成績, 寫一程式讓使用者查尋學生成績

#include < iostream.h >
#include < stdio.h >

void main(void)
{
int num;
int data;
FILE *file=fopen("points.bin","rb");
do
{
printf("num=");
scanf("%d",&num);
if ( num>=50 || num<0 )
break;
fseek(file, num*sizeof(int), SEEK_SET);
fread(&data, sizeof(int), 1, file);
printf("Student(%d)=%d\n",num,data);
} while(1);
fclose(file);
}

參考來源:

"fseek( input, 0, SEEK_END); // 先把讀寫位置移到檔尾 filelen = ftell( input ); // 再傳回檔案目前的讀寫位置 範例:有一個檔案(points.bin)用整數記錄全班50位同學的成績, 寫一程式讓使用者查尋學生成績"
- 第八章:檔案 (在「Google 網頁註解」中檢視)

Minidx.com

minidx.com search engine

參考來源:

"一时想不出博客叫什么名字好,因为是放在Minidx.com下面的,所以就叫全文检索博客好了。不过内容五花八门,可能什么都有吧。Minidx是我于05年开始开发的一个全文检索引擎,关于Minidx全文检索的信息,请访问:http://minidx.com,中文请到:http://cn.minidx.com。 如有问题请联系minidxer(at)gmail.com,谢谢配合! 相关技术交流类的问题请尽量通过在http://blog.minidx.com/guestbook或者相关文章里留言而不要发邮件,因为你的邮件很有可能被自动归类到SPAM里导致我没办法看到……"
- About | 中文Flex例子 (在「Google 網頁註解」中檢視)

dump_buffer

void dump_buffer(void *buffer, int buffer_size)
{
int i;

for(i = 0;i < buffer_size;++i)
printf("%c", ((char *)buffer)[i]);
}

參考來源:

"void dump_buffer(void *buffer, int buffer_size) { int i; for(i = 0;i < buffer_size;++i) printf("%c", ((char *)buffer)[i]); }"
- C, howto read binary file into buffer (在「Google 網頁註解」中檢視)

Tuesday, August 03, 2010

strstr c语言中的字符串分割(strstr)

1. int main(int argc,char **argv)
2. {
3. char temp[10];
4. char *haystack="aaa||a||bbb||c||ee||";
5. char *needle="||";
6. char* buf = strstr( haystack, needle);
7. while( buf != NULL )
8. {
9. strncpy(temp, haystack, buf-haystack);
10. temp[buf-haystack] =0;
11. printf( "%s\n ", temp); //haystack);
12.
13. haystack = buf + strlen(needle);
14.
15. buf = strstr( haystack, needle);
16. }
17. return 0;
18. }

參考來源:

"在前面C语言中利用strtok函数进行字符串分割介绍的strtok函数,比较适合多个字符(也就是字符串)作分隔符的场合,而很多时候我们仅仅需要某一个特定的字符来分割字符串,当然利用strtok也可以实现,不过这里介绍的strstr效率上来说更加适合。"
- c语言中的字符串分割(strstr) - ubuntu,debian,redhat -linuxany.com (在「Google 網頁註解」中檢視)

Monday, August 02, 2010

strtok

在搞了很久的search時,今天好像被雷打到,
懂了一些東西。
strtok的第二個NULL

在 Microsoft C strtok() 函數會採用兩個字串,做為引數。第一個是一系列的第二個字串所定義的分隔符號隔開的零個或多個語彙基元。strtok() 第一次呼叫傳回第一個引數中第一個語彙基元的指標。在原始字串中取得下一個語彙基元 (Token),strtok() 的呼叫必須由使用 NULL 做為第一個引數會告訴 strtok() 搜尋下一個在前一個語彙基元字串語彙基元。

使用 strtok() 時,請牢記下列資訊:

* 每次呼叫函式時使用相同的字串,所以由 strtok() 使用修改原始字串 strtok() 將會以 NULL 取代原始字串中的分隔符號。
* strtok() 到第二個引數可以隨時變更為不同的分隔符號。
* 只有單一字元都被視為分隔符號。

http://www.cplusplus.com/reference/clibrary/cstring/strtok/

http://life.iiietc.ncu.edu.tw/xms/forum/show.php?id=22791

參考來源: 資訊: strtok(): C 函式--補充的文件 (在「Google 網頁註解」中檢視)

General topics on UNIX programming

邊找regexec的時候剛好也找到解決opt的問題的網頁:
裏面有regex在C的範例,跟一些 Unix-like下的 programming教學。

http://mij.oltrelinux.com/devel/unixprg/
General topics on UNIX programming
The following entries cover some general programming topics under UNIX:

* Regular expressions
o notes
o summary
o example
* Parsing the command line
o notes
o summary
o examples
* Tasks, fork(), wait() and waitpid()
o notes
o summary
o examples
* Threads
o notes
o summary
o examples

Interprocess communication / UNIX IPC programming
The following entries cover topics specific to Inter-process communication mechanisms under UNIX:

* IPC: signals
o notes
o summary
o examples
* IPC: pipes
o notes
o summary
o examples
* IPC: named pipes
o notes
o summary
o examples
* IPC: BSD sockets
o notes
o summary
o examples
* IPC: POSIX Message queues
o notes
o summary
o examples
* IPC: POSIX Semaphores
o notes
o summary
o examples
* IPC: POSIX shared memory
o notes
o summary
o examples
* IPC: notes on POSIX objects -- the POSIX objects mess
o notes

參考來源:

"General topics on UNIX programming The following entries cover some general programming topics under UNIX: Regular expressions notes summary example Parsing the command line notes summary examples Tasks, fork(), wait() and waitpid() notes summary examples Threads notes summary examples"
- UNIX programming examples (在「Google 網頁註解」中檢視)

Saturday, July 31, 2010

出拳手必要不要打直

出拳手必要不要打直
因為這個問題,所以找了一下並且參考一些資料。
這裡個blog 提到一些人對於出拳要不要出打直提出看法,就算是同屬於JKD的系統,也有不一樣的見解。

2010年6月前,我之前是奉行手畢完全打直的。後來,發現有點卡卡的有時手還會有點痛。

後來有聽一位柔道教練說,伸直受敵容易傷到手肘。
後來出拳,改成拳頭往下扣一點。

參考一些人的照片,跟看寶師出拳的樣子。
發現,自己上臂的肌肉其實是不發達的。如果是發達的,就沒有個問題,因為伸直剛好是"不折的手"(合氣道裏面稱的),那整條肌腱剛好彎曲護住。

所以也就沒有這個問題了。

參考來源:

"截拳道在出拳時強調《手臂不可完全打直》有幾個原因: 1.自然;人的手在放鬆自然垂下時是微彎的(我們稱為九分直或自然彎度)(如下圖),沒有人是完全直的,除非你在用力! 2.拳打直一旦落空,很容易震傷自己的手肘,或失控。 3.避免被反擊手肘關節(拳打直一旦對手反擊你的關節,只要輕輕一震你的手就會受傷甚至斷掉,而在九分直時還有一分的緩衝空間可以瞬間抵抗,不致於立即受傷)。 4.拳頭收回的《速度》比起完全打直時更快速!"
- 截拳道之《手臂不可完全打直》之根本概念 - 台灣截拳道(J.K.D) - 阿峰 - Yahoo!奇摩部落格 (在「Google 網頁註解」中檢視)

Thursday, July 29, 2010

你的時間不夠用嗎

這是個不錯的分享網址
叫作惜墨,也就是都是珍藏,珍貴的意思。
副標題是,你有一個夢想,你要保護它。
裏面有不錯的文章,滿值得一看。

-----
你的时间不够用么?
2010年07月28日 | 个人提升, 提高效率, 时间管理, 简化生活, 简单生活 | 作者:博华gravatar关闭作者: 博华 姓名: 博华
Email: bhzhang1@gmail.com
博客: http://www.apple4.cn
个人介绍: 博华喜欢打篮球,喜欢看书,喜欢听歌,喜欢简单的生活。每天只专注于最重要的事情,不去想其他的杂事。喜欢水滴石穿的道理,因为寓意很简单:专注+坚持。人生的座右铭是:既然你已经决定在生活中放手一搏,为什么不去倾尽全力干到极致?看他的所有文章 (138)

我们经常会说一句话“我没有时间。”我不禁反问,我们为什么没有时间?同样的人,每天都有同样的24小时,为什么有些人出色的完成了工作,有些人甚至要去加班加点完成昨天的工作?我想,这不仅仅是一个效率问题,更是一个生活态度的问题。
一、管理时间=管理金钱?

參考來源:

"你的时间不够用么? 2010年07月28日 | 个人提升, 提高效率, 时间管理, 简化生活, 简单生活 | 作者:博华关闭作者: 博华 姓名: 博华 Email: bhzhang1@gmail.com博客: http://www.apple4.cn个人介绍: 博华喜欢打篮球,喜欢看书,喜欢听歌,喜欢简单的生活。 每天只专注于最重要的事情,不去想其他的杂事。 喜欢水滴石穿的道理,因为寓意很简单:专注+坚持。 人生的座右铭是:既然你已经决定在生活中放手一搏,为什么不去倾尽全力干到极致?看他的所有文章 (138) 我们经常会说一句话“我没有时间。”我不禁反问,我们为什么没有时间?同样的人,每天都有同样的24小时,为什么有些人出色的完成了工作,有些人甚至要去加班加点完成昨天的工作?我想,这不仅仅是一个效率问题,更是一个生活态度的问题。 一、管理时间=管理金钱?"
- 你的时间不够用么? | 惜墨,关注自我成长,个人提升,时间管理,简化生活,学习方法,生活技巧 (在「Google 網頁註解」中檢視)

大文本文件逆序(fread/fwrite操作

大文本文件逆序(fread/fwrite操作)
2010-03-05 13:52

备份

#include
#include
#include

void reverse(char *s,int len) //逆序函数
{
int i;
char temp;
for(i=0;i0) //待改进的一段
{
rewind(fp);
fseek(fp,(i-1)*SIZE,0);
fread(p1,SIZE,1,fp);
reverse(p1,SIZE-1);
fseek(fp,-i*SIZE,2);
fread(p2,SIZE,1,fp);
reverse(p2,SIZE-1);
fseek(fp,(i-1)*SIZE,0);
fwrite(p2,SIZE,1,fp);
fseek(fp,-i*SIZE,2);
fwrite(p1,SIZE,1,fp);
i++;
}
last = filelen-2*count*SIZE;
char *p = (char *)malloc(sizeof(char)*last);
if(last<2*SIZE)
{
fseek(fp,(i-1)*SIZE,0);
fread(p,last,1,fp); // 得大改的一段
reverse(p,last-1);
fseek(fp,(i-1)*SIZE,0);
fwrite(p,last,1,fp);
}

fclose(fp);
free(p1);
free(p2);
free(p);
system("pause");
return 0;
}

return 0;
}

当然,下面的也能逆序文件

#include
void reverse(FILE *fp)
{
char ch;
if ((ch=fgetc(fp))!=EOF)
reverse(fp);
else
rewind(fp);
if (ch!=EOF)
fputc(ch,fp);
}
int main(int argc, char* argv[])
{
FILE *fp=fopen("test.txt","r+");
if (fp)
{
reverse(fp);
fclose(fp);
}
return 0;
}

參考來源:

"大文本文件逆序(fread/fwrite操作) 2010-03-05 13:52 备份 #include <stdio.h> #include <stdlib.h> #include <string.h>"
- 大文本文件逆序(fread/fwrite操作)_巫山上云雨的空间_百度空间 (在「Google 網頁註解」中檢視)

This program reads a file and counts the words in it.

/*

* word_cnt.c

* This program reads a file and counts the words in it.

*/

參考來源:

"/*  * word_cnt.c  * This program reads a file and counts the words in it.  */"
- Ron Wein's C Examples: word_cnt.c (在「Google 網頁註解」中檢視)

Wednesday, July 28, 2010

A TUTORIAL ON POINTERS AND ARRAYS IN C

A TUTORIAL ON POINTERS AND ARRAYS IN C

by Ted Jensen
Version 1.2 (HTML version)

Feb. 2000
This material is hereby placed in the public domain
Available in various formats via
http://pweb.netcom.com/~tjensen/ptr/cpoint.htm

參考來源:

"A TUTORIAL ON POINTERS AND ARRAYS IN C by Ted Jensen Version 1.2 (HTML version) Feb. 2000 This material is hereby placed in the public domain Available in various formats via http://pweb.netcom.com/~tjensen/ptr/cpoint.htm"
- A Tutorial on Pointers and Arrays in C (在「Google 網頁註解」中檢視)

Tuesday, July 27, 2010

1. 字符串操作函數

1. 字符串操作函數: "- Sent using Google Toolbar"

The C Programming Language

The C Programming Language



References

* The C Programming Language (second edition - ANSI C),
Brian W. Kernighan and Dennis M. Ritchie,
Prentice Hall, Inc., 1988.

* A Book on C (fourth edition),
Al Kelley and Ira Pohl,
Addison-Wesley, 1997.


Examples

Examples marked by the (advanced) symbol contain slightly more advanced material and will not be shown in class.

參考來源:

"Examples Examples marked by the symbol contain slightly more advanced material and will not be shown in class."
- The C Programming Language (在「Google 網頁註解」中檢視)

Friday, July 23, 2010

利用strstr和sscanf解析GPS信息

利用strstr和sscanf解析GPS信息

作者:杨硕,华清远见嵌入式学院讲师。

考察C程序员是否合格的一个重要标准就是看他操作字符串的能力,一个合格的C程序员应该可以熟练的对字符串进行拆分、组合、格式转换以及搜索定位,从一堆数据中提取出有效信息。

比如说我们要做一个GPS导航的项目,需要读取GPS模块以ASCII码的形式发送过来的数据,然后对这些数据进行处理,提取我们需要的信息。这就涉及到很多操作字符串的问题。下面就以此为例,利用strstr函数和sscanf函数解析GPS数据。

GPS输出的数据格式如下:
$GPGGA,121252.000,3937.3032,N,11611.6046,E,1,05,2.0,45.9,M,-5.7,M,,0000*77
$GPRMC,121252.000,A,3958.3032,N,11629.6046,E,15.15,359.95,070306,,,A*54
$GPVTG,359.95,T,,M,15.15,N,28.0,K,A*04
$GPGGA,121253.000,3937.3090,N,11611.6057,E,1,06,1.2,44.6,M,-5.7,M,,0000*72
$GPGSA,A,3,14,15,05,22,18,26,,,,,,,2.1,1.2,1.7*3D
$GPGSV,3,1,10,18,84,067,23,09,67,067,27,22,49,312,28,15,47,231,30*70
$GPGSV,3,2,10,21,32,199,23,14,25,272,24,05,21,140,32,26,14,070,20*7E
$GPGSV,3,3,10,29,07,074,,30,07,163,28*7D

可以看到,GPS模块发送过来的原始数据有很多,但是通常我们只需要其中的一部分信息就够用了,比如对于导航的功能,我们只需要以$GPRMC开头,以换行符结束的一行信息就够了。即:
$GPRMC,121252.000,A,3958.3032,N,11629.6046,E,15.15,359.95,070306,,,A*54

因此我们需要做的就是从读取的数据中截取以$GPRMC开头的一行信息,然后从中解析出经纬度、日期时间等有效信息即可。

假设从串口读取的数据存放在一个字符串指针char *raw_buf指向的内存单元里,首先我们通过ANSI C提供的strstr()函数找到以$GPRMC开头以换行符’\n’结束的字符串:
/* find "$GPRMC" from raw_buf */
if ((wellhandled_string = strstr(raw_buf, “$GPRMC”)) != NULL)
{
for (i=0; i

參考來源:

"利用strstr和sscanf解析GPS信息 作者:杨硕,华清远见嵌入式学院讲师。 考察C程序员是否合格的一个重要标准就是看他操作字符串的能力,一个合格的C程序员应该可以熟练的对字符串进行拆分、组合、格式转换以及搜索定位,从一堆数据中提取出有效信息。 比如说我们要做一个GPS导航的项目,需要读取GPS模块以ASCII码的形式发送过来的数据,然后对这些数据进行处理,提取我们需要的信息。这就涉及到很多操作字符串的问题。下面就以此为例,利用strstr函数和sscanf函数解析GPS数据。"
- 利用strstr和sscanf解析GPS信息-- 嵌入式学院(华清远见旗下品牌) (在「Google 網頁註解」中檢視)

Thursday, July 22, 2010

maven-javaeye

第一:举例说,你有个一依赖A用到了spring-2.0.5;后来spring在仓库换地方了(这种事情太多了,看看maven混乱的仓库吧),而你需要的是最新的spring2.5.1,那么你编译的时候就会同时有一堆spring2.0.5的文件和spring2.5的文件;那么你需要手动的排除 2.0.5的相关资源。问题是在maven体系里面,这种情况非常常见,大量的依赖混在一起的时候,你看着mvn install之后lib文件夹下乱七八糟的jar真是欲哭无泪啊,很多jar是同一个库的不同的版本,这些版本的依赖可能还不同,导致问题进一步的恶化。
第二:从eclipse的maven插件来说,add dependency的时候,一旦仓库更新了,你根本看不到最新的文件是是什么,比如struts2现在是2.0.11,但是你搜索的时候只能看到 2.0.9,因为我是那个时候装的;加入了这个dependency之后只能手动改版本到2.0.11再编译。
第三:开发者们同步仍然有困难。如果项目依赖一个仓库里面没有的文件你就完蛋了,手动拷贝到本地目录是个常见做法,如果你有100个人参与项目我想你要加入一个依赖简直大家都要崩溃了,比如struts2的json插件这个包。幸好还有artifactory,不过你一遍遍的手动发到私服上也够烦了。
maven的支持者们,我们是活在现实世界中的生命,maven的思想很好但是java本身缺乏版本管理机制并且maven也没有切实有效的解决这个问题,只能靠meta里面maven文件夹里面的描述信息,这个信息很多时候没有经过严格测试的(我遇到过几次了!导致项目根本没法编译过去,那个包的开发人员一定也用的是他自己的私服)!如果再这样下去我想很多人会崩溃的……
我仍然是maven的用户,但是我在瞪着眼睛等待一个新的工具,取代maven和ant。

參考來源:

"第一:举例说,你有个一依赖A用到了spring-2.0.5;后来spring在仓库换地方了(这种事情太多了,看看maven混乱的仓库吧),而你需要的是最新的spring2.5.1,那么你编译的时候就会同时有一堆spring2.0.5的文件和spring2.5的文件;那么你需要手动的排除2.0.5的相关资源。问题是在maven体系里面,这种情况非常常见,大量的依赖混在一起的时候,你看着mvn install之后lib文件夹下乱七八糟的jar真是欲哭无泪啊,很多jar是同一个库的不同的版本,这些版本的依赖可能还不同,导致问题进一步的恶化。"
- 关于Maven,不吐不快。 - develop - JavaEye论坛 (在「Google 網頁註解」中檢視)

qsort: sorting array of strings, integers and structs abstract

qsort: sorting array of strings, integers and structs
abstract
qsort() is standard C function for sorting arrays. It is defined by ISO C standard, and implemented in most C/C++ standard libraries(stdlib.h). This article contains an example of using qsort() for sorting integers, strings and structs.
compatible
# Any ANSI C compiler
# Should work with most C++ compilers

qsort() takes four arguments:

void qsort(void *base, size_t nel, size_t width, int (*compar)(const void *, const void *));

* base — is a pointer to the beginning of data array
* nel — is a number of elements
* width — is a size of each element (in bytes)
* compar — is a callback function (pointer to function), which does comparison and returns positive or negative integer depending on result.

This example contains three separate functions sort_integers_example(), sort_cstrings_example() and sort_structs_example().

* sort_integers_example() uses int_cmp() as compar callback. Additional function print_int_array is used for printing integer array contents.
* sort_cstrings_example() uses cstring_cmp() as compar callback. Additional function print_cstring_array is used for printing string array contents.
* sort_structs_example() uses struct_cmp_by_price() and struct_cmp_by_product() as compar callbacks. Additional function print_struct_array is used for printing array of struct.

參考來源:

"qsort: sorting array of strings, integers and structs abstract  qsort() is standard C function for sorting arrays. It is defined by ISO C standard, and implemented in most C/C++ standard libraries(stdlib.h). This article contains an example of using qsort() for sorting integers, strings and structs."
- qsort: sorting array of strings, integers and structs (在「Google 網頁註解」中檢視)

結構(struct)的大小問題

結構(struct)的大小問題
在記憶體配置的時候,因為效率考量,預設會依照元素大小整數倍的對齊
並且會以其中最大的元素為單位,配置整數倍的記憶體
例如同樣是char, short, int三個元素

參考來源:

"結構(struct)的大小問題 在記憶體配置的時候,因為效率考量,預設會依照元素大小整數倍的對齊並且會以其中最大的元素為單位,配置整數倍的記憶體例如同樣是char, short, int三個元素"
- Coding James: 結構(struct)的大小問題 (在「Google 網頁註解」中檢視)

Structure 結構化的資料型態一

Structure
結構化的資料型態一

這一星期的課程,我們將面對C語言中比較深入的話題,怎麼表達複雜的資料型態,怎麼做到一言以蔽之,簡潔而有力的C語言寫法。還有,如果你覺得 int,char,float...不夠親切,你希望用更好的名稱來表達你的變數,這時候你需要typedef的語法。如果這都還不夠,還不能符合你的要求,還有以bit為單位的處理(bit manupulation),以及列舉(enumeration)的資料型態。

參考來源:

"Structure 結構化的資料型態一           這一星期的課程,我們將面對C語言中比較深入的話題,怎麼表達複雜的資料型態,怎麼做到一言以蔽之,簡潔而有力的C語言寫法。還有,如果你覺得int,char,float...不夠親切,你希望用更好的名稱來表達你的變數,這時候你需要typedef的語法。如果這都還不夠,還不能符合你的要求,還有以bit為單位的處理(bit manupulation),以及列舉(enumeration)的資料型態。"
- Structure I (在「Google 網頁註解」中檢視)

介紹如何將struct array寫入binary file,並從binary file讀出struct array

Abstract
本文介紹如何將struct array寫入binary file,並從binary file讀出struct array。

參考來源:

"Abstract 本文介紹如何將struct array寫入binary file,並從binary file讀出struct array。 Introduction C語言 / fwrite_fread_struct_array.c"
- (原創) 如何將struct array寫入文字檔? 如何從文字檔讀出struct array? (C/C++) (C) - 真 OO无双 之 真乱舞书 - 博客园 (在「Google 網頁註解」中檢視)

Wednesday, July 21, 2010

inception 電影評論

不錯的一句話
inception 電影評論

事實並不存在,只是我們,陷在其中。

參考來源:

"现实并不存在,只是我们,陷在其中——《Inception》 - [电影] 版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明http://parasite.blogbus.com/logs/69692744.html"
- 现实并不存在,只是我们,陷在其中——《Inception》 - 我和E的宇宙飞船 - 博客大巴 (在「Google 網頁註解」中檢視)

What's the difference between text and binary I/O?

Q: What's the difference between text and binary I/O?

A: In text mode, a file is assumed to consist of lines of printable characters (perhaps including tabs). The routines in the stdio library (getc, putc, and all the rest) translate between the underlying system's end-of-line representation and the single \n used in C programs. C programs which simply read and write text therefore don't have to worry about the underlying system's newline conventions: when a C program writes a '\n', the stdio library writes the appropriate end-of-line indication, and when the stdio library detects an end-of-line while reading, it returns a single '\n' to the calling program. [footnote]

In binary mode, on the other hand, bytes are read and written between the program and the file without any interpretation. (On MS-DOS systems, binary mode also turns off testing for control-Z as an in-band end-of-file character.)

Text mode translations also affect the apparent size of a file as it's read. Because the characters read from and written to a file in text mode do not necessarily match the characters stored in the file exactly, the size of the file on disk may not always match the number of characters which can be read from it. Furthermore, for analogous reasons, the fseek and ftell functions do not necessarily deal in pure byte offsets from the beginning of the file. (Strictly speaking, in text mode, the offset values used by fseek and ftell should not be interpreted at all: a value returned by ftell should only be used as a later argument to fseek, and only values returned by ftell should be used as arguments to fseek.)

In binary mode, fseek and ftell do use pure byte offsets. However, some systems may have to append a number of null bytes at the end of a binary file to pad it out to a full record.

See also questions 12.37 and 19.12.

參考來源:

"Q: What's the difference between text and binary I/O?"
- Question 12.40 (在「Google 網頁註解」中檢視)

CSC 209 course notes -c 教學

CSC 209 course notes
Course notes available so far:

* Software tools
* Shell programming
* The unix filesystem
* The C programming language (intro)
* C data types; pointers and arrays
* C: printf and scanf
* argc and argv in C
* C strings
* C files
* getopt example
* struct, malloc
* what is being covered about unix processes
* Process memory layout and OS considerations
* Socket examples

(It's not being taught this term, but I have some detailed notes which I'm fond of about the AWK programming language, which is often used in shell scripts for various data processing and string munging tasks which are a bit more sophisticated than what cut and join and such can do.)

http://www.dgp.toronto.edu/~ajr/209/notes/

參考來源:

"CSC 209 course notes Course notes available so far:"
- CSC 209 course notes (在「Google 網頁註解」中檢視)

Tuesday, July 20, 2010

ptt scanf example

推 phstudy:%s改成%[^,] 07/17 19:16
推 dann1:成功了~ 大大可以解釋一下[^,]這個的意思嗎 07/17 19:35
推 dann1:研究了一下好像是規定字串結尾是逗號 那^的意思是無視嗎 07/17 19:39
推 TsinTa:^是not的意思,[^,]代表存取逗號外的所有字元 07/17 19:44
推 loveme00835:regular expression 07/17 19:48
→ loveme00835:可以搭配fread、fwrite, 把整個結構變數都用二進位方 07/17 20:13
→ loveme00835:式存放在檔案中, 這樣也可以支援隨機存取 07/17 20:14
→ loveme00835:http://ppt.cc/@qjm 07/17 20:15

參考來源:

"#include <stdio.h> #include <stdlib.h> typedef struct { int age; char name[ 10 ]; int weight; }Person; int main() { Person person = { 20, "Jane", 50 }; // 存資料進檔案 FILE *file = fopen( "test.txt", "wb" ); fwrite( &person, sizeof(Person), 1, file ); fclose( file );"
- Paste #281215 | LodgeIt! (在「Google 網頁註解」中檢視)

Monday, July 19, 2010

Q&amp;&amp;A

Q&&A

參考來源:

"Hi, I need a program in C that is capable of writing the multiple records into a file.And another function that should read the same data from the from the file and store it in the approptiate data structure."
- Read multiple records from a file and store it in a structure (在「Google 網頁註解」中檢視)

Program for sorting records in a file, Using linked list and insertion sort, records are sorted.

Program for sorting records in a file, Using linked list and insertion sort, records are sorted.

參考來源:

"Program for sorting records in a file, Using linked list and insertion sort, records are sorted."
- Program for sorting records in a file, Using linked list and insertion sort, records are sorted. « hackattacking.com (在「Google 網頁註解」中檢視)

rsort : Sort multi-line text records.

www.cs.duke.edu/~des/scripts/

#


# rsort : Sort multi-line text records.

The Scriptorium
Daniel E. Singer
Department of Computer Science
Duke University

參考來源:

"rsort : Sort multi-line text records."
- Dan's Scripts Page (在「Google 網頁註解」中檢視)

Mutiple-Line record in AWK

Mutiple-Line record in AWK
這是值得參考的名詞叫作多行的輸入。
other site:
http://www.math.utah.edu/docs/info/gawk_6.html#SEC34

參考來源:

"Multiple-Line Records In some databases, a single line cannot conveniently hold all the information in one entry."
- The GNU Awk User's Guide - Reading Input Files (在「Google 網頁註解」中檢視)

Creating Linked Lists in C++

Creating Linked Lists in C++
What is a linked list?
A linked list is a data structure which is built from structures and pointers. It forms a chain of "nodes" with pointers representing the links of the chain and holding the entire thing together. A linked list can be represented by a diagram like this one:
不錯的參考 C ++

參考來源:

"Creating Linked Lists in C++ What is a linked list? A linked list is a data structure which is built from structures and pointers. It forms a chain of "nodes" with pointers representing the links of the chain and holding the entire thing together. A linked list can be represented by a diagram like this one:"
- Creating Linked Lists in C++ (在「Google 網頁註解」中檢視)

Sorting Records in cprogramming board

Sorting Records
I am writing a program to sort records using a sorting algorithm of my choice. However before I can get to that I am having trouble reading in each record. Can someone provide some insight. I know that I want to do a linked list for easy insertion rather than an array, I just don't know where I am going wrong with my code. Thanks in advance!!

參考來源:

"I am writing a program to sort records using a sorting algorithm of my choice. However before I can get to that I am having trouble reading in each record. Can someone provide some insight. I know that I want to do a linked list for easy insertion rather than an array, I just don't know where I am going wrong with my code. Thanks in advance!!"
- Sorting Records (在「Google 網頁註解」中檢視)

sort record

這是另外一個sort record的 Q&A有程式碼

參考來源:

"Array Struct Sort Help!! Urgent! Expand Post » Ok i've tried understanding some previous posts but im just finding it really hard to work with structure passing to other functions and sorting. Can someone please explain in a simplistic on how i can pass structure to a function that sorts the structure by 'Year' or 'Artist' Below is the code i've done so far that allows a user to input records and those records are then put to a *.txt file....how can i proceed from there on..."
- Array Struct Sort Help!! Urgent! - C (在「Google 網頁註解」中檢視)

C-Data structures in <a href="http://cplusplus.com">cplusplus.com</a>

We have already learned how groups of sequential data can be used in C++. But this is somewhat restrictive, since in many occasions what we want to store are not mere sequences of elements all of the same data type, but sets of different elements with different data types.

Data structures
A data structure is a group of data elements grouped together under one name. These data elements, known as members, can have different types and different lengths. Data structures are declared in C++ using the following syntax:

參考來源:

"Data structures A data structure is a group of data elements grouped together under one name. These data elements, known as members, can have different types and different lengths. Data structures are declared in C++ using the following syntax:"
- Data Structures (在「Google 網頁註解」中檢視)

Sunday, July 18, 2010

C++ - Sorting and searching data

How can I sort data in alphebatical order after writng them(some records containing information about customers,say)in to a file? How can I create a program to read and print customer records arranged with their names in alphabatical order?

參考來源:

"C++ - Sorting and searching data Expert: Ralph McArdell - 7/11/2006 QuestionHow can I sort data in alphebatical order after writng them(some records containing information about customers,say)in to a file? How can I create a program to read and print customer records arranged with their names in alphabatical order?"
- C++: Sorting and searching data, donald knuth, sorting algorithm (在「Google 網頁註解」中檢視)

C++ - About file handling in C++ Expert

You are here: Experts > Computing/Technology > C/C++ > C++ > About file handling in C++

C++ - About file handling in C++
Expert: Ralph McArdell - 12/2/2007

Question
Kindly requested that can you tell me How to sort the 100 records in the file in C++

參考來源:

"You are here:  Experts > Computing/Technology > C/C++ > C++ > About file handling in C++ C++ - About file handling in C++ Expert: Ralph McArdell - 12/2/2007 QuestionKindly requested that can you tell me How to sort the 100 records in the file in C++"
- C++: About file handling in C++, c standard library, file in c (在「Google 網頁註解」中檢視)

vim插件ZenCoding

vim插件ZenCoding
十分實用的html編輯的vim plugin

參考來源:

"vim插件ZenCoding一些常用的操作 相当的酷,记录一些常用的操作 安装很方便,不再像我以前使用的sparkup.vim得配置python环境了,可直接到http://github.com/mattn/zencoding-vim下载zencoding.vim文件放到vimfiles/plugin或.vim/plugin目录就OK了。 接下来介绍些使用方法(Copy自LazyHack的使用zen coding for vim快速编写html代码) 展开缩写 输入 div>p#foo$*3>a 这样的缩写,然后按 ctrl + y + , 来展开(注意那个逗号),展开后它应该是这个样子的 <div> <p id="foo1"> <a href=""></a> </p> <p id="foo2"> <a href=""></a> </p> <p id="foo3"> <a href=""></a> </p> </div>"
- vim插件ZenCoding一些常用的操作 - 简单其实不简单 - ITFeed (在「Google 網頁註解」中檢視)

預官的考古題

這邊有預官的考古題參考

參考來源:

"預官考古題目錄 87年試題:國文、英文 88年試題:國文、英文 89年試題:國文、英文 90年試題:國文、英文 91年試題:國文、英文、計算機概論、憲法與立國精神 92年試題:國文、英文、計算機概論、憲法與立國精神 93年試題:國文、英文、計算機概論、憲法與立國精神 94年試題:國文、英文、計算機概論、憲法與立國精神 95年試題:國文、英文、計算機概論、憲法與立國精神 96年試題:國文、英文、計算機概論、憲法與立國精神 97年試題:國文、英文、計算機概論、憲法與立國精神 98年試題:國文、英文、計算機概論、憲法與立國精神"
- 預官考古題 (在「Google 網頁註解」中檢視)

Saturday, July 17, 2010

關於胡鄧

胡鄧
這是一篇轉自人人網的文章,當然,人生有幾個15年。
楊正說過一句話,年輕的時候,要有能馬上放下任何東西的打算。
這個是他過來人的遺憾,
如下面的感想,一輩子能夠實現多少夢想,一輩子又有幾個15年。

參考來源:

"胡邓绝对是个非常有意思的人。   第一,他叫了个这么古怪的名字,一定是他爸爸姓胡他妈妈姓邓! 第二,他在电视上看起来傻乎乎的,居然还是心理专家,居然每次都能说到你骨头里,居然每次都说到你骨头里了还不忙不乱慢悠悠摆着手。   我无意间进了胡邓的博客,人真是不可貌相,原来他的生活那么精彩。下面这句介绍是摘来的:   胡邓何许人也?中国大学生中最早的背包自助旅行者,新浪网旅游论坛资深版主,此外,他还是中国人民大学心理科学研究中心博士,由他首开并主讲的“自助旅行与心理素质教育”一课年年爆满,人大学生在网上如是说:“能选到胡邓的课是你一生的福气!”"
- 【胡邓】_刺猬皮小袄_新浪博客 (在「Google 網頁註解」中檢視)

C

Port Check Program (in C) Part 1

Many programs exist that have the need to check the status of a port for one reason or another. In the least simply pre-checking for an open port can save a great deal of time for a program (especially if it relies upon default timing when doing the real connection). Recently I had the need to write a sort of pre-check program that would see if a port was open and could be accessed over the network. This series examines the rapid prototyping I ended up doing to get the program from a to z. It is designed for those who simply need or want to know how to do this sort of thing. This particular example is done in C, however, there might be follow on texts that tackle the task in other languages.

參考來源:

"Port Check Program (in C) Part 1 Many programs exist that have the need to check the status of a port for one reason or another. In the least simply pre-checking for an open port can save a great deal of time for a program (especially if it relies upon default timing when doing the real connection). Recently I had the need to write a sort of pre-check program that would see if a port was open and could be accessed over the network."
- Port Check Program Part 1 (在「Google 網頁註解」中檢視)

Daily Bookmarks 20100717

lxer
http://lxer.com/module/newswire/viewby.php?filter=9

蘇州上海杭州攻略

這個是蘇州上海杭州攻略 在去哪裡的blog 上的參考

參考來源:

"10月底的苏州 上海 杭州行详细攻略 (2009年10月29日) 分类: 默认分类 第一天 首都机场到无锡硕放机场     机票:260+50 从机场到苏州 每天10:30   11:20  14:30  17:10   20:20在无锡机场到达出口处门口有依维柯民航班车到苏州市区,票价30元每人。 入住苏州酒店  位于人民路上平门站的格林豪泰   酒店离汽车站及火车站都很近步行即可到达        去观前街商业区  有很多老字号   第二天 从酒店步行去了拙政园  狮子林  苏州博物馆"
- 地瓜地~ (在「Google 網頁註解」中檢視)

分享到校內

這個說明了怎麼不用插件分享至校內

參考來源:

"不用插件实现分享博文至校内 2009-06-30 By Leo.N 其实这是别人在WordPress.org.cn上提出来的问题,因为我也时不时弄下校内,所以就研究了下怎么实现。 首先,找到你所使用模板里的single.php,用文本编辑器打开(注意选择用UTF-8编码,某则会出现乱码)。 在适当位置添加一下代码: <a href="http://share.xiaonei.com/share/buttonshare.do?link=<?php the_permalink() ?>&title=<?php the_title(); ?>"target="_blank">分享到校内</a> 解释: http://share.xiaonei.com/share/buttonshare.do?link= 是校内提交分享地址的接口,等号后面的就是所需提交的地址; <?php the_permalink() ?>"
- 不用插件实现分享博文至校内 - 不知所云 Leo.N's Blog (在「Google 網頁註解」中檢視)

Thursday, July 15, 2010

Daily Bookmarks 20100715

A Web Search Engine for Indexing, Searching and Publishing Arabic Bibliographic Databases
http://www.isoc.org/inet99/proceedings/posters/085/index.htm#ref18

Computer Science 226Algorithms and Data StructuresSpring 2003
http://www.cs.princeton.edu/courses/archive/spring03/cs226/info.html

Algorithms in C code
http://www.cs.princeton.edu/~rs/Algs3.c1-4/code.txt

An Introduction to XML and Web Technologies example
http://www.brics.dk/ixwt/examples.html


External Memory Algorithms and Data Structures (EMADS), Fall 2003
http://www.daimi.au.dk/~gerth/emF03/

Monday, July 12, 2010

Daily Bookmarks 20100712

how to design template

http://www.freetemplatesonline.com/templates/

http://www.oswd.org/

http://dzineblog.com/2008/07/best-photoshop-layout-design-tutorials.html

http://www.photoshopsupport.com/tutorials/jennifer/web-template.html#free_website_design_resources

http://www.webstockbox.com/css/converting-photoshop-web-template-file-to-htmlxhtmlcss-web-page-file-video-tutorial/

Friday, June 25, 2010

Daily Bookmarks 20100625

读书写字看风景人生就像一场旅行,不仅在乎目的地,在乎的还有沿途的风景,以及看风景的心情…
http://liuhongdan.com/?p=843

王斌
http://www.iwangbin.com/

Sunday, June 06, 2010

Daily Bookmarks 20100606

城市胡同 python
http://www.wujianrong.com/

第一次写完整的Python GUI程序
http://blog.csdn.net/thy38/archive/2009/11/13/4809085.aspx

Ubuntu SM (Screen Message) 螢幕大字報
http://zeroplex.blogspot.com/2010/04/ubuntu-sm.html

wxpython学习笔记
http://www.tt010.net/cms/show_article/1016.html

用PyGtk實現定時器(timer)
http://www.linux-wiki.cn/index.php?title=用PyGtk实现定时器(timer)&variant=zh-hant

SIP DNS SRV Query分散式網路的好伙伴
http://kaijie-chang.blogspot.com/2009_12_01_archive.html

Thursday, May 27, 2010

Daily Bookmarks 20100527



[社群行銷成功案例] 美國第一位網路民選總統:歐巴馬 Obama
http://blog.awoo.com.tw/2010/03/obama-social-marketing/

產業觀察 03 遊戲產業成功案例之三 : 巴哈姆特
http://blog.xuite.net/maomi/game/3445122

Tuesday, May 25, 2010

Daily Bookmarks 20100525

Information Retrieval and Extraction-NTU NLG lab
http://nlg.csie.ntu.edu.tw/courses/IR/slides/2010/

Information RetrievalData Structures & AlgorithmsEdited byBill FrakesDept. of Computer Science, Virginia Tech at Falls Church
http://www.dcc.uchile.cl/~rbaeza/iradsbook/irbook.html

INFORMATION RETRIEVAL AND EXTRACTION-CSIE NCU
http://www.csie.ncu.edu.tw/~chia/Course/IR/

Modern Information Retrieval
http://people.ischool.berkeley.edu/~hearst/irbook/

DRBL steup Wiki
http://www.tmes.mlc.edu.tw/wiki/index.php/Drblsetup

[Lifetype] 一個Lifetype樣板(Template)的繼承架構
http://mrmo.cc/mousontech/305

[PHP] 客製化部落格同步發文實作筆記 - 模擬瀏覽器行為
http://changyy.pixnet.net/blog/post/23010141

以PHP-cURL模擬瀏覽器行為
http://changyy.pixnet.net/blog/post/23910198

Monday, May 24, 2010

Daily Bookmarks 20100524

用 CodeIgniter 开发动态 Web 站点利用 MVC 框架和 CRUD 提高效率
http://www.ibm.com/developerworks/cn/opensource/os-codeigniter/

CodeIgniter 繁體中文
http://ci.wuboy.twbbs.org/

jQuery Drag and Drop Demo-linym
http://blog.linym.net/archives/452

Post details: UR(user requirement)、SA(system analysis)、SD (system design) 的分界
http://wzl.idv.tw/index.php?title=ur_user_requirement_sa_system_analysis_s&more=1&c=1&tb=1&pb=1

Sunday, May 23, 2010

Daily Bookmarks 20100523

Daily Bookmarks 20100523

YAML

竹北 Perl 推廣組

Now.in

Thinker

Pylons

SQLAlchemy

Active_record_pattern

Doctrine, the PHP ORM Framework

ORM library for CodeIgniter

什麼是TurboGears
http://ez2learn.com/index.php/python-tutorials/turbogears-tutorials/184-turbogears

SDblog - blog GAE
http://code.google.com/p/sdapp/

放糖的绿豆汤-SDblog作者
http://quke.cn/

《简明 Python 教程》为 "A Byte of Python" 的唯一指定简体中文译本
http://linux.chinaitlab.com/manual/Python_chinese/

這裡的走向

我想要重新啟動這裡撰寫技術性文章的時候了。
揮別北京生活都快一年的,之前因為無名連不上都把技術文章寫在這裡。

兩邊都有不錯的質量,但是,另外一邊又有點混雜。

初步想寫的個同步的程式,
不過還是要加強一下自己的能力QQ


Saturday, June 06, 2009

??Google WebTookit Tool

升級GCC required by /usr/lib/gcc/i686-pc-linux-gnu/4.1.2/libstdc++.so.6

因為升級 gcc 4.1.2 -> 4.3.2
出現
required by /usr/lib/gcc/i686-pc-linux-gnu/4.1.2/libstdc++.so.6

原來是一些設定沒更新
PClatop bin # gcc-config -l
[1] i686-pc-linux-gnu-4.1.2
[2] i686-pc-linux-gnu-4.3.2
#gcc-config 2
#source /etc/profile

#qfile libstdc++.so.6

這樣裝好的 chromium-bin就可以使用了

Thursday, June 04, 2009

xfce 單一視窗透明度transset

之前搞定,xfce 的視窗透明度compiz特別功能之一

但是我們要如何設置單一視窗的透明度呢?
因為想要聽歌的視窗,有跑歌詞,想要讓他透明化

在terminal下輸入,
transset .6
就會出現一個箭頭,點點那個箭頭就可以了。