锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲黄色免费电影,亚洲精品中文字幕无码蜜桃,亚洲av日韩av永久在线观看http://m.tkk7.com/pyguru/A blog of technology and life.zh-cnMon, 12 May 2025 10:34:44 GMTMon, 12 May 2025 10:34:44 GMT60Parsing MIME & HTMLhttp://m.tkk7.com/pyguru/archive/2005/02/19/1312.htmlpygurupyguruFri, 18 Feb 2005 16:33:00 GMThttp://m.tkk7.com/pyguru/archive/2005/02/19/1312.htmlhttp://m.tkk7.com/pyguru/comments/1312.htmlhttp://m.tkk7.com/pyguru/archive/2005/02/19/1312.html#Feedback0http://m.tkk7.com/pyguru/comments/commentRss/1312.htmlhttp://m.tkk7.com/pyguru/services/trackbacks/1312.html
Parsing MIME & HTML

Understanding an email message encoded with MIME can be very, very, very difficult. It can get frustrating due to the number of options and different ways to do the actual encoding. Now add to that the sometimes too-liberal interpretations of the relevant RFCs by the email client designers and you will begin to get the idea. This article will show you how this task can be laughably simple thanks to Perl's extensive bag of tricks, CPANno alt defined.

I started out with a simple and straightforward mission: Fetch an Email from a POP mailbox and display it in a 7-bit, text-only capable device. This article describes the different stages for a simple tool that accomplishes this task, written in Perl with a lot of help from CPAN modules. I hope this to be useful to other Perl folks who might have a similar mission. Let's discuss each part of this task in turn, as we read through mfetch, the script I prepared as an example. Keep in mind that TIMTOWTDI.

Setting up the script

The first thing, as you know, is loading up all of the modules I will be using. I'm sure you already know strict and warnings. We'll see how do we use the rest of the modules a bit later.

    1: #!/usr/bin/perl
2:
3: # This script is (c) 2002 Luis E. Mu帽oz, All Rights Reserved
4: # This code can be used under the same terms as Perl itself. It comes
5: # with absolutely NO WARRANTY. Use at your own risk.
6:
7: use strict;
8: use warnings;
9: use IO::File;
10: use Net::POP3;
11: use NetAddr::IP;
12: use Getopt::Std;
13: use MIME::Parser;
14: use HTML::Parser;
15: use Unicode::Map8;
16: use MIME::WordDecoder;
17:
18: use vars qw($opt_s $opt_u $opt_p $opt_m $wd $e $map);
19:
20: getopts('s:u:p:m:');
21:
22: usage_die("-s server is required\n") unless $opt_s;
23: usage_die("-u username is required\n") unless $opt_u;
24: usage_die("-p password is required\n") unless $opt_p;
25: usage_die("-m message is required\n") unless $opt_m;
26:
27: $opt_s = NetAddr::IP->new($opt_s)
28: or die "Cannot make sense of given server\n";

Note the lines 27 and 28, where I use NetAddr::IPno alt defined to convert whatever the user gave us through the -s option into an IP address. This is a very common use of this module, as its new() method will convert many common IP notations into an object I can later extract an IP address from. It will even perform a name resolution for us if required. So far, everything should look familiar, as a lot of scripts start like this one.

It is worth noting that the error handling in lines 22-25 is not a brilliant example of good coding or documentation. It is much better practice to write your scripts' documentation in POD, and use a module such as Pod::Usageno alt defined to provide useful error messages to the user. At the very least, try to provide an informative usage message. You can see the usage_die() function if you download the complete script.

Fetching a message via POP3

On to deeper waters. The first step in parsing a message, is getting at the message itself. For this, I'll use Net::POP3no alt defined, which implements the POP3 protocol described in RFC-1939no alt defined. This is all done in the code below.

   30: my $pops = Net::POP3->new($opt_s->addr)
31: or die "Failed to connect to POP3 server: $!\n";
32:
33: $pops->login($opt_u, $opt_p)
34: or die "Authentication failed\n";
35:
36: my $fh = new_tmpfile IO::File
37: or die "Cannot create temporary file: $!\n";
38:
39: $pops->get($opt_m, $fh)
40: or die "No such message $opt_m\n";
41:
42: $pops->quit();
43: $pops = undef;
44:
45: $fh->seek(0, SEEK_SET);

At line 30, a connection to the POP server is attempted. This is a TCP connection, in this case to port 110. If this connection succeeds, the USER and PASS commands are issued at line 33, which are the simplest form of authentication supported by the POP protocol. Your username and password are being sent here through the network without the protection of cryptography, so a bit of caution is in order.

Net::POP3no alt defined supports many operations defined in the POP protocol that allow for more complex actions, such as fetching the list of messages, unseen messages, etc. It can also fetch messages for us in a variety of ways. Since I want this script to be as lightweight as possible (i.e., to burn as little memory as possible), I want to fetch the message to a temporary on-disk file. The temporary file is nicely provided by the new_tmpfile method of IO::Fileno alt defined in line 36, which returns a file handle to a deleted file. I can work on this file, which will magically disappear when the script is finished.

Later, I instruct the Net::POP3 object to fetch the required message from the mail server and write it to the supplied filehandle using the get method, on line 39. After this, the connection is terminated gracefully by invoking quit and destroying the object. Destroying the object insures that the TCP connection with the server is terminated, freeing the resources being held in the POP server as soon as possible. This is a good programming practice for network clients.

The interaction required by mfetch with the POP server is really simple, so I'm not making justice to Net::POP3. It provides a very complete implementation of the protocol, allowing for much more sophisticated applications.

Note that in line 45, I rewind the file so that the fetched message can be read back by the code that follows.

For this particular example, we could also have used Net::POP3Client, which provides a somewhat similar interface. The code would have looked more or less like the following fragment.

    1: my $pops = new Net::POP3Client(USER => $opt_u,
2: PASSWORD => $opt_p,
3: HOST => $opt_s->addr)
4: or die "Error connecting or logging in: $!\n";
5:
6: my $fh = new_tmpfile IO::File
7: or die "Cannot create temporary file: $!\n";
8:
9: $pops->HeadAndBodyToFile($fh, $opt_m)
10: or die "Cannot fetch message: $!\n";
11:
12: $pops->Close();

Parsing the MIME structure

Just as email travels inside a sort of envelope (the headers), complex messages that include attachments and generally, HTML messages, travel within a collection of MIME entities. You can think of these entities as containers that can transfer any kind of binary information through the Email infrastructure, which in general does not know how to deal with 8-bit data. The code reproduced below, takes care of parsing this MIME structure.

   47: my $mp = new MIME::Parser;
48: $mp->ignore_errors(1);
49: $mp->extract_uuencode(1);
50:
51: eval { $e = $mp->parse($fh); };
52: my $error = ($@ || $mp->last_error);
53:
54: if ($error)
55: {
56: $mp->filer->purge; # Get rid of the temp files
57: die "Error parsing the message: $error\n";
58: }

Perl has a wonderful class that provides the ability to understand this MIME encapsulation, returning a nice hierarchy of objects that represent the message. You access this facilities through the MIME::Parserno alt defined class, part of the MIME-Toolsno alt defined bundle. MIME::Parser returns a hierarchy of MIME::Entity objects representing your message. The parser is so smart, that if you pass it a non-MIME email, it will be returned to you as a text/plain entity.

MIME::Parser can be tweaked in many ways, as its documentation will show you. One of the points where this toggling might be important, is the decoding process. Remember that I need to be as light in memory usage as possible. The default behavior of MIME::Parser involves the use of temporary files for decoding of the message. These temporary files can be spared and core memory used instead by invoking output_to_core(). Before doing this, note all the caveats cited in the module's documentation. The most important one is that if a 100 MB file ends up in your inbox, this whole thing needs to be slurped into RAM.

In line 47 I create the parser object. The call to ignore_errors() in line 48 is an attempt to made this parser as tolerant as possible. extract_uuencode() in line 49, takes care of pieces of the email that are uu-encoded automatically, translating them back into a more readable form. The actual request to parse the message, available through reading the $fh filehandle, is in line 51. Note that it is enclosed in an eval block. I have to do this as the parser might throw an exception if certain errors are encountered. The eval allows me to catch this exception and react in a way that is sensible to this application. In this case, I want to be sure that any temporary file created by the parsing process is cleared by a call to purge(), as seen in lines 56 and 57.

Setting up the HTML parser

Parsing HTML can be a tricky and tedious task. Thankfully, Perl has a number of nice ways to help you do this job. A number of excellent books such as The Perl Cookbook (from O'Reilly & Associatesno alt defined) has a couple of recipes that came very close to what I needed, especially recipe 20.5, "Converting HTML to ASCII", which I reproduce below.

    1: use HTML::TreeBuilder;
2: use HTML::FormatText;
3:
4: $html = HTML::TreeBuilder->new();
5: $html->parse($document);
6:
7: $formatter = HTML::FormatText->new(leftmargin => 0, rightmargin => 50);
8:
9: $ascii = $formatter->format($html);

I did not want to use this recipe because of two reasons: I needed fine-grained control in the HTML to ASCII conversion and I wanted to have as little impact as possible in resources. I did a small benchmark that shows the kind of performance difference among the two options while parsing a copy of one of my web articles. The result below shows that the custom parser explained later runs faster than the Cookbook's recipe. This does not mean that the recipe or the modules it uses are bad. This result simply means that the recipe is actually doing a lot of additional work, which just happens to not be all that useful for this particular task.

bash-2.05a$ ./mbench
Benchmark: timing 100 iterations of Cookbook's, Custom...
Cookbook's: 73 wallclock secs (52.82 usr + 0.00 sys = 52.82 CPU) @ 1.89/s (n=100)
Custom: 1 wallclock secs ( 1.17 usr + 0.00 sys = 1.17 CPU) @ 85.47/s (n=100)
Rate Cookbook's Custom
Cookbook's 1.89/s -- -98%
Custom 85.5/s 4415% --

HTML::FormatTextno alt defined does an awesome job of converting the HTML to plain text. Unfortunately I have a set of guidelines that I need to follow in the conversion and that are not compatible with the output of this module. Additionally, HTML::TreeBuilderno alt defined does an excellent job of parsing an HTML document, but produces an intermediate structure - the parse tree - that in my case, wastes resources.

However, Perl has an excellent HTML parser in the HTML::Parserno alt defined module. In this case, I chose to use this class to implement an event-driven parser, where tokens (syntactic elements) in the source document cause the parser to call functions I provide. This allowed me complete control on the translation while sparing the intermediate data structure.

Converting HTML to text is a lossy transformation. This means that what goes out of this transformation is not exactly equivalent to what went in in the first place. Pictures, text layout, style and a few other information elements are lost. My needs required that I noted the existence of images as well as a reasonably accurate rendition of the page's text, but nothing else. Remember that the target device can only display 7-bit text, and this is within a very small and limited display. This piece of code sets up the parser to do what I need.

   62: my $parser = HTML::Parser->new
63: (
64: api_version => 3,
65: default_h => [ "" ],
66: start_h => [ sub { print "[IMG ",
67: d($_[1]->{alt}) || $_[1]->{src},"]\n"
68: if $_[0] eq 'img';
69: }, "tagname, attr" ],
70: text_h => [ sub { print d(shift); }, "dtext" ],
71: ) or die "Cannot create HTML parser\n";
72:
73: $parser->ignore_elements(qw(script style));
74: $parser->strict_comment(1);

Starting on line 71, I set up the HTML::Parser object that will help me do this. First, I tell it I want to use the latest (as of this writing) interface style, which provides more flexibility than earlier interfaces. On line 65, I tell the object that by default, no parse events should do anything. There are other ways to say this, but the one shown is the most efficient.

Lines 66 through 69 define a handler for the start events. This handler will be called each time an opening tag such as <a> or <img> is recognized in the source being parsed. Handlers are specified as a reference to an array whose first element tells the parser what to do and its second element, tells the parser what information to pass to the code. In this example, I supply a function that for any img tag, will output a hopefully descriptive text composed with either the alt or the src attributes. I request this handler to be called with the name of the tag as the first argument and the list of attributes as further arguments, through the string "tagname, attr" found in line 69. The d() function will be explained a bit later, but it has to do with decoding its argument.

The text event will be triggered by anything inside tags in the input text. I've set up a simpler handler for this event that merely prints out whatever is recognized. I also request that HTML entities such as &euro; or &ntilde; be decoded for me through the string "dtext" on line 70. HTML entities are used to represent special characters outside the traditional ASCII range. In the interest of document accuracy, you should always use entities instead of directly placing 8-bit characters in the text.

Some syntactic elements are used to enclose information that is not important for this application, such as <style>...</style> and <script>...</script>. I ask the parser to ignore those elements with the call to ignore_elements() at line 73. I also request the parser to follow strict comment syntax through the call to strict_comment() on line 74.

Setting up the Unicode mappings

MIME defines various ways to encode binary data depending on the frequency of octets greater than 127. With relatively few high-bit octets, Quoted-Printable encoding is used. When many high-bit octets are present, Base-64 encoding is used instead. The reason is that Quoted-Printable is slightly more readable but very inefficient in space while Base-64 is completely unreadable by standard humans and adds much less overhead in the size of encoded files. Often, message headers such as the sender's name are encoded using Quoted-Printable when they contain characters such as a '帽'. These headers look like From: =?ISO-8859-1?Q?Luis_Mu=F1oz?= <some@body.org> and should be converted to From: Luis Mu帽oz <some@body.org>. In plain english, Quoted-Printable encoding is being used to make the extended ISO-8859-1 characters acceptable for any 7-bit transport such as email. Many contemporary mail transport agents can properly handle message bodies that contain high-bit octets but will choke on headers with binary data, in case you were wondering why all this fuzz.

Lines 92 through 102 define setup_decoder(), which can use the headers contained in a MIME::Headno alt defined object to setup a suitable decoder based on the MIME::WordDecoderno alt defined class. This will translate instances of Quoted-Printable text, to its high-bit equivalent. Note that I selected ISO-8859-1 as the default in case no proper character set can be identified. This was a sensible choice for me, as ISO-8859-1 encloses spanish characters, which happen to be my native language.

   92: sub setup_decoder
93: {
94: my $head = shift;
95: if ($head->get('Content-Type')
96: and $head->get('Content-Type') =~ m!charset="([^\"]+)"!)
97: {
98: $wd = supported MIME::WordDecoder uc $1;
99: }
100: $wd = supported MIME::WordDecoder "ISO-8859-1" unless $wd;
101: }

But this clever decoding is not enough. Getting at the original high-bit characters is not enough. I must recode these high characters into something usable by the 7-bit display device. So in line 76 I set up a mapping based on Unicode::Map8no alt defined. This module can convert 8-bit characters such as ISO-8859-1 or ASCII into wider characters (Unicodeno alt defined) and then back into our chosen representation, ASCII, which only defines 7-bit characters. This means that any character that cannot be properly represented, will be lost, which for our application is acceptable.

   76: $map = Unicode::Map8->new('ASCII')
77: or die "Cannot create character map\n";

The decoding and character mapping is then brought together at line 90, where I define the d() function, that simply invokes the adequate MIME decoding method, transforms the resulting string into Unicode via the to16() method and then, transforms it back into ASCII using to8() to insure printable results in our device. Since I am allergic to warnings related to undef values, I make sure that decode() always get a defined string to work with.

   90: sub d { $map->to8($map->to16($wd->decode(shift||''))); }

As you might notice if you try this code, the conversion is again lossy because there are characters that does not exist in ASCII. You can experiment with the addpair() method to Unicode::Map8 in order to add custom character transformations (i.e., '鈧? might be 'E'). Another way to achieve this, is through deriving a class from Unicode::Map8 and implementing the unmapped_to8 method to supply your own interpretation of the missing characters. Take a look at the module's documentation for more information.

Starting the decode process

With all the pieces in place, all that's left is to traverse the hierarchy of entities that MIME::Parser provides after parsing a message. I implemented a very simple recursive function decode_entities starting at line 103. This is a recursive function because recursion comes naturally as a way to handle trees such as those produced by MIME::Parser. At least to me.

  103: sub decode_entities
104: {
105: my $ent = shift;
106:
107: if (my @parts = $ent->parts)
108: {
109: decode_entities($_) for @parts;
110: }
111: elsif (my $body = $ent->bodyhandle)
112: {
113: my $type = $ent->head->mime_type;
114:
115: setup_decoder($ent->head);
116:
117: if ($type eq 'text/plain')
118: { print d($body->as_string); }
119: elsif ($type eq 'text/html')
120: { $parser->parse($body->as_string); }
121: else
122: { print "[Unhandled part of type $type]"; }
123: }
124: }

The condition at line 107 asks if this part or entity contains other parts. If it does, it extracts them and invokes itself recursively to process each sub-part at line 109.

If this part is a leaf, its body is processed. Line 111 gets it as a MIME::Bodyno alt defined object. On line 155 I setup a decoder for this part's encoding and based on the type of this part, taken at line 113, the code on lines 117 to 122 call the proper handlers.

In order to fire the decoding process, I call decode_entities() with the result of the MIME decoding of the message on line 86. This will invoke the HTML parser when needed and in general, produce the output I look for in this example. After this processing is done, I make sure to wipe temporary files created by MIME::Parser on line 88. Note that if the message is not actually encoded with MIME, MIME::Parser will arrange for you to receive a single part of type text/plain that contains the whole message text, which is perfect for our application.

   86: decode_entities($e);
87:
88: $mp->filer->purge;

And that's about it

After these less than 130 lines of code, I can easily fetch and decode a message, such as in the following example:

bash-2.05a$ ./mfetch -s pop.foo.bar -u myself \
-p very_secure_password -m 5

Date: Sat, 28 Dec 2002 20:14:37 -0400
From: root <root@foo.bar>
To: myself@foo.bar
Subject: This is the plain subject

This is a boring and plain message.

More complex MIME messages can also be decoded. Look at this example where I dissect a dreaded piece of junk mail, but don't worry. I used head to spare you pages and pages of worthless image links:

bash-2.05a$ ./mfetch -s pop.foo.bar -u myself \
-p very_secure_password -m 2 | head -20


Date: Sun, 22 Dec 2002 23:22:25 -0400
From: Luis Muoz <lem@foo.bar>
To: Myself <myself@foo.bar>
Subject: Fwd: Get $860 Free - Come, Play, Have Fun!



Begin forwarded message:

> From: Cosmic Offers <munged@migada.com.INVALID>;
> Date: Sun Dec 22, 2002 20:59:43 America/Caracas
> To: spam@victim.net
> Subject: Get $860 Free - Come, Play, Have Fun!
>

>
[IMG http://www.migada.com/email/Flc_600_550_liberty_mailer_.gif]
[IMG http://www.migada.com/email/Flc_600_550_liberty_mail-02.gif]
[IMG http://www.migada.com/email/Flc_600_550_liberty_mail-03.gif]
[IMG http://www.migada.com/email/Flc_600_550_liberty_mail-04.gif]

If you're curious, please download the complete script and play with it a bit. I hope this tutorial and its related script to be as helpful for you as it has been for me



pyguru 2005-02-19 00:33 鍙戣〃璇勮
]]>
涓撲笟鐢?shù)瀛愪?/title><link>http://m.tkk7.com/pyguru/archive/2005/02/18/1297.html</link><dc:creator>pyguru</dc:creator><author>pyguru</author><pubDate>Thu, 17 Feb 2005 22:33:00 GMT</pubDate><guid>http://m.tkk7.com/pyguru/archive/2005/02/18/1297.html</guid><wfw:comment>http://m.tkk7.com/pyguru/comments/1297.html</wfw:comment><comments>http://m.tkk7.com/pyguru/archive/2005/02/18/1297.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://m.tkk7.com/pyguru/comments/commentRss/1297.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/pyguru/services/trackbacks/1297.html</trackback:ping><description><![CDATA[     鎽樿: 涓撲笟鐢?shù)瀛愪? 緹庡浗鍖栧鏂囨憳鏌ラ槄娉? 鍖?鎷湡绱㈠紩銆佹湡鐨勫唴瀹規(guī)牸寮忓強娌塊潻銆佹湡鏂囨憳銆佹湡绱㈠紩銆佸嵎錛堟枃鎽橈級绱㈠紩銆佸嵎錛堣緟鍔╋級绱㈠紩銆佹寚瀵兼х儲寮曘佺瘡璁$儲寮曘佽祫鏂欐潵婧愮儲寮曘丆A鍕樿銆佸寲瀛︾墿璐ㄧ儲寮曚腑绱㈠紩鏍?棰樼殑閫夋嫨鍘熷垯銆丆A绱㈠紩鏌ラ槄鍘熷垯鍙婄儲寮曞叧緋昏〃銆丆A鏌ラ槄瀹炰緥璁ㄨ鍙婇檮褰曘傚叡璁?94欏點傚江嫻峰嵖1978騫寸紪錛岃緝鑰侊紝浣嗕粛鐒舵湁鍙傝冧環(huán)鍊箋傚洜涓烘槸瓚呮槦鏍煎紡錛屾枃 浠朵綋縐緝澶э紝...  <a href='http://m.tkk7.com/pyguru/archive/2005/02/18/1297.html'>闃呰鍏ㄦ枃</a><img src ="http://m.tkk7.com/pyguru/aggbug/1297.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/pyguru/" target="_blank">pyguru</a> 2005-02-18 06:33 <a href="http://m.tkk7.com/pyguru/archive/2005/02/18/1297.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>BioJava In Angerhttp://m.tkk7.com/pyguru/archive/2005/02/18/1296.htmlpygurupyguruThu, 17 Feb 2005 22:32:00 GMThttp://m.tkk7.com/pyguru/archive/2005/02/18/1296.htmlhttp://m.tkk7.com/pyguru/comments/1296.htmlhttp://m.tkk7.com/pyguru/archive/2005/02/18/1296.html#Feedback0http://m.tkk7.com/pyguru/comments/commentRss/1296.htmlhttp://m.tkk7.com/pyguru/services/trackbacks/1296.html

 

BioJava In Anger

蹇熸寚鍗?/span>

浠嬬粛錛?/span>

BioJava 鐨勮璁℃兜鐩栦簡鐢熺墿淇℃伅瀛︾殑寰堝鏂歸潰錛屾湰韜氨姣旇緝澶嶆潅鍜屽簽澶э紝鏈夋椂鍊欑敋鑷充護浜虹敓鐣忋傚浜庨偅浜涙兂蹇熶簡瑙e茍涓斿埄鐢ㄨ繖涓己澶х殑宸ュ叿鐨勭敓鐗╀俊鎭瀹朵滑鏉ヨ錛屾湁鏃跺欓潰瀵硅繖涓澶у爢鐨勬帴鍙e父甯鎬細(xì)澶寸棝嬈茶銆傛湰鎸囧崡鑳藉甯姪浣犲埄鐢?span class="SpellE">BioJava寮鍙?span lang="EN-US">99錛呭父鐢ㄧ殑紼嬪簭錛岃屼笉蹇呬負(fù)姝ゆ帉鎻?span lang="EN-US">99錛呯殑BioJava鎺ュ彛銆?/span>

鏈寚鍗椾嬌鐢ㄥ鏁扮紪紼嬪揩閫熸寚鍗楃殑鏍煎紡錛岄噰鐢ㄢ滄垜濡備綍浣跨敤.....鈥濈殑涓婚褰㈠紡鏉ュ府鍔╁ぇ瀹朵嬌鐢?span class="SpellE">BioJava銆傛瘡涓富棰橀兘鎻愪緵浣犲彲鑳戒細(xì)鏈熸湜騫剁粡甯鎬嬌鐢ㄧ殑婧愪唬鐮併傝繖浜涗唬鐮佸熀鏈笂鍙互鐩存帴鍦ㄤ綘鐨勬満鍣ㄤ腑緙栬瘧榪愯銆傛垜灝介噺璇︾粏娉ㄩ噴榪欎簺浠g爜錛岃澶у鏇村鏄撶悊瑙g▼搴忎腑鍙兘鐨勪竴浜涙櫐娑╀唬鐮併?/span>

鈥?span class="SpellE">BioJava In Anger鈥濈敱Mark Schreiber緇存姢銆備換浣曞緩璁拰闂璇瘋仈緋?span lang="EN-US">biojava mailing list銆傜偣鍑?span lang="EN-US">榪欓噷璁㈤槄閭歡鍒楄〃銆?/span>

鏈寚鍗椾嬌鐢ㄧ殑渚嬪瓙緇忚繃BioJava1.3, Java1.4嫻嬭瘯銆?/span>

鏈寚鍗椾腑鏂囩増鐢?span lang="EN-US"> Wu Xin(Center of Bioinformatics,Peking University)緲昏瘧,浠諱綍緲昏瘧闂璇烽氳繃閭歡鍒楄〃鑱旂郴鎴栬呯櫥褰?span lang="EN-US">BBS銆?/span>


鎴戝浣曚嬌鐢?span lang="EN-US">.......?

瀹夎

> 瀹夎Java

> 瀹夎BioJava

鎴愬垎琛?span lang="EN-US">(alphabets)鍜屾爣璁?span lang="EN-US">(symbol)

>鎴戝浣曞緱鍒癉NA,RNA鎴栬泲鐧借川鐨勬垚鍒嗚〃?

>鎴戝浣曠敤鑷畾涔夌殑鏍囪寤虹珛鑷畾涔夌殑鎴愬垎琛?

>鎴戝浣曞緩绔嬫潅浜や駭鐗╂垚鍒嗚〃(cross product alphabet),渚嬪瀵嗙爜瀛楁垚鍒嗚〃(codon alphabet)?

>鎴戝浣曚粠鏉備氦浜х墿鎴愬垎琛?cross product alphabet)涓垎瑙e嚭浠栦滑鐨勭粍鎴愭爣璁?component symbol)?

>鎴戝浣曞垽鍒袱涓垚鍒嗚〃鎴栦袱涓爣璁版槸鍚︾浉鍚?

>鎴戝浣曞緩绔嬩竴涓涔夋爣璁?ambiguous symbol),渚嬪Y鎴朢?

鍩烘湰搴忓垪鎿嶄綔

>鎴戝浣曚粠瀛椾覆涓垱寤轟竴鏉″簭鍒楀璞′互鍙婂皢鍏跺啓鍥炰竴鏉″瓧涓?

>鎴戝浣曚粠涓鏉″簭鍒椾腑寰楀埌瀛愬簭鍒?

>鎴戝浣曞皢DNA搴忓垪杞綍鍒癛NA搴忓垪?

>鎴戝浣曞緱鍒頒竴鏉NA鎴朢NA搴忓垪鐨勪簰琛ラ摼?

>搴忓垪鏄笉鍙彉鐨?immutable),鎴戝浣曟敼鍙樺畠鐨勫悕瀛?

>鎴戝浣曠紪杈戜竴鏉″簭鍒楁垨鑰呮爣璁伴摼(symbollist)?

緲昏瘧(translation)

>鎴戝浣曞皢涓鏉NA鎴朢NA鎴栨爣璁伴摼緲昏瘧鎴愯泲鐧借川?

>鎴戝浣曞皢鍗曚釜瀵嗙爜瀛愮炕璇戞垚鍗曚釜姘ㄥ熀閰?

>鎴戝浣曚嬌鐢ㄤ竴涓潪鏍囧噯緲昏瘧琛?

搴忓垪杈撳叆杈撳嚭(sequence I/O)

>鎴戝浣曞皢搴忓垪浠ASTA鏍煎紡杈撳嚭?

>鎴戝浣曡鍙朏ASTA鏍煎紡鐨勬枃浠?

>鎴戝浣曡鍙朑enBank/EMBL/SwissProt鏍煎紡鐨勬枃浠?/span>

>鎴戝浣曚粠GenBank/EMBL/SwissProt鏍煎紡涓娊鍙栧簭鍒楀茍涓斾互FASTA鏍煎紡杈撳嚭?

>鎴戝浣曞皢ABI搴忓垪杞寲涓築ioJava搴忓垪?

娉ㄩ噴(annotation)

>鎴戝浣曞皢涓鏉″簭鍒楃殑娉ㄩ噴鍒楀嚭鏉?

>鎴戝浣曠敤鐗╃榪欎釜鍙傛暟(鎴栧叾浠栨敞閲婂睘鎬?鏉ョ瓫閫夊簭鍒?

浣嶇疆鍜岀壒寰?span lang="EN-US">(location and feature)

>鎴戝浣曟寚瀹氫竴涓偣浣嶇疆(point location)?

>鎴戝浣曟寚瀹氫竴涓?span class="GramE">鍩熶綅緗?/span>(range location)?

>鎴戝浣曚嬌鐢ㄧ幆鐘朵綅緗?circular location)?

>鎴戝浣曞緩绔嬩竴涓壒寰?feature)?

>鎴戝浣曚互綾誨瀷涓哄弬鏁扮瓫閫夌壒寰?

>鎴戝浣曞垹闄ょ壒寰?

BLAST鍜?span lang="EN-US">FASTA

>鎴戝浣曞垱寤轟竴涓狟LAST瑙f瀽鍣?/span>?

>鎴戝浣曞垱寤轟竴涓狥ASTA瑙f瀽鍣?/span>?

>鎴戝浣曚粠瑙f瀽緇撴灉涓娊鍙栦俊鎭?

璁℃暟鍜屽垎甯?span lang="EN-US">(count and distribution)

>鎴戝浣曡綆楀簭鍒椾腑鐨勬畫鍩烘暟?

>鎴戝浣曡綆楀簭鍒椾腑鏌愮鏍囪(symbol)鐨勯鐜?

>鎴戝浣曞皢璁℃暟杞負(fù)鍒嗗竷?

>鎴戝浣曚粠涓縐嶅垎甯冧腑鍒涘緩涓鏉¢殢鏈哄簭鍒?

>鎴戝浣曚粠涓縐嶅垎甯冧腑璁$畻鐔靛?

>鎴戝浣曡兘鎵懼埌涓縐嶇畝鍗曠殑鏂規(guī)硶鏉ュ垽鏂袱縐嶅垎甯冩槸鍚﹀叿鏈夌浉鍚岀殑鏉冮噸?

>鎴戝浣曞涓涓嚜瀹氫箟鐨勬垚鍒嗚〃鍒涘緩涓涓狽闃跺垎甯?order N distribution)?

>鎴戝浣曞皢涓縐嶅垎甯冧互XML鏍煎紡杈撳嚭?

鏉冮噸鐭╅樀鍜屽姩鎬佽鍒?span lang="EN-US">(weight matrix and dynamic programming)

>鎴戝浣曞埄鐢ㄤ竴涓潈閲嶇煩闃?span class="GramE">瀵繪壘妯′綋?

>鎴戝浣曞垱寤?span class="GramE">涓涓殣椹ā鍨?/span>璋?profile HMM)?

>鎴戝浣曞緩绔嬩竴涓嚜瀹氫箟鐨勯殣椹ā鍨?/span>(HMM)?

鐢ㄦ埛鐣岄潰(user interfaces)

>鎴戝浣曞皢娉ㄩ噴鍜岀壒寰佷互鏍?wèi)鐘跺舰寮忔槃·?

>鎴戝浣曞湪GUI涓樉紺轟竴鏉″簭鍒?

>鎴戝浣曟樉紺哄簭鍒楁爣灝?

>鎴戝浣曟樉紺虹壒寰?

OBDA

>鎴戝浣曡緗瓸ioSQL?


鍏嶈矗澹版槑:

榪欎簺婧愪唬鐮佺敱鍚勪釜浣滆呰礎(chǔ)鐚?span lang="EN-US">,灝界緇忚繃鎴戜滑嫻嬭瘯,浣嗕粛鐒跺彲鑳芥湁閿欒鍙戠敓銆傛墍鏈変唬鐮佸彲浠ュ厤璐逛嬌鐢紝浣嗘垜浠茍涓嶄繚璇佸拰璐熻矗浠g爜鐨勬紜с傚湪浣跨敤鍓嶏紝璇瘋嚜鎴戞祴璇曘?/span>


鐗堟潈錛?/span>

鏈珯鏂囨。灞炰簬鍏惰礎(chǔ)鐚呫傚鏋滃湪鍑虹増鐗╀腑浣跨敤錛岃鍏堝瀭璇?span lang="EN-US">biojava mailing list銆傛簮浠g爜鏄?span lang="EN-US">寮鏀捐祫婧?/span>,濡傛灉浣犲悓鎰忓叾澹版槑鍒欏彲浠ュ厤璐逛嬌鐢ㄣ?/span>

 

 Maintainted by Wu Xin, CBI, Peking University, China, 2003

 



pyguru 2005-02-18 06:32 鍙戣〃璇勮
]]>
Bioperl綆浠?/title><link>http://m.tkk7.com/pyguru/archive/2005/02/18/1295.html</link><dc:creator>pyguru</dc:creator><author>pyguru</author><pubDate>Thu, 17 Feb 2005 22:29:00 GMT</pubDate><guid>http://m.tkk7.com/pyguru/archive/2005/02/18/1295.html</guid><wfw:comment>http://m.tkk7.com/pyguru/comments/1295.html</wfw:comment><comments>http://m.tkk7.com/pyguru/archive/2005/02/18/1295.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/pyguru/comments/commentRss/1295.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/pyguru/services/trackbacks/1295.html</trackback:ping><description><![CDATA[<span id="ArticleContent1_ArticleContent1_lblContent"> <p>        Bioperl 鏈榪戝凡緇忓埌浜?.0鐗?鍏堣bioperl.org,璇ョ粍緇囨寮忔垚绔嬩簬1995騫?鍦ㄦ涔嬪墠宸茬粡浣滀負(fù)闈炴寮忕殑鍥綋瀛樺湪閭e緢澶氬勾,鐜板湪浠栧凡緇忓艦鎴愪簡涓涓浗闄? 鎬х殑寮鍙戣呯殑鍗忎細(xì),榪欎簺寮鍙戣呭紑鍙戠敤浜庣敓鐗╀俊鎭,鍩哄洜緇勫,鍜岀敓鍛界瀛︾爺絀剁殑寮鏀炬簮鐮佺殑Perl 宸ュ叿.</p> <p> 璇ョ粍緇囩殑鏀寔鑰呭拰鎺ㄥ姩鑰呮槸Open Bioinformatics Foundation. 浠栦滑鐨勪紮浼磋繕鏈塨iojava.org, biopython.org, DAS, bioruby.org, biocorba.org, ENSEMBL 鍜?EMBOSS. </p> <p>Bioperl鐨勬湇鍔″櫒鎻愪緵渚涗笅鍒楁湇鍔?鐢ㄤ簬鐢熷懡縐戝鐨勫熀浜巔erl鐨勬ā鍧?鑴氭湰,web鑱旀帴鐨勮蔣浠? </p> <p>Bioperl鐜板湪宸插彂灞曟垚涓轟竴涓護浜虹灘鐩殑鍥介檯鎬х殑鑷敱杞歡寮鍙戣鍒掞紝bioperl鍦ㄧ敓鐗╀俊鎭鐨勪嬌鐢ㄥ姞閫熶簡鐢熺墿淇℃伅瀛︺佸熀鍥犵粍瀛︿互鍙婂叾浠栫敓鍛? 縐戝鐮旂┒鐨勫彂灞曘傛渶榪慴ioperl 1.0鐗堟湰姝e紡鍙戝竷錛岃繖鍏墮棿鍘嗘椂涓冨勾錛屾垚緇╂枑鐒躲侭ioperl 1.0 鍖呮嫭832涓枃浠訛紝93涓猄cript錛屽姛鑳戒赴瀵岋紝婧愮爜鍏ㄩ儴寮鏀俱傚畠鏄敓鐗╀俊鎭鐮旂┒鐨勫埄鍣ㄣ傝緇嗙殑鍐呭澶у鍙互璁塊棶<a >www.bioperl.org</a>銆?/p> <p>Bioperl浣滀負(fù)perl鐨勬墿鍏呯殑涓撻棬鐢ㄤ簬鐢熺墿淇℃伅鐨勫伐鍏蜂笌鍑芥暟闆?鑷劧涔熺戶鎵夸簡perl鐨勪紬澶氫紭鐐?</p> <p>絎竴. Perl寮哄ぇ鐨勬鍒欒〃紺哄紡(regular expression)姣斿浠ュ強瀛楃涓叉搷浣滀嬌榪欎釜宸ヤ綔鍙樺緱綆鍗曡屾病鏈夊叾瀹冭璦鑳界浉姣斻侾erl 闈炲父鎿呴暱浜庡垏鍓詫紝鎵漿錛岀粸錛屽紕騫籌紝鎬葷粨錛屼互鍙婂叾瀹冪殑鎿嶄綔鏂囧瓧鏂囦歡銆傜敓鐗╄祫鏂欏ぇ閮ㄥ垎鏄枃瀛楁枃浠?鐗╃鍚嶇О,縐嶅睘鍏崇郴錛屽熀鍥犳垨搴忓垪鐨勬敞瑙o紝璇勪綇錛岀洰褰曟煡闃? 鐢氳嚦DNA搴忓垪涔熸槸綾繪枃瀛楃殑銆傜幇鍦ㄤ簰鐩鎬氦鎹互浠ユ枃瀛楁枃浠剁殑褰㈠紡瀛樺湪鐨勪絾鏄叿鏈変笉鍏煎鐨勮祫鏂欐牸寮忕敓鐗╀俊鎭祫鏂欐槸涓涓緢澶寸柤鐨勯棶棰?perl鐨勮繖涓柟闈㈢殑浼? 鐐?鍙互鍦ㄨ繖涓鏂歸潰瑙e喅涓嶅皯闂.</p> <p>絎簩. Perl 鑳藉閿欍傜敓鐗╄祫鏂欓氬父鏄笉瀹屽叏鐨勶紝閿欒鎴栬呰璇樊浠庢暟鎹殑浜х敓鏃跺欏彲鑳藉氨浜х敓浜?鍙﹀鐢熺墿鏁版嵁鐨勬煇欏瑰兼爮浣嶅彲浠ヨ蹇界暐 ,鍙兘鏄┖鐫鐨勶紝鎴栨槸鏌愪釜鏍忎綅涔熷氨鏄煇涓?琚鏈熻鍑虹幇濂藉嚑嬈?涓句緥鏉ヨ錛屼竴涓疄楠屽彲鑳借閲嶅鐨勬搷浣?錛屾垨鏄祫鏂欎互鎵嬪姩杈撳叆鎵浠ユ湁閿欒銆侾erl騫朵笉浠? 鎰忔煇涓兼槸絀虹殑鎴栨槸鏈夊鎬殑瀛楃銆傛瑙勮〃紺哄紡鑳藉琚啓鎴愬彇鍑哄茍涓旀洿姝i敊璇殑涓鑸敊璇傚綋鐒惰繖縐嶅脊鎬т篃鍙兘鏄悇鍧忓銆?</p> <p><br>       榪樻湁,Perl 鏄粍浠跺鍚戠殑銆侾erl 榧撳姳浜轟滑灝嗕粬浠殑杞歡鍐欐垚灝忔ā緇勶紝涓嶈鏄敤 Perl 鍑藉紡搴撴ā緇勬垨鏄緇熺殑 Unix 宸ュ叿瀵煎悜鐨勬柟寮忋傚閮ㄧ▼搴忚兘澶熻交鏄撶殑琚暣鍚堣繘 Perl 紼嬪簭,闈犵潃綆¢亾(pipe),緋葷粺鍛煎彨,鎴栨槸鎻掑駭(socket)銆侾erl5 寮曡繘鐨勫姩鎬佽澆鍏ュ櫒鍏佽浜轟滑浣跨敤 C 鐨勫嚱寮忥紝鎴栬呰鏁翠釜緙栫▼榪囩殑鍑藉紡搴擄紝琚嬌鐢ㄥ湪 Perl 鐩磋瘧鍣ㄤ腑銆傛渶榪戠殑鎴愭灉鏄笘鐣屽悇鍦扮殑鏅鴻兘緇撴櫠閮戒細(xì)鏀跺綍鍦ㄤ竴緇勬ā緇勯噷闈紝縐頒負(fù)鈥漛ioPerl鈥濓紙璇峰弬鑰?Perl Journal錛?br>        Perl 寰堝鏄撳幓鍐欏茍涓旇兘寰堝揩寮鍙戝畬銆傜洿璇戝櫒璁╀綘涓嶉渶瑕佸鍛婁綘鎵鏈夌殑鍑芥暟鍨嬪紡浠ュ強璧勬枡鍨嬫侊紝褰撴湭瀹氫箟鐨勫嚱寮忚鍛煎彨鏃跺彧浼?xì)寮曡捣涓涓敊璇紝闄ら敊鍣ㄤ篃鑳戒笌Emacs寰堝ソ 鐨勫悎浣滃茍涓旇浣犺兘鐢ㄤ護浜鴻垝鏈嶇殑浜よ皥寮忕殑寮鍙戞ā寮忋?br>         Perl 鏄壇濂界殑鍘熷瀷璇█銆傚洜涓哄畠蹇屼笖鑴?quick and dirty)錛岀敤 Perl 寤烘瀯鏂版紨綆楃殑鍘熷瀷姣旂洿鎺ュ啓鎴愪竴涓揩鐨勯渶瑕佺紪紼嬭繃鐨勮璦鏉ョ殑鏈夋剰涔夈傛湁鏃跺欏彂鐜扮粨鏋滄槸Perl宸茬粡澶熷揩浜嗭紝鎵浠ョ▼搴忓彉涓嶉渶瑕佺Щ妞?鏇村鎯呭艦鏄煇浜哄彲浠ョ敤C鍐? 涓涓皬鐨勬牳蹇冪▼搴忥紝緙栫▼鎴愬姩鎬佽澆鍏ョ殑妯$粍鎴栨槸澶栭儴鐨勫彲鎵ц紼嬪簭錛岀劧鍚庡叾瀹冪殑閮ㄥ垎鐢≒erl鏉ュ畬鎴愩傝繖閮ㄥ垎鐨勪緥瀛愬彲浠ュ弬鑰?<a >http://waldo.wi.mit.edu/ftp/distribution/software/rhmapper/)銆?/a> </p> <p>         鏈変竴鐐硅寮鴻皟鐨勬槸, Perl 鍦ㄥ啓浣滅綉欏?CGI 鏂歸潰闈炲父浼樼錛岃屼笖閲嶈鎬ч殢鐫鍚勫疄楠屽皢璧勬枡鍙戣〃鍦ㄧ綉緇滀笂涔嬪悗鏇存槸澧炲姞銆傛垜鍦ㄥ熀鍥犱腑蹇冪幆澧冧笅浣跨敤 Perl 鐨勭粡楠屼粠澶村埌灝鵑兘鏄煎緱縐拌禐鐨勩傜劧鑰屾垜鍙戠幇 Perl 涔熸湁瀹冪殑闂銆傚畠鐨勬澗鏁g殑紼嬪簭椋庢牸瀵艱嚧璁稿閿欒錛岃繖浜涘湪鍏跺畠涓ユ牸鐨勮璦閮戒細(xì)琚姄鍒般備婦渚嬫潵璇達(dá)紝Perl 璁╀綘鍦ㄤ竴涓彉鏁板湪琚寚瀹氬間箣鍓嶅氨鑳戒嬌鐢紝榪欐槸涓緢鏈夌敤鐨勭壒鎬у綋浣犻渶瑕佺殑鏃跺欙紝浣嗘槸鍗存槸涓涓伨闅懼綋浣犲崟綰殑鎵撻敊浜嗚鯨璇嗗悕縐般傚悓鏍風(fēng)殑錛屽緢瀹規(guī)槗蹇樿瑕佸鍛婁竴涓嚱 寮忛噷闈㈢殑鍖哄煙鍙樻暟錛屽鑷翠笉灝忓績鍦版敼鍒頒簡鍏ㄥ煙鍙樻暟銆?br>    鏈鍚庯紝Perl 鐨勪笉瓚充箣澶勫湪浜庡緩绔嬪浘褰㈠寲鐨勪嬌鐢ㄨ呮帴鍙c傝櫧鐒?Unix蹇犲疄淇″緬鎵鏈変簨鎯呴兘鑳藉湪鍛戒護妯″紡涓嬪畬鎴愶紝澶у鏁扮殑緇堢浣跨敤鑰呭嵈涓嶅悓鎰忋傝紿楋紝閫夊崟錛屽脊璺崇殑鍥炬宸茬粡鍙樻垚浜嗗繀瑕佺殑鏃跺皻銆?/p> <p><br>         鐩村埌鏈榪戯紝鐩村埌鏈榪戯紝Perl 鐨勪嬌鐢ㄨ呯晫闈?GUI)鍙戝睍浠嶆槸涓嶆垚鐔熺殑銆傜劧鑰?Nick Ing-Simmons鐨勫姫鍔涗嬌寰?perlTK(pTK) 鐨勬暣鍚堜嬌寰椾互 Perl 椹卞姩鐨勪嬌鐢ㄨ呮帴鍙e湪 X-window涓婇潰鎴愪負(fù)鍙兘銆傛垜鐨勪紮浼村拰鎴戞浘緇忓湪 MIT 鍩哄洜涓績鍐欒繃鍑犱釜 pTK 涓哄熀紜鐨勫簲鐢ㄧ▼搴忎緵浜掕繛緗戜嬌鐢ㄨ咃紝鑰屼笖浠庡ご鍒板熬閮芥槸涓涓護浜烘弧鎰忕殑緇忛獙銆傚叾瀹冪殑鍩哄洜涓績鍒欐洿澶ц妯$殑浣跨敤 pTK錛屽湪鏌愪簺鍦版柟宸茬粡鎴愪負(fù)涓昏鐨勭敓浜у姏銆?/p></span><img src ="http://m.tkk7.com/pyguru/aggbug/1295.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/pyguru/" target="_blank">pyguru</a> 2005-02-18 06:29 <a href="http://m.tkk7.com/pyguru/archive/2005/02/18/1295.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鐢熺墿淇℃伅瀛?-- 榛勮嫳姝?錛堣В鏀懼啗306鍖婚櫌錛?榪囨稕錛堟竻鍗庡ぇ瀛︾敓鐗╀俊鎭鐮旂┒鎵錛?/title><link>http://m.tkk7.com/pyguru/archive/2005/02/18/1294.html</link><dc:creator>pyguru</dc:creator><author>pyguru</author><pubDate>Thu, 17 Feb 2005 22:27:00 GMT</pubDate><guid>http://m.tkk7.com/pyguru/archive/2005/02/18/1294.html</guid><wfw:comment>http://m.tkk7.com/pyguru/comments/1294.html</wfw:comment><comments>http://m.tkk7.com/pyguru/archive/2005/02/18/1294.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://m.tkk7.com/pyguru/comments/commentRss/1294.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/pyguru/services/trackbacks/1294.html</trackback:ping><description><![CDATA[<b> <h1>鐢熺墿淇℃伅瀛?/h1></b> <p align="justify"><b><font face="瀹嬩綋" lang="ZH-CN">鎾扮ǹ浜猴細(xì)榛勮嫳姝?錛堣В鏀懼啗306鍖婚櫌錛? 榪囨稕錛堟竻鍗庡ぇ瀛︾敓鐗╀俊鎭鐮旂┒鎵錛?/font></b></p> <p align="justify"><b><font face="瀹嬩綋" lang="ZH-CN">瀹$ǹ浜猴細(xì)瀛欎箣鑽o紙娓呭崕澶у鐢熺墿淇℃伅瀛︾爺絀舵墍錛?/font></b></p> <dir> <p><b>1 <a >姒傝堪</a></b></p> <p><font face="瀹嬩綋" lang="ZH-CN"><b>2 <a >鐢熺墿淇℃伅鏁版嵁搴撲笌鏌ヨ </a></b></font></p> <blockquote> <p><a ><font face="瀹嬩綋" lang="ZH-CN"><b>2.1 鍩哄洜鍜屽熀鍥犵粍鏁版嵁搴?/b> </font></a></p></blockquote> <blockquote> <p><a ><font face="瀹嬩綋" lang="ZH-CN"><b>2.2 铔嬬櫧璐ㄦ暟鎹簱</b> </font></a></p></blockquote> <blockquote> <p><a ><font face="瀹嬩綋" lang="ZH-CN"><b>2.3 鍔熻兘鏁版嵁搴?/b> </font></a></p></blockquote> <blockquote> <p><a ><font face="瀹嬩綋" lang="ZH-CN"><b>2.4 鍏跺畠鏁版嵁搴撹祫婧?/b> </font></a></p></blockquote> <p><font face="瀹嬩綋" lang="ZH-CN"><b>3 <a >搴忓垪姣斿鍜屾暟鎹簱鎼滅儲</a></b></font><a ><font face="瀹嬩綋" lang="ZH-CN"> </font></a></p> <blockquote> <p><a ><font face="瀹嬩綋" lang="ZH-CN"><b>3.1 搴忓垪涓や袱姣斿</b> </font></a></p></blockquote> <blockquote> <p><a ><font face="瀹嬩綋" lang="ZH-CN"><b>3.2 澶氬簭鍒楁瘮瀵?/b></font></a><font face="瀹嬩綋" lang="ZH-CN"> </font></p></blockquote> <p><font face="瀹嬩綋" lang="ZH-CN"><b>4 <a >鏍擱吀涓庤泲鐧借川緇撴瀯鍜屽姛鑳界殑棰勬祴鍒嗘瀽</a></b></font><a ><font face="瀹嬩綋" lang="ZH-CN"> </font></a></p> <blockquote> <p><a ><font face="瀹嬩綋" lang="ZH-CN"><b>4.1 閽堝鏍擱吀搴忓垪鐨勯嫻嬫柟娉?/b> </font></a></p> <p><a ><font face="瀹嬩綋" lang="ZH-CN"><b>4.2 閽堝铔嬬櫧璐ㄧ殑棰勬祴鏂規(guī)硶</b></font></a><font face="瀹嬩綋" lang="ZH-CN"> </font></p></blockquote><font face="瀹嬩綋" lang="ZH-CN"> <p><b>5 <a >鍒嗗瓙榪涘寲</a></b> </p> <p><font face="瀹嬩綋" lang="ZH-CN"><b>6 <a >鍩哄洜緇勫簭鍒椾俊鎭垎鏋?/a></b></font><a ><font face="瀹嬩綋" lang="ZH-CN"> </font></a></p></font> <blockquote> <p><a ><font face="瀹嬩綋" lang="ZH-CN"><b>6.1 鍩哄洜緇勫簭鍒楀垎鏋愬伐鍏?/b> </font></a></p> <p><a ><font face="瀹嬩綋" lang="ZH-CN"><b>6.2 浜虹被鍜岄紶綾誨叕鍏辯墿鐞嗗浘璋辯殑浣跨敤</b> </font></a></p> <p><a ><font face="瀹嬩綋" lang="ZH-CN"><b>6.3 SNPs璇嗗埆</b> </font></a></p> <p><a ><font face="瀹嬩綋" lang="ZH-CN"><b>6.4 鍏ㄥ熀鍥犵粍姣旇緝</b> </font></a></p> <p><a ><font face="瀹嬩綋" lang="ZH-CN"><b>6.5 EST搴忓垪搴旂敤</b> </font></a></p></blockquote><font face="瀹嬩綋" lang="ZH-CN"> <p><b>7 <a >鍔熻兘鍩哄洜緇勭浉鍏充俊鎭垎鏋?/a></b><a > </a></p></font> <blockquote> <p><a ><font face="瀹嬩綋" lang="ZH-CN"><b>7.1 澶ц妯″熀鍥犺〃杈捐氨鍒嗘瀽</b> </font></a></p> <p><a ><font face="瀹嬩綋" lang="ZH-CN"><b>7.2 鍩哄洜緇勬按騫寵泲鐧借川鍔熻兘緇煎悎棰勬祴</b></font></a><font face="瀹嬩綋" lang="ZH-CN"> </font></p></blockquote><font face="瀹嬩綋" lang="ZH-CN"> <p><b><a >鍙傝冩枃鐚?/a></b><a > </a></p></font><font face="瀹嬩綋" lang="ZH-CN" size="3"> <p align="justify">銆</p></font></dir> <img src ="http://m.tkk7.com/pyguru/aggbug/1294.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/pyguru/" target="_blank">pyguru</a> 2005-02-18 06:27 <a href="http://m.tkk7.com/pyguru/archive/2005/02/18/1294.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>CGI::Carp - CGI routines for writing to the HTTPD (or other) error loghttp://m.tkk7.com/pyguru/archive/2005/02/18/1293.htmlpygurupyguruThu, 17 Feb 2005 21:27:00 GMThttp://m.tkk7.com/pyguru/archive/2005/02/18/1293.htmlhttp://m.tkk7.com/pyguru/comments/1293.htmlhttp://m.tkk7.com/pyguru/archive/2005/02/18/1293.html#Feedback0http://m.tkk7.com/pyguru/comments/commentRss/1293.htmlhttp://m.tkk7.com/pyguru/services/trackbacks/1293.html

NAME

CGI::Carp - CGI routines for writing to the HTTPD (or other) error log


SYNOPSIS

    use CGI::Carp;

    croak "We're outta here!";
confess "It was my fault: $!";
carp "It was your fault!";
warn "I'm confused";
die "I'm dying.\n";


DESCRIPTION

CGI scripts have a nasty habit of leaving warning messages in the error logs that are neither time stamped nor fully identified. Tracking down the script that caused the error is a pain. This fixes that. Replace the usual

    use Carp;

with

    use CGI::Carp

And the standard warn(), die (), croak(), confess() and carp() calls will automagically be replaced with functions that write out nicely time-stamped messages to the HTTP server error log.

For example:

   [Fri Nov 17 21:40:43 1995] test.pl: I'm confused at test.pl line 3.
[Fri Nov 17 21:40:43 1995] test.pl: Got an error message: Permission denied.
[Fri Nov 17 21:40:43 1995] test.pl: I'm dying.


REDIRECTING ERROR MESSAGES

By default, error messages are sent to STDERR. Most HTTPD servers direct STDERR to the server's error log. Some applications may wish to keep private error logs, distinct from the server's error log, or they may wish to direct error messages to STDOUT so that the browser will receive them.

The carpout() function is provided for this purpose. Since carpout() is not exported by default, you must import it explicitly by saying

   use CGI::Carp qw(carpout);

The carpout() function requires one argument, which should be a reference to an open filehandle for writing errors. It should be called in a BEGIN block at the top of the CGI application so that compiler errors will be caught. Example:

   BEGIN {
use CGI::Carp qw(carpout);
open(LOG, ">>/usr/local/cgi-logs/mycgi-log") or
die("Unable to open mycgi-log: $!\n");
carpout(LOG);
}

carpout() does not handle file locking on the log for you at this point.

The real STDERR is not closed -- it is moved to SAVEERR. Some servers, when dealing with CGI scripts, close their connection to the browser when the script closes STDOUT and STDERR. SAVEERR is used to prevent this from happening prematurely.

You can pass filehandles to carpout() in a variety of ways. The ``correct'' way according to Tom Christiansen is to pass a reference to a filehandle GLOB:

    carpout(\*LOG);

This looks weird to mere mortals however, so the following syntaxes are accepted as well:

    carpout(LOG);
carpout(main::LOG);
carpout(main'LOG);
carpout(\LOG);
carpout(\'main::LOG');

    ... and so on

FileHandle and other objects work as well.

Use of carpout() is not great for performance, so it is recommended for debugging purposes or for moderate-use applications. A future version of this module may delay redirecting STDERR until one of the CGI::Carp methods is called to prevent the performance hit.


MAKING PERL ERRORS APPEAR IN THE BROWSER WINDOW

If you want to send fatal (die, confess) errors to the browser, ask to import the special ``fatalsToBrowser'' subroutine:

    use CGI::Carp qw(fatalsToBrowser);
die "Bad error here";

Fatal errors will now be echoed to the browser as well as to the log. CGI::Carp arranges to send a minimal HTTP header to the browser so that even errors that occur in the early compile phase will be seen. Nonfatal errors will still be directed to the log file only (unless redirected with carpout).


By default, the software error message is followed by a note to contact the Webmaster by e-mail with the time and date of the error. If this message is not to your liking, you can change it using the set_message() routine. This is not imported by default; you should import it on the use() line:

    use CGI::Carp qw(fatalsToBrowser set_message);
set_message("It's not a bug, it's a feature!");

You may also pass in a code reference in order to create a custom error message. At run time, your code will be called with the text of the error message that caused the script to die. Example:

    use CGI::Carp qw(fatalsToBrowser set_message);
BEGIN {
sub handle_errors {
my $msg = shift;
print "<h1>Oh gosh</h1>";
print "Got an error: $msg";
}
set_message(\&handle_errors);
}

In order to correctly intercept compile-time errors, you should call set_message() from within a BEGIN{} block.


CHANGE LOG

1.05 carpout() added and minor corrections by Marc Hedlund <hedlund@best.com> on 11/26/95.

1.06 fatalsToBrowser() no longer aborts for fatal errors within eval() statements.

1.08 set_message() added and carpout() expanded to allow for FileHandle objects.

1.09 set_message() now allows users to pass a code REFERENCE for really custom error messages. croak and carp are now exported by default. Thanks to Gunther Birznieks for the patches.

1.10 Patch from Chris Dean (ctdean@cogit.com) to allow module to run correctly under mod_perl.


AUTHORS

Lincoln D. Stein <lstein@genome.wi.mit.edu> Feel free to redistribute this under the Perl Artistic License.


SEE ALSO

Carp, CGI::Base, CGI::BasePlus, CGI::Request, CGI::MiniSvr, CGI::Form, CGI::Response


DISCLAIMER

We are painfully aware that these documents may contain incorrect links and misformatted HTML. Such bugs lie in the automatic translation process that automatically created the hundreds and hundreds of separate documents that you find here. Please do not report link or formatting bugs, because we cannot fix per-document problems. The only bug reports that will help us are those that supply working patches to the installhtml or pod2html programs, or to the Pod::HTML module itself, for which I and the entire Perl community will shower you with thanks and praises.

If rather than formatting bugs, you encounter substantive content errors in these documents, such as mistakes in the explanations or code, please use the perlbug utility included with the Perl distribution.

--Tom Christiansen, Perl Documentation Compiler and Editor


Return to the Perl Documentation Index.
Return to the Perl Home Page.

pyguru 2005-02-18 05:27 鍙戣〃璇勮
]]>
Perl 5 by Examplehttp://m.tkk7.com/pyguru/archive/2005/02/18/1292.htmlpygurupyguruThu, 17 Feb 2005 19:56:00 GMThttp://m.tkk7.com/pyguru/archive/2005/02/18/1292.htmlhttp://m.tkk7.com/pyguru/comments/1292.htmlhttp://m.tkk7.com/pyguru/archive/2005/02/18/1292.html#Feedback0http://m.tkk7.com/pyguru/comments/commentRss/1292.htmlhttp://m.tkk7.com/pyguru/services/trackbacks/1292.html闃呰鍏ㄦ枃

pyguru 2005-02-18 03:56 鍙戣〃璇勮
]]>
Perl: The Carp Modulehttp://m.tkk7.com/pyguru/archive/2005/02/18/1291.htmlpygurupyguruThu, 17 Feb 2005 19:49:00 GMThttp://m.tkk7.com/pyguru/archive/2005/02/18/1291.htmlhttp://m.tkk7.com/pyguru/comments/1291.htmlhttp://m.tkk7.com/pyguru/archive/2005/02/18/1291.html#Feedback0http://m.tkk7.com/pyguru/comments/commentRss/1291.htmlhttp://m.tkk7.com/pyguru/services/trackbacks/1291.html Example: The Carp Module

This useful little module lets you do a better job of analyzing runtime errors-like when your script can't open a file or when an unexpected input value is found. It defines the carp(), croak(), and confess() fuNCtions. These are similar to warn() and die(). However, instead of reported in the exact script line where the error occurred, the fuNCtions in this module will display the line number that called the fuNCtion that generated the error. Confused? So was I, until I did some experimenting. The results of that experimenting can be found in Listing 15.6.

Load the Carp module.
Invoke the strict pragma.
Start the Foo namespace.
Define the
foo() fuNCtion.
Call the
carp() fuNCtion.
Call the
croak() fuNCtion.
Switch to the main namespace.
Call the
foo() fuNCtion.

Listing 15.6  15LST06.PL-Using the carp() and croak() from the Carp Module
use Carp;
use strict;

package Foo;
sub foo {
main::carp("carp called at line " . __LINE__ .
",\n but foo() was called");

main::croak("croak called at line " . __LINE__ .
",\n but foo() was called");
}

package main;
foo::foo();


This program displays:

carp called at line 9, 

but foo() was called at e.pl line 18

croak called at line 10,

but foo() was called at e.pl line 18

This example uses a compiler symbol, __LINE__, to iNCorporate the current line number in the string passed to both carp() and croak(). This technique enables you to see both the line number where carp() and croak() were called and the line number where foo() was called.

The Carp module also defines a confess() fuNCtion which is similar to croak() except that a fuNCtion call history will also be displayed. Listing 15.7 shows how this fuNCtion can be used. The fuNCtion declarations were placed after the foo() fuNCtion call so that the program flow reads from top to bottom with no jumping around.

Load the Carp module.
Invoke the strict pragma.
Call
foo().
Define
foo().
Call
bar().
Define
bar().
Call
baz().
Define
baz().
Call
Confess().

Listing 15.7  15LST07.PL-Using confess() from the Carp Module
use Carp;
use strict;

foo();

sub foo {
bar();
}

sub bar {
baz();
}

sub baz {
confess("I give up!");
}

This program displays:

I give up! at e.pl line 16

main::baz called at e.pl line 12

main::bar called at e.pl line 8

main::foo called at e.pl line 5

This daisy-chain of fuNCtion calls was done to show you how the fuNCtion call history looks when displayed. The fuNCtion call history is also called a stack trace. As each fuNCtion is called, the address from which it is called gets placed on a stack. When the confess() fuNCtion is called, the stack is unwound or read. This lets Perl print the fuNCtion call history.



pyguru 2005-02-18 03:49 鍙戣〃璇勮
]]>
Add RSS feeds to your Web site with Perl XML::RSShttp://m.tkk7.com/pyguru/archive/2005/02/17/1268.htmlpygurupyguruWed, 16 Feb 2005 19:04:00 GMThttp://m.tkk7.com/pyguru/archive/2005/02/17/1268.htmlhttp://m.tkk7.com/pyguru/comments/1268.htmlhttp://m.tkk7.com/pyguru/archive/2005/02/17/1268.html#Feedback0http://m.tkk7.com/pyguru/comments/commentRss/1268.htmlhttp://m.tkk7.com/pyguru/services/trackbacks/1268.html Guest Contributor, TechRepublic
December 22, 2004
URL: http://www.builderau.com.au/architect/webservices/0,39024590,39171461,00.htm


TechRepublic

Take advantage of the XML::RSS CPAN package, which is specifically designed to read and parse RSS feeds.

You've probably already heard of RSS, the XML-based format which allows Web sites to publish and syndicate the latest content on their site to all interested parties. RSS is a boon to the lazy Webmaster, because (s)he no longer has to manually update his or her Web site with new content.

Instead, all a Webmaster has to do is plug in an RSS client, point it to the appropriate Web sites, and sit back and let the site "update itself" with news, weather forecasts, stock market data, and software alerts. You've already seen, in previous articles, how you can use the ASP.NET platform to manually parse an RSS feed and extract information from it by searching for the appropriate elements. But I'm a UNIX guy, and I have something that's even better than ASP.NET. It's called Perl.

Installing XML::RSS
RSS parsing in Perl is usually handled by the XML::RSS CPAN package. Unlike ASP.NET, which comes with a generic XML parser and expects you to manually write RSS-parsing code, the XML::RSS package is specifically designed to read and parse RSS feeds. When you give XML::RSS an RSS feed, it converts the various <item>s in the feed into array elements, and exposes numerous methods and properties to access the data in the feed. XML::RSS currently supports versions 0.9, 0.91, and 1.0 of RSS.

Written entirely in Perl, XML::RSS isn't included with Perl by default, and you must install it from CPAN. Detailed installation instructions are provided in the download archive, but by far the simplest way to install it is to use the CPAN shell, as follows:

shell> perl -MCPAN -e shell
cpan> install XML::RSS

If you use the CPAN shell, dependencies will be automatically downloaded for you (unless you told the shell not to download dependent modules). If you manually download and install the module, you may need to download and install the XML::Parser module before XML::RSS can be installed. The examples in this tutorial also need the LWP::Simple package, so you should download and install that one too if you don't already have it.

Basic usage
For our example, we'll assume that you're interested in displaying the latest geek news from Slashdot on your site. The URL for Slashdot's RSS feed is located here. The script in Listing A retrieves this feed, parses it, and turns it into a human-readable HTML page using XML::RSS:

Listing A

#!/usr/bin/perl

# import packages
use XML::RSS;
use LWP::Simple;

# initialize object
$rss = new XML::RSS();

# get RSS data
$raw = get('http://www.slashdot.org/index.rss');

# parse RSS feed
$rss->parse($raw);

# print HTML header and page
print "Content-Type: text/html\n\n";
print ""; print ""; print "";
print "";
print "
" . $rss->channel('title') . "
"; # print titles and URLs of news items foreach my $item (@{$rss->{'items'}}) { $title = $item->{'title'}; $url = $item->{'link'}; print "$title

"; } # print footers print "

";
print "";

Place the script in your Web server's cgi-bin/ directory/. Remember to make it executable, and then browse to it using your Web browser. After a short wait for the RSS file to download, you should see something like Figure A.

Figure A


Slashdot RSS feed

How does the script in Listing A work? Well, the first task is to get the RSS feed from the remote system to the local one. This is accomplished with the LWP::Simple package, which simulates an HTTP client and opens up a network connection to the remote site to retrieve the RSS data. An XML::RSS object is created, and this raw data is then passed to it for processing.

The various elements of the RSS feed are converted into Perl structures, and a foreach() loop is used to iterate over the array of items. Each item contains properties representing the item name, URL and description; these properties are used to dynamically build a readable list of news items. Each time Slashdot updates its RSS feed, the list of items displayed by the script above will change automatically, with no manual intervention required.

The script in Listing A will work with other RSS feeds as well鈥攕imply alter the URL passed to the LWP's get() method, and watch as the list of items displayed by the script changes.


Here are some RSS feeds to get you started

Tip: Notice that the RSS channel name (and description) can be obtained with the object's channel() method, which accepts any one of three arguments (title, description or link) and returns the corresponding channel value.


Adding multiple sources and optimising performance
So that takes care of adding a feed to your Web site. But hey, why limit yourself to one when you can have many? Listing B, a revision of the Listing A, sets up an array containing the names of many different RSS feeds, and iterates over the array to produce a page containing multiple channels of information.

Listing B

#!/usr/bin/perl

# import packages
use XML::RSS;
use LWP::Simple;

# initialize object
$rss = new XML::RSS();

# get RSS data
$raw = get('http://www.slashdot.org/index.rss');

# parse RSS feed
$rss->parse($raw);

# print HTML header and page
print "Content-Type: text/html\n\n";
print ""; print ""; print "";
print "";
print "
" . $rss->channel('title') . "
"; # print titles and URLs of news items foreach my $item (@{$rss->{'items'}}) { $title = $item->{'title'}; $url = $item->{'link'}; print "$title

"; } # print footers print "

";
print "";

Figure B shows you what it looks like.

Figure B


Several RSS feeds

You'll notice, if you're sharp-eyed, that Listing B uses the parsefile() method to read a local version of the RSS file, instead of using LWP to retrieve it from the remote site. This revision results in improved performance, because it does away with the need to generate an internal request for the RSS data source every time the script is executed. Fetching the RSS file on each script run not only causes things to go slow (because of the time taken to fetch the RSS file), but it's also inefficient; it's unlikely that the source RSS file will change on a minute-by-minute basis, and by fetching the same data over and over again, you're simply wasting bandwidth. A better solution is to retrieve the RSS data source once, save it to a local file, and use that local file to generate your page.

Depending on how often the source file gets updated, you can write a simple shell script to download a fresh copy of the file on a regular basis.

Here's an example of such a script:

#!/bin/bash
/bin/wget http://www.freshmeat.net/backend/fm.rdf -O freshmeat.rdf

This script uses the wget utility (included with most Linux distributions) to download and save the RSS file to disk. Add this to your system crontab, and set it to run on an hourly or daily basis.

If you find performance unacceptably low even after using local copies of RSS files, you can take things a step further, by generating a static HTML snapshot from the script above, and sending that to clients instead. To do this, comment out the line printing the "Content-Type" header in the script above and then run the script from the console, redirecting the output to an HTML file. Here's how:

$ ./rss.cgi > static.html

Now, simply serve this HTML file to your users. Since the file is a static file and not a script, no server-side processing takes place before the server transmits it to the client. You can run the command-line above from your crontab to regenerate the HTML file on a regular basis. Performance with a static file should be noticeably better than with a Perl script.

Looks easy? What are you waiting for鈥攇et out there and start hooking your site up to your favorite RSS news feeds.



pyguru 2005-02-17 03:04 鍙戣〃璇勮
]]>
Lilina錛歊SS鑱氬悎鍣ㄦ瀯寤轟釜浜洪棬鎴?Write once, publish anywhere)http://m.tkk7.com/pyguru/archive/2005/02/17/1267.htmlpygurupyguruWed, 16 Feb 2005 19:00:00 GMThttp://m.tkk7.com/pyguru/archive/2005/02/17/1267.htmlhttp://m.tkk7.com/pyguru/comments/1267.htmlhttp://m.tkk7.com/pyguru/archive/2005/02/17/1267.html#Feedback0http://m.tkk7.com/pyguru/comments/commentRss/1267.htmlhttp://m.tkk7.com/pyguru/services/trackbacks/1267.htmlLilina錛?b style="color: black; background-color: rgb(160, 255, 255);">RSS鑱氬悎鍣ㄦ瀯寤轟釜浜洪棬鎴?Write once, publish anywhere)

鏈榪戞悳闆?b style="color: black; background-color: rgb(160, 255, 255);">RSS瑙f瀽宸ュ叿涓壘鍒頒簡MagPieRSS 鍜屽熀浜庡叾璁捐鐨?a >Lilina錛汱ilina鐨勪富瑕佸姛鑳斤細(xì)

1 鍩轟簬WEB鐣岄潰鐨?b style="color: black; background-color: rgb(160, 255, 255);">RSS綆$悊錛氭坊鍔狅紝鍒犻櫎錛孫PML瀵煎嚭錛?b style="color: black; background-color: rgb(160, 255, 255);">RSS鍚庡彴緙撳瓨鏈哄埗錛堥伩鍏嶅鏁版嵁婧愭湇鍔″櫒浜х敓榪囧ぇ鍘嬪姏錛夛紝ScriptLet: 綾諱技浜嶥el.icio.us it鐨勬敹钘忓す鍗蟲椂璁㈤槄JS鑴氭湰錛?/p>

2 鍓嶅彴鍙戝竷錛氬皢鑷繁鐨勯欏墊敼鎴愪簡鐢↙ilina鍙戝竷鎴戝父鐪嬬殑鍑犱釜鏈嬪弸鐨勭綉蹇楋紝涔熺渷鍘諱簡寰堝鏇存柊鑷繁緗戦〉鐨勫伐浣滐紝闇瑕?strong>php 4.3 + mbstring iconv
lilina.png
寮婧愯蔣浠跺i18n鐨勬敮鎸佽秺鏉ヨ秺濂戒簡錛宲hp 4.3.x錛?--enable-mbstring' '--with-iconv'鍚庢瘮杈冨ソ鐨勫悓鏃跺鐞嗕簡UTF-8鍜屽叾浠栦腑鏂囧瓧絎﹂泦鍙戝竷鐨?b style="color: black; background-color: rgb(160, 255, 255);">RSS銆?br> 闇瑕佹劅璋teve鍦≒HP榪涜杞爜鏂歸潰瀵?a >MagPieRSS榪涜鍜孹ML Hacking宸ヤ綔銆傝嚦灝戠洰鍓嶄負(fù)姝細(xì)Add to my yahoo榪樹笉鑳藉緢濂界殑澶勭悊utf-8瀛楃闆嗙殑RSS鏀惰棌銆?/p>

璁板緱騫村垵Wen Xin鍦–NBlog鐨勭爺璁ㄤ細(xì)涓婁粙緇嶄簡涓漢闂ㄦ埛鐨勬蹇碉紝闅忕潃RSS鍦–MS鎶鏈腑鐨勬垚鐔燂紝瓚婃潵瓚婂鐨勬湇鍔″彲浠ヨ涓漢鐢ㄦ埛鏍規(guī)嵁鑷繁闇姹傛瀯寤洪棬鎴鳳紝涔熺畻鏄鍚堜簡浜掕仈緗戠殑闈炰腑蹇冨寲瓚嬪娍鍚э紝姣斿鍒╃敤Add to My Yahoo!鍔熻兘錛岀敤鎴峰彲浠ヨ交鏉劇殑瀹炵幇鑷繁浠庢洿澶氭暟鎹簮榪涜鏂伴椈璁㈤槄銆傛兂璞′竴涓嬫妸浣犺嚜宸辯殑del.icio.us涔︾鏀惰棌 / flickr鍥劇墖鏀惰棌 / Yahoo!鏂伴椈閮介氳繃榪欐牱涓涓?b style="color: black; background-color: rgb(160, 255, 255);">RSS鑱氬悎鍣ㄨ仛鍚?鍙戝竷璧鋒潵銆傚叾浼犳挱鏁堢巼灝嗘湁澶氬揩銆?/p>

濂芥瘮杞歡寮鍙戦氳繃涓棿騫沖彴/铏氭嫙鏈哄疄鐜幫細(xì)涓嬈″啓鎴愶紝闅忓榪愯錛圵rite once, run anywhere錛夛紝閫氳繃RSS/XML榪欎釜涓棿灞傦紝淇℃伅鍙戝竷涔熷疄鐜頒簡錛氫竴嬈″啓鎴愶紝闅忓鍙戝竷錛圵rite once, publish anywhere...錛?/p>

瀹夎Lilina闇瑕丳HP 4.3 浠ヤ笂錛屽茍甯︽湁iconv mbstring絳夊嚱鏁扮殑鏀寔錛岃紜涓涓?a --with-iconv'

鍙﹀灝辨槸涓涓渶瑕佽兘閫氳繃鏈嶅姟鍣ㄧ鍚戝閮ㄦ湇鍔″櫒鍙戦丷PC璇鋒眰錛岃繖鐐?1.NET涓嶆敮鎸併傛劅瑙?a >PowWeb鐨勬湇鍔?/a>寰堜笉閿欙紝寰堝緙虹渷鐨勫寘閮藉畨瑁呭ソ浜嗭細(xì)

iconv
iconv support enabled
iconv implementation unknown
iconv library version unknown

Directive Local Value Master Value
iconv.input_encoding ISO-8859-1 ISO-8859-1
iconv.internal_encoding ISO-8859-1 ISO-8859-1
iconv.output_encoding ISO-8859-1 ISO-8859-1

mbstring
Multibyte Support enabled
Japanese support enabled
Simplified chinese support enabled
Traditional chinese support enabled
Korean support enabled
Russian support enabled
Multibyte (japanese) regex support enabled

灝嗗畨瑁呭寘瑙e寘錛堜笅杞芥枃浠舵墿灞曞悕鏄?gz 鍏跺疄鏄?tgz錛岄渶瑕侀噸鍛藉悕涓涓嬶級錛氫笂浼犲埌鏈嶅姟鍣ㄧ浉搴旂洰褰曚笅錛屾敞鎰忥細(xì)鐩稿簲cache鐩綍鍜屽綋鍓嶇洰褰曠殑鍙啓鍏ュ睘鎬ц緗紝鐒跺悗閰嶇疆涓涓媍onf.php涓殑鍙傛暟鍗沖彲寮濮嬩嬌鐢ㄣ?/p>

浣曚笢緇欐垜鐨勫緩璁細(xì)
1錛夊彸杈圭殑涓鏍忥紝絎竴欏圭殑sources鏈濂借窡hobby銆佸弸鎯呴摼鎺ヤ竴鏍鳳紝鍔犱釜鍥劇墖銆?br> 2錛変竴鍫嗘绱㈡鍦ㄩ偅鍎匡紝鏈変簺涔憋紝寤鴻鍙湁涓涓紝鍏跺畠鐨勬斁鍒頒竴涓簩綰ч〉闈笂銆?br> 3錛夋妸鑱旂郴鏂瑰紡鍙奵c,鍒嗗埆鍋氭垚涓鏉℃垨涓涓浘鐗囷紝鏀懼湪鍙寵竟涓鏍忎腑錛屽叿浣撶殑鍐呭鍙互鏀懼埌浜岀駭欏甸潰涓婏紝鍥犱負(fù)鎴戣寰楀ソ璞℃病鏈夊灝戜漢浼?xì)缁嗚杩欎簺鏂囧瓧銆?br> 4錛夊鏋滃彲鑳斤紝鎶妉ilina鐨勫ご閮ㄩ摼鎺ユ眽鍖栦竴涓嬪惂錛?/p>

涓浜涙敼榪涜鍒掞細(xì)
1 鍒犻櫎榪囬暱鐨勬憳瑕侊紝鍙互閫氳繃瀵繪壘絎?涓?

" 瀹炵幇錛?br> 2 鍒嗙粍鍔熻兘錛氬皢RSS榪涜緇勮緭鍑猴紱

淇敼榛樿鏄劇ず瀹炵幇錛歀ilina緙虹渷鏄劇ず鏈榪?澶╁彂琛ㄧ殑鏂囩珷錛屽鏋滈渶瑕佹敼鎴愬叾浠栨椂闂村懆鏈熷彲浠ユ壘鍒幫細(xì)
$TIMERANGE = ( $_REQUEST['hours'] ? $_REQUEST['hours']*3600 : 3600*24 ) ;

榪涜鏀瑰姩銆?/p>

RSS鏄竴涓兘灝嗚嚜宸辯殑鎵鏈夎祫婧愶細(xì)WIKI / BLOG / 閭歡鑱氬悎璧鋒潵鐨勮交閲忕駭鍗忚錛屼互鍚庢棤璁轟綘鍦ㄤ綍澶勪功鍐欙紝鍙鏈?b style="color: black; background-color: rgb(160, 255, 255);">RSS鎺ュ彛灝遍兘鍙互閫氳繃涓瀹氭柟寮忚繘琛屽啀嬈$殑姹囪仛鍜屽彂甯冭搗鏉ワ紝浠庤屽ぇ澶ф彁楂樹簡涓漢鐭ヨ瘑綆$悊鍜屽彂甯?浼犳挱鏁堢巼銆?/p>

浠ュ墠瀵?b style="color: black; background-color: rgb(160, 255, 255);">RSS鐞嗚В闈炲父嫻咃細(xì)涓嶅氨鏄竴涓狣TD鍢涳紝鐪熶簡瑙h搗瑙f瀽鍣ㄦ潵錛屾墠鐭ラ亾namespace鐨勯噸瑕佹э紝涓涓ソ鐨勫崗璁篃搴旇鏄繖鏍風(fēng)殑錛氬茍闈炴病鏈変粈涔堝彲鍔犵殑錛屼絾鑲畾鏄病鏈変粈涔堝彲鈥滃噺鈥濈殑浜嗭紝鑰岀湡鐨勮鍋氬埌榪欎釜鍏跺疄寰堥毦寰堥毦鈥︹︺?/p>

鎴戜細(xì)鍐嶅皾璇曚竴涓婮AVA鐨勭浉鍏寵В鏋愬櫒錛屽皢鍏舵墿灞曞埌WebLucene欏圭洰涓紝鏇村Java鐩稿叧Open Source RSS瑙f瀽鍣ㄨ祫婧?/a>銆?/p>

鍙﹀鎵懼埌鐨?涓嬌鐢?b style="color: black; background-color: rgb(255, 255, 102);">Perl榪涜RSS瑙f瀽鐨勫寘錛?br> 浣跨敤XML::RSS::Parser::Lite鍜?a >XML::RSS::Parser 瑙f瀽RSS

XML::RSS::Parser::Lite鐨勪唬鐮佹牱渚嬪涓嬶細(xì)

#!/usr/bin/perl -w
# $Id$
# XML::RSS::Parser::Lite sample

use strict;
use XML::RSS::Parser::Lite;
use LWP::Simple;


my $xml = get("http://www.klogs.org/index.xml");
my $rp = new XML::RSS::Parser::Lite;
$rp->parse($xml);

# print blog header
print "<a href=\"".$rp->get('url')."\">" . $rp->get('title') . " - " . $rp->get('description') . "</a>\n";

# convert item to <li>
print "<ul>";
for (my $i = 0; $i < $rp->count(); $i++) {
my $it = $rp->get($i);
print "<li><a href=\"" . $it->get('url') . "\">" . $it->get('title') . "</a></li>\n";
}
print "</ul>";

瀹夎錛?br> 闇瑕丼OAP-Lite

浼樼偣錛?br> 鏂規(guī)硶綆鍗曪紝鏀寔榪滅▼鎶撳彇錛?/p>

緙虹偣錛?br> 鍙敮鎸乼itle, url, description榪?涓瓧孌碉紝涓嶆敮鎸佹椂闂村瓧孌碉紝

璁″垝鐢ㄤ簬綆鍗曠殑鎶撳彇RSS鍚屾鏈嶅姟璁捐錛氭瘡涓漢閮藉彲浠ュ嚭鐗堣嚜宸辮闃呯殑RSS銆?/p>


XML::RSS::Parser浠g爜鏍蜂緥濡備笅錛?br> #!/usr/bin/perl -w
# $Id$
# XML::RSS::Parser sample with Iconv charset convert

use strict;
use XML::RSS::Parser;
use Text::Iconv;
my $converter = Text::Iconv->new("utf-8", "gbk");


my $p = new XML::RSS::Parser;
my $feed = $p->parsefile('index.xml');

# output some values
my $title = XML::RSS::Parser->ns_qualify('title',$feed->rss_namespace_uri);
# may cause error this line: print $feed->channel->children($title)->value."\n";
print "item count: ".$feed->item_count()."\n\n";
foreach my $i ( $feed->items ) {
map { print $_->name.": ".$converter->convert($_->value)."\n" } $i->children;
print "\n";
}

浼樼偣錛?br> 鑳藉鐩存帴灝嗘暟鎹寜瀛楁杈撳嚭錛屾彁渚涙洿搴曞眰鐨勭晫闈紱

緙虹偣錛?br> 涓嶈兘鐩存帴瑙f瀽榪滅▼RSS錛岄渶瑕佷笅杞藉悗鍐嶈В鏋愶紱

2004-12-14:
浠巆nblog鐨凾rackback涓簡瑙e埌浜?a >Planet RSS鑱氬悎鍣?/a>

Planet鐨勫畨瑁咃細(xì)瑙e寘鍚庯紝鐩存帴鍦ㄧ洰褰曚笅榪愯錛歱ython planet.py examples/config.ini 灝卞彲浠ュ湪output鐩綍涓湅鍒扮己鐪佹牱渚婩EED涓殑杈撳嚭浜唅ndex.html錛屽彟澶栬繕鏈塷pml.xml鍜?b style="color: black; background-color: rgb(160, 255, 255);">rss.xml絳夎緭鍑猴紙榪欑偣姣旇緝濂斤級

鎴戠敤鍑犱釜RSS璇曚簡涓涓嬶紝UTF-8鐨勬病鏈夐棶棰橈紝浣嗘槸GBK鐨勫叏閮ㄩ兘涔辯爜浜嗭紝planetlib.py涓拰XML瀛楃闆嗗鐞嗙殑鍙湁浠ヤ笅浠g爜錛氱湅鏉ユ墍鏈夌殑闈濽TF-8閮借褰撲綔iso8859_1澶勭悊浜嗭細(xì)
try:
data = unicode(data, "utf8").encode("utf8")
logging.debug("Encoding: UTF-8")
except UnicodeError:
try:
data = unicode(data, "iso8859_1").encode("utf8")
logging.debug("Encoding: ISO-8859-1")
except UnicodeError:
data = unicode(data, "ascii", "replace").encode("utf8")
logging.warn("Feed wasn't in UTF-8 or ISO-8859-1, replaced " +
"all non-ASCII characters.")

榪戞湡瀛︿範(fàn)涓涓婸ython鐨剈nicode澶勭悊錛屾劅瑙夋槸涓涓緢綆媧佺殑璇█錛屾湁姣旇緝濂界殑try ... catch 鏈哄埗鍜宭ogging

鍏充簬MagPieRSS鎬ц兘闂鐨勭枒铏戯細(xì)
瀵逛簬Planet鍜孧agPieRSS鎬ц兘鐨勪富瑕佸樊寮傚湪鏄紦瀛樻満鍒朵笂錛屽叧浜庝嬌鐢ㄧ紦瀛樻満鍒跺姞閫焀EB鏈嶅姟鍙互鍙傝冿細(xì)鍙紦瀛樼殑cms璁捐銆?/p>

鍙互鐪嬪埌錛歀ilina鐨勭紦瀛樻満鍒舵槸姣忔璇鋒眰鐨勬椂鍊欓亶鍘嗙紦瀛樼洰褰曚笅鐨?b style="color: black; background-color: rgb(160, 255, 255);">RSS鏂囦歡錛屽鏋滅紦瀛樻枃浠惰繃鏈燂紝榪樿鍔ㄦ佸悜RSS鏁版嵁婧愯繘琛岃姹傘傚洜姝や笉鑳芥敮鎸佸悗鍙板お澶氱殑RSS璁㈤槄鍜屽墠绔ぇ閲忕殑騫跺彂璁塊棶錛堜細(xì)閫犳垚寰堝鐨処/O鎿嶄綔錛夈?/p>

Planet鏄竴涓悗鍙拌剼鏈紝閫氳繃鑴氭湰灝嗚闃呯殑RSS瀹氭湡姹囪仛鎴愪竴涓枃浠惰緭鍑烘垚闈欐佹枃浠躲?/p>

鍏跺疄鍙鍦∕agPieRSS鍓嶇澧炲姞涓涓獁get鑴氭湰瀹氭湡灝唅ndex.php鐨勬暟鎹緭鍑烘垚index.html錛岀劧鍚庤姹傛瘡嬈¤闂厛璁塊棶index.html緙撳瓨錛岃繖鏍蜂笉灝卞拰Planet鐨勬瘡灝忔椂鐢熸垚index.html闈欐佺紦瀛樹竴鏍蜂簡鍚椼?/p>

鎵浠ュ湪涓嶅厑璁歌嚜宸遍厤緗湇鍔″櫒鑴氭湰鐨勮櫄鎷熶富鏈烘潵璇碢lanet鏍規(guī)湰鏄棤娉曡繍琛岀殑銆?/p>

鏇村鍏充簬PHP涓鐞咷BK鐨刋ML瑙f瀽闂璇峰弬鑰冿細(xì)
MagPieRSS涓璘TF-8鍜孏BK鐨?b style="color: black; background-color: rgb(160, 255, 255);">RSS瑙f瀽鍒嗘瀽

2004-12-19
姝e鍦⊿ocialBrain 2005騫寸殑璁ㄨ浼?xì)涓Q孖saac Mao鎵璇達(dá)細(xì)Blog is a 'Window', also could be a 'Bridge'錛孊log鏄釜浜?緇勭粐瀵瑰鐨勨滅獥鍙b濓紝鑰?b style="color: black; background-color: rgb(160, 255, 255);">RSS鏇存柟渚夸綘灝嗚繖浜涚獥鍙g粍鍚堣搗鏉ワ紝鎴愪負(fù)鍏墮棿鐨勨滄ˉ姊佲濓紝鏈変簡榪欐牱鐨勪腑闂村彂甯冨眰錛孊log涓嶄粎浠庡崟鐐瑰彂甯冿紝鏇村埌P2P鑷姪浼犳挱錛岃秺鏉ヨ秺鐪嬪埌浜?b style="color: black; background-color: rgb(160, 255, 255);">RSS鍦ㄧ綉緇滀紶鎾笂鐨勯噸瑕佹с?/p>

Posted by chedong at December 11, 2004 12:34 AM Edit
Last Modified at December 19, 2004 04:40 PM

Trackback Pings

TrackBack URL for this entry:
http://www.chedong.com/cgi-bin/mt3/mt-tb.cgi/27

Listed below are links to weblogs that reference Lilina錛?b style="color: black; background-color: rgb(160, 255, 255);">RSS鑱氬悎鍣ㄦ瀯寤轟釜浜洪棬鎴?Write once, publish anywhere):

祿 MagPieRSS涓璘TF-8鍜孏BK鐨?b style="color: black; background-color: rgb(160, 255, 255);">RSS瑙f瀽鍒嗘瀽錛堥檮錛歱hp涓殑闈㈠悜瀛楃緙栫▼璇﹁В錛?/a> from 杞︿笢BLOG
絎竴嬈″皾璇昅agpieRSS錛屽洜涓烘病鏈夊畨瑁卛conv鍜宮bstring錛屾墍浠ュけ璐ヤ簡錛屼粖澶╁湪鏈嶅姟鍣ㄤ笂瀹夎浜唅conv鍜宮tstring鐨勬敮鎸侊紝鎴戜粖澶╀粩緇嗙湅浜嗕竴涓媗ilina涓殑rss_fetch鐨勭敤娉曪細(xì)鏈閲嶈鐨勬槸鍒跺畾RSS鐨勮緭鍑烘牸寮忎負(fù)'MAGPIE_OU...
[Read More]

Tracked on December 19, 2004 12:37 AM

祿 鐢?lilina 鍜?blogline 鏉ョ湅 blog from Philharmania's Weblog
鐪嬪埌涓綃?a rel="nofollow">浠嬬粛 lilina 鐨勬枃绔?/a>鍚庡氨鑷繁瀹夎浜嗕竴涓?/a>璇曚簡涓嬨?a rel="nofollow">lilina 鏄竴涓敤 PHP 璇?[Read More]

Tracked on December 26, 2004 01:57 PM

祿 CNBlog浣滆呯兢RSS寰侀泦涓?/a> from CNBlog: Blog on Blog
鍦–NBLOG涓婃惌寤轟簡
Lilina RSS鑱氬悎鍣?/a>錛岃鍚勪綅蹇楁効鑰呭皢鍚勮嚜緗戝織鎴栬呭拰涓巆nblog鐩稿叧涓撴爮鐨?b style="color: black; background-color: rgb(160, 255, 255);">RSS鎻愪氦緇欐垜 鈥?鐩存帴鍦ㄨ瘎璁轟腑鍥炲鍗沖彲銆? 鎺ㄥ箍浣跨敤RSS鑱氬悎宸ュ叿涓昏鐨勭洰鐨? . [Read More]

Tracked on December 26, 2004 07:42 PM

祿 鍏充簬鍔犲揩 lilina 鏄劇ず閫熷害鐨勪竴浜涜緗?/a> from Kreny's Blog
鎴戠殑 lilina 鍦ㄨ瀹氫簡鍑犱綅鏈嬪弸鐨?blog 鍜屼竴浜?news 浠ュ悗錛屽彂鐜版墦寮閫熷害寮傚父鐨勬參錛屼簬鏄鏁欎簡杞︿笢錛岃В鍐充簡闂銆? 瑙e喅鐨勫叧閿湪浜庯細(xì)

鐩存帴灝嗕互涓嬭鍙ュ姞鍏ュ埌 index.php 澶撮儴鍗沖彲錛孡ILINA涓綘 .
[Read More]

Tracked on January 14, 2005 06:14 PM

祿 MT鐨勬ā鏉夸慨鏀瑰拰鐣岄潰鐨偆璁劇疆 from 杞︿笢BLOG
鍒嗙被绱㈠紩錛?棣栭〉緙虹渷鏈夋寜鏈堝綊妗g殑绱㈠紩錛屾病鏈夊垎綾葷洰褰曠殑绱㈠紩錛岀湅浜嗘墜鍐岄噷闈篃娌℃湁鍏蜂綋鐨勫弬鏁板畾涔夛紝鍙ソ鐩存帴鐪婼OURCE錛氬皾璇曠潃鎶奙onthly鏀規(guī)垚Category錛屽眳鐒舵垚浜?:-) 榪樺埌浜哅ovable Style鐨凪T鏍峰紡绔欙紝... [Read More]

Tracked on January 17, 2005 01:25 PM

Comments

璇烽棶濡傛灉鏇存敼榛樿鏄劇ず7澶╃殑鏂伴椈錛岃阿璋€?/p>

Posted by: honren at December 12, 2004 10:20 PM

鎴戜嬌鐢╨ilina宸茬粡涓孌墊椂闂翠簡銆?br> http://news.yanfeng.org
紼嶅井鏀逛簡涓鐐筓I銆?br> 濡傛灉浣犺兘鏀硅繘瀹冿紝閭e氨濂戒簡銆?/p>

Posted by: mulberry at December 13, 2004 09:24 AM

鑰佽濺鍚屽織錛屾病瑙夊緱浣犱嬌鐢╨ilina浠ユ潵錛屼富欏電殑璁塊棶閫熷害鍏鋒參鍚楋紵鏀懼純鍚э紝鑷沖皯娌″繀瑕佸綋浣滈欏碉紝lilina榪樺湪鎶鏈繕涓嶆垚鐔焋~

Posted by: kalen at December 16, 2004 10:33 AM

鍙互鑰冭檻涓涓嬬敤drupal

Posted by: shunz at December 28, 2004 06:46 PM

鍙互璇曡瘯鎴戝仛鐨勶細(xì)http://blog.terac.com

姣?灝忔椂鎶撳彇blog,鐒跺悗姣忎釜閫?鏉℃渶鏂扮殑錛屾帓搴忥紝鑱氬悎錛岀敓鎴愰潤鎬亁ml錛岀敤xsl鏍煎紡鍖栨樉紺恒傘傘?/p>

Posted by: andy at January 6, 2005 12:53 PM

杞︿笢鍚屽織錛岃繖鏍峰仛涓嶅ソ錛歅
rss鏈潵灝卞湪緗戜笂錛屼綘鑱氬悎瀹冨湪浣犵殑緗戦〉涓婁笉浠呮崯瀹充簡浣犺嚜宸變富欏電殑璐ㄩ噺錛岃屼笖榪鋒儜浜嗘悳绱㈠紩鎿庯紝閫犳垚浣犵棝鏂ョ殑鈥滈棬鎴風(fēng)綉绔欐崯瀹沖垱浣滅儹鎯呪濈殑鏁堟灉銆傝繕鏄笉瑕佽仛鍚堢殑濂斤紒



pyguru 2005-02-17 03:00 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 亚洲AV日韩精品一区二区三区| 鲁大师在线影院免费观看| 黄页网站在线视频免费| 国产精品亚洲专区无码牛牛| 久久亚洲精品无码gv| 免费成人黄色大片| 性做久久久久免费看| 欧洲精品免费一区二区三区| 女性无套免费网站在线看| 一个人免费高清在线观看| 欧洲精品成人免费视频在线观看 | 亚洲欧洲无码AV不卡在线| 中文字幕无码亚洲欧洲日韩| 亚洲成a人无码亚洲成www牛牛| 亚洲成AV人片高潮喷水| 国产精品亚洲精品爽爽| v片免费在线观看| a级毛片100部免费观看| 91在线老王精品免费播放| 日本妇人成熟免费中文字幕| 妞干网在线免费观看| 国产成人精品免费视频软件| 亚洲人成影院在线观看| 精品亚洲综合久久中文字幕| 亚洲综合在线观看视频| 亚洲无人区码一二三码区别图片 | 亚洲国产精品无码AAA片| 亚洲一区二区在线视频| 亚洲国产精品综合久久2007| 亚洲性色精品一区二区在线| 色哟哟国产精品免费观看| 中文字幕视频在线免费观看| 182tv免费视视频线路一二三| 大学生一级特黄的免费大片视频| 免费在线观看日韩| 亚洲精品无码乱码成人| 亚洲一区二区三区在线观看蜜桃| 亚洲AV无码国产一区二区三区| 国产一级a毛一级a看免费视频 | 一个人晚上在线观看的免费视频| 久草免费福利资源站|