查询的标签:


PHP中的随机数生成

标签: and

不管哪种语言,都会涉及到生成一些随机数。并且过程都是大同小异:先设置一个种子点,再进行随机数的生成。如果没有设置种子点,实际上产生的是一个伪随机数序列。也就是说,在一次生成过程中,虽然能够产生一个随机数的序列,但是在多次生成中,这个序列是一模一样的。所以要设置一个种子点,这个种子点通常也要是随机的,所以一个比较好的方法就是以时间...

1 Comment »

在Wordpress2.5版以上添加boxes组件的方法

标签: , and

在Wordpress中,如果要开发一个插件,Wordpress提供了很多可以的API和Hook。如果想要让一个插件能够在后台添加文章post-new.php的页面中添加一个box模块(类似于原有的“摘要”、“Trackback”等模块),传统方法可以使用如下代码:
add_action('dbx_post_advanced', 'myplugin_old_custom_box' );
或者是
add_action('dbx_post_sidebar', 'myplugin_old_custom_box' );<...

No Comments »

Linux下由两个管道提供双向数据流的C程序

标签: , and

以下是一个Linux/Unix下由两个管道提供双向数据流的C程序,这是操作系统课程中经常使用的基本程序:
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <stdio.h>
#include <string.h>
int main()
{
    int fd1[2],fd2[2],cld_pid,status;
    char buf[200], len;
 
    if (pipe(fd1) == -1) // 创建...

1 Comment »

Linux下显示某一目录下文件名列表的C程序

标签: , and

以下是一个Linux/Unix下显示某一目录下文件列表的C程序,相当于最基本的ls命令的功能,显示的内容报告该目录下的子目录以及文件名:
#include <sys/types.h>
#include <dirent.h>
#include <stdio.h>
#include <errno.h>
int main(int argc,char *argv[])
{
    DIR *dp;
    struct dirent *dirp;
    int n=0;
    if (argc!=...

2 Comments »

Apache模块开发中的内容过滤

标签: , , , , , and

最近在持续研究Apache服务器的模块开发。在模块开发中,有一个很重要的方面就是对内容进行处理,包括请求的内容与返回的内容。Apache本身带了一个Module,能够对输出内容进行过滤。原来一直没有发现,直到看到下面这篇文章才恍然大悟。谢谢文章的作者Linux_prog先生~在加上apache的tutor网站上的内容http://www.apachetutor.org/dev/smart-filter,应该能够对Apache内容处理方面的模块开...

2 Comments »

Apache模块开发中的请求处理

标签: , , , , , and

最近持续在研究Apache的模块开发,为在Apache上的实验做准备。以下是介绍Apache Module中处理请求的过程,以及如何加入请求处理挂钩以及响应处理挂钩。尤其是几张图,很清晰地解释了Apache处理请求以及返回结果的框架。只是这篇文章主要从概念上介绍,没有实际可用的代码,仅帮助开发人员理解之用。
Request Processing in Apache
Processing HTTP requests is central to most web applic...

No Comments »

为Apache开发一个Module的实例

标签: , , , , , and

这是一篇介绍为Apache开发一个新的Module的Tutorial,非常简单易懂,英语六级以上的人看懂应该没有问题。如果你觉得看得麻烦,可以直接看其中的代码以及指令部分。 
This tutorial guides the reader through the minimal tasks involved in writing a module for Apache 2. The module developed here has almost no functionality - it's only impact is the generation of a static message to logs/errorlog for each HTTP request.
 

No Comments »

在Apache中自己开发一个新的Module

标签: , , , , and

最近需要在Apache中做实验,需要改Apache的源代码,感觉很头大。以下是找到的一篇关于Apache Module开发(Apche Modules Develop)的文章,觉得有些用处,先保留下来,也供大家一起参考。
Writing Apache modules
Apache, like many other successful open source projects has a modular architecture. This means that to add or modify functionality you do not need to know the whole code base. Source code access for Apache means that you c...

No Comments »