﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-我希望你是我独家记忆</title><link>http://www.cppblog.com/Hero/</link><description> 一段永远封存的记忆，随风而去</description><language>zh-cn</language><lastBuildDate>Thu, 23 Apr 2026 04:09:50 GMT</lastBuildDate><pubDate>Thu, 23 Apr 2026 04:09:50 GMT</pubDate><ttl>60</ttl><item><title>【大数据】资源数据获取</title><link>http://www.cppblog.com/Hero/archive/2016/04/14/213279.html</link><dc:creator>Hero</dc:creator><author>Hero</author><pubDate>Thu, 14 Apr 2016 07:45:00 GMT</pubDate><guid>http://www.cppblog.com/Hero/archive/2016/04/14/213279.html</guid><wfw:comment>http://www.cppblog.com/Hero/comments/213279.html</wfw:comment><comments>http://www.cppblog.com/Hero/archive/2016/04/14/213279.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Hero/comments/commentRss/213279.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Hero/services/trackbacks/213279.html</trackback:ping><description><![CDATA[<a href="http://www.quora.com/_/redirect?url=http%3A%2F%2FJunar.com&amp;sig=d3f00d" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">Junar.com</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Farchive.ics.uci.edu%2Fml%2F&amp;sig=6dbd38" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://archive.ics.uci.ed<wbr>u/ml/</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Faws.amazon.com%2Fdatasets%3F_encoding%3DUTF8%26jiveRedirect%3D1&amp;sig=e67cf8" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://aws.amazon.com/dat<wbr>asets?_...</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fcrawdad.org%2F&amp;sig=ba921e" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://crawdad.org/</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fplatform.newscred.com&amp;sig=5fca3b" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://platform.newscred.<wbr>com</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fdata.cityofchicago.org&amp;sig=f9f531" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://data.cityofchicago<wbr>.org</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fdata.govloop.com&amp;sig=b998b1" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://data.govloop.com</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fdata.gov.uk%2F&amp;sig=eba0e8" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://data.gov.uk/</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fdata.medicare.gov&amp;sig=e155ab" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://data.medicare.gov</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fdata.seattle.gov&amp;sig=d42066" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://data.seattle.gov</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fdata.sunlightlabs.com&amp;sig=06d344" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://data.sunlightlabs.<wbr>com</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fdeveloper.yahoo.com%2Fgeo%2Fgeoplanet%2Fdata%2F&amp;sig=8514c7" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://developer.yahoo.co<wbr>m/geo/g...</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fecon.worldbank.org%2Fdatasets&amp;sig=d27ab8" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://econ.worldbank.org<wbr>/datasets</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FWikipedia%3ADatabase_download&amp;sig=dd51ee" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://en.wikipedia.org/w<wbr>iki/Wik...</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Ffactfinder.census.gov%2Fservlet%2FDatasetMainPageServlet&amp;sig=ff0d76" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://factfinder.census.<wbr>gov/ser...</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fftp.ncbi.nih.gov%2F&amp;sig=4c8391" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://ftp.ncbi.nih.gov/</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fgettingpastgo.socrata.com&amp;sig=8a7619" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://gettingpastgo.socr<wbr>ata.com</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fgoogleresearch.blogspot.com%2F2006%2F08%2Fall-our-n-gram-are-belong-to-you.html&amp;sig=ef02f5" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://googleresearch.blo<wbr>gspot.c...</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fwww.kasabi.com&amp;sig=c71556" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://www.kasabi.com</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Flinkeddata.org%2F&amp;sig=396844" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://linkeddata.org/</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fmedihal.archives-ouvertes.fr&amp;sig=7e309f" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://medihal.archives-o<wbr>uvertes.fr</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fngrams.googlelabs.com%2F&amp;sig=012af8" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://ngrams.googlelabs.<wbr>com/</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fpublic.resource.org%2F&amp;sig=3d4d91" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://public.resource.or<wbr>g/</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Frechercheisidore.fr&amp;sig=1ff4b8" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://rechercheisidore.f<wbr>r</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Freddit.com%2Fr%2Fdatasets&amp;sig=e8146d" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://reddit.com/r/datas<wbr>ets</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=https%3A%2F%2Fdatamarket.azure.com%2F&amp;sig=c58a53" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">https://datamarket.azure.<wbr>com/</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fsnap.stanford.edu%2Fdata%2Findex.html&amp;sig=d755a3" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://snap.stanford.edu/<wbr>data/in...</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Ftimetric.com%2Fpublic-data%2F&amp;sig=0228fc" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://timetric.com/publi<wbr>c-data/</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fwww2.jpl.nasa.gov%2Fsrtm&amp;sig=282e3e" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://www2.jpl.nasa.gov/<wbr>srtm</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fwww.archives.gov%2Fresearch%2Falic%2Ftools%2Fonline-databases.html&amp;sig=abcb1d" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://www.archives.gov/r<wbr>esearch...</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fwww.bls.gov%2F&amp;sig=423969" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://www.bls.gov/</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fwww.crunchbase.com%2F&amp;sig=c690ef" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://www.crunchbase.com<wbr>/</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fwww.dartmouthatlas.org%2F&amp;sig=a8f603" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://www.dartmouthatlas<wbr>.org/</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fwww.data.gov%2F&amp;sig=a1a306" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://www.data.gov/</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fwww.datakc.org&amp;sig=1e8197" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://www.datakc.org</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fwww.delicious.com%2Fjbaldwinconnect%2FDataSets&amp;sig=9b6aef" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://www.delicious.com/<wbr>jbaldwi...</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fwww.factual.com%2F&amp;sig=e773e1" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://www.factual.com/</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fwww.freebase.com%2F&amp;sig=6965e6" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://www.freebase.com/</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fwww.google.com%2Fpublicdata%2Fdirectory&amp;sig=1b293d" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://www.google.com/pub<wbr>licdata...</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fwww.guardian.co.uk%2Fnews%2Fdatablog&amp;sig=d5d335" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://www.guardian.co.uk<wbr>/news/d...</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fwww.infochimps.com&amp;sig=160b93" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://www.infochimps.com</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fwww.kaggle.com%2F&amp;sig=f284c6" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://www.kaggle.com/</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fwww.nationalarchives.gov.uk%2Fdoc%2Fopen-government-licence%2Fopen-government-licence.htm&amp;sig=68f7f9" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://www.nationalarchiv<wbr>es.gov....</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fwww.nyc.gov%2Fhtml%2Fdatamine%2Fhtml%2Fhome%2Fhome.shtml&amp;sig=61301b" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://www.nyc.gov/html/d<wbr>atamine...</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fwww.ordnancesurvey.co.uk%2Foswebsite%2Fopendata%2F&amp;sig=be5173" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://www.ordnancesurvey<wbr>.co.uk/...</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fwww.philwhln.com%2Fhow-to-get-experience-working-with-large-datasets&amp;sig=0db155" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://www.philwhln.com/h<wbr>ow-to-g...</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fbuild.kiva.org%2F&amp;sig=adad3d" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://build.kiva.org/</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fwww.imdb.com%2Finterfaces&amp;sig=bebc0b" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://www.imdb.com/inter<wbr>faces</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=https%3A%2F%2Fwist.echo.nasa.gov%2F%7Ewist%2Fapi%2Fimswelcome%2F&amp;sig=9c05de" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">https://wist.echo.nasa.go<wbr>v/~wist...</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fimat-relpred.yandex.ru%2Fen%2Fdatasets&amp;sig=46dc27" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://imat-relpred.yande<wbr>x.ru/en...</a><br style="font-family: Arial; line-height: 26px; background-color: #ffffff;" /><a href="http://www.quora.com/_/redirect?url=http%3A%2F%2Fwww.dados.gov.pt%2Fpt%2Fcatalogodados%2Fcatalogodados.aspx&amp;sig=0bdf81" rel="nofollow" target="_blank" style="color: #ff9900; text-decoration: none; margin: 0px; padding: 0px; font-family: Arial; line-height: 26px; background-color: #ffffff;">http://www.dados.gov.pt/p<wbr>t/catal...</a><img src ="http://www.cppblog.com/Hero/aggbug/213279.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Hero/" target="_blank">Hero</a> 2016-04-14 15:45 <a href="http://www.cppblog.com/Hero/archive/2016/04/14/213279.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>【转载】浅谈JavaScript的事件响应</title><link>http://www.cppblog.com/Hero/archive/2016/04/14/213274.html</link><dc:creator>Hero</dc:creator><author>Hero</author><pubDate>Thu, 14 Apr 2016 03:12:00 GMT</pubDate><guid>http://www.cppblog.com/Hero/archive/2016/04/14/213274.html</guid><wfw:comment>http://www.cppblog.com/Hero/comments/213274.html</wfw:comment><comments>http://www.cppblog.com/Hero/archive/2016/04/14/213274.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Hero/comments/commentRss/213274.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Hero/services/trackbacks/213274.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 每当猴子们问我JavaScript和DOM里啥东西最牛逼时，我都会一巴掌打回去：卧槽还用问么当然是事件响应了啊！没它你能有时间和我讨论这个？你早去工地搬砖去了好么！浏览器没有事件响应就没有行为交互，那简直就是一夜回到解放前的感觉啊。此外，以事件驱动使得功能解耦也是个相当高端大气的技巧了，嘛，以此为主的Node.js&nbsp;现在可是风生水起的说。那现在我们就再抠抠事件监听的相关基础，让大家在心情...&nbsp;&nbsp;<a href='http://www.cppblog.com/Hero/archive/2016/04/14/213274.html'>阅读全文</a><img src ="http://www.cppblog.com/Hero/aggbug/213274.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Hero/" target="_blank">Hero</a> 2016-04-14 11:12 <a href="http://www.cppblog.com/Hero/archive/2016/04/14/213274.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>【转载】负载均衡一（四层和七层负载均衡的区别）</title><link>http://www.cppblog.com/Hero/archive/2016/04/12/213250.html</link><dc:creator>Hero</dc:creator><author>Hero</author><pubDate>Tue, 12 Apr 2016 13:02:00 GMT</pubDate><guid>http://www.cppblog.com/Hero/archive/2016/04/12/213250.html</guid><wfw:comment>http://www.cppblog.com/Hero/comments/213250.html</wfw:comment><comments>http://www.cppblog.com/Hero/archive/2016/04/12/213250.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Hero/comments/commentRss/213250.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Hero/services/trackbacks/213250.html</trackback:ping><description><![CDATA[<p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">（一）</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;"><strong style="margin: 0px; padding: 0px; color: #333333;">　　</strong>简单理解四层和七层负载均衡:</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;"><strong style="margin: 0px; padding: 0px; color: #333333;">　　</strong><strong style="margin: 0px; padding: 0px; color: #333333;">&#9312;&nbsp;</strong>所谓四层就是基于IP+端口的负载均衡；七层就是基于URL等应用层信息的负载均衡；同理，还有基于MAC地址的二层负载均衡和基于IP地址的三层负载均衡。 换句换说，二层负载均衡会通过一个虚拟MAC地址接收请求，然后再分配到真实的MAC地址；三层负载均衡会通过一个虚拟IP地址接收请求，然后再分配到真实的IP地址；四层通过虚拟IP+端口接收请求，然后再分配到真实的服务器；七层通过虚拟的URL或主机名接收请求，然后再分配到真实的服务器。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　<strong style="margin: 0px; padding: 0px; color: #333333;">&#9313;&nbsp;</strong>所谓的四到七层负载均衡，就是在对后台的服务器进行负载均衡时，依据四层的信息或七层的信息来决定怎么样转发流量。 比如四层的负载均衡，就是通过发布三层的IP地址（VIP），然后加四层的端口号，来决定哪些流量需要做负载均衡，对需要处理的流量进行NAT处理，转发至后台服务器，并记录下这个TCP或者UDP的流量是由哪台服务器处理的，后续这个连接的所有流量都同样转发到同一台服务器处理。七层的负载均衡，就是在四层的基础上（没有四层是绝对不可能有七层的），再考虑应用层的特征，比如同一个Web服务器的负载均衡，除了根据VIP加80端口辨别是否需要处理的流量，还可根据七层的URL、浏览器类别、语言来决定是否要进行负载均衡。举个例子，如果你的Web服务器分成两组，一组是中文语言的，一组是英文语言的，那么七层负载均衡就可以当用户来访问你的域名时，自动辨别用户语言，然后选择对应的语言服务器组进行负载均衡处理。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　<strong style="margin: 0px; padding: 0px; color: #333333;">&#9314;&nbsp;</strong>负载均衡器通常称为四层交换机或七层交换机。四层交换机主要分析IP层及TCP/UDP层，实现四层流量负载均衡。七层交换机除了支持四层负载均衡以外，还有分析应用层的信息，如HTTP协议URI或Cookie信息。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　1、负载均衡分为L4 switch（四层交换），即在OSI第4层工作，就是TCP层啦。此种Load Balance不理解应用协议（如HTTP/FTP/MySQL等等）。例子：LVS，F5。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　2、另一种叫做L7 switch（七层交换），OSI的最高层，应用层。此时，该Load Balancer能理解应用协议。例子： &nbsp;haproxy，MySQL Proxy。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　注意：上面的很多Load Balancer既可以做四层交换，也可以做七层交换。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　（二）</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;"><strong style="margin: 0px; padding: 0px; color: #333333;">　　负载均衡设备也常被称为"四到七层交换机"，那么四层和七层两者到底区别在哪里？</strong></p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;"><strong style="margin: 0px; padding: 0px; color: #333333;">　　第一，技术原理上的区别。</strong></p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;"><strong style="margin: 0px; padding: 0px; color: #333333;">　　所谓四层负载均衡</strong>，也就是主要通过报文中的目标地址和端口，再加上负载均衡设备设置的服务器选择方式，决定最终选择的内部服务器。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　以常见的TCP为例，负载均衡设备在接收到第一个来自客户端的SYN 请求时，即通过上述方式选择一个最佳的服务器，并对报文中目标IP地址进行修改(改为后端服务器IP），直接转发给该服务器。TCP的连接建立，即三次握手是客户端和服务器直接建立的，负载均衡设备只是起到一个类似路由器的转发动作。在某些部署情况下，为保证服务器回包可以正确返回给负载均衡设备，在转发报文的同时可能还会对报文原来的源地址进行修改。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; text-align: center; background-color: #faffff;"><img src="http://images.cnitblog.com/kb/1/201401/03114159-1d39f32589b04705b65bf5bda16d2252.jpg" alt="" style="margin: 0px; padding: 0px; font-size: 12px; border: none; max-width: 620px;" /></p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;"><strong style="margin: 0px; padding: 0px; color: #333333;">　　所</strong><strong style="margin: 0px; padding: 0px; color: #333333;">谓七层负载均衡</strong>，也称为&#8220;内容交换&#8221;，也就是主要通过报文中的真正有意义的应用层内容，再加上负载均衡设备设置的服务器选择方式，决定最终选择的内部服务器。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　以常见的TCP为例，负载均衡设备如果要根据真正的应用层内容再选择服务器，只能先代理最终的服务器和客户端建立连接(三次握手)后，才可能接受到客户端发送的真正应用层内容的报文，然后再根据该报文中的特定字段，再加上负载均衡设备设置的服务器选择方式，决定最终选择的内部服务器。负载均衡设备在这种情况下，更类似于一个代理服务器。负载均衡和前端的客户端以及后端的服务器会分别建立TCP连接。所以从这个技术原理上来看，七层负载均衡明显的对负载均衡设备的要求更高，处理七层的能力也必然会低于四层模式的部署方式。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;"><strong style="margin: 0px; padding: 0px; color: #333333;">　　第二，应用场景的需求。</strong></p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　七层应用负载的好处，是使得整个网络更"<strong style="margin: 0px; padding: 0px; color: #333333;">智能化</strong>"。例如访问一个网站的用户流量，可以通过七层的方式，将对图片类的请求转发到特定的图片服务器并可以使用缓存技术；将对文字类的请求可以转发到特定的文字服务器并可以使用压缩技术。当然这只是七层应用的一个小案例，从技术原理上，这种方式可以对客户端的请求和服务器的响应进行任意意义上的修改，极大的提升了应用系统在网络层的灵活性。很多在后台，例如Nginx或者Apache上部署的功能可以前移到负载均衡设备上，例如客户请求中的Header重写，服务器响应中的关键字过滤或者内容插入等功能。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　另外一个常常被提到功能就<strong style="margin: 0px; padding: 0px; color: #333333;">是</strong>安全性。网络中最常见的SYN Flood攻击，即黑客控制众多源客户端，使用虚假IP地址对同一目标发送SYN攻击，通常这种攻击会大量发送SYN报文，耗尽服务器上的相关资源，以达到Denial of Service(<em style="margin: 0px; padding: 0px; color: #333333;">DoS</em>)的目的。从技术原理上也可以看出，四层模式下这些SYN攻击都会被转发到后端的服务器上；而七层模式下这些SYN攻击自然在负载均衡设备上就截止，不会影响后台服务器的正常运营。另外负载均衡设备可以在七层层面设定多种策略，过滤特定报文，例如SQL&nbsp;Injection等应用层面的特定攻击手段，从应用层面进一步提高系统整体安全。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　现在的7层负载均衡，主要还是着重于<strong style="margin: 0px; padding: 0px; color: #333333;">应用</strong>HTTP协议，所以其应用范围主要是众多的网站或者内部信息平台等基于B/S开发的系统。 4层负载均衡则对应其他TCP应用，例如基于C/S开发的ERP等系统。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;"><strong style="margin: 0px; padding: 0px; color: #333333;">　　第三，七层应用需要考虑的问题。<a href="http://hi.baidu.com/aking_roc" target="_blank" style="margin: 0px; padding: 0px; color: #1a64a2; text-decoration: none;"><br style="margin: 0px; padding: 0px; line-height: 10px;" /></a></strong></p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;"><strong style="margin: 0px; padding: 0px; color: #333333;">　　1：是否真的必要</strong>，七层应用的确可以提高流量智能化，同时必不可免的带来设备配置复杂，负载均衡压力增高以及故障排查上的复杂性等问题。在设计系统时需要考虑四层七层同时应用的混杂情况。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;"><strong style="margin: 0px; padding: 0px; color: #333333;">　　2：是否真的可以提高安全性</strong>。例如SYN Flood攻击，七层模式的确将这些流量从服务器屏蔽，但负载均衡设备本身要有强大的抗DDoS能力，否则即使服务器正常而作为中枢调度的负载均衡设备故障也会导致整个应用的崩溃。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;"><strong style="margin: 0px; padding: 0px; color: #333333;">　　3：是否有足够的灵活度</strong>。七层应用的优势是可以让整个应用的流量智能化，但是负载均衡设备需要提供完善的七层功能，满足客户根据不同情况的基于应用的调度。最简单的一个考核就是能否取代后台Nginx或者Apache等服务器上的调度功能。能够提供一个七层应用开发接口的负载均衡设备，可以让客户根据需求任意设定功能，才真正有可能提供强大的灵活性和智能性。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　（本节出自 &#8220;ADC技术博客&#8221; 博客，请务必保留此出处http://virtualadc.blog.51cto.com/3027116/591396）</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　（三）</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;"><strong style="margin: 0px; padding: 0px; color: #333333;">　　负载均衡四七层介绍:</strong></p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　负载均衡（Load Balance）建立在现有网络结构之上，它提供了一种廉价有效透明的方法扩展网络设备和服务器的带宽、增加吞吐量、加强网络数据处理能力、提高网络的灵活性和可用性。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　负载均衡有两方面的含义：首先，大量的并发访问或数据流量分担到多台节点设备上分别处理，减少用户等待响应的时间；其次，单个重负载的运算分担到多台节点设备上做并行处理，每个节点设备处理结束后，将结果汇总，返回给用户，系统处理能力得到大幅度提高。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　本文所要介绍的负载均衡技术主要是指在均衡服务器群中所有服务器和应用程序之间流量负载的应用，目前负载均衡技术大多数是用于提高诸如在Web服务器、FTP服务器和其它关键任务服务器上的Internet服务器程序的可用性和可伸缩性。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;"><strong style="margin: 0px; padding: 0px; color: #333333;">　　负载均衡技术分类</strong></p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　目前有许多不同的负载均衡技术用以满足不同的应用需求，下面从负载均衡所采用的设备对象、应用的网络层次（指OSI参考模型）及应用的地理结构等来分类。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;"><strong style="margin: 0px; padding: 0px; color: #333333;">　　软/硬件负载均衡</strong></p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　软件负载均衡解决方案是指在一台或多台服务器相应的操作系统上安装一个或多个附加软件来实现负载均衡，如DNS Load Balance，CheckPoint Firewall-1 ConnectControl等，它的优点是基于特定环境，配置简单，使用灵活，成本低廉，可以满足一般的负载均衡需求。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　软件解决方案缺点也较多，因为每台服务器上安装额外的软件运行会消耗系统不定量的资源，越是功能强大的模块，消耗得越多，所以当连接请求特别大的时候，软件本身会成为服务器工作成败的一个关键；软件可扩展性并不是很好，受到操作系统的限制；由于操作系统本身的Bug，往往会引起安全问题。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　硬件负载均衡解决方案是直接在服务器和外部网络间安装负载均衡设备，这种设备我们通常称之为负载均衡器，由于专门的设备完成专门的任务，独立于操作系统，整体性能得到大量提高，加上多样化的负载均衡策略，智能化的流量管理，可达到最佳的负载均衡需求。&nbsp;</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　负载均衡器有多种多样的形式，除了作为独立意义上的负载均衡器外，有些负载均衡器集成在交换设备中，置于服务器与Internet链接之间，有些则以两块网络适配器将这一功能集成到PC中，一块连接到Internet上，一块连接到后端服务器群的内部网络上。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　一般而言，硬件负载均衡在功能、性能上优于软件方式，不过成本昂贵。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;"><strong style="margin: 0px; padding: 0px; color: #333333;">　　本地/全局负载均衡<a href="http://hi.baidu.com/aking_roc" target="_blank" style="margin: 0px; padding: 0px; color: #1a64a2; text-decoration: none;"><br style="margin: 0px; padding: 0px; line-height: 10px;" /></a></strong></p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　负载均衡从其应用的地理结构上分为本地负载均衡(Local Load Balance)和全局负载均衡(Global Load Balance，也叫地域负载均衡)，本地负载均衡是指对本地的服务器群做负载均衡，全局负载均衡是指对分别放置在不同的地理位置、有不同网络结构的服务器群间作负载均衡。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　本地负载均衡能有效地解决数据流量过大、网络负荷过重的问题，并且不需花费昂贵开支购置性能卓越的服务器，充分利用现有设备，避免服务器单点故障造成数据流量的损失。其有灵活多样的均衡策略把数据流量合理地分配给服务器群内的服务器共同负担。即使是再给现有服务器扩充升级，也只是简单地增加一个新的服务器到服务群中，而不需改变现有网络结构、停止现有的服务。&nbsp;</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　全局负载均衡主要用于在一个多区域拥有自己服务器的站点，为了使全球用户只以一个IP地址或域名就能访问到离自己最近的服务器，从而获得最快的访问速度，也可用于子公司分散站点分布广的大公司通过Intranet（企业内部互联网）来达到资源统一合理分配的目的。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;"><strong style="margin: 0px; padding: 0px; color: #333333;">　　网络层次上的负载均衡</strong></p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　针对网络上负载过重的不同瓶颈所在，从网络的不同层次入手，我们可以采用相应的负载均衡技术来解决现有问题。&nbsp;</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　随着带宽增加，数据流量不断增大，网络核心部分的数据接口将面临瓶颈问题，原有的单一线路将很难满足需求，而且线路的升级又过于昂贵甚至难以实现，这时就可以考虑采用链路聚合（Trunking）技术。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　链路聚合技术（第二层负载均衡）将多条物理链路当作一条单一的聚合逻辑链路使用，网络数据流量由聚合逻辑链路中所有物理链路共同承担，由此在逻辑上增大了链路<a href="http://hi.baidu.com/aking_roc" target="_blank" style="margin: 0px; padding: 0px; color: #1a64a2; text-decoration: none;">的</a>容量，使其能满足带宽增加的需求。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　现代负载均衡技术通常操作于网络的第四层或第七层。第四层负载均衡将一个Internet上合法注册的IP地址映射为多个内部服务器的IP地址，对每次 TCP连接请求动态使用其中一个内部IP地址，达到负载均衡的目的。在第四层交换机中，此种均衡技术得到广泛的应用，一个目标地址是服务器群VIP（虚拟 IP，Virtual IP address）连接请求的数据包流经交换机，交换机根据源端和目的IP地址、TCP或UDP端口号和一定的负载均衡策略，在服务器IP和VIP间进行映射，选取服务器群中最好的服务器来处理连接请求。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　第七层负载均衡控制应用层服务的内容，提供了一种对访问流量的高层控制方式，适合对HTTP服务器群的应用。第<strong style="margin: 0px; padding: 0px; color: #333333;">七层负载均衡技术通过检查流经的HTTP报头，根据报头内的信息来执行负载均衡任务</strong>。&nbsp;</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　第七层负载均衡优点表现在如下几个方面：&nbsp;</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　通过对HTTP报头的检查，可以检测出HTTP400、500和600系列的错误信息，因而能透明地将连接请求重新定向到另一台服务器，避免应用层故障。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　可根据流经的数据类型（如判断数据包是图像文件、压缩文件或多媒体文件格式等），把数据流量引向相应内容的服务器来处理，增加系统性能。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　能根据连接请求的类型，如是普通文本、图象等静态文档请求，还是asp、cgi等的动态文档请求，把相应的请求引向相应的服务器来处理，提高系统的性能及安全性。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　第七层负载均衡受到其所支持的协议限制（一般只有HTTP），这样就限制了它应用的广泛性，并且检查HTTP报头会占用大量的系统资源，势必会影响到系统的性能，在大量连接请求的情况下，负载均衡设备自身容易成为网络整体性能的瓶颈。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　<strong style="margin: 0px; padding: 0px; color: #333333;">负载均衡策略</strong></p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　在实际应用中，我们可能不想仅仅是把客户端的服务请求平均地分配给内部服务器，而不管服务器是否宕机。而是想使Pentium III服务器比Pentium II能接受更多的服务请求，一台处理服务请求较少的服务器能分配到更多的服务请求，出现故障的服务器将不再接受服务请求直至故障恢复等等。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　选择合适的负载均衡策略，使多个设备能很好的共同完成任务，消除或避免现有网络负载分布不均、数据流量拥挤反应时间长的瓶颈。在各负载均衡方式中，针对不同的应用需求，在OSI参考模型的第二、三、四、七层的负载均衡都有相应的负载均衡策略。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　负载均衡策略的优劣及其实现的难易程度有两个关键因素：一、负载均衡算法，二、对网络系统状况的检测方式和能力。&nbsp;</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　考虑到服务请求的不同类型、服务器的不同处理能力以及随机选择造成的负载分配不均匀等问题，为了更加合理的把负载分配给内部的多个服务器，就需要应用相应的能够正确反映各个服务器处理能力及网络状态的<strong style="margin: 0px; padding: 0px; color: #333333;">负载均衡算法</strong>：</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　轮循均衡（Round Robin）：每一次来自网络的请求轮流分配给内部中的服务器，从1至N然后重新开始。此种均衡算法适合于服务器组中的所有服务器都有相同的软硬件配置并且平均服务请求相对均衡的情况。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　权重轮循均衡（Weighted Round Robin）：根据服务器的不同处理能力，给每个服务器分配不同的权值，使其能够接受相应权值数的服务请求。例如：服务器A的权值被设计成1，B的权值是 3，C的权值是6，则服务器A、B、C将分别接受到10%、30％、60％的服务请求。此种均衡算法能确保高性能的服务器得到更多的使用率，避免低性能的服务器负载过重。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　随机均衡（Random）：把来自网络的请求随机分配给内部中的多个服务器。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　权重随机均衡（Weighted Random）：此种均衡算法类似于权重轮循算法，不过在处理请求分担时是个随机选择的过程。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　响应速度均衡（Response Time）：负载均衡设备对内部各服务器发出一个探测请求（例如Ping），然后根据内部中各服务器对探测请求的最快响应时间来决定哪一台服务器来响应客户端的服务请求。此种均衡算法能较好的反映服务器的当前运行状态，但这最快响应时间仅仅指的是负载均衡设备与服务器间的最快响应时间，而不是客户端与服务器间的最快响应时间。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　最少连接数均衡（Least Connection）：客户端的每一次请求服务在服务器停留的时间可能会有较大的差异，随着工作时间加长，如果采用简单的轮循或随机均衡算法，每一台服务器上的连接进程可能会产生极大的不同，并没有达到真正的负载均衡。最少连接数均衡算法对内部中需负载的每一台服务器都有一个数据记录，记录当前该服务器正在处理的连接数量，当有新的服务连接请求时，将把当前请求分配给连接数最少的服务器，使均衡更加符合实际情况，负载更加均衡。此种均衡算法适合长时处理的请求服务，如FTP。&nbsp;</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　处理能力均衡：此种均衡算法将把服务请求分配给内部中处理负荷（根据服务器CPU型号、CPU数量、内存大小及当前连接数等换算而成）最轻的服务器，由于考虑到了内部服务器的处理能力及当前网络运行状况，所以此种均衡算法相对来说更加精确，尤其适合运用到第七层（应用层）负载均衡的情况下。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　DNS响应均衡（Flash DNS）：在Internet上，无论是HTTP、FTP或是其它的服务请求，客户端一般都是通过域名解析来找到服务器确切的IP地址的。在此均衡算法下，分处在不同地理位置的负载均衡设备收到同一个客户端的域名解析请求，并在同一时间内把此域名解析成各自相对应服务器的IP地址（即与此负载均衡设备在同一位地理位置的服务器的IP地址）并返回给客户端，则客户端将以最先收到的域名解析IP地址来继续请求服务，而忽略其它的IP地址响应。在种均衡策略适合应用在全局负载均衡的情况下，对本地负载均衡是没有意义的。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　尽管有多种的负载均衡算法可以较好的把数据流量分配给服务器去负载，但如果负载均衡策略没有对网络系统状况的检测方式和能力，一旦在某台服务器或某段负载均衡设备与服务器网络间出现故障的情况下，负载均衡设备依然把一部分数据流量引向那台服务器，这势必造成大量的服务请求被丢失，达不到不间断可用性的要求。所以良好的负载均衡策略应有对网络故障、服务器系统故障、应用服务故障的检<strong style="margin: 0px; padding: 0px; color: #333333;">测方式和能力</strong>：</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　Ping侦测：通过ping的方式检测服务器及网络系统状况，此种方式简单快速，但只能大致检测出网络及服务器上的操作系统是否正常，对服务器上的应用服务检测就无能为力了。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　TCP Open侦测：每个服务都会开放某个通过TCP连接，检测服务器上某个TCP端口（如Telnet的23口，HTTP的80口等）是否开放来判断服务是否正常。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　HTTP URL侦测：比如向HTTP服务器发出一个对main.html文件的访问请求，如果收到错误信息，则认为服务器出现故障。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　负载均衡策略的优劣除受上面所讲的两个因素影响外，在有些应用情况下，我们需要将来自同一客户端的所有请求都分配给同一台服务器去负担，例如服务器将客户端注册、购物等服务请求信息保存的本地数据库的情况下，把客户端的子请求分配给同一台服务器来处理就显的至关重要了。有两种方式可以解决此问题，一是根据IP地址把来自同一客户端的多次请求分配给同一台服务器处理，客户端IP地址与服务器的对应信息是保存在负载均衡设备上的；二是在客户端浏览器 cookie内做独一无二的标识来把多次请求分配给同一台服务器处理，适合通过代理服务器上网的客户端。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　还有一种路径外返回模式（Out of Path Return），当客户端连接请求发送给负载均衡设备的时候，中心负载均衡设备将请求引向某个服务器，服务器的回应请求不再返回给中心负载均衡设备，即绕过流量分配器，直接返回给客户端，因此中心负载均衡设备只负责接受并转发请求，其网络负担就减少了很多，并且给客户端提供了更快的响应时间。此种模式一般用于HTTP服务器群，在各服务器上要安装一块虚拟网络适配器，并将其IP地址设为服务器群的VIP，这样才能在服务器直接回应客户端请求时顺利的达成三次握手。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　<strong style="margin: 0px; padding: 0px; color: #333333;">负载均衡实施要素</strong></p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　负载均衡方案应是在网站建设初期就应考虑的问题，不过有时随着访问流量的爆炸性增长，超出决策者的意料，这也就成为不得不面对的问题。当我们在引入某种负载均衡方案乃至具体实施时，像其他的许多方案一样，首先是确定当前及将来的应用需求，然后在代价与收效之间做出权衡。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　针对当前及将来的应用需求，分析网络瓶颈的不同所在，我们就需要确立是采用哪一类的负载均衡技术，采用什么样的均衡策略，在可用性、兼容性、安全性等等方面要满足多大的需求，如此等等。&nbsp;</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　不管负载均衡方案是采用花费较少的软件方式，还是购买代价高昂在性能功能上更强的第四层交换机、负载均衡器等硬件方式来实现，亦或其他种类不同的均衡技术，下面这几项都是我们在引入均衡方案时可能要考虑的问题：</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　性能：性能是我们在引入均衡方案时需要重点考虑的问题，但也是一个最难把握的问题。衡量性能时可将每秒钟通过网络的数据包数目做为一个参数，另一个参数是均衡方案中服务器群所能处理的最大并发连接数目，但是，假设一个均衡系统能处理百万计的并发连接数，可是却只能以每秒2个包的速率转发，这显然是没有任何作用的。性能的优劣与负载均衡设备的处理能力、采用的均衡策略息息相关，并且有两点需要注意：一、均衡方案对服务器群整体的性能，这是响应客户端连接请求速度的关键；二、负载均衡设备自身的性能，避免有大量连接请求时自身性能不足而成为服务瓶颈。有时我们也可以考虑采用混合型负载均衡策略来提升服务器群的总体性能，如DNS负载均衡与NAT负载均衡相结合。另外，针对有大量静态文档请求的站点，也可以考虑采用高速缓存技术，相对来说更节省费用，更能提高响应性能；对有大量ssl/xml内容传输的站点，更应考虑采用ssl/xml加速技术。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　可扩展性：IT技术日新月异，一年以前最新的产品，现在或许已是网络中性能最低的产品；业务量的急速上升，一年前的网络，现在需要新一轮的扩展。合适的均衡解决方案应能满足这些需求，能均衡不同操作系统和硬件平台之间的负载，能均衡HTTP、邮件、新闻、代理、数据库、防火墙和 Cache等不同服务器的负载，并且能以对客户端完全透明的方式动态增加或删除某些资源。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　灵活性：均衡解决方案应能灵活地提供不同的应用需求，满足应用需求的不断变化。在不同的服务器群有不同的应用需求时，应有多样的均衡策略提供更广泛的选择。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　可靠性：在对服务质量要求较高的站点，负载均衡解决方案应能为服务器群提供完全的容错性和高可用性。但在负载均衡设备自身出现故障时，应该有良好的冗余解决方案，提高可靠性。使用冗余时，处于同一个冗余单元的多个负载均衡设备必须具有有效的方式以便互相进行监控，保护系统尽可能地避免遭受到重大故障的损失。</p><p style="margin-right: 0px; margin-left: 0px; padding: 0px; font-family: verdana, Arial, Helvetica, sans-serif; color: #232323; line-height: 28px; background-color: #faffff;">　　易管理性：不管是通过软件还是硬件方式的均衡解决方案，我们都希望它有灵活、直观和安全的管理方式，这样便于安装、配置、维护和监控，提高工作效率，避免差错。在硬件负载均衡设备上，目前主要有三种管理方式可供选择：一、命令行接口（CLI：Command Line Interface），可通过超级终端连接负载均衡设备串行接口来管理，也能telnet远程登录管理，在初始化配置时，往往要用到前者；二、图形用户接口（GUI：Graphical User Interfaces），有基于普通web页的管理，也有通过Java Applet 进行安全管理，一般都需要管理端安装有某个版本的浏览器；三、SNMP（Simple Network Management Protocol，简单网络管理协议）支持，通过第三方网络管理软件对符合SNMP标准的设备进行管理。<br /><br />原文链接<br /><span style="font-family: verdana, 'courier new'; line-height: 21px;">http://kb.cnblogs.com/page/188170/</span></p><img src ="http://www.cppblog.com/Hero/aggbug/213250.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Hero/" target="_blank">Hero</a> 2016-04-12 21:02 <a href="http://www.cppblog.com/Hero/archive/2016/04/12/213250.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>【转载】大型网站系统架构演化之路</title><link>http://www.cppblog.com/Hero/archive/2016/04/12/213249.html</link><dc:creator>Hero</dc:creator><author>Hero</author><pubDate>Tue, 12 Apr 2016 12:56:00 GMT</pubDate><guid>http://www.cppblog.com/Hero/archive/2016/04/12/213249.html</guid><wfw:comment>http://www.cppblog.com/Hero/comments/213249.html</wfw:comment><comments>http://www.cppblog.com/Hero/archive/2016/04/12/213249.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Hero/comments/commentRss/213249.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Hero/services/trackbacks/213249.html</trackback:ping><description><![CDATA[<h2 style="margin: 30px 0px 14px; padding: 0px 0px 5px; color: #222222; border-bottom-color: #eeeeee; border-bottom-width: 1px; border-bottom-style: solid; font-size: 18px; font-family: 'microsoft yahei'; line-height: 25px;">前言</h2><h1><div style="display: inline-block;"><p style="margin: 0px 0px 15px; padding: 0px; color: #444444; font-family: 'microsoft yahei'; font-size: 14px; font-weight: normal; line-height: 25px;">一个成熟的大型网站（如淘宝、京东等）的系统架构并不是开始设计就具备完整的高性能、高可用、安全等特性，它总是随着用户量的增加，业务功能的扩展逐渐演变完善的，在这个过程中，开发模式、技术架构、设计思想也发生了很大的变化，就连技术人员也从几个人发展到一个部门甚至一条产品线。所以成熟的系统架构是随业务扩展而完善出来的，并不是一蹴而就；不同业务特征的系统，会有各自的侧重点，例如淘宝，要解决海量的商品信息的搜索、下单、支付，例如腾讯，要解决数亿的用户实时消息传输，百度它要处理海量的搜索请求，他们都有各自的业务特性，系统架构也有所不同。尽管如此我们也可以从这些不同的网站背景下，找出其中共用的技术，这些技术和手段可以广泛运行在大型网站系统的架构中，下面就通过介绍大型网站系统的演化过程，来认识这些技术和手段。</p></div></h1><h2 style="margin: 30px 0px 14px; padding: 0px 0px 5px; color: #222222; border-bottom-color: #eeeeee; border-bottom-width: 1px; border-bottom-style: solid; font-size: 18px; font-family: 'microsoft yahei'; line-height: 25px;">一、最开始的网站架构</h2><h1><div style="display: inline-block;"><p style="margin: 0px 0px 15px; padding: 0px; color: #444444; font-family: 'microsoft yahei'; font-size: 14px; font-weight: normal; line-height: 25px;">最初的架构，应用程序、数据库、文件都部署在一台服务器上，如图：</p><p style="margin: 0px 0px 15px; padding: 0px; color: #444444; font-family: 'microsoft yahei'; font-size: 14px; font-weight: normal; line-height: 25px;"><img title="image" src="http://images.cnitblog.com/blog/352511/201409/251844423268454.png" alt="image" width="453" height="347" border="0" style="margin: 0px auto; padding: 5px; border: 1px solid #e6e6e6; max-width: 628px; display: block; height: auto;" /></p></div></h1><h2 style="margin: 30px 0px 14px; padding: 0px 0px 5px; color: #222222; border-bottom-color: #eeeeee; border-bottom-width: 1px; border-bottom-style: solid; font-size: 18px; font-family: 'microsoft yahei'; line-height: 25px;">二、应用、数据、文件分离</h2><h1><div style="display: inline-block;"><p style="margin: 0px 0px 15px; padding: 0px; color: #444444; font-family: 'microsoft yahei'; font-size: 14px; font-weight: normal; line-height: 25px;">随着业务的扩展，一台服务器已经不能满足性能需求，故将应用程序、数据库、文件各自部署在独立的服务器上，并且根据服务器的用途配置不同的硬件，达到最佳的性能效果。</p><p style="margin: 0px 0px 15px; padding: 0px; color: #444444; font-family: 'microsoft yahei'; font-size: 14px; font-weight: normal; line-height: 25px;"><img title="image" src="http://images.cnitblog.com/blog/352511/201409/251844436545725.png" alt="image" width="603" height="375" border="0" style="margin: 0px auto; padding: 5px; border: 1px solid #e6e6e6; max-width: 628px; display: block; height: auto;" /></p></div></h1><h2 style="margin: 30px 0px 14px; padding: 0px 0px 5px; color: #222222; border-bottom-color: #eeeeee; border-bottom-width: 1px; border-bottom-style: solid; font-size: 18px; font-family: 'microsoft yahei'; line-height: 25px;">三、利用缓存改善网站性能</h2><h1><div style="display: inline-block;"><p style="margin: 0px 0px 15px; padding: 0px; color: #444444; font-family: 'microsoft yahei'; font-size: 14px; font-weight: normal; line-height: 25px;">在硬件优化性能的同时，同时也通过软件进行性能优化，在大部分的网站系统中，都会利用缓存技术改善系统的性能，使用缓存主要源于热点数据的存在，大部分网站访问都遵循28原则（即80%的访问请求，最终落在20%的数据上），所以我们可以对热点数据进行缓存，减少这些数据的访问路径，提高用户体验。</p><p style="margin: 0px 0px 15px; padding: 0px; color: #444444; font-family: 'microsoft yahei'; font-size: 14px; font-weight: normal; line-height: 25px;"><img title="image" src="http://images.cnitblog.com/blog/352511/201409/251844460767600.png" alt="image" width="518" height="528" border="0" style="margin: 0px auto; padding: 5px; border: 1px solid #e6e6e6; max-width: 628px; display: block; height: auto;" /></p><p style="margin: 0px 0px 15px; padding: 0px; color: #444444; font-family: 'microsoft yahei'; font-size: 14px; font-weight: normal; line-height: 25px;">缓存实现常见的方式是本地缓存、分布式缓存。当然还有CDN、反向代理等，这个后面再讲。本地缓存，顾名思义是将数据缓存在应用服务器本地，可以存在内存中，也可以存在文件，OSCache就是常用的本地缓存组件。本地缓存的特点是速度快，但因为本地空间有限所以缓存数据量也有限。分布式缓存的特点是，可以缓存海量的数据，并且扩展非常容易，在门户类网站中常常被使用，速度按理没有本地缓存快，常用的分布式缓存是Membercache、Redis。</p></div></h1><h2 style="margin: 30px 0px 14px; padding: 0px 0px 5px; color: #222222; border-bottom-color: #eeeeee; border-bottom-width: 1px; border-bottom-style: solid; font-size: 18px; font-family: 'microsoft yahei'; line-height: 25px;">四、使用集群改善应用服务器性能</h2><h1><div style="display: inline-block;"><p style="margin: 0px 0px 15px; padding: 0px; color: #444444; font-family: 'microsoft yahei'; font-size: 14px; font-weight: normal; line-height: 25px;">应用服务器作为网站的入口，会承担大量的请求，我们往往通过应用服务器集群来分担请求数。应用服务器前面部署<span class="wp_keywordlink"><a href="http://www.codeceo.com/article/balanced-algorithm.html" title="负载均衡" target="_blank" style="color: #0088db; text-decoration: none; cursor: pointer;">负载均衡</a></span>服务器调度用户请求，根据分发策略将请求分发到多个应用服务器节点。</p><p style="margin: 0px 0px 15px; padding: 0px; color: #444444; font-family: 'microsoft yahei'; font-size: 14px; font-weight: normal; line-height: 25px;"><img title="架构4" src="http://images.cnitblog.com/blog/352511/201409/251844471702801.png" alt="架构4" width="701" height="456" border="0" style="margin: 0px auto; padding: 5px; border: 1px solid #e6e6e6; max-width: 628px; display: block; height: auto;" /></p><p style="margin: 0px 0px 15px; padding: 0px; color: #444444; font-family: 'microsoft yahei'; font-size: 14px; font-weight: normal; line-height: 25px;">常用的负载均衡技术硬件的有F5，价格比较贵，软件的有LVS、Nginx、HAProxy。LVS是四层负载均衡，根据目标地址和端口选择内部服务器，Nginx和HAProxy是七层负载均衡，可以根据报文内容选择内部服务器，因此LVS分发路径优于Nginx和HAProxy，性能要高些，而Nginx和HAProxy则更具配置性，如可以用来做动静分离（根据请求报文特征，选择静态资源服务器还是应用服务器）。</p></div></h1><h2 style="margin: 30px 0px 14px; padding: 0px 0px 5px; color: #222222; border-bottom-color: #eeeeee; border-bottom-width: 1px; border-bottom-style: solid; font-size: 18px; font-family: 'microsoft yahei'; line-height: 25px;">五、数据库读写分离和分库分表</h2><h1><div style="display: inline-block;"><p style="margin: 0px 0px 15px; padding: 0px; color: #444444; font-family: 'microsoft yahei'; font-size: 14px; font-weight: normal; line-height: 25px;">随着用户量的增加，数据库成为最大的瓶颈，改善数据库性能常用的手段是进行读写分离以及分表，读写分离顾名思义就是将数据库分为读库和写库，通过主备功能实现数据同步。分库分表则分为水平切分和垂直切分，水平切换则是对一个数据库特大的表进行拆分，例如用户表。垂直切分则是根据业务不同来切换，如用户业务、商品业务相关的表放在不同的数据库中。</p><p style="margin: 0px 0px 15px; padding: 0px; color: #444444; font-family: 'microsoft yahei'; font-size: 14px; font-weight: normal; line-height: 25px;"><img title="架构3" src="http://images.cnitblog.com/blog/352511/201409/260851219209749.png" alt="架构3" width="740" height="460" border="0" style="margin: 0px auto; padding: 5px; border: 1px solid #e6e6e6; max-width: 628px; display: block; height: auto;" /></p></div></h1><h2 style="margin: 30px 0px 14px; padding: 0px 0px 5px; color: #222222; border-bottom-color: #eeeeee; border-bottom-width: 1px; border-bottom-style: solid; font-size: 18px; font-family: 'microsoft yahei'; line-height: 25px;">六、使用CDN和反向代理提高网站性能</h2><h1><div style="display: inline-block;"><p style="margin: 0px 0px 15px; padding: 0px; color: #444444; font-family: 'microsoft yahei'; font-size: 14px; font-weight: normal; line-height: 25px;">假如我们的服务器都部署在成都的机房，对于四川的用户来说访问是较快的，而对于北京的用户访问是较慢的，这是由于四川和北京分别属于电信和联通的不同发达地区，北京用户访问需要通过互联路由器经过较长的路径才能访问到成都的服务器，返回路径也一样，所以数据传输时间比较长。对于这种情况，常常使用CDN解决，CDN将数据内容缓存到运营商的机房，用户访问时先从最近的运营商获取数据，这样大大减少了网络访问的路径。比较专业的CDN运营商有蓝汛、网宿。</p><p style="margin: 0px 0px 15px; padding: 0px; color: #444444; font-family: 'microsoft yahei'; font-size: 14px; font-weight: normal; line-height: 25px;">而反向代理，则是部署在网站的机房，当用户请求达到时首先访问反向代理服务器，反向代理服务器将缓存的数据返回给用户，如果没有没有缓存数据才会继续走应用服务器获取，也减少了获取数据的成本。反向代理有Squid，Nginx。</p><p style="margin: 0px 0px 15px; padding: 0px; color: #444444; font-family: 'microsoft yahei'; font-size: 14px; font-weight: normal; line-height: 25px;"><img title="架构5" src="http://images.cnitblog.com/blog/352511/201409/260851254513595.png" alt="架构5" width="718" height="599" border="0" style="margin: 0px auto; padding: 5px; border: 1px solid #e6e6e6; max-width: 628px; display: block; height: auto;" /></p></div></h1><h2 style="margin: 30px 0px 14px; padding: 0px 0px 5px; color: #222222; border-bottom-color: #eeeeee; border-bottom-width: 1px; border-bottom-style: solid; font-size: 18px; font-family: 'microsoft yahei'; line-height: 25px;">七、使用分布式文件系统</h2><h1><div style="display: inline-block;"><p style="margin: 0px 0px 15px; padding: 0px; color: #444444; font-family: 'microsoft yahei'; font-size: 14px; font-weight: normal; line-height: 25px;">用户一天天增加，业务量越来越大，产生的文件越来越多，单台的文件服务器已经不能满足需求。需要分布式的文件系统支撑。常用的分布式文件系统有NFS。</p><p style="margin: 0px 0px 15px; padding: 0px; color: #444444; font-family: 'microsoft yahei'; font-size: 14px; font-weight: normal; line-height: 25px;"><img title="架构5.5" src="http://images.cnitblog.com/blog/352511/201409/260851282647353.png" alt="架构5.5" width="756" height="528" border="0" style="margin: 0px auto; padding: 5px; border: 1px solid #e6e6e6; max-width: 628px; display: block; height: auto;" /></p></div></h1><h2 style="margin: 30px 0px 14px; padding: 0px 0px 5px; color: #222222; border-bottom-color: #eeeeee; border-bottom-width: 1px; border-bottom-style: solid; font-size: 18px; font-family: 'microsoft yahei'; line-height: 25px;">八、使用NoSql和搜索引擎</h2><h1><div style="display: inline-block;"><p style="margin: 0px 0px 15px; padding: 0px; color: #444444; font-family: 'microsoft yahei'; font-size: 14px; font-weight: normal; line-height: 25px;">对于海量数据的查询，我们使用nosql数据库加上搜索引擎可以达到更好的性能。并不是所有的数据都要放在关系型数据中。常用的NOSQL有mongodb和redis，搜索引擎有<span class="wp_keywordlink"><a href="http://www.codeceo.com/article/lucene-java-search-engine.html" title="Lucene" target="_blank" style="color: #0088db; text-decoration: none; cursor: pointer;">Lucene</a></span>。</p><p style="margin: 0px 0px 15px; padding: 0px; color: #444444; font-family: 'microsoft yahei'; font-size: 14px; font-weight: normal; line-height: 25px;"><img title="架构6" src="http://images.cnitblog.com/blog/352511/201409/260851321075527.png" alt="架构6" width="767" height="569" border="0" style="margin: 0px auto; padding: 5px; border: 1px solid #e6e6e6; max-width: 628px; display: block; height: auto;" /></p></div></h1><h2 style="margin: 30px 0px 14px; padding: 0px 0px 5px; color: #222222; border-bottom-color: #eeeeee; border-bottom-width: 1px; border-bottom-style: solid; font-size: 18px; font-family: 'microsoft yahei'; line-height: 25px;">九、将应用服务器进行业务拆分</h2><h1><div style="display: inline-block;"><p style="margin: 0px 0px 15px; padding: 0px; color: #444444; font-family: 'microsoft yahei'; font-size: 14px; font-weight: normal; line-height: 25px;">随着业务进一步扩展，应用程序变得非常臃肿，这时我们需要将应用程序进行业务拆分，如百度分为新闻、网页、图片等业务。每个业务应用负责相对独立的业务运作。业务之间通过消息进行通信或者同享数据库来实现。</p><p style="margin: 0px 0px 15px; padding: 0px; color: #444444; font-family: 'microsoft yahei'; font-size: 14px; font-weight: normal; line-height: 25px;"><img title="架构7" src="http://images.cnitblog.com/blog/352511/201409/260851352481788.png" alt="架构7" width="787" height="583" border="0" style="margin: 0px auto; padding: 5px; border: 1px solid #e6e6e6; max-width: 628px; display: block; height: auto;" /></p></div></h1><h2 style="margin: 30px 0px 14px; padding: 0px 0px 5px; color: #222222; border-bottom-color: #eeeeee; border-bottom-width: 1px; border-bottom-style: solid; font-size: 18px; font-family: 'microsoft yahei'; line-height: 25px;">十、搭建分布式服务</h2><h1><div style="display: inline-block;"><p style="margin: 0px 0px 15px; padding: 0px; color: #444444; font-family: 'microsoft yahei'; font-size: 14px; font-weight: normal; line-height: 25px;">这时我们发现各个业务应用都会使用到一些基本的业务服务，例如用户服务、订单服务、支付服务、安全服务，这些服务是支撑各业务应用的基本要素。我们将这些服务抽取出来利用分部式服务框架搭建分布式服务。淘宝的Dubbo是一个不错的选择。</p><p style="margin: 0px 0px 15px; padding: 0px; color: #444444; font-family: 'microsoft yahei'; font-size: 14px; font-weight: normal; line-height: 25px;"><img title="架构8" src="http://images.cnitblog.com/blog/352511/201409/260851397174320.png" alt="架构8" width="796" height="630" border="0" style="margin: 0px auto; padding: 5px; border: 1px solid #e6e6e6; max-width: 628px; display: block; height: auto;" /></p></div></h1><h2 style="margin: 30px 0px 14px; padding: 0px 0px 5px; color: #222222; border-bottom-color: #eeeeee; border-bottom-width: 1px; border-bottom-style: solid; font-size: 18px; font-family: 'microsoft yahei'; line-height: 25px;">小结</h2><h1><p style="margin: 0px 0px 15px; padding: 0px; color: #444444; font-family: 'microsoft yahei'; font-size: 14px; font-weight: normal; line-height: 25px;">大型网站的架构是根据业务需求不断完善的，根据不同的业务特征会做特定的设计和考虑，本文只是讲述一个常规大型网站会涉及的一些技术和手段。<br /><br />原文链接<br /></p><div><span style="font-size: 10pt;"><span style="font-size: 12pt;">http://www.codeceo.com/article/web-artch-road.html</span></span></div><p style="margin: 0px 0px 15px; padding: 0px; color: #444444; font-family: 'microsoft yahei'; font-size: 14px; font-weight: normal; line-height: 25px;"><br /><br /></p><div></div></h1><img src ="http://www.cppblog.com/Hero/aggbug/213249.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Hero/" target="_blank">Hero</a> 2016-04-12 20:56 <a href="http://www.cppblog.com/Hero/archive/2016/04/12/213249.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>【转载】Win7技巧 10个提高工作效率的快捷键</title><link>http://www.cppblog.com/Hero/archive/2016/04/12/213241.html</link><dc:creator>Hero</dc:creator><author>Hero</author><pubDate>Tue, 12 Apr 2016 03:03:00 GMT</pubDate><guid>http://www.cppblog.com/Hero/archive/2016/04/12/213241.html</guid><wfw:comment>http://www.cppblog.com/Hero/comments/213241.html</wfw:comment><comments>http://www.cppblog.com/Hero/archive/2016/04/12/213241.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Hero/comments/commentRss/213241.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Hero/services/trackbacks/213241.html</trackback:ping><description><![CDATA[<br /><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;"></p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;">　　首先我们说一下Win键，也就是键盘上的那个微软徽标键，在Win8专用键盘上，也已经采用了最新的微软LOGO，自从我们接触Windows系统，就会经常用到这个功能键，比如按Win键打开开始菜单，显然比你使用鼠标移动到桌面的左下角要来得快。但在Win7系统里，通过Win键与其他键的组合使用，还可以实现更多的功能，下面几个，不知道你正在使用的是哪个？</p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;">　　1、Win + X ：打开移动中心</p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;"></p><center style="padding: 0px; margin: 0px; font-stretch: normal; line-height: normal; font-family: 宋体; background-color: #f6f6f4;"><img src="http://myarticle.enet.com.cn/images/2012/1010/1349879744531.jpg" border="0" alt="Win7技巧汇 10个提高工作效率的快捷键" style="padding: 0px; margin: 0px 0px 10px; font-stretch: normal; font-size: 12px; border: 1px solid #e1e1e1; vertical-align: middle;" /></center><span style="font-family: 宋体; line-height: 24px; background-color: #f6f6f4;">　　移动中心，目前仅在Win7系统里存在，并且只支持笔记本。通过Win+X键可以快速启动该移动中心，在这里能够设置显示器亮度、快捷电源计划、外部显示器和幻灯演示控制等。</span><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;"></p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;">　　2、Win + 空格：显示桌面</p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;"></p><center style="padding: 0px; margin: 0px; font-stretch: normal; line-height: normal; font-family: 宋体; background-color: #f6f6f4;"><img src="http://myarticle.enet.com.cn/images/2012/1010/1349879747434.jpg" border="0" alt="Win7技巧汇 10个提高工作效率的快捷键" style="padding: 0px; margin: 0px 0px 10px; font-stretch: normal; font-size: 12px; border: 1px solid #e1e1e1; vertical-align: middle;" /></center><span style="font-family: 宋体; line-height: 24px; background-color: #f6f6f4;">　　显示桌面，在Win7系统里实际上是两种状态，一种是将鼠标移动到右下角的&#8220;显示桌面&#8221;后不点击鼠标，此时显示的桌面仅用于快速预览，当鼠标移开这个位置时恢复桌面窗口状体；另一种是移动鼠标到显示桌面后单击鼠标，此时是完全显示桌面，移动鼠标后窗口也不再恢复。</span><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;"></p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;">　　而&#8220; Win + 空格键&#8221;，仅仅实现了第一种，即快速预览显示桌面，其动作是，按下快捷键显示桌面，松开后恢复；第二种完全显示桌面，我们可以使用&#8220; Win + D &#8221;键，按下后，直接最小化所有窗口，显示桌面，再次按下即打开刚才的所有窗口。</p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;">　　3、Win + Tab ：3D窗口的切换</p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;"></p><center style="padding: 0px; margin: 0px; font-stretch: normal; line-height: normal; font-family: 宋体; background-color: #f6f6f4;"><img src="http://myarticle.enet.com.cn/images/2012/1010/1349879757026.jpg" border="0" alt="Win7技巧汇 10个提高工作效率的快捷键" style="padding: 0px; margin: 0px 0px 10px; font-stretch: normal; font-size: 12px; border: 1px solid #e1e1e1; vertical-align: middle;" /></center><span style="font-family: 宋体; line-height: 24px; background-color: #f6f6f4;">　　上面这个图，相信很多人也都见过，这也是很多人感觉到Win7很酷的一个界面，其实就是窗口切换。操作方法是：按住Win键，再按Tab键，逐次切换。</span><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;"></p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;">　　其实在Win7系统里，关于窗口的操作有很多，比如窗口的预览，窗口的切换，显示的效果也不尽相同，但都是为了快速浏览并打开需要的窗口。</p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;">　　这里还有一个组合键： Alt + Tab ，也是窗口切换，其显示的效果如下：</p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;"></p><center style="padding: 0px; margin: 0px; font-stretch: normal; line-height: normal; font-family: 宋体; background-color: #f6f6f4;"><img src="http://myarticle.enet.com.cn/images/2012/1010/1349879764837.jpg" border="0" alt="Win7技巧汇 10个提高工作效率的快捷键" style="padding: 0px; margin: 0px 0px 10px; font-stretch: normal; font-size: 12px; border: 1px solid #e1e1e1; vertical-align: middle;" /></center><span style="font-family: 宋体; line-height: 24px; background-color: #f6f6f4;">　　通过 Alt + Tab 快捷键调出的窗口，是一个缩略的预览效果，在缩略图上只要滑动鼠标到当前窗口即可快速显示激活窗口。</span><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;"></p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;">　　4、Win + 数字1-0 (主键盘字母区上方的)</p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;">　　这套快捷键可以启动Windows 7任务栏上从左起第一个到第十个程序，若对应程序已经启动则可以切换到该程序的窗口，假如这个窗口有多个相似窗口，重复按同一个数字可以在这些窗口里循环。</p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;">　　这些组合键可以说是配合Windows 7任务栏而专门设计的。不知道有多少朋友把Windows 7的任务栏物尽其用了，如果还像以前那样任务栏在没有程序运行轻快下一片空白的话，就有点可惜了。把堆放在桌面上常用程序快捷方式移到任务栏上去吧，以后要启动什么程序，只要按一下 Win + 对应的数字就可以了。</p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;">　　5、Win + Home ：最小化当前窗口背后的窗口</p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;">　　听上去有些拗口。一般我们会打开多个窗口，想要最小化其中的一部分窗口，只能一个个最小化，但可能你正在专心于一个PS的设计，其他窗口也许会影响到你，不妨按下Win + Home ，除了你的PS，其他窗口都让他们最小化吧。</p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;">　　6、Win + 上&#8593; / 下&#8595; （方向键）：窗口最大化、最小化、还原的切换</p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;">　　这组快捷键，应该算是实现了三种功能：当前窗口若是最大化，按 &#8220;Win + &#8595; &#8221;可以还原到窗口状态；再按一次，则最小化到任务栏；当前窗口若是可调节状态，按Win + &#8593; 则可最大化窗口。</p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;">　　窗口最小化后，该组快捷键不可再恢复窗口。</p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;">　　Win + 左&#8592; / 右&#8594; （方向键）</p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;"></p><center style="padding: 0px; margin: 0px; font-stretch: normal; line-height: normal; font-family: 宋体; background-color: #f6f6f4;"><img src="http://myarticle.enet.com.cn/images/2012/1010/1349879769234.jpg" border="0" alt="Win7技巧汇 10个提高工作效率的快捷键" style="padding: 0px; margin: 0px 0px 10px; font-stretch: normal; font-size: 12px; border: 1px solid #e1e1e1; vertical-align: middle;" /></center><span style="font-family: 宋体; line-height: 24px; background-color: #f6f6f4;">　　这组快捷键也是一个循环，在当前窗口下，按下Win + &#8592; / &#8594; 后，可以让当前窗口占据左或右半个屏幕(根据左右键来决定)，在拥有多个显示器的情况下，连续按同一个方向键，可以让窗口移动到另一个显示器上。</span><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;"></p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;">　　对于经常要比对两份文档的朋友来说，善用这个快捷键可以避免文档之间来回切换问题，使用这个功能对显示器稍许有一点要求，最好有1440*900或者更高的宽屏分辨率(1680*1050是个比较理想的分辨率)，这样可以让文档内容完整显示出来而不需要左右卷动。</p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;">　　关于Win键，我们主要说了与窗口相关的应用，当然，它还有其他应用，但就快捷高效来说，了解这些已经十分贴心。下面我们再来看看其他与效率相关的快捷键。</p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;">　　7、Alt + P ：在资源管理器里 开启/关闭预览窗格</p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;"></p><center style="padding: 0px; margin: 0px; font-stretch: normal; line-height: normal; font-family: 宋体; background-color: #f6f6f4;"><img src="http://myarticle.enet.com.cn/images/2012/1010/1349879775690.jpg" border="0" alt="Win7技巧汇 10个提高工作效率的快捷键" style="padding: 0px; margin: 0px 0px 10px; font-stretch: normal; font-size: 12px; border: 1px solid #e1e1e1; vertical-align: middle;" /></center><span style="font-family: 宋体; line-height: 24px; background-color: #f6f6f4;">　　在Windows资源管理器里按下 Alt + P 可以快速开启/关闭预览窗格，通过预览窗格可以快速查看选中的文件。鼠标操作的话，则需要依次点击资源管理器上的&#8220;组织&#8221;&#8211;&#8220;布局&#8221;，然后选中或取消&#8220;预览窗格&#8221;选项。</span><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;"></p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;">　　除了用作查看图片外，该预览窗格还可以对多种文档进行即时预览，包括 TXT文本，Word、Excel等Office文档(前提是已安装了Office)。如果说图片预览还有很多看图类软件可以代替的话，那么文档预览功能无疑要更为实用，寻找某份文档的时候也不用逐个打开来辨别了。</p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;">　　8、Ctrl + Shift + N ：新建文件夹</p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;">　　在文件夹窗口中按下Ctrl + Shift + N组合键，可以快速建立一个文件夹，如果是在IE9浏览器中按下这组键，则是在新窗口中打开新标签。</p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;">　　9、Ctrl+Shift+Esc：快速打开Windows任务管理器</p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;"></p><center style="padding: 0px; margin: 0px; font-stretch: normal; line-height: normal; font-family: 宋体; background-color: #f6f6f4;"><img src="http://myarticle.enet.com.cn/images/2012/1010/1349879781767.jpg" border="0" alt="Win7技巧汇 10个提高工作效率的快捷键" style="padding: 0px; margin: 0px 0px 10px; font-stretch: normal; font-size: 12px; border: 1px solid #e1e1e1; vertical-align: middle;" /></center><span style="font-family: 宋体; line-height: 24px; background-color: #f6f6f4;">　　在Win7中，想打开任务管理器，可以用鼠标右键点击任务栏中的空白处，然后在弹出菜单中选择&#8220;启动任务管理器&#8221;，或者按 Ctrl+Alt+Del锁定屏幕，再点击锁定界面中的&#8220;启动任务管理器&#8221;。而Ctrl+Shift+Esc快捷键，可以在任何情况下直接打开任务管理器。</span><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;"></p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;">　　10、Ctrl + Shift + Enter(或鼠标双击)：以管理员身份运行</p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;"></p><center style="padding: 0px; margin: 0px; font-stretch: normal; line-height: normal; font-family: 宋体; background-color: #f6f6f4;"><img src="http://myarticle.enet.com.cn/images/2012/1010/1349879789242.jpg" border="0" alt="Win7技巧汇 10个提高工作效率的快捷键" style="padding: 0px; margin: 0px 0px 10px; font-stretch: normal; font-size: 12px; border: 1px solid #e1e1e1; vertical-align: middle;" /></center><span style="font-family: 宋体; line-height: 24px; background-color: #f6f6f4;">　　这个组合键的用途在于直接以管理员身份运行某个程序。</span><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;"></p><p style="padding: 0px; margin: 13px 0px; font-stretch: normal; line-height: 25px; font-family: 宋体; word-break: break-all; background-color: #f6f6f4;">　　Windows 7一个比较特殊的地方在于，会经常要用到&#8220;以管理员身份运行&#8221;程序，一般我们会通过右键选择，如果不想使用右键的话，在双击程序前，按住 Ctrl + Shift 再点击程序就能直接以管理员身份运行。<a href="http://www.enet.com.cn/" style="padding: 0px; margin: 0px; font-stretch: normal; font-size: 12px; line-height: normal; text-decoration: none; color: #000000;"><br /><br />原文</a>地址：<br /></p><div>http://www.enet.com.cn/article/2012/1011/A20121011173415.shtml</div><img src ="http://www.cppblog.com/Hero/aggbug/213241.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Hero/" target="_blank">Hero</a> 2016-04-12 11:03 <a href="http://www.cppblog.com/Hero/archive/2016/04/12/213241.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Tomcat Manager用户配置</title><link>http://www.cppblog.com/Hero/archive/2015/10/29/212146.html</link><dc:creator>Hero</dc:creator><author>Hero</author><pubDate>Thu, 29 Oct 2015 07:54:00 GMT</pubDate><guid>http://www.cppblog.com/Hero/archive/2015/10/29/212146.html</guid><wfw:comment>http://www.cppblog.com/Hero/comments/212146.html</wfw:comment><comments>http://www.cppblog.com/Hero/archive/2015/10/29/212146.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Hero/comments/commentRss/212146.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Hero/services/trackbacks/212146.html</trackback:ping><description><![CDATA[<p style="margin: 1.2em 0px 1.3em; padding: 0px; border: 0px; outline: 0px; font-size: 13px; vertical-align: baseline; color: #333333; font-family: 'Courier New', 宋体, 'Times New Roman', serif; line-height: 19.5px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">Tomcat Manager是Tomcat自带的、用于对Tomcat自身以及部署在Tomcat上的应用进行管理的web应用。Tomcat是Java领域使用最广泛的服务器之一，因此Tomcat Manager也成为了使用非常普遍的功能应用。</p><p style="margin: 1.2em 0px 1.3em; padding: 0px; border: 0px; outline: 0px; font-size: 13px; vertical-align: baseline; color: #333333; font-family: 'Courier New', 宋体, 'Times New Roman', serif; line-height: 19.5px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">在默认情况下，Tomcat Manager是处于禁用状态的。准确地说，Tomcat Manager需要以用户角色进行登录并授权才能使用相应的功能，不过Tomcat并没有配置任何默认的用户，因此需要我们进行相应的用户配置之后才能使用Tomcat Manager。</p><p style="margin: 1.2em 0px 1.3em; padding: 0px; border: 0px; outline: 0px; font-size: 13px; vertical-align: baseline; color: #333333; font-family: 'Courier New', 宋体, 'Times New Roman', serif; line-height: 19.5px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">Tomcat Manager的用户配置是在<code style="margin: 0px 3px; padding: 1px 4px; border: 1px solid #e1e1e8; outline: 0px; vertical-align: baseline; font-family: Consolas, Monaco, Menlo, 宋体; color: #dd1144; border-radius: 3px; background: #f7f7f9;">Tomcat安装目录/conf/tomcat-users.xml</code>文件中进行管理的。</p><p style="margin: 1.2em 0px 1.3em; padding: 0px; border: 0px; outline: 0px; font-size: 13px; vertical-align: baseline; color: #333333; font-family: 'Courier New', 宋体, 'Times New Roman', serif; line-height: 19.5px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">Tomcat Manager的用户配置非常简单，下面我们以一个具体的配置为例：</p><pre linenum"="" style="margin-top: 0px; margin-bottom: 20px; padding: 10px; border: 1px solid #999999; outline: 0px; font-size: 12px; vertical-align: baseline; word-wrap: break-word; word-break: break-all; overflow: auto; position: relative; color: #333333; font-stretch: normal; line-height: 1.5; font-family: 'Courier New', Consola, SimSun; border-radius: 8px; -webkit-box-shadow: #999999 0px 2px 4px; box-shadow: #999999 0px 2px 4px; background: #f7f7f7;"><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #880000; background: transparent;">&lt;tomcat-users&gt;</span><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #000000; background: transparent;"><br /></span><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #880000; background: transparent;">&lt;role</span> <span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: red; background: transparent;">rolename</span><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #666600; background: transparent;">=</span><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #0000ff; background: transparent;">"manager-gui"</span><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #880000; background: transparent;">/&gt;</span><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #000000; background: transparent;"><br /></span><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #880000; background: transparent;">&lt;role</span> <span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: red; background: transparent;">rolename</span><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #666600; background: transparent;">=</span><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #0000ff; background: transparent;">"manager-script"</span><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #880000; background: transparent;">/&gt;</span><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #000000; background: transparent;"><br /></span><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #880000; background: transparent;">&lt;user</span> <span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: red; background: transparent;">username</span><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #666600; background: transparent;">=</span><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #0000ff; background: transparent;">"tomcat"</span> <span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: red; background: transparent;">password</span><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #666600; background: transparent;">=</span><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #0000ff; background: transparent;">"tomcat"</span> <span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: red; background: transparent;">roles</span><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #666600; background: transparent;">=</span><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #0000ff; background: transparent;">"manager-gui"</span><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #880000; background: transparent;">/&gt;</span><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #000000; background: transparent;"><br /></span><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #880000; background: transparent;">&lt;user</span> <span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: red; background: transparent;">username</span><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #666600; background: transparent;">=</span><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #0000ff; background: transparent;">"<span id="2_nwp" style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; width: auto; height: auto; float: none; background: transparent;"><a id="2_nwl" href="http://cpro.baidu.com/cpro/ui/uijs.php?adclass=0&amp;app_id=0&amp;c=news&amp;cf=1001&amp;ch=0&amp;di=128&amp;fv=18&amp;is_app=0&amp;jk=afd7f39aa3cae07f&amp;k=admin&amp;k0=admin&amp;kdi0=0&amp;luki=1&amp;n=10&amp;p=baidu&amp;q=97086099_cpr&amp;rb=0&amp;rs=1&amp;seller_id=1&amp;sid=7fe0caa39af3d7af&amp;ssp2=1&amp;stid=0&amp;t=tpclicked3_hc&amp;td=1691595&amp;tu=u1691595&amp;u=http%3A%2F%2Fwww%2E365mini%2Ecom%2Fpage%2Ftomcat%2Dmanager%2Duser%2Dconfiguration%2Ehtm&amp;urlid=0" target="_blank" mpid="2" style="color: #660099; text-decoration: none;"><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #0000ff; width: auto; height: auto; background: transparent;">admin</span></a></span>"</span> <span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: red; background: transparent;">password</span><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #666600; background: transparent;">=</span><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #0000ff; background: transparent;">"123456"</span> <span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: red; background: transparent;">roles</span><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #666600; background: transparent;">=</span><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #0000ff; background: transparent;">"manager-script"</span><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #880000; background: transparent;">/&gt;</span><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #000000; background: transparent;"><br /></span><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #880000; background: transparent;">&lt;/tomcat-users&gt;</span></pre><p style="margin: 1.2em 0px 1.3em; padding: 0px; border: 0px; outline: 0px; font-size: 13px; vertical-align: baseline; color: #333333; font-family: 'Courier New', 宋体, 'Times New Roman', serif; line-height: 19.5px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">如上所示，我们只需要在<code style="margin: 0px 3px; padding: 1px 4px; border: 1px solid #e1e1e8; outline: 0px; vertical-align: baseline; font-family: Consolas, Monaco, Menlo, 宋体; color: #dd1144; border-radius: 3px; background: #f7f7f9;">tomcat-users</code>节点中配置相应的<code style="margin: 0px 3px; padding: 1px 4px; border: 1px solid #e1e1e8; outline: 0px; vertical-align: baseline; font-family: Consolas, Monaco, Menlo, 宋体; color: #dd1144; border-radius: 3px; background: #f7f7f9;">role</code>(角色/权限)和<code style="margin: 0px 3px; padding: 1px 4px; border: 1px solid #e1e1e8; outline: 0px; vertical-align: baseline; font-family: Consolas, Monaco, Menlo, 宋体; color: #dd1144; border-radius: 3px; background: #f7f7f9;">user</code>(用户)即可。一个<code style="margin: 0px 3px; padding: 1px 4px; border: 1px solid #e1e1e8; outline: 0px; vertical-align: baseline; font-family: Consolas, Monaco, Menlo, 宋体; color: #dd1144; border-radius: 3px; background: #f7f7f9;">user</code>节点表示单个用户，属性<code style="margin: 0px 3px; padding: 1px 4px; border: 1px solid #e1e1e8; outline: 0px; vertical-align: baseline; font-family: Consolas, Monaco, Menlo, 宋体; color: #dd1144; border-radius: 3px; background: #f7f7f9;">username</code>和<code style="margin: 0px 3px; padding: 1px 4px; border: 1px solid #e1e1e8; outline: 0px; vertical-align: baseline; font-family: Consolas, Monaco, Menlo, 宋体; color: #dd1144; border-radius: 3px; background: #f7f7f9;">password</code>分别表示登录的用户名和密码，属性<code style="margin: 0px 3px; padding: 1px 4px; border: 1px solid #e1e1e8; outline: 0px; vertical-align: baseline; font-family: Consolas, Monaco, Menlo, 宋体; color: #dd1144; border-radius: 3px; background: #f7f7f9;">roles</code>表示该用户所具备的权限。</p><p style="margin: 1.2em 0px 1.3em; padding: 0px; border: 0px; outline: 0px; font-size: 13px; vertical-align: baseline; color: #333333; font-family: 'Courier New', 宋体, 'Times New Roman', serif; line-height: 19.5px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;"><code style="margin: 0px 3px; padding: 1px 4px; border: 1px solid #e1e1e8; outline: 0px; vertical-align: baseline; font-family: Consolas, Monaco, Menlo, 宋体; color: #dd1144; border-radius: 3px; background: #f7f7f9;">user</code>节点的<code style="margin: 0px 3px; padding: 1px 4px; border: 1px solid #e1e1e8; outline: 0px; vertical-align: baseline; font-family: Consolas, Monaco, Menlo, 宋体; color: #dd1144; border-radius: 3px; background: #f7f7f9;">roles</code>属性值与<code style="margin: 0px 3px; padding: 1px 4px; border: 1px solid #e1e1e8; outline: 0px; vertical-align: baseline; font-family: Consolas, Monaco, Menlo, 宋体; color: #dd1144; border-radius: 3px; background: #f7f7f9;">role</code>节点的<code style="margin: 0px 3px; padding: 1px 4px; border: 1px solid #e1e1e8; outline: 0px; vertical-align: baseline; font-family: Consolas, Monaco, Menlo, 宋体; color: #dd1144; border-radius: 3px; background: #f7f7f9;">rolename</code>属性值相对应，表示当前用户具备该role节点所表示的角色权限。当然，一个用户可以具备多种权限，因此属性<code style="margin: 0px 3px; padding: 1px 4px; border: 1px solid #e1e1e8; outline: 0px; vertical-align: baseline; font-family: Consolas, Monaco, Menlo, 宋体; color: #dd1144; border-radius: 3px; background: #f7f7f9;">roles</code>的值可以是多个<code style="margin: 0px 3px; padding: 1px 4px; border: 1px solid #e1e1e8; outline: 0px; vertical-align: baseline; font-family: Consolas, Monaco, Menlo, 宋体; color: #dd1144; border-radius: 3px; background: #f7f7f9;">rolename</code>，多个<code style="margin: 0px 3px; padding: 1px 4px; border: 1px solid #e1e1e8; outline: 0px; vertical-align: baseline; font-family: Consolas, Monaco, Menlo, 宋体; color: #dd1144; border-radius: 3px; background: #f7f7f9;">rolename</code>之间以英文逗号隔开即可。</p><p style="margin: 1.2em 0px 1.3em; padding: 0px; border: 0px; outline: 0px; font-size: 13px; vertical-align: baseline; color: #333333; font-family: 'Courier New', 宋体, 'Times New Roman', serif; line-height: 19.5px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">稍加思考，我们就应该猜测到，<code style="margin: 0px 3px; padding: 1px 4px; border: 1px solid #e1e1e8; outline: 0px; vertical-align: baseline; font-family: Consolas, Monaco, Menlo, 宋体; color: #dd1144; border-radius: 3px; background: #f7f7f9;">rolename</code>的属性值并不是随意的内容，否则Tomcat怎么能够知道我们随便定义的<code style="margin: 0px 3px; padding: 1px 4px; border: 1px solid #e1e1e8; outline: 0px; vertical-align: baseline; font-family: Consolas, Monaco, Menlo, 宋体; color: #dd1144; border-radius: 3px; background: #f7f7f9;">rolename</code>表示什么样的权限呢。实际上，Tomcat已经为我们定义了4种不同的角色&#8212;&#8212;也就是4个<code style="margin: 0px 3px; padding: 1px 4px; border: 1px solid #e1e1e8; outline: 0px; vertical-align: baseline; font-family: Consolas, Monaco, Menlo, 宋体; color: #dd1144; border-radius: 3px; background: #f7f7f9;">rolename</code>，我们只需要使用Tomcat为我们定义的这几种角色就足够满足我们的工作需要了。</p><p style="margin: 1.2em 0px 1.3em; padding: 0px; border: 0px; outline: 0px; font-size: 13px; vertical-align: baseline; color: #333333; font-family: 'Courier New', 宋体, 'Times New Roman', serif; line-height: 19.5px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">以下是Tomcat Manager 4种角色的大致介绍(下面URL中的*为通配符)：</p><dl style="margin: 1em 0px; color: #333333; font-family: 'Courier New', 宋体, 'Times New Roman', serif; font-size: 13px; line-height: 19.5px;"><dt style="margin-top: 0px; color: #008800;">manager-gui</dt><dd style="margin-top: 1px; margin-bottom: 0.5em;">允许访问html接口(即URL路径为/manager/html/*)</dd><dt style="margin-top: 0px; color: #008800;">manager-script</dt><dd style="margin-top: 1px; margin-bottom: 0.5em;">允许访问纯文本接口(即URL路径为/manager/text/*)</dd><dt style="margin-top: 0px; color: #008800;">manager-jmx</dt><dd style="margin-top: 1px; margin-bottom: 0.5em;">允许访问JMX<span id="1_nwp" style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; width: auto; height: auto; float: none; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;"><a id="1_nwl" href="http://cpro.baidu.com/cpro/ui/uijs.php?adclass=0&amp;app_id=0&amp;c=news&amp;cf=1001&amp;ch=0&amp;di=128&amp;fv=18&amp;is_app=0&amp;jk=afd7f39aa3cae07f&amp;k=%B4%FA%C0%ED&amp;k0=%B4%FA%C0%ED&amp;kdi0=0&amp;luki=2&amp;n=10&amp;p=baidu&amp;q=97086099_cpr&amp;rb=0&amp;rs=1&amp;seller_id=1&amp;sid=7fe0caa39af3d7af&amp;ssp2=1&amp;stid=0&amp;t=tpclicked3_hc&amp;td=1691595&amp;tu=u1691595&amp;u=http%3A%2F%2Fwww%2E365mini%2Ecom%2Fpage%2Ftomcat%2Dmanager%2Duser%2Dconfiguration%2Ehtm&amp;urlid=0" target="_blank" mpid="1" style="color: #660099; text-decoration: none;"><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #0000ff; width: auto; height: auto; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">代理</span></a></span>接口(即URL路径为/manager/jmxproxy/*)</dd><dt style="margin-top: 0px; color: #008800;">manager-status</dt><dd style="margin-top: 1px; margin-bottom: 0.5em;">允许访问Tomcat只读状态页面(即URL路径为/manager/status/*)</dd></dl><p style="margin: 1.2em 0px 1.3em; padding: 0px; border: 0px; outline: 0px; font-size: 13px; vertical-align: baseline; color: #333333; font-family: 'Courier New', 宋体, 'Times New Roman', serif; line-height: 19.5px; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">从Tomcat Manager内部配置文件中可以得知，<code style="margin: 0px 3px; padding: 1px 4px; border: 1px solid #e1e1e8; outline: 0px; vertical-align: baseline; font-family: Consolas, Monaco, Menlo, 宋体; color: #dd1144; border-radius: 3px; background: #f7f7f9;">manager-gui</code>、<code style="margin: 0px 3px; padding: 1px 4px; border: 1px solid #e1e1e8; outline: 0px; vertical-align: baseline; font-family: Consolas, Monaco, Menlo, 宋体; color: #dd1144; border-radius: 3px; background: #f7f7f9;">manager-script</code>、<code style="margin: 0px 3px; padding: 1px 4px; border: 1px solid #e1e1e8; outline: 0px; vertical-align: baseline; font-family: Consolas, Monaco, Menlo, 宋体; color: #dd1144; border-radius: 3px; background: #f7f7f9;">manager-jmx</code>均具备<code style="margin: 0px 3px; padding: 1px 4px; border: 1px solid #e1e1e8; outline: 0px; vertical-align: baseline; font-family: Consolas, Monaco, Menlo, 宋体; color: #dd1144; border-radius: 3px; background: #f7f7f9;">manager-status</code>的权限，也就是说，<code style="margin: 0px 3px; padding: 1px 4px; border: 1px solid #e1e1e8; outline: 0px; vertical-align: baseline; font-family: Consolas, Monaco, Menlo, 宋体; color: #dd1144; border-radius: 3px; background: #f7f7f9;">manager-gui</code>、<code style="margin: 0px 3px; padding: 1px 4px; border: 1px solid #e1e1e8; outline: 0px; vertical-align: baseline; font-family: Consolas, Monaco, Menlo, 宋体; color: #dd1144; border-radius: 3px; background: #f7f7f9;">manager-script</code>、<code style="margin: 0px 3px; padding: 1px 4px; border: 1px solid #e1e1e8; outline: 0px; vertical-align: baseline; font-family: Consolas, Monaco, Menlo, 宋体; color: #dd1144; border-radius: 3px; background: #f7f7f9;">manager-jmx</code>三种角色权限无需再额外添加<code style="margin: 0px 3px; padding: 1px 4px; border: 1px solid #e1e1e8; outline: 0px; vertical-align: baseline; font-family: Consolas, Monaco, Menlo, 宋体; color: #dd1144; border-radius: 3px; background: #f7f7f9;">manager-status</code>权限，即可直接访问路径<q style="margin: 0px; padding: 0px; border: 1px dotted #778855; outline: 0px; vertical-align: baseline; background: none 0px 0px repeat scroll #f5f5f5;">/manager/<span id="0_nwp" style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; width: auto; height: auto; float: none; background: transparent;"><a id="0_nwl" href="http://cpro.baidu.com/cpro/ui/uijs.php?adclass=0&amp;app_id=0&amp;c=news&amp;cf=1001&amp;ch=0&amp;di=128&amp;fv=18&amp;is_app=0&amp;jk=afd7f39aa3cae07f&amp;k=status&amp;k0=status&amp;kdi0=0&amp;luki=5&amp;n=10&amp;p=baidu&amp;q=97086099_cpr&amp;rb=0&amp;rs=1&amp;seller_id=1&amp;sid=7fe0caa39af3d7af&amp;ssp2=1&amp;stid=0&amp;t=tpclicked3_hc&amp;td=1691595&amp;tu=u1691595&amp;u=http%3A%2F%2Fwww%2E365mini%2Ecom%2Fpage%2Ftomcat%2Dmanager%2Duser%2Dconfiguration%2Ehtm&amp;urlid=0" target="_blank" mpid="0" style="color: #660099; text-decoration: none;"><span style="margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: baseline; color: #0000ff; width: auto; height: auto; background: transparent;">status</span></a></span>/*</q>。</p><img src ="http://www.cppblog.com/Hero/aggbug/212146.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Hero/" target="_blank">Hero</a> 2015-10-29 15:54 <a href="http://www.cppblog.com/Hero/archive/2015/10/29/212146.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>【hibernate】hbm2ddl.auto配置详解</title><link>http://www.cppblog.com/Hero/archive/2015/08/26/211687.html</link><dc:creator>Hero</dc:creator><author>Hero</author><pubDate>Wed, 26 Aug 2015 07:19:00 GMT</pubDate><guid>http://www.cppblog.com/Hero/archive/2015/08/26/211687.html</guid><wfw:comment>http://www.cppblog.com/Hero/comments/211687.html</wfw:comment><comments>http://www.cppblog.com/Hero/archive/2015/08/26/211687.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Hero/comments/commentRss/211687.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Hero/services/trackbacks/211687.html</trackback:ping><description><![CDATA[<div style="border:none;border-bottom:solid #4F81BD 1.0pt;padding:0cm 0cm 4.0pt 0cm">  <p><span style="font-family: Courier;"></span></p></div><div style="border:none;border-bottom:solid #4F81BD 1.0pt;padding:0cm 0cm 4.0pt 0cm">  <h1 style="text-align: center; ">hibernate.hbm2ddl.auto<span style="font-family:宋体;">配置详解</span></h1>  </div>  <h1>一、<span style="font-weight: normal; font-stretch: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="font-family:宋体;">配置使用方式</span></h1>  <p>hibernate.cfg.xml <span style="font-family:宋体;Courier New&quot;;Courier New&quot;">中</span>hibernate.hbm2ddl.auto<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">配置节点如下：</span></p>  <div style="border:solid windowtext 1.0pt;padding:1.0pt 4.0pt 1.0pt 4.0pt; background:#CCCCCC;">  <p style="border: none; padding: 0cm; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;"><span style="background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">&lt;properties&gt;<br /> &nbsp; &lt;property name="hibernate.show_sql" value="true" /&gt;</span>&nbsp;<span style="background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;"><br /> &nbsp; &lt;property name="hibernate.hbm2ddl.auto" value="create" /&gt;<br /> &lt;/properties&gt;</span></p>  </div>  <h1>二、<span style="font-weight: normal; font-stretch: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="font-family:宋体;">官方解释</span></h1>  <p>Hibernate Reference Documentation 3.3.1<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">解释如下：</span><br /> Automatically validate or export schema DDL to the database when the SessionFactory is created.With create-drop, the database schema will be dropped when the SessionFactory is closed explicitly.<br /> eg. validate | update | create | create-drop</p>  <h1>三、<span style="font-weight: normal; font-stretch: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="font-family:宋体;">自己理解</span></h1>  <p><span style="font-family:宋体;Courier New&quot;;Courier New&quot;">其实这个</span>hibernate.hbm2ddl.auto<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">参数的作用主要用于：</span></p>  <p><span style="font-family:宋体;Courier New&quot;;Courier New&quot;">自动创建</span>|<span style="font-family: 宋体;Courier New&quot;;Courier New&quot;">更新</span>|<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">验证数据库表结构。</span></p>  <p><span style="font-family:宋体;Courier New&quot;;Courier New&quot;">如果不是此方面的需求建议不配置该条语句。</span></p>  <h2>1.<span style="font-weight: normal; font-stretch: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>create<span style="font-family:宋体;">：</span></h2>  <p><span style="font-family:宋体;Courier New&quot;;Courier New&quot;">每次加载</span>hibernate<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">时都会删除上一次的生成的表，然后根据你的</span>model<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">类再重新来生成新表，哪怕两次没有任何改变也要这样执行，这就是导致数据库表数据丢失的一个重要原因。</span></p>  <h2>2.<span style="font-weight: normal; font-stretch: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>create-drop <span style="font-family:宋体;">：</span></h2>  <p><span style="font-family:宋体;Courier New&quot;;Courier New&quot;">每次加载</span>hibernate<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">时根据</span>model<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">类生成表，但是</span>SessionFactory<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">一关闭</span>,<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">表就自动删除。</span></p>  <h2>3.<span style="font-weight: normal; font-stretch: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>update<span style="font-family:宋体;">：</span></h2>  <p><span style="font-family:宋体;Courier New&quot;;Courier New&quot;">最常用的属性，第一次加载</span>hibernate<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">时根据</span>model<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">类会自动建立起表的结构（前提是先建立好数据库），以后加载</span>hibernate<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">时根据</span> model<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">类自动更新表结构，即使表结构改变了但表中的行仍然存在不会删除以前的行。要注意的是当部署到服务器后，表结构是不会被马上建立起来的，是要等</span> <span style="font-family:宋体;Courier New&quot;;Courier New&quot;">应用第一次运行起来后才会。</span></p>  <h2>4.<span style="font-weight: normal; font-stretch: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>validate <span style="font-family:宋体;">：</span></h2>  <p><span style="font-family:宋体;Courier New&quot;;Courier New&quot;">每次加载</span>hibernate<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">时，验证创建数据库表结构，只会和数据库中的表进行比较，不会创建新表，但是会插入新值。</span></p>  <h1>四、<span style="font-weight: normal; font-stretch: normal; font-size: 7pt; line-height: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="font-family:宋体;">小结</span></h1>  <p><span style="font-family:宋体;Courier New&quot;;Courier New&quot;">当我们把</span>hibernate.hbm2ddl.auto=create<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">时</span>hibernate<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">先用</span>hbm2ddl<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">来生成数据库</span>schema<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">。</span></p>  <p><span style="font-family:宋体;Courier New&quot;;Courier New&quot;">当我们把</span>hibernate.cfg.xml<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">文件中</span>hbm2ddl<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">属性注释掉，这样我们就取消了在启动时用</span>hbm2ddl<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">来生成数据库</span>schema<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">。通常只有在不断重复进行单元测试的时候才需要打开它，但再次运行</span>hbm2ddl<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">会把你保存的一切都删除掉（</span>drop<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">）</span>---- create<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">配置的含义是：&#8220;在创建</span>SessionFactory<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">的时候，从</span>scema<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">中</span>drop<span style="font-family: 宋体;Courier New&quot;;Courier New&quot;">掉所以的表，再重新创建它们&#8221;。</span></p>  <p><span style="font-family:宋体;Courier New&quot;;Courier New&quot;;color:red">我们在项目中使用</span><span style="color:red">Hibernate</span><span style="font-family:宋体;Courier New&quot;;Courier New&quot;; color:red">映射</span><span style="color:red">oracle</span><span style="font-family:宋体;Courier New&quot;;Courier New&quot;; color:red">的视图的时候，发现会出现某种特殊条件下</span><span style="color:red">hibernate</span><span style="font-family:宋体;Courier New&quot;;Courier New&quot;; color:red">自动创建了一张和视图同名的</span><span style="color:red">Table</span><span style="font-family:宋体;Courier New&quot;;Courier New&quot;; color:red">，导致获取视图信息时，实际上获取的总是空表中的内容。</span></p>  <p><span style="font-family:宋体;Courier New&quot;;Courier New&quot;">注意，很多</span>Hibernate<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">新手在这一步会失败，我们不时看到关于</span>Table not found<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">错误信息的提问。但是，只要你根据上面描述的步骤来执行，就不会有这个问题，因为</span>hbm2ddl<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">会在第一次运行的时候创建数据库</span>schema<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">，</span> <span style="font-family:宋体;Courier New&quot;;Courier New&quot;">后续的应用程序重启后还能继续使用这个</span>schema<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">。假若你修改了映射，或者修改了数据库</span>schema,<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">你必须把</span>hbm2ddl<span style="font-family:宋体;Courier New&quot;;Courier New&quot;">重新打开一次。</span></p><p><span style="font-family: Courier;"></span></p><img src ="http://www.cppblog.com/Hero/aggbug/211687.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Hero/" target="_blank">Hero</a> 2015-08-26 15:19 <a href="http://www.cppblog.com/Hero/archive/2015/08/26/211687.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转载]21副GIF动图让你了解各种数学概念</title><link>http://www.cppblog.com/Hero/archive/2015/06/03/210816.html</link><dc:creator>Hero</dc:creator><author>Hero</author><pubDate>Wed, 03 Jun 2015 12:24:00 GMT</pubDate><guid>http://www.cppblog.com/Hero/archive/2015/06/03/210816.html</guid><wfw:comment>http://www.cppblog.com/Hero/comments/210816.html</wfw:comment><comments>http://www.cppblog.com/Hero/archive/2015/06/03/210816.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/Hero/comments/commentRss/210816.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Hero/services/trackbacks/210816.html</trackback:ping><description><![CDATA[<p class="copyright-area" style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 10px; padding-top: 10px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 10px; margin: 0px 0px 10px; border-left: 0px; letter-spacing: normal; padding-right: 10px; background-color: rgb(240,240,240); text-indent: 0px; -webkit-text-stroke-width: 0px"><img style="font-size: 0px; max-width: 100%; border-top: 0px; height: auto; border-right: 0px; vertical-align: middle; border-bottom: 0px; color: transparent; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" alt="" src="http://www.cppblog.com/Hero/admin/21副GIF动图让你了解各种数学概念%20-%20博客%20-%20伯乐在线_files/6941baebgw1elptndev8yj20fk09l432.jpg" /></p>
<blockquote style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: italic 14px/21px 'Noticia Text', Georgia, serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px">
<p style="font-size: 14px; border-top: 0px; border-right: 0px; border-bottom: 0px; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; padding-right: 0px">&#8220;让我们面对它；总的来说数学是不容易的，但当你征服了问题，并达到新的理解高度，这就是它给你的回报。&#8221;</p>
<p style="font-size: 14px; border-top: 0px; border-right: 0px; border-bottom: 0px; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; padding-right: 0px">&#8212;&#8212;Danica McKellar</p></blockquote>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px">数学是很难的学科，但因为它是科学家用数学来解释宇宙的语言，我们无可避免的要学习它。看看下面的这些 GIF 动图，它们提供了视觉的方式来帮助你理解各种数学技巧。</p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><strong style="font-size: 14px; border-top: 0px; border-right: 0px; border-bottom: 0px; font-weight: bold; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px">1、椭圆的画法</strong></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><img style="font-size: 0px; max-width: 100%; border-top: 0px; height: auto; border-right: 0px; vertical-align: middle; border-bottom: 0px; color: transparent; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" alt="" src="http://www.cppblog.com/Hero/admin/21副GIF动图让你了解各种数学概念%20-%20博客%20-%20伯乐在线_files/6941baebgw1elptnbnitzg20e207xjyg.gif" /></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><strong style="font-size: 14px; border-top: 0px; border-right: 0px; border-bottom: 0px; font-weight: bold; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px">2、杨辉三角问题(Pascal triangles)解法</strong></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><img style="font-size: 0px; max-width: 100%; border-top: 0px; height: auto; border-right: 0px; vertical-align: middle; border-bottom: 0px; color: transparent; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" alt="" src="http://www.cppblog.com/Hero/admin/21副GIF动图让你了解各种数学概念%20-%20博客%20-%20伯乐在线_files/6941baebgw1elptnaa3v9g207806o3z0.gif" /></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><strong style="font-size: 14px; border-top: 0px; border-right: 0px; border-bottom: 0px; font-weight: bold; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px">3、使用&#8220;FOIL&#8221;轻松的解决二项式乘法</strong></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><img style="font-size: 0px; max-width: 100%; border-top: 0px; height: auto; border-right: 0px; vertical-align: middle; border-bottom: 0px; color: transparent; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" alt="" src="http://www.cppblog.com/Hero/admin/21副GIF动图让你了解各种数学概念%20-%20博客%20-%20伯乐在线_files/6941baebgw1elptn9dydag20gw082wfd.gif" /></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><strong style="font-size: 14px; border-top: 0px; border-right: 0px; border-bottom: 0px; font-weight: bold; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px">4、对数解法技巧</strong></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><img style="font-size: 0px; max-width: 100%; border-top: 0px; height: auto; border-right: 0px; vertical-align: middle; border-bottom: 0px; color: transparent; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" alt="" src="http://www.cppblog.com/Hero/admin/21副GIF动图让你了解各种数学概念%20-%20博客%20-%20伯乐在线_files/6941baebgw1elptn8g1qkg20dw07tthi.gif" /></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><strong style="font-size: 14px; border-top: 0px; border-right: 0px; border-bottom: 0px; font-weight: bold; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px">5、矩阵转置的技巧</strong></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><img style="font-size: 0px; max-width: 100%; border-top: 0px; height: auto; border-right: 0px; vertical-align: middle; border-bottom: 0px; color: transparent; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" alt="" src="http://www.cppblog.com/Hero/admin/21副GIF动图让你了解各种数学概念%20-%20博客%20-%20伯乐在线_files/6941baebgw1elptn6vzwbg205u07itam.gif" /></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><strong style="font-size: 14px; border-top: 0px; border-right: 0px; border-bottom: 0px; font-weight: bold; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px">6、勾股定理</strong></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><img style="font-size: 0px; max-width: 100%; border-top: 0px; height: auto; border-right: 0px; vertical-align: middle; border-bottom: 0px; color: transparent; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" alt="" src="http://www.cppblog.com/Hero/admin/21副GIF动图让你了解各种数学概念%20-%20博客%20-%20伯乐在线_files/6941baebgw1elptn5kxv0g20hs0a0e81.gif" /></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><strong style="font-size: 14px; border-top: 0px; border-right: 0px; border-bottom: 0px; font-weight: bold; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px">7、多边形的外角之和总是等于 360 度</strong></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><img style="font-size: 0px; max-width: 100%; border-top: 0px; height: auto; border-right: 0px; vertical-align: middle; border-bottom: 0px; color: transparent; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" alt="" src="http://www.cppblog.com/Hero/admin/21副GIF动图让你了解各种数学概念%20-%20博客%20-%20伯乐在线_files/6941baebgw1elptn1s9ahg209909l751.gif" /></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><strong style="font-size: 14px; border-top: 0px; border-right: 0px; border-bottom: 0px; font-weight: bold; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px">8、圆周率&#960;</strong></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><img style="font-size: 0px; max-width: 100%; border-top: 0px; height: auto; border-right: 0px; vertical-align: middle; border-bottom: 0px; color: transparent; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" alt="" src="http://www.cppblog.com/Hero/admin/21副GIF动图让你了解各种数学概念%20-%20博客%20-%20伯乐在线_files/6941baebgw1elptn0p8gvg20k006cadp.gif" /></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><strong style="font-size: 14px; border-top: 0px; border-right: 0px; border-bottom: 0px; font-weight: bold; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px">9、一弧度就是长度刚好等于半径的一段圆弧所对的圆心角</strong></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><img style="font-size: 0px; max-width: 100%; border-top: 0px; height: auto; border-right: 0px; vertical-align: middle; border-bottom: 0px; color: transparent; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" alt="" src="http://www.cppblog.com/Hero/admin/21副GIF动图让你了解各种数学概念%20-%20博客%20-%20伯乐在线_files/6941baebgw1elptmzigg1g20ci0cigo8.gif" /></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><strong style="font-size: 14px; border-top: 0px; border-right: 0px; border-bottom: 0px; font-weight: bold; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px">10、在Y轴上使用正弦(红色)，在X轴上使用余弦(蓝色)，则在 XY 轴平面上画出的环形如下图(黑色)</strong></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><img style="font-size: 0px; max-width: 100%; border-top: 0px; height: auto; border-right: 0px; vertical-align: middle; border-bottom: 0px; color: transparent; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" alt="" src="http://www.cppblog.com/Hero/admin/21副GIF动图让你了解各种数学概念%20-%20博客%20-%20伯乐在线_files/6941baebgw1elptmy8f5tg20dw0ettm3.gif" /></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><strong style="font-size: 14px; border-top: 0px; border-right: 0px; border-bottom: 0px; font-weight: bold; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px">11、同前一原理，但更简单</strong></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><img style="font-size: 0px; max-width: 100%; border-top: 0px; height: auto; border-right: 0px; vertical-align: middle; border-bottom: 0px; color: transparent; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" alt="" src="http://www.cppblog.com/Hero/admin/21副GIF动图让你了解各种数学概念%20-%20博客%20-%20伯乐在线_files/6941baebgw1elptmw70uag20dw08cqd6.gif" /></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><strong style="font-size: 14px; border-top: 0px; border-right: 0px; border-bottom: 0px; font-weight: bold; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px">12、这是将 sin 和 cos 运用到三角形上</strong></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><img style="font-size: 0px; max-width: 100%; border-top: 0px; height: auto; border-right: 0px; vertical-align: middle; border-bottom: 0px; color: transparent; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" alt="" src="http://www.cppblog.com/Hero/admin/21副GIF动图让你了解各种数学概念%20-%20博客%20-%20伯乐在线_files/6941baebgw1elptmu4wgqg20hg08twk9.gif" /></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><strong style="font-size: 14px; border-top: 0px; border-right: 0px; border-bottom: 0px; font-weight: bold; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px">13、余弦是正弦的衍生物</strong></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><img style="font-size: 0px; max-width: 100%; border-top: 0px; height: auto; border-right: 0px; vertical-align: middle; border-bottom: 0px; color: transparent; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" alt="" src="http://www.cppblog.com/Hero/admin/21副GIF动图让你了解各种数学概念%20-%20博客%20-%20伯乐在线_files/6941baebgw1elptmsierog20gt08imz7.gif" /></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><strong style="font-size: 14px; border-top: 0px; border-right: 0px; border-bottom: 0px; font-weight: bold; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px">14、正切线</strong></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><img style="font-size: 0px; max-width: 100%; border-top: 0px; height: auto; border-right: 0px; vertical-align: middle; border-bottom: 0px; color: transparent; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" alt="" src="http://www.cppblog.com/Hero/admin/21副GIF动图让你了解各种数学概念%20-%20博客%20-%20伯乐在线_files/6941baebgw1elptmrgxzfg20ie0goju8.gif" /></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><strong style="font-size: 14px; border-top: 0px; border-right: 0px; border-bottom: 0px; font-weight: bold; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px">15、同上，但翻个面看，更容易理解</strong></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><img style="font-size: 0px; max-width: 100%; border-top: 0px; height: auto; border-right: 0px; vertical-align: middle; border-bottom: 0px; color: transparent; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" alt="" src="http://www.cppblog.com/Hero/admin/21副GIF动图让你了解各种数学概念%20-%20博客%20-%20伯乐在线_files/6941baebgw1elptmqievdg20m80dwdk8.gif" /></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><strong style="font-size: 14px; border-top: 0px; border-right: 0px; border-bottom: 0px; font-weight: bold; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px">16、将一个公式从笛卡尔坐标转换成轴坐标</strong></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><img style="font-size: 0px; max-width: 100%; border-top: 0px; height: auto; border-right: 0px; vertical-align: middle; border-bottom: 0px; color: transparent; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" alt="" src="http://www.cppblog.com/Hero/admin/21副GIF动图让你了解各种数学概念%20-%20博客%20-%20伯乐在线_files/6941baebgw1elptmoujzfg20dw0dwaub.gif" /></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><strong style="font-size: 14px; border-top: 0px; border-right: 0px; border-bottom: 0px; font-weight: bold; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px">17、画抛物线</strong></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><img style="font-size: 0px; max-width: 100%; border-top: 0px; height: auto; border-right: 0px; vertical-align: middle; border-bottom: 0px; color: transparent; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" alt="" src="http://www.cppblog.com/Hero/admin/21副GIF动图让你了解各种数学概念%20-%20博客%20-%20伯乐在线_files/6941baebgw1elptmlxiuig20hs0a0jvo.gif" /></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><strong style="font-size: 14px; border-top: 0px; border-right: 0px; border-bottom: 0px; font-weight: bold; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px">18、黎曼和(Riemann sum)约等于其曲线下的面积</strong></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><img style="font-size: 0px; max-width: 100%; border-top: 0px; height: auto; border-right: 0px; vertical-align: middle; border-bottom: 0px; color: transparent; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" alt="" src="http://www.cppblog.com/Hero/admin/21副GIF动图让你了解各种数学概念%20-%20博客%20-%20伯乐在线_files/6941baebgw1elptmkp3xxg20fi08cglu.gif" /></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><strong style="font-size: 14px; border-top: 0px; border-right: 0px; border-bottom: 0px; font-weight: bold; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px">19、双曲线</strong></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><img style="font-size: 0px; max-width: 100%; border-top: 0px; height: auto; border-right: 0px; vertical-align: middle; border-bottom: 0px; color: transparent; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" alt="" src="http://www.cppblog.com/Hero/admin/21副GIF动图让你了解各种数学概念%20-%20博客%20-%20伯乐在线_files/6941baebgw1elptmjuinxg208c08cn28.gif" /></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><strong style="font-size: 14px; border-top: 0px; border-right: 0px; border-bottom: 0px; font-weight: bold; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px">20、将双曲线表现成 3D 形式，也许你不相信，它完全是用直线画成的</strong></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><img style="font-size: 0px; max-width: 100%; border-top: 0px; height: auto; border-right: 0px; vertical-align: middle; border-bottom: 0px; color: transparent; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" alt="" src="http://www.cppblog.com/Hero/admin/21副GIF动图让你了解各种数学概念%20-%20博客%20-%20伯乐在线_files/6941baebgw1elptmijzebg20b40b4khz.gif" /></p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px">你甚至可以做成这样的效果：</p>
<p style="border-top: 0px; border-right: 0px; white-space: normal; word-spacing: 0px; border-bottom: 0px; text-transform: none; color: rgb(0,0,0); padding-bottom: 0px; padding-top: 0px; font: 14px/21px 'Microsoft YaHei', 宋体, 'Myriad Pro', Lato, 'Helvetica Neue', Helvetica, Arial, sans-serif; padding-left: 0px; margin: 0px 0px 20px; border-left: 0px; letter-spacing: normal; padding-right: 0px; background-color: rgb(255,255,255); text-indent: 0px; -webkit-text-stroke-width: 0px"><img style="font-size: 0px; max-width: 100%; border-top: 0px; height: auto; border-right: 0px; vertical-align: middle; border-bottom: 0px; color: transparent; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" alt="" src="http://www.cppblog.com/Hero/admin/21副GIF动图让你了解各种数学概念%20-%20博客%20-%20伯乐在线_files/6941baebgw1elptmfa599g20b407ox6p.gif" /></p><img src ="http://www.cppblog.com/Hero/aggbug/210816.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Hero/" target="_blank">Hero</a> 2015-06-03 20:24 <a href="http://www.cppblog.com/Hero/archive/2015/06/03/210816.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转载]幽默的老外程序员注释</title><link>http://www.cppblog.com/Hero/archive/2011/04/06/143529.html</link><dc:creator>Hero</dc:creator><author>Hero</author><pubDate>Wed, 06 Apr 2011 07:38:00 GMT</pubDate><guid>http://www.cppblog.com/Hero/archive/2011/04/06/143529.html</guid><wfw:comment>http://www.cppblog.com/Hero/comments/143529.html</wfw:comment><comments>http://www.cppblog.com/Hero/archive/2011/04/06/143529.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Hero/comments/commentRss/143529.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Hero/services/trackbacks/143529.html</trackback:ping><description><![CDATA[<div id=news_body>
<p>程序源代码中的注释经常是一个卧虎藏龙的地方，来看看这一辑国外某公司产品中的注释。注意：看的时候严禁喝水或进食。</p>
<p><a href="http://pic003.cnblogs.com/2010/34358/201010/20101012102234625.jpg"><img style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: block; FLOAT: none; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: auto" title=clip_image001 border=0 alt=clip_image001 src="mhtml:file://C:\Users\user\Desktop\幽默的老外程序员注释_IT新闻_博客园.mht!http://pic003.cnblogs.com/2010/34358/201010/20101012102235605.jpg" width=570 height=171></a></p>
<p>亲爱的代码维护人员：</p>
<p>当您尝试优化这段代码但发现这是一个极端错误的决定的时候，请修改下面的计时器，以便警示后人。</p>
<p>总计浪费在这段代码的时间 = 16小时。</p>
<p><a href="http://pic003.cnblogs.com/2010/34358/201010/20101012102236511.jpg"><img style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: block; FLOAT: none; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: auto" title=clip_image002 border=0 alt=clip_image002 src="mhtml:file://C:\Users\user\Desktop\幽默的老外程序员注释_IT新闻_博客园.mht!http://pic003.cnblogs.com/2010/34358/201010/20101012102236797.jpg" width=485 height=43></a><br>真的很有问题。</p>
<p><a href="http://pic003.cnblogs.com/2010/34358/201010/20101012102237525.jpg"><img style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: block; FLOAT: none; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: auto" title=clip_image003 border=0 alt=clip_image003 src="mhtml:file://C:\Users\user\Desktop\幽默的老外程序员注释_IT新闻_博客园.mht!http://pic003.cnblogs.com/2010/34358/201010/20101012102238734.jpg" width=607 height=56></a></p>
<p>谨以此代码献给我的妻子达琳，感谢她一直支持我，还有我三个孩子和一只狗。</p>
<p><a href="http://pic003.cnblogs.com/2010/34358/201010/20101012102239752.jpg"><img style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: block; FLOAT: none; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: auto" title=clip_image004 border=0 alt=clip_image004 src="mhtml:file://C:\Users\user\Desktop\幽默的老外程序员注释_IT新闻_博客园.mht!http://pic003.cnblogs.com/2010/34358/201010/20101012102239181.jpg" width=329 height=32></a>神奇代码，请勿改动。</p>
<p><a href="http://pic003.cnblogs.com/2010/34358/201010/20101012102240338.jpg"><img style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: block; FLOAT: none; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: auto" title=clip_image005 border=0 alt=clip_image005 src="mhtml:file://C:\Users\user\Desktop\幽默的老外程序员注释_IT新闻_博客园.mht!http://pic003.cnblogs.com/2010/34358/201010/20101012102241853.jpg" width=268 height=28></a>喝醉啦，迟些再弄。</p>
<p><a href="http://pic003.cnblogs.com/2010/34358/201010/20101012102242993.jpg"><img style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: block; FLOAT: none; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: auto" title=clip_image006 border=0 alt=clip_image006 src="mhtml:file://C:\Users\user\Desktop\幽默的老外程序员注释_IT新闻_博客园.mht!http://pic003.cnblogs.com/2010/34358/201010/20101012102243310.jpg" width=470 height=139></a></p>
<p>你可能会认为你读得懂以下的代码。但是你不会懂的，相信我吧。</p>
<p>要是你尝试玩弄这段代码的话，你将会在无尽的通宵中不断地咒骂自己为什么会认为自己聪明到可以优化这段代码。</p>
<p>好了，现在请关闭这个文件去玩点别的吧。</p>
<p><a href="http://pic003.cnblogs.com/2010/34358/201010/20101012102243220.jpg"><img style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: block; FLOAT: none; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: auto" title=clip_image007 border=0 alt=clip_image007 src="mhtml:file://C:\Users\user\Desktop\幽默的老外程序员注释_IT新闻_博客园.mht!http://pic003.cnblogs.com/2010/34358/201010/20101012102244433.jpg" width=512 height=34></a></p>
<p>程序员1(于2002年6月7日)：在登陆界面临时加入一些调试代码</p>
<p>程序员2(于2007年5月22日)：临你个屁啊</p>
<p><a href="http://pic003.cnblogs.com/2010/34358/201010/20101012102244983.jpg"><img style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: block; FLOAT: none; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: auto" title=clip_image008 border=0 alt=clip_image008 src="mhtml:file://C:\Users\user\Desktop\幽默的老外程序员注释_IT新闻_博客园.mht!http://pic003.cnblogs.com/2010/34358/201010/20101012102245698.jpg" width=461 height=27><br></a>反正这个办法就修复了问题，我也不知道为什么会这样</p>
<p><a href="http://pic003.cnblogs.com/2010/34358/201010/20101012102245356.jpg"><img style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: block; FLOAT: none; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: auto" title=clip_image009 border=0 alt=clip_image009 src="mhtml:file://C:\Users\user\Desktop\幽默的老外程序员注释_IT新闻_博客园.mht!http://pic003.cnblogs.com/2010/34358/201010/2010101210224515.jpg" width=447 height=91></a></p>
<p>要理解什么是递归的话，请参考本文件的底部</p>
<blockquote>
<p>(在文件的底部)</p>
</blockquote>
<p>&#160;</p>
<p><a href="http://pic003.cnblogs.com/2010/34358/201010/20101012102246534.jpg"><img style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: block; FLOAT: none; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: auto" title=clip_image010 border=0 alt=clip_image010 src="mhtml:file://C:\Users\user\Desktop\幽默的老外程序员注释_IT新闻_博客园.mht!http://pic003.cnblogs.com/2010/34358/201010/20101012102246747.jpg" width=225 height=22></a></p>
<p>狂插两下; //痛啊</p>
<p><a href="http://pic003.cnblogs.com/2010/34358/201010/20101012102247262.jpg"><img style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: block; FLOAT: none; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: auto" title=clip_image011 border=0 alt=clip_image011 src="mhtml:file://C:\Users\user\Desktop\幽默的老外程序员注释_IT新闻_博客园.mht!http://pic003.cnblogs.com/2010/34358/201010/20101012102247280.jpg" width=410 height=42></a></p>
<p>亲爱的未来的我自己，请原谅我。</p>
<p>我有着难以表达的歉意。</p>
<p><a href="http://pic003.cnblogs.com/2010/34358/201010/20101012102248524.jpg"><img style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: block; FLOAT: none; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: auto" title=clip_image012 border=0 alt=clip_image012 src="mhtml:file://C:\Users\user\Desktop\幽默的老外程序员注释_IT新闻_博客园.mht!http://pic003.cnblogs.com/2010/34358/201010/20101012102248402.jpg" width=359 height=41></a></p>
<p>我不对以下代码负责。</p>
<p>是他们逼我写的，是违背我意愿的。</p>
<p><a href="http://pic003.cnblogs.com/2010/34358/201010/20101012102249702.jpg"><img style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: block; FLOAT: none; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: auto" title=clip_image013 border=0 alt=clip_image013 src="mhtml:file://C:\Users\user\Desktop\幽默的老外程序员注释_IT新闻_博客园.mht!http://pic003.cnblogs.com/2010/34358/201010/20101012102249416.jpg" width=421 height=25></a></p>
<p>疯了吗?欢迎来到斯巴达。</p>
<p><a href="http://pic003.cnblogs.com/2010/34358/201010/20101012102249413.jpg"><img style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: block; FLOAT: none; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: auto" title=clip_image014 border=0 alt=clip_image014 src="mhtml:file://C:\Users\user\Desktop\幽默的老外程序员注释_IT新闻_博客园.mht!http://pic003.cnblogs.com/2010/34358/201010/20101012102250322.jpg" width=558 height=24></a></p>
<p>要是你能修正这个问题的话，我会把72个处女中的两个送给你。</p>
<p><a href="http://pic003.cnblogs.com/2010/34358/201010/20101012102250786.jpg"><img style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: block; FLOAT: none; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: auto" title=clip_image015 border=0 alt=clip_image015 src="mhtml:file://C:\Users\user\Desktop\幽默的老外程序员注释_IT新闻_博客园.mht!http://pic003.cnblogs.com/2010/34358/201010/20101012102251999.jpg" width=257 height=52></a></p>
<p>没有注释留给你，难写的代码必定难读</p>
<p><a href="http://pic003.cnblogs.com/2010/34358/201010/20101012102251800.jpg"><img style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: block; FLOAT: none; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: auto" title=clip_image016 border=0 alt=clip_image016 src="mhtml:file://C:\Users\user\Desktop\幽默的老外程序员注释_IT新闻_博客园.mht!http://pic003.cnblogs.com/2010/34358/201010/20101012102251514.jpg" width=439 height=22></a>IE 浏览器的 Hack (在这里先假设IE是浏览器)</p>
<p><a href="http://pic003.cnblogs.com/2010/34358/201010/20101012102252229.jpg"><img style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: block; FLOAT: none; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: auto" title=clip_image017 border=0 alt=clip_image017 src="mhtml:file://C:\Users\user\Desktop\幽默的老外程序员注释_IT新闻_博客园.mht!http://pic003.cnblogs.com/2010/34358/201010/20101012102252800.jpg" width=247 height=25></a></p>
<p>有待修正。 修正什么啊?</p>
<p><a href="http://pic003.cnblogs.com/2010/34358/201010/20101012102253849.jpg"><img style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: block; FLOAT: none; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: auto" title=clip_image018 border=0 alt=clip_image018 src="mhtml:file://C:\Users\user\Desktop\幽默的老外程序员注释_IT新闻_博客园.mht!http://pic003.cnblogs.com/2010/34358/201010/20101012102253672.jpg" width=570 height=23></a></p>
<p>要是再让我看到这种代码，我会带着枪来上班的</p>
<p><a href="http://pic003.cnblogs.com/2010/34358/201010/20101012102254578.jpg"><img style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: block; FLOAT: none; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: auto" title=clip_image019 border=0 alt=clip_image019 src="mhtml:file://C:\Users\user\Desktop\幽默的老外程序员注释_IT新闻_博客园.mht!http://pic003.cnblogs.com/2010/34358/201010/20101012102255592.jpg" width=310 height=169></a></p>
<p>有只龙在这里&#8230;&#8230;</p>
<p><a href="http://pic003.cnblogs.com/2010/34358/201010/20101012102256393.jpg"><img style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: block; FLOAT: none; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: auto" title=clip_image020 border=0 alt=clip_image020 src="mhtml:file://C:\Users\user\Desktop\幽默的老外程序员注释_IT新闻_博客园.mht!http://pic003.cnblogs.com/2010/34358/201010/20101012102257927.jpg" width=594 height=229></a></p>
<p>在你阅读以下代码时，你要先搞懂为什么我在这样做。</p>
<p>我想读取一个根节点下面所有的子节点，以便控制根节点不会显示在选择框上。但那个傻逼的DBA找了一些某些傻逼的借口不让我用索引去读取这些数据，而要求我用他们傻逼的迭代器。所以有了以下代码。</p>
<p><a href="http://pic003.cnblogs.com/2010/34358/201010/20101012102258171.jpg"><img style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: block; FLOAT: none; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; MARGIN-LEFT: auto; BORDER-LEFT-WIDTH: 0px; MARGIN-RIGHT: auto" title=clip_image021 border=0 alt=clip_image021 src="mhtml:file://C:\Users\user\Desktop\幽默的老外程序员注释_IT新闻_博客园.mht!http://pic003.cnblogs.com/2010/34358/201010/20101012102258296.jpg" width=524 height=45></a></p>
<p>当我写这段代码的时候，只有老天和我自己知道我在做什么。</p>
<p>现在，只剩老天知道了。</p>
</div>
<!--end: news_body -->
<img src ="http://www.cppblog.com/Hero/aggbug/143529.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Hero/" target="_blank">Hero</a> 2011-04-06 15:38 <a href="http://www.cppblog.com/Hero/archive/2011/04/06/143529.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>DOS批处理中%cd%和%~dp0的异同</title><link>http://www.cppblog.com/Hero/archive/2011/03/29/142970.html</link><dc:creator>Hero</dc:creator><author>Hero</author><pubDate>Tue, 29 Mar 2011 12:13:00 GMT</pubDate><guid>http://www.cppblog.com/Hero/archive/2011/03/29/142970.html</guid><wfw:comment>http://www.cppblog.com/Hero/comments/142970.html</wfw:comment><comments>http://www.cppblog.com/Hero/archive/2011/03/29/142970.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/Hero/comments/commentRss/142970.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/Hero/services/trackbacks/142970.html</trackback:ping><description><![CDATA[<span style="WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; FONT: medium Simsun; WHITE-SPACE: normal; ORPHANS: 2; COLOR: rgb(0,0,0); WORD-SPACING: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class=Apple-style-span><span style="TEXT-ALIGN: left; LINE-HEIGHT: 18px; FONT-FAMILY: Arial, sans-serif, Helvetica, Tahoma; FONT-SIZE: 12px" class=Apple-style-span>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">在DOS的批处理中，有时候需要知道当前的路径。在DOS中，有两个环境变量可以跟当前路径有关，一个是%cd%, 一个是%~dp0。</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">&nbsp;</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">&nbsp;&nbsp; 这两个变量的用法和代表的内容一般是不同的。</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">&nbsp;</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">&nbsp; 1. %cd% 可以用在批处理文件中，也可以用在命令行中；展开后，是驱动器盘符:+当前目录，如：</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">&nbsp;</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">&nbsp;&nbsp; 在 c:\dir 下，</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">&nbsp;</p>
<div style="PADDING-BOTTOM: 1px; OVERFLOW-X: auto; OVERFLOW-Y: auto; BACKGROUND-COLOR: transparent; PADDING-LEFT: 1px; WIDTH: 694px; PADDING-RIGHT: 1px; FONT-FAMILY: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', Consolas, 'Courier New', monospace; WORD-WRAP: break-word; MARGIN-LEFT: 9px; FONT-SIZE: 12px; WORD-BREAK: break-all; PADDING-TOP: 1px" class=dp-highlighter>
<div class=bar>
<div style="TEXT-ALIGN: left; PADDING-BOTTOM: 3px; MARGIN: 0px; PADDING-LEFT: 3px; PADDING-RIGHT: 3px; COLOR: black; FONT-WEIGHT: bold; PADDING-TOP: 3px" class=tools>Bat代码<span class=Apple-converted-space>&nbsp;</span><embed height=15 type=application/x-shockwave-flash pluginspage=http://www.macromedia.com/go/getflashplayer width=14 src=http://luck-donkey.javaeye.com/javascripts/syntaxhighlighter/clipboard_new.swf flashvars="clipboard=echo%20%25cd%25" quality="high" allowscriptaccess="always">&nbsp;<a style="COLOR: rgb(16,138,198); TEXT-DECORATION: underline" title=收藏这段代码 onclick="code_favorites_do_favorite(this);return false;" href="javascript:void()"><img style="BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" class=star alt=收藏代码 src="http://luck-donkey.javaeye.com/images/icon_star.png"></a></div>
</div>
<ol style="BORDER-BOTTOM: rgb(209,215,220) 1px solid; BORDER-LEFT: rgb(209,215,220) 1px solid; PADDING-BOTTOM: 2px; LINE-HEIGHT: 1.4em; BACKGROUND-COLOR: rgb(255,255,255); LIST-STYLE-TYPE: decimal; MARGIN: 0px 0px 1px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; COLOR: rgb(43,145,175); FONT-SIZE: 1em; BORDER-TOP: rgb(209,215,220) 1px solid; BORDER-RIGHT: rgb(209,215,220) 1px solid; PADDING-TOP: 2px" class=dp-default>
    <li style="BORDER-LEFT: rgb(209,215,220) 1px solid; PADDING-BOTTOM: 0px; LINE-HEIGHT: 18px; BACKGROUND-COLOR: rgb(250,250,250); MARGIN: 0px 0px 0px 38px; PADDING-LEFT: 10px; PADDING-RIGHT: 0px; FONT-SIZE: 1em; PADDING-TOP: 0px"><span style="COLOR: black"><span style="COLOR: black">echo&nbsp;%cd%&nbsp;&nbsp;</span></span></li>
</ol>
</div>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">&nbsp;</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">&nbsp;&nbsp; 显示为，</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">&nbsp;</p>
<div style="PADDING-BOTTOM: 1px; OVERFLOW-X: auto; OVERFLOW-Y: auto; BACKGROUND-COLOR: transparent; PADDING-LEFT: 1px; WIDTH: 694px; PADDING-RIGHT: 1px; FONT-FAMILY: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', Consolas, 'Courier New', monospace; WORD-WRAP: break-word; MARGIN-LEFT: 9px; FONT-SIZE: 12px; WORD-BREAK: break-all; PADDING-TOP: 1px" class=dp-highlighter>
<div class=bar>
<div style="TEXT-ALIGN: left; PADDING-BOTTOM: 3px; MARGIN: 0px; PADDING-LEFT: 3px; PADDING-RIGHT: 3px; COLOR: black; FONT-WEIGHT: bold; PADDING-TOP: 3px" class=tools>Bat代码<span class=Apple-converted-space>&nbsp;</span><embed height=15 type=application/x-shockwave-flash pluginspage=http://www.macromedia.com/go/getflashplayer width=14 src=http://luck-donkey.javaeye.com/javascripts/syntaxhighlighter/clipboard_new.swf flashvars="clipboard=c%3A%5Cdir" quality="high" allowscriptaccess="always">&nbsp;<a style="COLOR: rgb(16,138,198); TEXT-DECORATION: underline" title=收藏这段代码 onclick="code_favorites_do_favorite(this);return false;" href="javascript:void()"><img style="BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" class=star alt=收藏代码 src="http://luck-donkey.javaeye.com/images/icon_star.png"></a></div>
</div>
<ol style="BORDER-BOTTOM: rgb(209,215,220) 1px solid; BORDER-LEFT: rgb(209,215,220) 1px solid; PADDING-BOTTOM: 2px; LINE-HEIGHT: 1.4em; BACKGROUND-COLOR: rgb(255,255,255); LIST-STYLE-TYPE: decimal; MARGIN: 0px 0px 1px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; COLOR: rgb(43,145,175); FONT-SIZE: 1em; BORDER-TOP: rgb(209,215,220) 1px solid; BORDER-RIGHT: rgb(209,215,220) 1px solid; PADDING-TOP: 2px" class=dp-default>
    <li style="BORDER-LEFT: rgb(209,215,220) 1px solid; PADDING-BOTTOM: 0px; LINE-HEIGHT: 18px; BACKGROUND-COLOR: rgb(250,250,250); MARGIN: 0px 0px 0px 38px; PADDING-LEFT: 10px; PADDING-RIGHT: 0px; FONT-SIZE: 1em; PADDING-TOP: 0px"><span style="COLOR: black"><span style="COLOR: black">c:\dir&nbsp;&nbsp;</span></span></li>
</ol>
</div>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">&nbsp;</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">&nbsp;&nbsp; %cd%的时间内容是可以被改变的，比如CD命令就可以改变它的内容。</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">&nbsp;</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">&nbsp;2. %~dp0&nbsp; &nbsp; 只可以用在批处理文件中，它是由它所在的批处理文件的目录位置决定的，是批处理文件所在的盘符:+路径。在执行这个批处理文件的过程中，它展开后的内容是不可以改变的。</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">&nbsp;</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">&nbsp;</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">&nbsp; 比如在D盘下有个批处理文件，dirshow.bat:</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">&nbsp;</p>
<div style="PADDING-BOTTOM: 1px; OVERFLOW-X: auto; OVERFLOW-Y: auto; BACKGROUND-COLOR: transparent; PADDING-LEFT: 1px; WIDTH: 694px; PADDING-RIGHT: 1px; FONT-FAMILY: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', Consolas, 'Courier New', monospace; WORD-WRAP: break-word; MARGIN-LEFT: 9px; FONT-SIZE: 12px; WORD-BREAK: break-all; PADDING-TOP: 1px" class=dp-highlighter>
<div class=bar>
<div style="TEXT-ALIGN: left; PADDING-BOTTOM: 3px; MARGIN: 0px; PADDING-LEFT: 3px; PADDING-RIGHT: 3px; COLOR: black; FONT-WEIGHT: bold; PADDING-TOP: 3px" class=tools>Bat代码<span class=Apple-converted-space>&nbsp;</span><embed height=15 type=application/x-shockwave-flash pluginspage=http://www.macromedia.com/go/getflashplayer width=14 src=http://luck-donkey.javaeye.com/javascripts/syntaxhighlighter/clipboard_new.swf flashvars="clipboard=%40echo%20off%0Aecho%20this%20is%20%25%25cd%25%25%20%20%25cd%25%0Aecho%20this%20is%20%25%25~dp0%20%25~dp0" quality="high" allowscriptaccess="always">&nbsp;<a style="COLOR: rgb(16,138,198); TEXT-DECORATION: underline" title=收藏这段代码 onclick="code_favorites_do_favorite(this);return false;" href="javascript:void()"><img style="BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" class=star alt=收藏代码 src="http://luck-donkey.javaeye.com/images/icon_star.png"></a></div>
</div>
<ol style="BORDER-BOTTOM: rgb(209,215,220) 1px solid; BORDER-LEFT: rgb(209,215,220) 1px solid; PADDING-BOTTOM: 2px; LINE-HEIGHT: 1.4em; BACKGROUND-COLOR: rgb(255,255,255); LIST-STYLE-TYPE: decimal; MARGIN: 0px 0px 1px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; COLOR: rgb(43,145,175); FONT-SIZE: 1em; BORDER-TOP: rgb(209,215,220) 1px solid; BORDER-RIGHT: rgb(209,215,220) 1px solid; PADDING-TOP: 2px" class=dp-default>
    <li style="BORDER-LEFT: rgb(209,215,220) 1px solid; PADDING-BOTTOM: 0px; LINE-HEIGHT: 18px; BACKGROUND-COLOR: rgb(250,250,250); MARGIN: 0px 0px 0px 38px; PADDING-LEFT: 10px; PADDING-RIGHT: 0px; FONT-SIZE: 1em; PADDING-TOP: 0px"><span style="COLOR: black"><span style="COLOR: black">@echo&nbsp;off&nbsp;&nbsp;</span></span></li>
    <li style="BORDER-LEFT: rgb(209,215,220) 1px solid; PADDING-BOTTOM: 0px; LINE-HEIGHT: 18px; BACKGROUND-COLOR: rgb(250,250,250); MARGIN: 0px 0px 0px 38px; PADDING-LEFT: 10px; PADDING-RIGHT: 0px; FONT-SIZE: 1em; PADDING-TOP: 0px"><span style="COLOR: black">echo&nbsp;this&nbsp;is&nbsp;%%cd%%&nbsp;&nbsp;%cd%&nbsp;&nbsp;</span></li>
    <li style="BORDER-LEFT: rgb(209,215,220) 1px solid; PADDING-BOTTOM: 0px; LINE-HEIGHT: 18px; BACKGROUND-COLOR: rgb(250,250,250); MARGIN: 0px 0px 0px 38px; PADDING-LEFT: 10px; PADDING-RIGHT: 0px; FONT-SIZE: 1em; PADDING-TOP: 0px"><span style="COLOR: black">echo&nbsp;this&nbsp;is&nbsp;%%~dp0&nbsp;%~dp0&nbsp;&nbsp;</span></li>
</ol>
</div>
&nbsp;
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">&nbsp;&nbsp; 在C:\ 下执行它，输出为：</p>
<p style="PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; PADDING-TOP: 0px">&nbsp;</p>
<div style="PADDING-BOTTOM: 1px; OVERFLOW-X: auto; OVERFLOW-Y: auto; BACKGROUND-COLOR: transparent; PADDING-LEFT: 1px; WIDTH: 694px; PADDING-RIGHT: 1px; FONT-FAMILY: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', Consolas, 'Courier New', monospace; WORD-WRAP: break-word; MARGIN-LEFT: 9px; FONT-SIZE: 12px; WORD-BREAK: break-all; PADDING-TOP: 1px" class=dp-highlighter>
<div class=bar>
<div style="TEXT-ALIGN: left; PADDING-BOTTOM: 3px; MARGIN: 0px; PADDING-LEFT: 3px; PADDING-RIGHT: 3px; COLOR: black; FONT-WEIGHT: bold; PADDING-TOP: 3px" class=tools>Bat代码<span class=Apple-converted-space>&nbsp;</span><embed height=15 type=application/x-shockwave-flash pluginspage=http://www.macromedia.com/go/getflashplayer width=14 src=http://luck-donkey.javaeye.com/javascripts/syntaxhighlighter/clipboard_new.swf flashvars="clipboard=C%3A%5C%3ED%3A%5Cdirshow.bat%0Athis%20is%20%25cd%25%20%20C%3A%5C%0Athis%20is%20%25~dp0%20D%3A%5C" quality="high" allowscriptaccess="always">&nbsp;<a style="COLOR: rgb(16,138,198); TEXT-DECORATION: underline" title=收藏这段代码 onclick="code_favorites_do_favorite(this);return false;" href="javascript:void()"><img style="BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" class=star alt=收藏代码 src="http://luck-donkey.javaeye.com/images/icon_star.png"></a></div>
</div>
<ol style="BORDER-BOTTOM: rgb(209,215,220) 1px solid; BORDER-LEFT: rgb(209,215,220) 1px solid; PADDING-BOTTOM: 2px; LINE-HEIGHT: 1.4em; BACKGROUND-COLOR: rgb(255,255,255); LIST-STYLE-TYPE: decimal; MARGIN: 0px 0px 1px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; COLOR: rgb(43,145,175); FONT-SIZE: 1em; BORDER-TOP: rgb(209,215,220) 1px solid; BORDER-RIGHT: rgb(209,215,220) 1px solid; PADDING-TOP: 2px" class=dp-default>
    <li style="BORDER-LEFT: rgb(209,215,220) 1px solid; PADDING-BOTTOM: 0px; LINE-HEIGHT: 18px; BACKGROUND-COLOR: rgb(250,250,250); MARGIN: 0px 0px 0px 38px; PADDING-LEFT: 10px; PADDING-RIGHT: 0px; FONT-SIZE: 1em; PADDING-TOP: 0px"><span style="COLOR: black"><span style="COLOR: black">C:\&gt;D:\dirshow.bat&nbsp;&nbsp;</span></span></li>
    <li style="BORDER-LEFT: rgb(209,215,220) 1px solid; PADDING-BOTTOM: 0px; LINE-HEIGHT: 18px; BACKGROUND-COLOR: rgb(250,250,250); MARGIN: 0px 0px 0px 38px; PADDING-LEFT: 10px; PADDING-RIGHT: 0px; FONT-SIZE: 1em; PADDING-TOP: 0px"><span style="COLOR: black">this&nbsp;is&nbsp;%cd%&nbsp;&nbsp;C:\&nbsp;&nbsp;</span></li>
    <li style="BORDER-LEFT: rgb(209,215,220) 1px solid; PADDING-BOTTOM: 0px; LINE-HEIGHT: 18px; BACKGROUND-COLOR: rgb(250,250,250); MARGIN: 0px 0px 0px 38px; PADDING-LEFT: 10px; PADDING-RIGHT: 0px; FONT-SIZE: 1em; PADDING-TOP: 0px"><span style="COLOR: black">this&nbsp;is&nbsp;%~dp0&nbsp;D:\&nbsp;&nbsp;</span></li>
</ol>
</div>
</span></span>
<img src ="http://www.cppblog.com/Hero/aggbug/142970.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/Hero/" target="_blank">Hero</a> 2011-03-29 20:13 <a href="http://www.cppblog.com/Hero/archive/2011/03/29/142970.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>