|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.servlet.GenericServlet | +--javax.servlet.http.HttpServlet | +--org.apache.catalina.servlets.CGIServlet
CGI-invoking servlet for web applications, used to execute scripts which comply to the Common Gateway Interface (CGI) specification and are named in the path-info used to invoke this servlet.
Note: This code compiles and even works for simple CGI cases. Exhaustive testing has not been done. Please consider it beta quality. Feedback is appreciated to the author (see below).
Example:
If an instance of this servlet was mapped (using
<web-app>/WEB-INF/web.xml
) to:
<web-app>/cgi-bin/*
then the following request:
http://localhost:8080/<web-app>/cgi-bin/dir1/script/pathinfo1
would result in the execution of the script
<web-app-root>/WEB-INF/cgi/dir1/script
with the script's PATH_INFO
set to /pathinfo1
.
Recommendation: House all your CGI scripts under
<webapp>/WEB-INF/cgi
. This will ensure that you do not
accidentally expose your cgi scripts' code to the outside world and that
your cgis will be cleanly ensconced underneath the WEB-INF (i.e.,
non-content) area.
The default CGI location is mentioned above. You have the flexibility to put CGIs wherever you want, however:
The CGI search path will start at webAppRootDir + File.separator + cgiPathPrefix (or webAppRootDir alone if cgiPathPrefix is null).
cgiPathPrefix is defined by setting this servlet's cgiPathPrefix init parameter
CGI Specification:
derived from
http://cgi-spec.golux.com.
A work-in-progress & expired Internet Draft. Note no actual RFC describing
the CGI specification exists. Where the behavior of this servlet differs
from the specification cited above, it is either documented here, a bug,
or an instance where the specification cited differs from Best
Community Practice (BCP).
Such instances should be well-documented here. Please email the
Jakarta Tomcat group<EMAIL_ADDRESS>with amendments.
Canonical metavariables:
The CGI specification defines the following canonical metavariables:
[excerpt from CGI specification]
AUTH_TYPE CONTENT_LENGTH CONTENT_TYPE GATEWAY_INTERFACE PATH_INFO PATH_TRANSLATED QUERY_STRING REMOTE_ADDR REMOTE_HOST REMOTE_IDENT REMOTE_USER REQUEST_METHOD SCRIPT_NAME SERVER_NAME SERVER_PORT SERVER_PROTOCOL SERVER_SOFTWARE
Metavariables with names beginning with the protocol name (e.g., "HTTP_ACCEPT") are also canonical in their description of request header fields. The number and meaning of these fields may change independently of this specification. (See also section 6.1.5 [of the CGI specification].)
[end excerpt]
standard input handling: If your script accepts standard input,
then the client must start sending input within a certain timeout period,
otherwise the servlet will assume no input is coming and carry on running
the script. The script's the standard input will be closed and handling of
any further input from the client is undefined. Most likely it will be
ignored. If this behavior becomes undesirable, then this servlet needs
to be enhanced to handle threading of the spawned process' stdin, stdout,
and stderr (which should not be too hard).
If you find your cgi scripts are timing out receiving input, you can set
the init parameter of your webapps' cgi-handling servlet
to be
Metavariable Values: According to the CGI specificion, implementations may choose to represent both null or missing values in an implementation-specific manner, but must define that manner. This implementation chooses to always define all required metavariables, but set the value to "" for all metavariables whose value is either null or undefined. PATH_TRANSLATED is the sole exception to this rule, as per the CGI Specification.
NPH -- Non-parsed-header implementation: This implementation does not support the CGI NPH concept, whereby server ensures that the data supplied to the script are preceisely as supplied by the client and unaltered by the server.
The function of a servlet container (including Tomcat) is specifically designed to parse and possible alter CGI-specific variables, and as such makes NPH functionality difficult to support.
The CGI specification states that compliant servers MAY support NPH output. It does not state servers MUST support NPH output to be unconditionally compliant. Thus, this implementation maintains unconditional compliance with the specification though NPH support is not present.
The CGI specification is located at http://cgi-spec.golux.com.
| Nested Class Summary | |
protected class |
CGIServlet.CGIEnvironment
Encapsulates the CGI environment and rules to derive that environment from the servlet container and request information. |
protected class |
CGIServlet.CGIRunner
Encapsulates the knowledge of how to run a CGI script, given the script's desired environment and (optionally) input/output streams Exposes a run method used to actually invoke the
CGI.
|
| Constructor Summary | |
CGIServlet()
|
| Method Summary | |
protected void |
doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Provides CGI Gateway service |
protected void |
doPost(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Provides CGI Gateway service -- delegates to doGet |
void |
init(javax.servlet.ServletConfig config)
Sets instance variables. |
static void |
main(java.lang.String[] args)
For future testing use only; does nothing right now |
protected void |
printServletEnvironment(javax.servlet.ServletOutputStream out,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Prints out important Servlet API and container information Copied from SnoopAllServlet by Craig R. |
| Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service |
| Methods inherited from class javax.servlet.GenericServlet |
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public CGIServlet()
| Method Detail |
public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException
Modified from Craig R. McClanahan's InvokerServlet
init
in interface javax.servlet.Servlet
init
in class javax.servlet.GenericServlet
config
- a ServletConfig
object
containing the servlet's
configuration and initialization
parameters
javax.servlet.ServletException
- if an exception has occurred that
interferes with the servlet's normal
operationprotected void printServletEnvironment(javax.servlet.ServletOutputStream out, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws java.io.IOException
Copied from SnoopAllServlet by Craig R. McClanahan
out
- ServletOutputStream as target of the informationreq
- HttpServletRequest object used as source of informationres
- HttpServletResponse object currently not used but could
provide future information
java.io.IOException
- if a write operation exception occursprotected void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws java.io.IOException, javax.servlet.ServletException
doGet
doPost
in class javax.servlet.http.HttpServlet
req
- HttpServletRequest passed in by servlet containerres
- HttpServletResponse passed in by servlet container
javax.servlet.ServletException
- if a servlet-specific exception occurs
java.io.IOException
- if a read/write exception occursHttpServlet
protected void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws javax.servlet.ServletException, java.io.IOException
doGet
in class javax.servlet.http.HttpServlet
req
- HttpServletRequest passed in by servlet containerres
- HttpServletResponse passed in by servlet container
javax.servlet.ServletException
- if a servlet-specific exception occurs
java.io.IOException
- if a read/write exception occursHttpServlet
public static void main(java.lang.String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |


Ranking the Cowboys’ Jason Garrett replacement candidates if Jerry Jones fires head coach
by Vinnie IyerShould Jerry Jones and the Cowboys become so frustrated with their 2019 season to the point of firing Jason Garrett, it would open up arguably the most desired coaching job in all of American sports for the first time in a decade.
Garrett, 53, has led Dallas since taking over for Wade Phillips halfway through 2010, with three playoff trips and two playoff wins on his resume. Losing its grasp on its third division title in five seasons in Week 13, Dallas (6-6) is clinging to first place in a weak NFC East atter its shocking 26-15 Thanksgiving home loss to Buffalo, only a half-game and head-to-head tiebreaker over Philadelphia (5-6).
With Jones having Super Bowl expectations for his team, more struggles against winning teams may push him to make another big midseason coaching change. And if the Cowboys don't fire Garrett, whose current contract expires after 2019, they could simplychoose not to re-sign him to a new contract for2020 and beyond.
MORE: Will the Cowboys fire Jason Garrett?
The Cowboys, a marquee franchise with a talented roster built to win it all now,would have endless high-profile options with whom to best replace Garrett.And Jones is always willing to back up the Brinks truck foranyone he feels willget the job done.
Usingfutures odds, perBetOnline.ag, as a point of reference, Sporting News ranked the seemingly bottomless pool of potential candidates who could replace Garrett if he's fired.
1. The big college names
| 1. | Urban Meyer | 3/1 |
| 2. | Lincoln Riley | 5/1 |
| 3. | Jim Harbaugh | 12/1 |
| 4. | Nick Saban | 40/1 |
| 5. | Dabo Swinney | 50/1 |
| 6. | Chip Kelly | 66/1 |
| 7. | Bob Stoops | 100/1 |
It's interesting Urban Meyer is the betting favorite above everyone else. He's been outstanding as a Fox college football analyst, but there's a strong feeling he will be in play for a potential USC opening, so extending that to the top NFL opening isn't a stretch.
Meyer's ability to deliver championships in short, combined with his organizational and motivational skills and special teams acumen, would be ideal for Jones to get his team over the Super Bowl hump, despite the lack of pro experience. He obviously knows offense well and has a direct connection with Ezekiel Elliott.
Lincoln Riley, the offensive wunderkind, makes a ton of sense, too, but the trick there is giving him enough incentive to leave a cushy spot at Oklahoma after replacing Bob Stoops, who may not want the stress of high-pressure NFL coaching as his return.
Jim Harbaugh is always in play for the best NFL gigs. Nick Saban will retirebefore ever giving the NFL another try after the Dolphins debacle. Dabo Swinney is a demigod at Clemson, and replacing Sabanat Alabama is the only way he might consider leaving. Going Chip Kelly to replace Garrett doesn't sound like an upgrade.
2. The big NFL names
| 1. | Sean Payton | (6/1) |
| 2. | Peyton Manning | (150/1) |
| 3. | Bill Cowher | (250/1) |
| 4. | Mike McCarthy | N/A |
Sean Payton is under contract with the Saints until 2022, so this is a longshot, unless Jones, as the Cowboys' GM, can pull off a blockbuster trade for him. But there's no doubt Jones once loved Payton as his offensive coordinator and thought he would be running his team one day. For Payton to get out of his situation, he would need to think Drew Brees is hanging it up soon, but that's likely not happening, either.
Peyton Manning and Bill Cowher have less stressful things to do thancoachin the Dallas fishbowl. Going Mike McCarthy feels like it would be a sub-lateral move away from Garrett.
3. Hot NFL assistants
| 1. | Josh McDaniels | 4/1 |
| 2. | Robert Saleh | 5/1 |
| 3. | Nick Sirianni | N/A |
| 4. | Matt Eberflus | N/A |
| 5. | Eric Bieniemy | N/A |
Josh McDaniels would certainly be in play again for every coach-seeking team after it didn't work out with theColtslast year. Jones, after losing to the Patriots, may want to tap into Bill Belchick's top play-caller and think Dallas would work out better than Denver.
Robert Saleh looks ready to lead a team to big things with his energy after what he's doing with the 49ers defense. The other three are probably not splashy enough for Jones.
4. Other college names
| 1. | Mike Leach | 20/1 |
| 2. | Chris Petersen | 25/1 |
| 3. | Tom Herman | 33/1 |
| 4. | Mike Gundy | 50/1 |
| 5. | Lane Kiffin | 66/1 |
| 6. | Matt Rhule | 66/1 |
| 7. | Gary Patterson | 80/1 |
| 8. | James Franklin | 80/1 |
This has a very Big 12 "close proximity to Dallas" feel to it, doesn't it? Tom Herman , Mike Gundy , Matt Rhule and Gary Patterson are currently head coaches in that conference, and Mike Leach used to be. Chris Petersen looks like he could make a nice transition from Washington to the NFL. Forget about Lane Kiffin and James Franklin , who could bring more volatlity vs. the stability of Garrett. Overall, there's a feeling that most of these guys would be in over their heads under Jones' rule.
5. Other NFL assistants
| 1. | Ken Norton Jr. | 16/1 |
| 2. | Dan Campbell | 25/1 |
| 3. | Gus Bradley | 33/1 |
| 4. | Jim Schwartz | 33/1 |
| 5. | Mike Muchak | 33/1 |
| 6. | Todd Haley | 40/1 |
Ken Norton, Dan Campbell and Todd Haley allhave Cowboys ties asguys Jones has liked in the past, a la Garrett. Norton has that Super Bowl glory day appeal and Campbell is rising again under Sean Payton in New Orleans. Gus Bradley deserves another shot in a situation that isn't the Jaguars and he's still very young. Jim Schwartz and Mike Munchak aren't big enough for Big D, despite their previous head-coaching experience.
6. Cowboys assistants
| 1. | Kris Richard | 16/1 |
| 2. | Kellen Moore | N/A |
| 3. | Rod Marinelli | N/A |
File Kris Richard in the "master motivator" column, given he, like Norton, did a great job firing up troops under the high-energy Pete Carroll. Rod Marinelli has that Lionshead-coaching experience, but it's not a good one.
Handing the keys to Kellen Moore, despite the fact he's only 31, seems like very much in play for Jones; it'sthe kind of move he would make to copycat the rest of the NFL, given Garrett's conservatism has been at odds with Moore's successfulaggressive passing attack at times. Too bad there aren'todds for Moore, because outside of Urban Meyer, he may actually be the most appealing Garrett replacement.
7. Big Cowboys names
| 1. | Tony Romo | 150/1 |
| 2. | Jason Witten | N/A |
| 3. | Barry Switzer | 500/1 |
| 4. | Jimmy Johnson | 500/1 |
| 5. | Jerry Jones | 500/1 |
Tony Romo returns to Dallas to call the game on Thanksgiving, whereJones willfurther appreciate his former quarterback's amazing football knowledge. It's hard to see Romo ever giving up his prized CBS gig to go into a totally new job with no experience, unlike what happened with Jon Gruden, "Monday Night Football" and the Raiders.
Jason Witten is already a player-coach, but should he actuallyretire after 2019,watch out. He's been in head-coaching headlines before with those wackyTennessee rumors.
Barry Switzer, 82,and Jimmy Johnson, 76, gave Jones his most recent Super Bowl titles, but of course they're not coming back to help Jones much later in life.
That leaves Jerry Jones, 77,pulling a Ted Turner and coming down from the owner's/general manager'sbox to lead his team himself. He could simply let Moore and Marinelli continue calling plays and hire situational analytics folks to do the rest of the in-game stuff.
OK, maybe not. But with "them Cowboys" and Jones, you can'tcompletely rule it out.
Meyer and Moore are the sneaky best feasible replacements, however, while Norton and Richard, for the moment, are the top sleepers.


{% extends "global/Page.html" %} {% load otree static %} {% block title %} {% endblock %} {% block content %}
The experiment is about to start.
Please use Full Screen (Press F11) for the duration of the experiment.


Disability Types
To create an accessible design, keep the needs of people with these disabilities in mind.
Users Affected
Colorblind
- May not be able to differentiate one color from another
- Can't understand information that is conveyed using only color
Low Vision
- Needs to be able to zoom into content to enlarge text without the content breaking — responsive sites are great!
- Has trouble understanding relationships between elements if related elements aren't close together
- Has a harder time reading text when contrast is low
Blind
- Interacts with all content using the keyboard and a screen reader
- Requires text alternatives to understand visual information, like images
- Navigates through pages using headings and landmarks
- Relies on programmatic labels and associated text to understand things like forms and dynamic content
Cognitive
- Needs more time to find information and fill out forms
- Understands content better when language is simple and direct
- Understands content better when text is reinforced by images, audio and video
- Finds it easier to navigate the site when page layouts and navigation are simple and clear
Deaf
- Needs synchronized captions to understand video content
- Needs transcripts to understand audio content
- Relies on accompanying text, visual or tactile cues to understand audio cues
Mobility
- Often uses a keyboard, switch, or other device to access content — must be able to interact with all elements without a mouse
- Wants to tab through focusable elements on the page in a logical order
- Uses skip links to efficiently skip repeated blocks of text
- May need more time to fill out forms and to interact with content
Elderly
- Vision, hearing, and mobility get worse with age
- Often has one or more disability, but may not use assistive technology


Golden Retrievers make great family dogs!
Goldens generally have a gentle temperament. My wife and I have a Golden Retriever mix. He actually has a black coat from the other breed in him.  He likes to snuggle on the couch. And, when we go hiking, he loves to lay down in cold streams.


The minimum distance between two convex polygons
Given two disjoint (i.e. non-intersecting) convex polygons P and Q, the goal is to find the
pair(s) of points (p,q) (p belonging to P and
q to Q) minimizing the distance between them.
The fact that the polygons are disjoint is important, since it is assumed the polygon contains its interior. If the polygons intersect, then the minimum distance is meaningless. However, another version of this problem, the minimum vertex distance between convex polygons has solutions in intersecting and non-intersecting cases.
Back to the main problem: intuitively, the points determining the minimum distance will not belong to the interior of their respective
polygons. Similar to the maximum distance problem, we have the following result:
The minimum distance between two convex polygons P and Q is
determined by anti-podal pair between the polygons. As there are three cases for anti-podal pairs between convex polygons, three cases for the minimum distance can occur:
- The vertex-vertex case
- The vertex-edge case
- The edge-edge case
In other words, the points determining the minimum distance are not necessarily vertices. The following three examples illustrate the above result:
Given this result, an algorithm based on the Rotating Calipers naturally comes to mind:
Consider the following algorithm, where the input is assumed to be two convex
polygons P and Q with m and n vertices respectively given in clockwise order.
- Compute the vertex with minimum y coordinate for P (call it
yminP) and the
vertex with maximum y coordinate for Q (call it ymaxQ).
- Construct two lines of support LP and LQ for the polygons
at yminP and
ymaxQ such that the polygons lie to the right of their respective lines
of support. Then LP and LQ have opposite direction, and
yminP and ymaxQ form an anti-podal pair between the polygons.
- Compute dist(yminP,ymaxQ) and keep it as the minimum.
- Rotate the lines clockwise until one of them coincides with an edge of its polygon.
- If only one line coincides with an edge, then the vertex-edge anti-podal pair distance should be computed along with the new vertex-vertex anti-podal pairA distance. Both distances are compared the current minimum, which is updated if necessary.
If both lines of support coincide with edges, then the situation is somewhat more complex. If the edges "overlap", that is if one can construct a line perpendicular to both edges and intersecting both edges (but not at vertices), then the edge-edge distance should be computed. Otherwise the three new vertex-vertex anti-podal pair distances are computed. All distances are compared to the current minimum which is updated if necessary.
- Repeat steps 4 and 5, until the lines reach (yminP, ymaxQ) again.
- Output the minimum distance.
The Rotating Calipers paradigm ensures all possible anti-podal pairs (and all possible subcases) are
considered. Furthermore, the whole algorithm has linear time complexity, since
(besides the initialization), there are only as many steps as there are
vertices.
The maximum and minimum distance problems show that the Rotating Calipers paradigm can be used in different ways (compared to the previous problems of diameter and width). The paradigm can be applied to a two polygon case.
The smallest-box problem (minimum area enclosing rectangle) shows yet another way of using the Rotating Calipers, by using two sets of orthogonal lines of support on the same polygon.
December 17th, 1998


Touch Hover
Test (initially closed)
Test 1.1
Test 2 (initially opened with active class)
Test 2.1
Test 3 (menu item without submenu)
Test 4 (initially opened without active class just on mobile)
Test 4.1


[gecode-users] Parallel conditional combinator
Mauricio Toro
mauriciotorob at gmail.com
Thu Apr 24 11:14:55 CEST 2008
Hello all,
I am thinking about implementing the
parallel conditional combinator as a
Gecode propagator. Any ideas about
how to do this efficiently?
By the way, where can I find examples
about using the reflection post and spec
propagator methods?
Thanks
--
Mauricio Toro Bermudez
Estudiante de Ingeniería de Sistemas
Pontificia Universidad Javeriana, Colombia
Stagiare à l'Ircam
1, place Igor-Stravinsky 75004 Paris,
France de 2008 à 2009
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20080424/e1771d36/attachment.htm>
More information about the gecode-users
mailing list


This document describes how the thread pool in paste.httpserver works, and how it can adapt to problems.
Note all of the configuration parameters listed here are prefixed with threadpool_ when running through a Paste Deploy configuration.
When a WSGI application is called, it’s possible that it will block indefinitely. There’s two basic ways you can manage threads:
In both cases things go wrong – if you start a thread every request you will have an explosion of threads, and with it memory and a loss of performance. This can culminate in really high loads, swapping, and the whole site grinds to a halt.
If you are using a pool of threads, all the threads can simply be used up. New requests go into a queue to be processed, but since that queue never moves forward everyone will just block. The site basically freezes, though memory usage doesn’t generally get worse.
The thread pool in Paste has some options to walk the razor’s edge between the two techniques, and to try to respond usefully in most cases.
The pool tracks all workers threads. Threads can be in a few states:
When a request comes in, if there are no idle worker threads waiting then the server looks at the workers; all workers are busy or hung. If too many are hung, another thread is opened up. The limit is if there are less than spawn_if_under busy threads. So if you have 10 workers, spawn_if_under is 5, and there are 6 hung threads and 4 busy threads, another thread will be opened (bringing the number of busy threads back to 5). Later those threads may be collected again if some of the threads become un-hung. A thread is hung if it has been working for longer than hung_thread_limit (default 30 seconds).
Every so often, the server will check all the threads for error conditions. This happens every hung_check_period requests (default 100). At this time if there are more than enough threads (because of spawn_if_under) some threads may be collected. If any threads have been working for longer than kill_thread_limit (default 1800 seconds, i.e., 30 minutes) then the thread will be killed.
To kill a thread the ctypes module must be installed. This will raise an exception (SystemExit) in the thread, which should cause the thread to stop. It can take quite a while for this to actually take effect, sometimes on the order of several minutes. This uses a non-public API (hence the ctypes requirement), and so it might not work in all cases. I’ve tried it in pure Python code and with a hung socket, and in both cases it worked. As soon as the thread is killed (before it is actually dead) another worker is added to the pool.
If the killed thread lives longer than dying_thread_limit (default 300 seconds, 5 minutes) then it is considered a zombie.
Zombie threads are not handled specially unless you set max_zombies_before_die. If you set this and there are more than this many zombie threads, then the entire process will be killed. This is useful if you are running the server under some process monitor, such as start-stop-daemon, daemontools, runit, or with paster serve --monitor. To make the process die, it may run os._exit, which is considered an impolite way to exit a process (akin to kill -9). It will try to run the functions registered with atexit (except for the thread cleanup functions, which are the ones which will block so long as there are living threads).
If you set error_email (including setting it globally in a Paste Deploy [DEFAULT] section) then you will be notified of two error conditions: when hung threads are killed, and when the process is killed due to too many zombie threads.
If you have a worker pool size of 10, and 11 slow or hung requests come in, the first 10 will get handed off but the server won’t know yet that they will hang. The last request will stay stuck in a queue until another request comes in. When a later request comes later (after hung_thread_limit seconds) the server will notice the problem and add more threads, and the 11th request will come through.
If a trickle of bad requests keeps coming in, the number of hung threads will keep increasing. At 100 the hung_check_period may not clean them up fast enough.
Killing threads is not something Python really supports. Corruption of the process, memory leaks, or who knows what might occur.  But this hasn’t been tried much in production, so there’s not much experience with it.
If you want to see what’s going on in your process, you can install the application egg:Paste#watch_threads (in the paste.debug.watchthreads module). This lets you see requests and how long they have been running. In Python 2.5 you can see tracebacks of the running requests; before that you can only see request data (URLs, User-Agent, etc). If you set allow_kill = true then you can also kill threads from the application. The thread pool is intended to run reliably without intervention, but this can help debug problems or give you some feeling of what causes problems in the site.
This does open up privacy problems, as it gives you access to all the request data in the site, including cookies, IP addresses, etc. It shouldn’t be left on in a public setting.
The HTTP server (not the thread pool) also accepts an argument socket_timeout. It is turned off by default. You might find it helpful to turn it on.


--- layout: site-content title: get started utilitySection: Get Started ---
Easy setup & access to CDN versioning.


One fihgt one
问题描述 :
Lv Bu and his soldiers are facing a cruel war――Cao Cao had his best generals just miles away.
There’s little time , but Lv Bu is unaware of how to arrange his warriors , what he know is that he have n brave generals while Cao Cao has m , and he has k fights to choose from , he’d like to make all his n warriors participate in the battle but get the least injuries . Lv Bu is happy because there is always a good solution . So , now is your task to tell Lv Bu the least injuries his troop would get.
No one could take part in two fights.
There’s little time , but Lv Bu is unaware of how to arrange his warriors , what he know is that he have n brave generals while Cao Cao has m , and he has k fights to choose from , he’d like to make all his n warriors participate in the battle but get the least injuries . Lv Bu is happy because there is always a good solution . So , now is your task to tell Lv Bu the least injuries his troop would get.
No one could take part in two fights.
输入:
Multiple cases. For each case ,there are three integers in the first line , namely n,m (1<=n<=m<=200)and k (n<=k<=m*n).
The next k lines are the information about k possible fights , for each line are two strings (no more than 20 characters ) and an integer. The first string indicates Lv Bu’s general and the second , of course , Cao Cao’s , and the integer is the injury Lv Bu’s general would get if this fight were chosen.
The next k lines are the information about k possible fights , for each line are two strings (no more than 20 characters ) and an integer. The first string indicates Lv Bu’s general and the second , of course , Cao Cao’s , and the integer is the injury Lv Bu’s general would get if this fight were chosen.
输出:
Multiple cases. For each case ,there are three integers in the first line , namely n,m (1<=n<=m<=200)and k (n<=k<=m*n).
The next k lines are the information about k possible fights , for each line are two strings (no more than 20 characters ) and an integer. The first string indicates Lv Bu’s general and the second , of course , Cao Cao’s , and the integer is the injury Lv Bu’s general would get if this fight were chosen.
The next k lines are the information about k possible fights , for each line are two strings (no more than 20 characters ) and an integer. The first string indicates Lv Bu’s general and the second , of course , Cao Cao’s , and the integer is the injury Lv Bu’s general would get if this fight were chosen.
样例输入:
2 3 5 LvBu ZhangFei 6 LvBu GuanYu 5 LvBu XuChu 4 ZhangLiao ZhangFei 8 ZhangLiao XuChu 3
样例输出:
8
//Accepted 496 KB 734 ms C++ 1967 B #include<cstdio> #include<cstring> #include<string> #include<algorithm> #include<map> #include<iostream> using namespace std; map<string,int> m1; map<string,int> m2; const int maxn=210; int w[maxn][maxn]; bool s[maxn],t[maxn]; int lx[maxn],ly[maxn]; int match[maxn]; int n,m,k; bool hungary(int u){ s[u]=true; for(int v=1;v<=m;v++){ if(!t[v] && lx[u]+ly[v]==w[u][v]){ t[v]=true;//易遗忘 if(match[v]==-1 || hungary(match[v])){ match[v]=u; return true; } } } return false; } int KM(){ int ans=0; memset(match,-1,sizeof(match)); for(int i=1;i<=n;i++){ lx[i]=-1<<30;//注意 } memset(ly,0,sizeof(ly)); for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) lx[i]=max(lx[i],w[i][j]); for(int i=1;i<=n;i++){ while(1){ memset(s,false,sizeof(s)); memset(t,false,sizeof(t)); if(hungary(i)) break; else{ int a=1<<30; for(int j=1;j<=n;j++) if(s[j]){ for(int k=1;k<=m;k++) if(!t[k] && a>lx[j]+ly[k]-w[j][k]) a=lx[j]+ly[k]-w[j][k]; } for(int j=1;j<=n;j++){ if(s[j]) lx[j]-=a; } for(int j=1;j<=m;j++){ if(t[j]) ly[j]+=a; } } } } for(int i=1;i<=m;i++) if(match[i]!=-1)// ans+=w[match[i]][i]; return -ans;//易遗忘 } int main(){ char name1[21],name2[21]; int u,v,injury; while(scanf("%d%d%d",&n,&m,&k)!=EOF){ m1.clear(); m2.clear(); u=v=1; for(int i=1;i<=n;i++){//不要忘了初始化图，因为此题不一定会填满n*m的边 for(int j=1;j<=m;j++) w[i][j]=-1<<30; } while(k--){ scanf("%s%s%d",name1,name2,&injury); if(m1.find(name1)==m1.end()) m1[name1]=u++;//若战将没有入图 if(m2.find(name2)==m2.end()) m2[name2]=v++; w[m1[name1]][m2[name2]]=-injury; } printf("%d\n",KM()); } return 0; }
解题参考：http://blog.csdn.net/freezhanacmore/article/details/8259354
(adsbygoogle = window.adsbygoogle || []).push({});
这排版…你都打开来看看改改
正是我要找的，适合新手
…. 配图居然是没方向的。。
不错，现在就缺少新的资料
代码不对，仔细对比一下输入输出， 怎么会有‘‘printf("The winning moves are:");’’这种输出呢？
好网站，肯定会火的
int half(int *array,int len,int key)
{
int l=0,r=len;
while(l<r)
{
int m=(l+r)>>1;
if(key>array )l=m+1;
else if(key<array )r=m;
else return m;
}
return -1;
}
这种就能避免一些Bug
l,m,r
左边是l,m;右边就是m+1,r;
编辑的时候有些不小心了
输出规范写错了哦~
楼主你能把scanf( "%d%*" ,&T );中%*的用法详细说明吗
这个系列很不错
mark, 很巧妙的实现！
真心不错，力顶作者
感觉这里的评分标准没啥作用阿，反而显得显得赘余，还不如直接去掉好了。


{{ _("This option is intended for the usage of Specter Desktop with nodes that you don't fully trust (e.g. remote / cloud nodes).") }}
{{ _("If enabled, you will see block hashes in the transactions overview.") }}
{{ _("You can take those block hashes to double check whether they also exist in other locations (other nodes, block explorers, etc).") }}
{{ _("If so, you can be sure that the corresponding transaction was included in this block, since there is a relationship between the blockhash and the tx.") }}
{{ _("In a nutshell: It substitutes double checking a specific tx in a block explorer with checking a blockhash which increases privacy.") }}


Read the Docs Theme¶
Note
This feature only applies to Sphinx documentation. We are working to bring it to our other documentation backends.
By default, Read the Docs will use its own custom sphinx theme unless you set one yourself
in your conf.py
file. Likewise, setting the theme to default
will accomplish the
same behavior. The theme can be found on github here and is meant to work
independently of Read the Docs itself if you want to just use the theme locally.
This blog post provides some info about the design, but in short, the theme aims to solve the limitations of Sphinx’s default navigation setup, where only a small portion of your docs were accessible in the sidebar. Our theme is also meant to work well on mobile and tablet devices.
Contributing to the theme¶
If you have issues or feedback, please open an issue on the theme’s GitHub repository which itself is a submodule within the larger RTD codebase. That means any changes to the theme or the Read the Docs badge styling should be made there. The code is separate so that it can be used independent of Read the Docs as a regular Sphinx theme.
How the Table of Contents builds¶
Currently the left menu will build based upon any toctree(s)
defined in your index.rst
file.
It outputs 2 levels of depth, which should give your visitors a high level of access to your
docs. If no toctrees are set in your index.rst file the theme reverts to sphinx’s usual
local toctree which is based upon the heading set on your current page.
It’s important to note that if you don’t follow the same styling for your rST headers across your documents, the toctree will misbuild, and the resulting menu might not show the correct depth when it renders.
Other style notes¶
- As a responsive style, you should not set a height and width to your images.
- Wide tables will add a horizontal scroll bar to maintain the responsive layout.