DELAEMON BLOG

Live as if you were to die tomorrow. Learn as if you were to live forever.

2013-01-01から1年間の記事一覧

MySQL UDF UDF_ARGS, UDF_INIT

mysql_com.h 487 typedef struct st_udf_args 488 { 489 unsigned int arg_count;>-->---/* Number of arguments */ 490 enum Item_result *arg_type;>-->---/* Pointer to item_results */ 491 char **args;>->--->--->---/* Pointer to argument */ 492 un…

MySQL UserDefinedFunction

http://dev.mysql.com/doc/refman/4.1/ja/adding-udf.html単純関数のUDFでhello world的なものを作ってみる。orz.c #include <string.h> #include <mysql/mysql.h> my_bool orz_init(UDF_INIT *initid, UDF_ARGS *args, char *message) { return 0; } void orz_deinit(UDF_INIT *initi</mysql/mysql.h></string.h>…

Apache Module logging

前回のままだとエラーメッセージを画面に出力してるので、ログファイルに書き出すように変更。読み込み #include "http_log.h エラー int code = apr_dbd_select(dbd->driver, r->pool, dbd->handle, &res, stmt, 0); if (code != 0) { ap_log_rerror(APLOG_…

Apache Module mod_dbd (ubuntu 12.4 apache install)

Apache Moduleからmod_dbdを使ってDBにアクセス、レコードの中身を表示してみる。 mod_dbdはapr(Apache Portable Runtime)を使ってデータベースを操作するもの。 http://httpd.apache.org/docs/2.4/mod/mod_dbd.html http://apr.apache.org/ubuntuにはmodule…

Apache Module IPを表示

ひな形つくってモジュールとディレクトリの紐付け済みでmod_xx.cを以下に編集 // ~ 省略 #include "http_core.h" /* The sample content handler */ static int ip_handler(request_rec *r) { const char *remotehost = NULL; if (strcmp(r->handler, "ip"))…

Apache Module ClearSilver

前作ったhello worldモジュールでClearSilverを使って表示してみるhttp://delaemon.hatenablog.jp/entry/2013/04/24/010326Makefile コマンドをapxs → apxs2へ。ClearSilverのインストールされたパスを指定。読み込むライブラリを指定。 # the used tools AP…

Apache Module Debug

作ったモジュールにClearSilverを使って表示を追加したら コンパイルは通るがアクセスするとerror.log吐いてる [notice] child pid 32713 exit signal Segmentation fault (11)デバック情報が少ないのでどこで落ちているのか調べるためcoreを吐くcore file s…

Ubuntu language-pack-ja-base

Apache Moduleを書き直してコンパイル使用としたら以下のエラー $ sudo apxs2 -i -a -c mod_hello_world.c perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = "en_US:", LC_ALL = "ja_JP.UTF-8", L…

C++ テンプレートエンジン clearsilver インストール

Apache Moduleをclearsilverというテンプレートエンジンを使って作る。 まずはインストール。pythonのも入れておく $ sudo apt-get install clearsilver-dev python-clearsilver 環境はUbuntu $ uname -a Linux <host_name> 3.2.0-36-generic #57-Ubuntu SMP Tue Jan 8 </host_name>…

Apache Module のモジュールの引数 STANDARD20_MODULE_STUFF

/** Use this in all standard modules */ #define STANDARD20_MODULE_STUFF MODULE_MAGIC_NUMBER_MAJOR, \ MODULE_MAGIC_NUMBER_MINOR, \ -1, \ __FILE__, \ NULL, \ NULL, \ MODULE_MAGIC_COOKIE, \ NULL /* rewrite args spot */

Apache Module apxsコマンドで生成されたソースコード

mod_hello_world.c /* ** mod_hello_world.c -- Apache sample hello_world module ** [Autogenerated via ``apxs -n hello_world -g''] ** ** To play with this sample module first compile it into a ** DSO file and install it into Apache's modules …

Apache Module の構造体 (ver.2.4.4)

httpd-2.4.4/include/http_config.h /** * Module structures. Just about everything is dispatched through * these, directly or indirectly (through the command and handler * tables). */ typedef struct module_struct module; struct module_struct…

Apache Module で Hello World

C言語本読むの飽きるから動くものを書いてみる。 apacheをインストールするとapxsっていうコマンドも一緒にインストールされる。 apxsコマンドでapacheモジュールのひな形が作れたりコンパイルできたりする。apacheインストール sudo apt-get install apache…

Graphviz で リツイートをグラフ化