bcber的空间

爱好:编程、安全、唱歌、女人、创业

文章图片

http://horicky.blogspot.com/2008/06/exploring-erlang-with-mapreduce.html

Under the category of "Concurrent Oriented Programming", Erlang has got some good attention recently due to some declared success from Facebook engineers of using Erlang in large scale applications.   Tempted to figure out the underlying ingredients of Erlang, I decided to spent some time to learn the language.

Multi-threading Problem

Multiple threads of execution is a common programming model in modern languages because it enable a more efficient use of computing resources provided by multi-core  and multi-machine architecture. One of question to be answered though, is how these parallel threads of execution interact and work co-operative to solve the application problem.

There are basically two models for communication between concurrent&

安装erlang和cean,通过cean安装ibrowse:

wget http://cean.process-one.net/pub/bin/linux-x86_64/R14/cean/cean-2.0.sh

chmod +x cean-2.0.sh

./cean-2.0.sh

./cean/bin/ceanctl install ibrowse

=======================================

test.erl

-module(test).

-export([start/1]).

start(Filename) ->

    ibrowse:start(),

    true = filelib:is_regular(Filename),

    for_each_line_in_file(Filename, [read]).

for_each_line_in_file(Name, Mode) ->

    {ok, Device} = file:open(Name, Mode),

    for_each_line(Device).

for_each_line(Device) ->

    case io:get_line(Device, "") of

        eof ->

            file:close(Device), ok;

        Line ->

            io:format("~p~n", [Line]),

            ibrowse:send_req(Line, [], get, [], []),

            for_each_line(Device)

    end.

================================

h

log_format  main  '$remote_addr - $remote_user [$time_local] "$host $request" '

                      '$status $body_bytes_sent $request_time "$http_referer" '

                      '"$http_user_agent" "$http_x_forwarded_for" $upstream_cache_status';

require 'pp'

require 'time'

require 'date'

#d1 = DateTime.strptime("20/May/2012:03:02:03 +0800", "%d/%b/%Y:%H:%M:%S %z")

#d2 = DateTime.strptime("20/May/2012:03:02:10 +0800", "%d/%b/%Y:%H:%M:%S %z")

sec5 = 5/86400

lineno = 0

file = File.new(ARGV[0])

x = {}

file.each do |line|

  _, remote_addr, time_local, host, url, status, body_bytes_sent, request_time, referrer, http_user_agent, http_x_forwarded_for = /^([^\s]+) - [^\s]+ \[(.*)\] \"(.*?) .*? (.*?) .*?\" (\d+) (\d+) ([\d\.]+) \"(.*)\" \"([^\"]*)\" \"(.*)\"/.match(line).to_a

  lineno = lineno + 1

  #puts line

  #if host

  #  puts remote_addr

  #  puts time_local

  #  puts host

  #  puts path

  #  puts status

  #  puts body_bytes_sent

  #  puts request_time

  #  puts referrer

  #  puts http_user_agent

  #  puts http_x_forwarded_for

  #end

&nb

http://phpcrawl.cuab.de/index.html

About PHPCrawl

PHPCrawl is a set of classes written in PHP for crawling/spidering websites, so just call it a webcrawler-library or crawler-engine for PHP.

PHPCrawl "spiders" websites and passes information about all found documents (pages, links, files ans so on) for futher processing to users of the library.

It provides several options to specify the behaviour of the crawler like URL- and Content-Type-filters, cookie-handling, robots.txt-handling, limiting options, multiprocessing and much more.

PHPCrawl is completly free opensource software and is licensed under the GNU GENERAL PUBLIC LICENSE v2.

To get a first impression on how to use the crawler you may want to take a look at the quickstart guide or an example. A complete reference and documentation of all available options and methods can be found in the classreferences-section

The current version of the phpcrawl-package and older releases can be downloaded from a sourceforge-mirror.

Note to users of phpcrawl version 0.7x or before: Although in version 0.8 some method-names and parameters have changed, it should be fully compatible to older versions of phpcrawl.

#include "deelx.h"

#include <map>

#include <string>

#include <time.h>

#define NOSEC_REGEX_WITH_CACHE

#ifdef NOSEC_REGEX_WITH_CACHE

#ifdef NOSEC_REGEX_CACHE_USE_BKDR_HASH

  static inline // BKDR Hash Function 目前会存在一些碰撞,考虑性能问题,暂时可接受

  unsigned int BKDRHash(const char *str)

  {

   unsigned int seed = 131; // 31 131 1313 13131 131313 etc..

   unsigned int hash = 0;

   while (*str)

   {

    hash = hash * seed + (*str++);

   }

   return (hash & 0x7FFFFFFF);

  }

  typedef std::pair<unsigned int, CRegexpT <char> *> RegexMapPair_A;

  typedef std::map<unsigned int, CRegexpT <char> * > RegexMapType_A;

#else

  typedef std::pair<std::string, CRegexpT <char> *> RegexMapPair_A;

  typedef std::map<std::string, CRegexpT <char> * > RegexMapType_A;

#endif

  static inline CRegexpT <char> *GetRegEx(const char *pattern, int flag)

  {

   static RegexMapType_A regex_map;

#ifdef NOSEC_REGEX_CACHE_USE_BKDR_HASH

   unsigned int hash = BKDRHash(pattern);

#else

   std::string hash = pattern;

   hash += ('A'+flag);

#endif

   RegexMapType_A::iterator it = regex_map.

文章图片

用2010用了两年了,一直没想过升级。最近想升级到XE2,测试之前的一些控件,有一些关键的还不能用,比如

Berg.Next.Component.Suite.v5.8.9.1

VirtualTreeview4.8.6

慢慢测试一下。

vst从svn上下载最新的代码,可以编译。不过默认居然选择的是64位,导致错误,在工程中选择32bit即可。

[DCC Fatal Error] VirtualTreesR.dpk(29): E2225 Never-build package 'dclstd' must be recompiled

setup.ini应该这么写,将MultiInstaller和zip放在同一目录,目标目录选择当前目录即可:

[Package - Virtual Treeview]

Name=Virtual Treeview

Zip=VirtualTrees20120418.zip

Folder=Virtual Treeview

SearchPath="Source","Common"

Includes="$BaseFolder\Virtual Treeview\Source","$BaseFolder\Virtual Treeview\Common"

GroupIndex=1

D16="Packages\Delphi XE2\VirtualTreesR.dpk", "Packages\Delphi XE2\VirtualTreesD.dpk"

Installable=1

[Options]

MinimumIDEVersion=D16

DefaultInstallIDE=D16

默认路径都安装到C:\Users\Public\Documents\RAD Studio\9.0\Bpl