GNU Gnulib
Table of Contents
可以查查可以用的function
"GNU Gnulib Table of Contents"
- GNU Gnulib (在「Google 網頁註解」中檢視)
GNU Gnulib
Table of Contents
可以查查可以用的function
"GNU Gnulib Table of Contents"
- GNU Gnulib (在「Google 網頁註解」中檢視)
implement strcasestr
參考來源:"用c语言实现函数strcasestr。函数原型:char*strcasestr(const char*haystack,const char*needle) 函数返回字符串指针"
- C字符串处理 - 好好学习,好好工作,好好生活 - BlogJava (在「Google 網頁註解」中檢視)
使用google大法,
如下
在.h文文件中添加如下声明:
#ifdef _MSC_VER
int strcasecmp(char *s1, char *s2);
int strncasecmp(char *s1, char *s2, register int n);
#endif
在.c文件中添加如下实现
#ifdef _MSC_VER
int strcasecmp(char *s1, char *s2)
{
while (toupper((unsigned char)*s1) == toupper((unsigned char)*s2++))
if (*s1++ == '') return 0;
return(toupper((unsigned char)*s1) - toupper((unsigned char)*--s2));
}
int strncasecmp(char *s1, char *s2, register int n)
{
while (--n >= 0 && toupper((unsigned char)*s1) == toupper((unsigned char)*s2++))
if (*s1++ == '') return 0;
return(n < 0 ? 0 : toupper((unsigned char)*s1) - toupper((unsigned char)*--s2));
}
#endif
"使用google大法,发现VC没有strcasecmp和strncasecmp函数,只好为他做了一个补丁。"
- VC下编译libMPG123(补) : sunnyu (在「Google 網頁註解」中檢視)
Unix Incompatibility Notes:
String and Memory Functions
一些 String and Memory的函式介紹
有strstr memmem strcasecmp etc .
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 網頁註解」中檢視)
libmysqlclient.so.15: cannot open shared object file: No such file or directory
裏面提供一些共享庫的概念,值得一讀,補充比較底層的資訊。
"运行时使用非标准位置/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的确好 但是不能对链表排序!哎 2叉FIND TREE好 Blog作者的回复: 库函数设计时一般只会包含最常用的功能,所以不可能做到面面俱到。 二叉搜索树实现简单,平均深度为O(logN),这是它的优点;但经过O(N*N)次插入/删除后,它的缺点就暴露出来了,那就是二叉树将严重失衡,甚至演化成了一棵单支树。因此,在一些应用中,常用AVL树或splay树代替二叉搜索树。"
- C语言中用qsort()快速排序 - C&C++ - Welcome to my blog (在「Google 網頁註解」中檢視)
D2前端技術論壇視頻
http://www.d2forum.org/
滿值得看的
還有影片,有空閒時間可以邊消化。
"第四届D2前端技术论坛视频 2009-12-30 第四届D2宣传片"
- D2 前端技术论坛 (在「Google 網頁註解」中檢視)
Vim 內建視窗分割功能,
各編輯視窗 (Window) 可載入不同編輯緩衝區 (Buffer) 來進行編輯,不限於當前的編輯緩衝區。 編輯視窗也可載入共同的編輯緩衝區來編輯。 事實上編輯視窗基本上就是一個編輯緩衝區的觀察窗口 (viewport)。
由於可開啟多重編輯視窗來並行編輯,
http://www.openfoundry.org/en/
vi vim指令整理
http://www.vixual.net/blog/
"Vim 內建視窗分割功能,可於編輯器內分割多重視窗及分頁來並行編輯檔案。 各編輯視窗 (Window) 可載入不同編輯緩衝區 (Buffer) 來進行編輯,不限於當前的編輯緩衝區。 編輯視窗也可載入共同的編輯緩衝區來編輯。 事實上編輯視窗基本上就是一個編輯緩衝區的觀察窗口 (viewport)。 由於可開啟多重編輯視窗來並行編輯,因此若能善用編輯視窗及編輯緩衝區等功能,便可提高編輯效率。"
- Vim - 編輯緩衝區以及編輯視窗 (Buffers and Windows) (在「Google 網頁註解」中檢視)
Date / Time apps
wmtimer
Page: 1 2 3
"Date / Time apps Page: 1 2 3"
- dockapps.org (在「Google 網頁註解」中檢視)
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() 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 網頁註解」中檢視)
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 網頁註解」中檢視)
perl -MCPAN -e 'install LWP::Simple'
參考來源:"perl -MCPAN -e 'install LWP::Simple'"
- punkcoder: slack-get::Can't locate LWP/Simple.pm (在「Google 網頁註解」中檢視)
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 網頁註解」中檢視)
這支程式主要是用到perl 的二個module: Crypt::SSLeay 和 WWW::Mechanize,前者是為了讓LWP::
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 網頁註解」中檢視)
"GTD"是一门高效实用的工作信念,而"
本文将基于GTD学习与实现的一些经验基础上,
MonkeyGTD介紹
""GTD"是一门高效实用的工作信念,而"MonkeyGTD3"则是实现GTD的工具。 本文将基于GTD学习与实现的一些经验基础上,介绍MonkeyGTD3的基本概念与新增功能。适用对象:了解GTD,具有强烈工作优化欲望,使用Firefox作为主浏览器。"
- 欢迎使用MonkeyGTD 3.0 | GTD Life (在「Google 網頁註解」中檢視)
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 網頁註解」中檢視)
字符串optstring可以下列元素,
1.单个字符,表示选项,
2.单个字符后接一个冒号:表示该选项后必须跟一个参数。
3 单个字符后跟两个冒号,表示该选项后必须跟一个参数。
"字符串optstring可以下列元素, 1.单个字符,表示选项, 2.单个字符后接一个冒号:表示该选项后必须跟一个参数。参数紧跟在选项后或者以空格隔开。该参数的指针赋给optarg。 3 单个字符后跟两个冒号,表示该选项后必须跟一个参数。参数必须紧跟在选项后不能以空格隔开。该参数的指针赋给optarg。(这个特性是GNU的扩张)。"
- getopt的用法 - 嵌入式 - IT博客 (在「Google 網頁註解」中檢視)
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 網頁註解」中檢視)
在google lucene 與gais搜尋到一個有趣的事情。
原來有這段歷史。
"回想起来:从Jack Xu确定我们使用Lucene这个方向到项目上线:我们用了将近4个月左右的时间:而当时Lucene 1.2还是一个在SourceForge孵化的项目。还要感谢当时网易的搜索产品经理:肖尚雷给我的机会,是他带我进入这个行业,让我能有时间从头到尾学习了Lucene这个项目的源代码。在Lucene之前,各个门户网站的搜索用的还是台湾中正大学中正大学资工所创立的一个索引/查询引擎GAIS,GAIS不提供源代码,只有可执行版本的工具包(有不同平台下的binary发布版)。四年过去了:Lucene项目发展很快并应用到大量的WEB和桌面应用中。网易也许是第一个使用Lucene引擎的,我也很高兴将Lucene推广并应用到了更多的项目中,包括:"
- 911 四年前的今天你在做什么? (车东[Blog^2]) (在「Google 網頁註解」中檢視)
NodeJS探索
一、什么是NodeJS?
第一眼看到这个词,估计你和我一样,
生活经验告诉我们,牛人往往都不怎么正常,
是不是很有意思?这意味着什么我想大伙都清楚吧?嗯,
好,废话到此,那接下来就请跟着我,
簡介
參考來源:"一直都想介绍一下Quanta Plus这款linux下的IDE (基于Qt的程序)。这是我目前使用过的最好用,最上手的网页编辑器了,D.K的所有代码也都是在这个编辑器下写的。我曾经推荐过另一款linux下的IDE: Aptana。那相比Aptana,Quanta Plus有什么优势呢?"
- Quanta Plus : A Brief Review of an IDE under Linux (在「Google 網頁註解」中檢視)
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 網頁註解」中檢視)
类似的还有strcasestr,
memmem,是对付内部包含0值字节的版本,
"类似的还有strcasestr,是strstr的忽略大小写版本 memmem,是对付内部包含0值字节的版本,因为0会被str族函数认为是结束符"
- strstr函数的功能 - C语言论坛 - 编程论坛 (在「Google 網頁註解」中檢視)
#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 網頁註解」中檢視)
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 網頁註解」中檢視)
#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 網頁註解」中檢視)
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 網頁註解」中檢視)
範例:有一個檔案(points.bin)
#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,
} while(1);
fclose(file);
}
"fseek( input, 0, SEEK_END); // 先把讀寫位置移到檔尾 filelen = ftell( input ); // 再傳回檔案目前的讀寫位置 範例:有一個檔案(points.bin)用整數記錄全班50位同學的成績, 寫一程式讓使用者查尋學生成績"
- 第八章:檔案 (在「Google 網頁註解」中檢視)
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 網頁註解」中檢視)
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 網頁註解」中檢視)
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 網頁註解」中檢視)
在搞了很久的search時,今天好像被雷打到,
懂了一些東西。
strtok的第二個NULL
在 Microsoft C strtok() 函數會採用兩個字串,做為引數。
使用 strtok() 時,請牢記下列資訊:
* 每次呼叫函式時使用相同的字串,所以由 strtok() 使用修改原始字串 strtok() 將會以 NULL 取代原始字串中的分隔符號。
* strtok() 到第二個引數可以隨時變更為不同的分隔符號。
* 只有單一字元都被視為分隔符號。
http://www.cplusplus.com/
http://life.iiietc.ncu.edu.tw/
邊找regexec的時候剛好也找到解決opt的問題的網頁:
裏面有regex在C的範例,跟一些 Unix-like下的 programming教學。
http://mij.oltrelinux.com/
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 網頁註解」中檢視)
出拳手必要不要打直
因為這個問題,所以找了一下並且參考一些資料。
這裡個blog 提到一些人對於出拳要不要出打直提出看法,
2010年6月前,我之前是奉行手畢完全打直的。後來,
後來有聽一位柔道教練說,伸直受敵容易傷到手肘。
後來出拳,改成拳頭往下扣一點。
參考一些人的照片,跟看寶師出拳的樣子。
發現,自己上臂的肌肉其實是不發達的。如果是發達的,
所以也就沒有這個問題了。
"截拳道在出拳時強調《手臂不可完全打直》有幾個原因: 1.自然;人的手在放鬆自然垂下時是微彎的(我們稱為九分直或自然彎度)(如下圖),沒有人是完全直的,除非你在用力! 2.拳打直一旦落空,很容易震傷自己的手肘,或失控。 3.避免被反擊手肘關節(拳打直一旦對手反擊你的關節,只要輕輕一震你的手就會受傷甚至斷掉,而在九分直時還有一分的緩衝空間可以瞬間抵抗,不致於立即受傷)。 4.拳頭收回的《速度》比起完全打直時更快速!"
- 截拳道之《手臂不可完全打直》之根本概念 - 台灣截拳道(J.K.D) - 阿峰 - Yahoo!奇摩部落格 (在「Google 網頁註解」中檢視)
這是個不錯的分享網址
叫作惜墨,也就是都是珍藏,珍貴的意思。
副標題是,你有一個夢想,你要保護它。
裏面有不錯的文章,滿值得一看。
-----
你的时间不够用么?
2010年07月28日 | 个人提升, 提高效率, 时间管理, 简化生活, 简单生活 | 作者:博华gravatar关闭作者: 博华 姓名: 博华
Email: bhzhang1@gmail.com
博客: http://www.apple4.cn
个人介绍: 博华喜欢打篮球,喜欢看书,喜欢听歌,喜欢简单的生活。
我们经常会说一句话“我没有时间。”我不禁反问,
一、管理时间=管理金钱?
"你的时间不够用么? 2010年07月28日 | 个人提升, 提高效率, 时间管理, 简化生活, 简单生活 | 作者:博华关闭作者: 博华 姓名: 博华 Email: bhzhang1@gmail.com博客: http://www.apple4.cn个人介绍: 博华喜欢打篮球,喜欢看书,喜欢听歌,喜欢简单的生活。 每天只专注于最重要的事情,不去想其他的杂事。 喜欢水滴石穿的道理,因为寓意很简单:专注+坚持。 人生的座右铭是:既然你已经决定在生活中放手一搏,为什么不去倾尽全力干到极致?看他的所有文章 (138) 我们经常会说一句话“我没有时间。”我不禁反问,我们为什么没有时间?同样的人,每天都有同样的24小时,为什么有些人出色的完成了工作,有些人甚至要去加班加点完成昨天的工作?我想,这不仅仅是一个效率问题,更是一个生活态度的问题。 一、管理时间=管理金钱?"
- 你的时间不够用么? | 惜墨,关注自我成长,个人提升,时间管理,简化生活,学习方法,生活技巧 (在「Google 網頁註解」中檢視)
大文本文件逆序(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 網頁註解」中檢視)
/*
* 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 網頁註解」中檢視)
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/~
"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 網頁註解」中檢視)
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 網頁註解」中檢視)
利用strstr和sscanf解析GPS信息
作者:杨硕,华清远见嵌入式学院讲师。
考察C程序员是否合格的一个重要标准就是看他操作字符串的能力,
比如说我们要做一个GPS导航的项目,
GPS输出的数据格式如下:
$GPGGA,121252.000,3937.3032,N,
$GPRMC,121252.000,A,3958.3032,
$GPVTG,359.95,T,,M,15.15,N,28.
$GPGGA,121253.000,3937.3090,N,
$GPGSA,A,3,14,15,05,22,18,26,,
$GPGSV,3,1,10,18,84,067,23,09,
$GPGSV,3,2,10,21,32,199,23,14,
$GPGSV,3,3,10,29,07,074,,30,
可以看到,GPS模块发送过来的原始数据有很多,
$GPRMC,121252.000,A,3958.3032,
因此我们需要做的就是从读取的数据中截取以$
假设从串口读取的数据存放在一个字符串指针char *raw_buf指向的内存单元里,首先我们通过ANSI C提供的strstr()函数找到以$GPRMC开头以换行符’
/* 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 網頁註解」中檢視)
第一:举例说,你有个一依赖A用到了spring-2.0.5;
第二:从eclipse的maven插件来说,add dependency的时候,一旦仓库更新了,
第三:开发者们同步仍然有困难。
maven的支持者们,我们是活在现实世界中的生命,
我仍然是maven的用户,但是我在瞪着眼睛等待一个新的工具,
"第一:举例说,你有个一依赖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() 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)的大小問題
在記憶體配置的時候,因為效率考量,
並且會以其中最大的元素為單位,配置整數倍的記憶體
例如同樣是char, short, int三個元素
"結構(struct)的大小問題 在記憶體配置的時候,因為效率考量,預設會依照元素大小整數倍的對齊並且會以其中最大的元素為單位,配置整數倍的記憶體例如同樣是char, short, int三個元素"
- Coding James: 結構(struct)的大小問題 (在「Google 網頁註解」中檢視)
Structure
結構化的資料型態一
這一星期的課程,我們將面對C語言中比較深入的話題,
"Structure 結構化的資料型態一 這一星期的課程,我們將面對C語言中比較深入的話題,怎麼表達複雜的資料型態,怎麼做到一言以蔽之,簡潔而有力的C語言寫法。還有,如果你覺得int,char,float...不夠親切,你希望用更好的名稱來表達你的變數,這時候你需要typedef的語法。如果這都還不夠,還不能符合你的要求,還有以bit為單位的處理(bit manupulation),以及列舉(enumeration)的資料型態。"
- Structure I (在「Google 網頁註解」中檢視)
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 網頁註解」中檢視)
不錯的一句話
inception 電影評論
事實並不存在,只是我們,陷在其中。
"现实并不存在,只是我们,陷在其中——《Inception》 - [电影] 版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明http://parasite.blogbus.com/logs/69692744.html"
- 现实并不存在,只是我们,陷在其中——《Inception》 - 我和E的宇宙飞船 - 博客大巴 (在「Google 網頁註解」中檢視)
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
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/~
"CSC 209 course notes Course notes available so far:"
- CSC 209 course notes (在「Google 網頁註解」中檢視)
推 phstudy:%s改成%[^,] 07/17 19:16
推 dann1:成功了~ 大大可以解釋一下[^,]這個的意思嗎 07/17 19:35
推 dann1:研究了一下好像是規定字串結尾是逗號 那^的意思是無視嗎 07/17 19:39
推 TsinTa:^是not的意思,[^,]
推 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 網頁註解」中檢視)
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. « hackattacking.com (在「Google 網頁註解」中檢視)
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
這是值得參考的名詞叫作多行的輸入。
other site:
http://www.math.utah.edu/docs/
"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++
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
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的 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 網頁註解」中檢視)
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 網頁註解」中檢視)
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 網頁註解」中檢視)
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
十分實用的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 網頁註解」中檢視)
胡鄧
這是一篇轉自人人網的文章,當然,人生有幾個15年。
楊正說過一句話,年輕的時候,要有能馬上放下任何東西的打算。
這個是他過來人的遺憾,
如下面的感想,一輩子能夠實現多少夢想,一輩子又有幾個15年。
"胡邓绝对是个非常有意思的人。 第一,他叫了个这么古怪的名字,一定是他爸爸姓胡他妈妈姓邓! 第二,他在电视上看起来傻乎乎的,居然还是心理专家,居然每次都能说到你骨头里,居然每次都说到你骨头里了还不忙不乱慢悠悠摆着手。 我无意间进了胡邓的博客,人真是不可貌相,原来他的生活那么精彩。下面这句介绍是摘来的: 胡邓何许人也?中国大学生中最早的背包自助旅行者,新浪网旅游论坛资深版主,此外,他还是中国人民大学心理科学研究中心博士,由他首开并主讲的“自助旅行与心理素质教育”一课年年爆满,人大学生在网上如是说:“能选到胡邓的课是你一生的福气!”"
- 【胡邓】_刺猬皮小袄_新浪博客 (在「Google 網頁註解」中檢視)
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 網頁註解」中檢視)
這個是蘇州上海杭州攻略 在去哪裡的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 網頁註解」中檢視)