Registration Form
First Name
Last Name
Email
Mobile Number
Age
DOB
User Name
Password Name
Address
Password Name
Gender
Male
Female
Skills
Python
Java
HTML
R
Hadoop
Select Country
India
US
UK
Chaina
Pakistan
france
England
Profile photo
favourite color


Formalities with the Panamanian Authorities (clearing in and out, immigration etc.) are completely separate from formalities with the Panama Canal Authority for Canal Transit.
Noonsite always states the official laws and regulations for clearance formalities. However, in practice many port authorities in Panama operate differently from each other and cruisers may well find they obtain different clearance conditions to those stated. See the adjacent reports and news for the latest info. from cruisers.
PANAMA ARRIVAL FORMALITIES
Important: Be sure to check-in with all authorities as soon as you land in Panama. Cruisers have reported fines of US$1000 each for not having an arrival stamp in their passports.
Advance Notification to the Panamanian Maritime Authority
There is a law concerning the pre-registration of visiting vessels. This requires details about the yacht and its crew to be sent to the Authorities (AMP) at least 48 hours before arrival at any Panamanian port. This information may be sent by email or by filling in the on-line form. The on-line form is available at AMP website
However, the AMP understand that this may not be possible for all yachts, and in such cases, the information will need to be provided on arrival.
In practice many authorities are not aware of the advance notification mandate and therefore it is not enforced in all ports. There does not appear to be problems for any boats that have not done so.
Yachts arriving from the Caribbean/South America
Can no longer clear Immigration at the Panama Canal Yacht Club as it has now been demolished, but must visit the office in Colon (or at Shelter Bay Marina). Be sure to arrive with the proper port clearance paper (zarpe). If you arrive without the correct papers you will be fined.
Yachts clearing in first at the San Blas Islands
Clearing into Panama in the San Blas Islands is currently in a state of flux. There is an on-going disagreement between the Kuna Congress and the Central Government, who in turn have suspended the Port Captain and Immigration services in the San Blas pending further developments.
The Immigration and Port Captain offices in Porvenir (now called Gaigirgordub) - at the western end of the San Blas - and Puerto Obaldia at the far eastern end, are both closed until further notice.
Vessels entering or leaving Panama on the Caribbean side will need to do so in Puerto Lindo (where the Porvenir Port Captain has relocated to) Colon or Portobelo. Note that if you check in at Portobelo you will need to go to Colon to buy your Cruising Permit - and - if you check in at Puerto Lindo you will need to go to Portobelo to get your visa from Immigration (short bus ride).
If arriving in the San Blas first, it is not advisable to take the SUV's from Carti in the San Blas Islands to Panama City or to Colon to clear in, as you will pass through police check points who will give you a hefty fine (or even arrest you) if you have not already visited an immigration office and had your passport stamped.
It is recommended to have the San Blas listed on your exit zarpe from your previous port (e.g. Colon via San Blas).
Yachts arriving from the Pacific
Should be aware that the Immigration offices at the Balboa Yacht Club and Flamenco Island are also classed as "Branch Offices". Officially that means they are not always manned and they can only administer entry to the country stamps, which are valid for 72 hours only.
Yachts going to Panama simply to transit the Panama Canal
Regulations are somewhat "cloudy" with reference to the 72 hour rule mainly being applied to commercial vessels transiting the Panama Canal, which most do within 72 hours, and for which no navigation permit is required and no crew visa. For yachts however it is a different story and a cruising permit and visa is required. According to regulations a domestic Zarpe is also required by yachts transiting the Canal (either Colon-Balboa or Balboa-Colon).
Note: Some yachts using agents have been able to pass the Canal handled the same way as commercial vessels, however this is only possible if the yacht in question has transited previously and registered with the Canal and is ready to transit on arrival in Panama.
The process for clearance is:
(1) Present your passport at the closest Immigration office to obtain a 72 hour visa. You will also need to provide copies of your International Zarpe, crew list and passports.
(2) Go to the Port Captain's Office to obtain your "Declaration General" and "Permiso de Navegacion" (Cruising Permit). You will need to surrender the original International Zarpe from your previous port of call and provide copies of crew list, crew passports and vessel documentation.
(3) Go to the central Immigration office to get your Mariners Visa (see Immigration below). This will be dated to last as long as your cruising permit. You will need copies of the cruising permit as well as passports.
After Immigration, yachts must clear with Customs and the Port Authority.
At both Balboa and Cristobal (Colon), arriving yachts may be boarded by Panamanian officials. At Cristobal they may complete all the initial clearance formalities. When the captain goes ashore to complete clearance procedures, all others must remain on board until clearance is complete. Cruisers report that the Colon Authorities are by far the most strict and "by the book" in all of Panama. If possible, it is recommended that clearance and obtaining a cruising permit is carried out elsewhere, before arrival in Colon.
Often in Panama clearance can be a lengthy process due to the amount of paperwork that has to be copied and processed and the number of different offices (and the bank) that have to be visited. Allow 4-5 hours over a 2 day period to be on the safe side.
Note:
A Permiso de Navegacion (Cruising Permit) is required by all foreign vessels sailing in Panamanian waters. These can only be issued against a valid ship (yacht) registration. See Documents and Fees for further details.
Domestic Clearance
When sailing from one district to another in Panama (e.g. San Blas to Colon or Colon to Balboa - via the Canal - etc.) it is necessary to clear in and out between Panamanian ports where there is a Port Captain's office. You will need to check out with the Port Captain and obtain a Domestic Zarpe for the next port. On arrival, report in to the Port Captain's Office at no cost. Take with you a copy of your Cruising Permit, a printed crew list and a copy of the boat’s registration document - just in case this is asked for. See Fees for charges.
If employing an Agent, it is helpful for them to be present during any inspection or official visit.
International Clearance
(1) Take your original Cruising Permit, with a Crew List and crew passport copies to the Port Captain office. Here you will pay for your international Zarpe.
(2) Have your passports stamped for exit by the local immigration office. No fee. Immigration will require a copy of all passports, the crew list and Zarpe.
Officially, the day you check out of Panama for another country is the day you should depart. It is however common practice for boats on the Pacific side of Panama for example, to stop in Las Perlas for a day or two on their way westward with no problems reported to date. Whilst boardings by officials are rare you may incur a fine of up to $500 if you linger and are boarded
Details of all charges can be found under "Fees" beow.
Last updated June 2016.
In March 2012, Panamanian Immigration Authorities introduced a new, highly inflated immigration fee. The official statement reads:-
"The Servicio Nacional de Migracion is currently enforcing an entry permit of US$ 105,00 for sea travellers piloting their own boat or yacht and arriving as a tourist. This fee permits entry into Panama for a period of three months, which can be extended for up to two years subject to an application to the Immigration authorities".
The Mariners Visa can only be issued to persons arriving with the vessel and tends to be issued for one year (or the same amount of time as the cruising permit).
This visa is cancelled when you leave Panama, so another will have to be purchased if you return by yacht. If however you are arriving/returning by other means of transport, a regular 6 Months entry VISA will be issued at the border/airport.
Therefore if arriving by boat and departing by plane, you will have to surrender your Mariners Visa. On return to Panama to re-join the boat, a regular entry visa will be issued and with this you can obtain an exit zarpe.
This new Mariners Visa appears to be applied more consistently now throughout the various Panamanian ports.
It is important to remember that each Immigration office in Panama interprets the rules and regulations their own way. It's therefore advisable to read latest reports from cruisers and check out the various Panama nets before arrival to find the best port for entry. See the report here for the latest updates from cruisers as to how and where different fees are being charged.
Apart from some eastern European, Asian and African countries who require a visa in advance, most other nationalities can enter Panama and buy a visa on arrival.
If checking in or out during the weekend or outside business hours, immigration charge an overtime fee of US$30.00 per yacht.
Immigration at Branch Offices
It is important to note that the Immigration Offices at Porvenir and Portobelo (on the Caribbean side of Panama) and Balboa Yacht Club and Flamenco Island (on the Pacific side), are only Branch Offices. This means that officially, they are unable to issue visas and can only issue "entry to the country" stamps. Legally, the "entry to the country" stamp permits crew 72 hrs to obtain a visa (as per the government regulations), either in Colon or Balboa or at your next Panama port of call.
That said, it appers that Porvenir Immigration are issuing Mariner Visas. Cruisers MUST be sure however to get a receipt, as some authorities on the mainland do not recognise this stamp as an official visa so proof of payment will be required.
The "72 hour rule"
This "72 hour rule" was apparently established primarily for commercial shipping passing the Panama Canal so that the crew do not have to appear at Immigration. Immigration officials are now applying this rule to yacht crew, however as always, its application is inconsistent throughout Panama and its use is somewhat "murky". In actual fact, many yachts cruise the San Blas and even leave their boats in the San Blas and fly home, and do not experience any problems re. lack of Mariners visa at the airport (See report here). Some officials at the Immigration office in Porvenir apparently do not tell cruisers about the 72 hour rule.
Be warned though, yachts are subject to being stopped and immigration papers checked. Therefore if you have been in the country for more than 72 hours and don't have a Mariners visa, you risk being penalized.
Remember also that the 72 hour rule means that if you have a flight booked within 3 days of your arrival in Panama, you will not have to buy a Mariners Visa. Be sure to show your airline ticket at check-in. When you return to Panama you will be given 30 days on arrival in Panama, enough time to gain an exit Zarpe and depart Panama, saving you the cost of the Mariners Visa.
Length of Stay in Panama for yacht crew
Three days (72 hours) is permitted, after which time a Mariners Visa must be purchased which permits entry into Panama for a period of three months, which can be extended for up to two years subject to an application to the Immigration authorities. However, as noted above, most offices tend to issue this visa for the same amount of time as your cruising permit (i.e. 1 calendar year).
Be sure to apply for an extension well in advance of your visa expiry date.
Last updated January 2016.
Firearms must be declared on arrival and will be held in bond until departure.
Bringing in Spare Parts to Panama by Air
All arriving passengers by air to Panama, residents or visitors, have to complete a Custom Declaration upon arrival. This declaration clearly states that you do not have to declare items you are bringing in as long as the total value does not exceed US$2000.
If you are bringing spares or equipment with a value below US$2000, generally there is no problem and it is recommended that you have invoices covering the items you are bringing in. If you pack the items amongst your luggage (not in boxes) you should have no problems.
If you are bringing in items with a value exceeding US$2000, duty is payable, or for a boat in transit a transit clearance must be arranged (to avoid paying duty). Part of the transit clearance is that an inspector must accompany the items on board the boat. Normally the cost of the transit clearance is based on the value of the items and in addition you have to pay for the inspector and his transportation to and from the boat. It is difficult to advise the total cost involved as it also depends on where the boat is moored.
Cruisers recommend that by far the easiest way to source spare parts and even large items is to use the services of Marine Warehouse in the USA who can deliver directly to Panama with no extra taxes and reasonable freight costs (if not express). Contact tom@)marinewarehouse.net.
Last updated February 2015.
Vaccinations
An international yellow fever vaccination certificate may be required if you have been to a yellow fever endemic country. This includes much of South America.
If such a vaccination is needed, then a public health clinic in Panama City or Colon can vaccinate for as little as $5. Some other countries will require such a certificate if your passport shows that you have been to Panama.
There is a risk of yellow fever transmission in the provinces of Darien, San Blas, or east Panama. This does not include Panama City and the Canal Zone. Visitors should seek specialist advice about the need to receive Yellow Fever vaccine if travelling to these areas. Travellers planning to visit these provinces should obtain a yellow fever vaccine ten days prior to travel.
If just transiting the Canal, it is not necessary to take anti-malarial precautions, but is recommended outside the Canal Area.
Animals
Portuguese Man 'o War
If you are stung by one (also applies to a lion fish, coral, stingrays etc.), the best remedy is HOT seawater. Any chemical agent, or change in PH, or Salinity, or chemical composition, will trigger the stinging cells to fire more venom. For many millions of years, these things have evolved to exist in a narrow temperature band, but by increasing the temperature, it simply turns the cells into protoplasm, like soup. Target temperature is about 50 C or 122 F, but just try to get as hot as you can tolerate.
In the past, noonsite has received a report from a cruising sailor who was bitten by a bat while sleeping. They were anchored in Bahia Benao near Punta Mala. It may not be a bad idea to get prophylactic rabies inoculation prior to going into areas where one might be attacked by a rabid animal.
ZIKA VIRUS ALERT: (September 2016) There have been recent safety alerts from the US State Department, UK Foreign Office, and Center for Disease Control (CDC) regarding travel to parts of Central and South America, Africa, southern Asia, the Caribbean, and the South Pacific islands. Panama is an area of interest due to mosquito transmission risk. There is growing concern about the rapid spread of the ZIKA Virus and the impact of the virus on pregnant women and babies. ZIKA is transmitted by mosquitos in tropical and sub-tropical climates, and there is currently no cure or vaccine. This situation is evolving rapidly, so please refer to the CDC’s dedicated website if you are intending to cruise in one of the effected areas.
HOSPITALS
Colon
Clinic near Quatro Altos (Tel: 433-7532)
Panama City
Clinica Hospital San Fernando (Tel: 278-6364) – This hospital has an international department to assist you. (Tel: 305-6300, Ex 4283).
Email<EMAIL_ADDRESS>Centro Medico Paitilla (Tel: 265-8800) Calle 53 and Ave. Balboa.
Located near the World Trade Center in the Marbella area.
Punta Pacifica Hospital (Tel: 204-8000). This is the newest and most advanced facility in the country and is affiliated with the John’s Hopkins Hospital of Baltimore, Maryland. Several cruisers have been helped with direct billing to insurance companies outside of Panama.
Hospital National (Tel: 207-8100) is located at Avenida Cuba between Calle 38 & Calle 39.
Last updated January 2016.
Cruising Permits, "Permiso de Navegacion"
These are required by all foreign vessels sailing in Panamanian waters. As from 1st July 2010, cruising permits are now issued for one year, renewable for 1 additional year and then 1 further additional year, so 3 years in total are permitted.
The cruising permit is cancelled when the yacht leaves the country and a new one will have to be purchased on re-entry.
Note: Cruising Permits can only be issued against a valid ship (yacht) registration and should this registration expire within the 1 year normally covered by the Cruising Permit, the permit will only be valid to the date the registration is valid (however the full amount must be paid). This really only applies to US boats (and other nationalities), whose vessel documentation shows an annual expiration date. Upon presentation of a renewed registration a NEW permit will be issued valid for 1 year. There is some confusion amongst Panama Port Captain's about the application of this law (see news item for further details).
The law states that Cruising Permits must be issued by calendar year (meaning if you arrive January or June, you still only get a permit valid to December 31st the same year). However, more and more ports are issuing the permits for one year (365 days from date of issue).
It is therefore important to note that the local authorities in each port in Panama may interpret the law in their own way.
See Fees for permits below.
Yachts clearing in Cristobal, who do not intend to stop in Balboa at all, can clear out of Panama in Cristobal, but they must do this one working day before transiting the Canal. Apparently the clearance is free in Cristobal, but costs $25 in Balboa. If intending to stop at Las Perlas or the San Blas Islands, this should be mentioned on the clearance paper by the relevant officer.
If a Fumigation certificate is required (i.e. if visiting the Galapagos islands) ensure that it is one issued by the Ministerio de Sanidad.
Note: A dinghy Licence is not required by visiting yachtsmen.
Last updated January 2016.
Full details about the Panama Canal Transit, including fees, can be found in this report.
Panama is not a cheap country to visit. There are substantial fees for clearing in and cruising. Even if you are only intending to visit the San Blas Islands (for example), it will cost in the region of US$500 to clear in and cruise here, even for a short time!
Fees continue to be charged inconsistently throughout Panama's ports of entry. It is is strongly recommended to find out in advance of your visit from cruisers that are there (via forums, Nets, reports on noonsite etc.) the best port for clearing-into the country where you can incur minimum fees.
Immigration
The Servicio Nacional de Migracion is currently enforcing an entry permit (Mariner's Visa) of US$ 105,00 per person for sea travellers piloting their own boat or yacht (and crew) and arriving as a tourist. This is NOT the same as a Tourist Visa. It is required for any stay longer than 72 hours and permits entry into Panama for a period of three months, which can be extended for up to two years subject to a application to the Immigration authorities.
Cruising Permit
Article 71 of Panama’s fiscal code now defines a one-year sailing and navigation license (cruising permit) that costs $5 and is renewable for another year.
Article 72 defines a temporary registration fee for private yachts: $45 for boats up to 6 meters (19.7 feet) in length, $90 for boats up to 10 meters (32.8 feet) and $180 for larger boats. The new registration is annual, but it is renewable for the same period.
Therefore approximate overall cost for 1 year cruising permit (depending on size of yacht) plus admin fees, is about US$205.
Other Fees on Checking-in
Port Captain Declaration General: US$20
There may be a charge if officials have to visit your yacht to "inspect" it (approx. $60). Overtime fees are charged as well.
The Quarantine fee is US$35.
The Health Ministry fee is US$122.
Mandatory boat fumigation: US$53 (be sure to get a quote as charges for this can be as high as US$300).
It costs approximately $20 to take a taxi to the bank to pay all the fees.
Fees on Checking-out
The check-out fees are less than the entry fees.
Domestic Zarpe: US$ 15.00 plus stamp fees.
There should not be any charges on clearing into a subsequent domestic port.
International Zarpe: Fees for this can vary widely and as much as US$53 charge has been reported. It seems to be wholly dependent on which office you use and who sees you.
San Blas - Kuna Yala Fees
If checking in at the San Blas Islands, there is a US$20 fee per 30 days for a Kuna Congress cruising permit for the islands for the boat, plus a further US$20 charge per person on board per 30 days. The only other charges appear to be for the Panama Cruising Permit and for Immigration - although latest reports are that the Kuna Yala are not enforcing this. It must also be mentioned that some yachts have reported that on several Islands, but not all, they have been asked to pay an "anchoring fee" of approx. US$ 10.00.
Other Fees
Yachts over 65ft must have an AIS transponder. One can be hired from the canal authorities.
For information on the latest Panama Canal transit fees (including deposits etc.), see the Panama Canal Authority Customer Form "Procedures for securing a handline transit of the Panama Canal" from their website www.pancanal.com (go to Maritime Operations and then to Customer Forms).
Fees for the National Park Area (around Isla Coiba, Isla Canal de Afuera, Isla Brincanco, Granito de Oro and Isla Rancheria) in northern Panama, have substantially increased. In 2012 they were $20 per day, per person, and a daily anchoring fee. For a 10m boat this was $30.
Panama has a sales tax of 7% which also includes the Banks, meaning that you pay a 7% tax on what the Bank charges for the transaction not on the whole amount of the transaction. This Tax also applies to Service Fees such as Agency fees etc.
Last updated January 2016.
Panamanians tend to be conservative dressers; men always wear long trousers, never trainers, and most people wear business clothes in town, which should be taken into consideration even if it is hot if you wish to avoid being too conspicuous.
For details of the restrictions on sailing in Panama Canal Waters see here
Especially in Panama City and any government office, please respect the local custom of wearing long pants, shirts with sleeves, and shoes (not sandals).
For agent recommendations from cruisers, see this noonsite report.
Dogs need health and anti-rabies certificates.
The owner must notify Panama at least three (3) days before the arrival of the pet by completing the Home Quarantine Request. This can be download from www.minsa.gob.pa.
This notification must be sent via email to<EMAIL_ADDRESS>In the email, you will need to provide a scanned copy of your pet’s health certificate as well as information related to your pet’s date of arrival.
All other animals need health certificates. In practice, the procedure is quite relaxed.


Well, 2018 is already amazing. Some folks think the price is just pumping. I happen to think that the new stuff is getting priced in. That’s in part because we’re not just going up as a coin, but we’re also rising faster than some of the other coins. I think 2018 is going to look pretty amazing.
Job Groundwork
So, I’ve had the conversation with my wife, my family, and now my job. Looks like I’ll be transitioning to full time crypto work over the next few months. I like the educational company I work for. I may even try to help them create a vice like service for science education videos. I don’t quite know what tomorrow holds. We’ll figure out if I’m putting in a letter of resignation or simply walking tomorrow. Either way I’m prepared to spend a lot more time in crypto land. Obviously my first goal is to fulfill the charter of the Minnow Support Project: Spread the values of Peace, Abundance, and Liberty, Grow the Steem ecosystem, and train and retain minnows on the platform.
I’ve also started backup witnesses on bitshares and peerplays. I’ll eventually start one on EOS too. These are secondary projects, but it helps take some pressure off of me having to sell Steem to pay for my life so I can continue to delegate as much Steem as possible to MSP projects (especially msp-waves broadcast station). If you happen to be a part of either of those communities please consider voting for me as a witness there. As I have more time I’ll see how I can provide useful tools and exposure for both of those communities and projects.
Followers
Honestly this could use it’s own post, but I’m trying to get a lot of my life in order to move to crypto full time. So, I’ll have to bundle this mega announcement with the others. I just hit 10,000 FOLLOWERS!!! BOOM. Outside of the follow for follow bot accounts I think there’s only something like 30 accounts that have actually reached this milestone! It’s a mega accomplishment. The fact that we have accounts like this is big for the platform. All I see is more growth and I’ll continue to work on growing my following here on Steem and figuring out ways to attract other users here.
With the price having come up I think it’s more attractive for youtubers to spend time here. I’m gonna do my best to recruit them. I have a YouTube forum on Jan 13 coming up. Should have around 5M subscribers represented as well as some Steem developers, whales, and audience. I think big things are coming here and I’m really looking forward to spearheading the steemification of social media.
3,000 Witness Votes!
This could also use it’s own announcment. It’s a pretty massive deal to me. When I leave the corporate world I’ll reveal my legal name and face and what not. You’ll see I’ve gotten 6,000 votes before in government elections. It’s funny cause now that I’m woke there’s no way I’d vote for that version of me, but I’ve been in politics. Frankly, I like it. I feel like through organization I can help a lot of people, but the key ingrediant that’s missing in USG is the actual consent and volentaryism that a space like Steem actually affords.
As per usual thanks to my mega whales supporting me. I wouldn’t be a top 8 witness without the Minnow Support Project and my digital family that lives there with me.
Thanks to the Minnow Support Witnesses:
@ausbitbank, @timcliff, @teamsteem, @followbtcnews, @swelker101, @drakos, @someguy123, @neoxian, @netuoso
Thanks to the witnesses that delegate in the thousands: @thecryptodrive, @lukestokes, @ausbitbank, @timcliff
Love to the moderator crew: @crimsonclad, @followbtcnews, @ausbitbank, @r0nd0n, @discordiant, @juliakponsford, @swelker101, @kubbyelizabeth, @ma1neevent, @stitchybitch, @rougebot, and @clayboyn.
We’re about to break 7,000 Steemians in there, so it’s hard to acknowledge all of them but folks like @torico, @artsygoddess, and @kristyyd are always around.
Much love to the Medal of Honor Winners of @netuoso, @crimsonclad, @followbtcnews, @r0nd0n, @ma1neevent, and our newest member @danielsaori.
Shoutout to @globocop for helping to keep the msp-waves station running!
I’m filled with gratitude
Thanks guys. Thanks for supporting me. I’ll do my best to bring about positive change, and I’m so excited for 2018.
 Let’s keep it up!
And of course. Thanks to @kaylinart. I wouldn’t be here if you had never given me a simple resteem. Much love to you and your family. I’m eternally grateful!
This page is synchronized from the post: ‘EPIC TRIPLE MILESTONE! Changing Jobs, 10k Followers, and 3k Witness Votes!’


RT @darkhelmetlive: Blasted out a quick blog post on how we worked with @newrelic to fix our bizarre Apdex woes. http://verboselogging.com/2013/07/29/newrelic-sinatra-rails-metal-controllers
7/30/2013, 11:48:25 PM
Favs: 0
Retweets: 0
link--- layout: tweet ---
RT @darkhelmetlive: Blasted out a quick blog post on how we worked with @newrelic to fix our bizarre Apdex woes. http://verboselogging.com/2013/07/29/newrelic-sinatra-rails-metal-controllers
7/30/2013, 11:48:25 PM
Favs: 0
Retweets: 0
link


--- title: Release of Code, Datasets, & Pretrained Model Weights keywords: fastai sidebar: home_sidebar nb_path: "nbs/release_info.ipynb" ---
You're looking at the code -- the notebooks are the code, with the exception of the Ellipse Editor and Console Scripts. Currently this is an anonymous mirror of a non-anonymous repository of a very similar name.
We weren't sure how to anonymously release a dataset on Zenodo. So for now, during the review process, we have datasets stored on Dropbox that are accessible via the get_data() function. Arguments to get_data
are:
Pending favorable review, these datasets will be released on Zenodo with relevant authors' names. {% include note.html content='The above datasets are each approximately 2000 images and their corresponding labels, crops, etc. One dataset we will not be releasing is the full 14,000-frame unlabeled set of videos of the drum, from which a few of the paper graphs, i.e. those in Figure 4, are derived. These 14000 frames are being kept back as "proprietary" so that the authors can learn & publish about additional physics now that we have the tools to study this sytem.' %}
These too are stored on Dropbox for now, and the function get_checkpoint() is intended to load them as with get_data. We release weights for the real dataset tasks of
The data and the weights both exist in Dropbox as sub-directories of a publicly-accessible espiownage-release
directory, accessible via this link. After the anonymous review process, a redirect will be placed there to point to the full (author-named) release repository.


| 1 |
Vinet_2018 |
Genetic analysis of calf health in Charolais beef cattle |
Vinet, A; Leclerc, H; Marquis, F; Phocas, F |
2018 |
2018-02-19 |
PMC |
N |
PMC6140890 |
29471383.0 |
10.1093/jas/sky043 |
1e8ce0xi |
0.714516 |
|
Donovan_1998, Quigley_1994 |
| 2 |
Bispo_2010 |
Effect of weaning status on animal performance and meat quality of Rubia Gallega calves |
Bispo, Esperanza; Monserrat, Lorenzo; González, Laura; Franco, Daniel; Moreno, Teresa |
2010 |
2010-11-30 |
PMC |
N |
PMC7158686 |
20692108.0 |
10.1016/j.meatsci.2010.07.005 |
lomy9k6v |
0.697821 |
Summers_2015, Kuehn_1994, Luebbe_2019, Crenshaw_2017 |
Luebbe_2019, Gruse_2016, Fiems_1989 |
| 3 |
Rauch_2018 |
Evaluation of two-stage weaning and trace mineral injection on receiving cattle growth performance and behavior |
Rauch, Jordan C; Stokes, Rebecca S; Shike, Daniel W |
2018 |
2018-12-07 |
NONCOMM |
N |
PMC7107296 |
|
10.1093/tas/txy131 |
ysoojuwt |
0.677410 |
Luebbe_2019, Summers_2015, Kuehn_1994, Crenshaw_2017, Franklin_2003 |
Luebbe_2019, Berge_2009, Fiems_1989 |
| 4 |
Richeson_2012 |
Weaning management of newly received beef calves with or without continuous exposure to a persistently infected bovine viral diarrhea virus pen mate: Effects on health, performance, bovine viral diarrhea virus titers, and peripheral blood leukocytes |
Richeson, J. T.; Kegley, E. B.; Powell, J. G.; Beck, P. A.; Ley, B. L. Vander; Ridpath, J. F. |
2012 |
2012-06-23 |
PMC |
N |
PMC7110029 |
22648754.0 |
10.2527/jas.2011-4077 |
eqlcltk7 |
0.655266 |
Summers_2015, Luebbe_2019, Crenshaw_2017, Kuehn_1994, Hill_2017 |
|
| 5 |
Wilson_2017 |
Effect of bovine respiratory disease during the receiving period on steer finishing performance, efficiency, carcass characteristics, and lung scores |
Wilson, B.K.; Step, D.L.; Maxwell, C.L.; Gifford, C.A.; Richards, C.J.; Krehbiel, C.R. |
2017 |
2017-02-28 |
PMC |
N |
PMC7147665 |
|
10.15232/pas.2016-01554 |
lns3co63 |
0.641084 |
Summers_2015, Luebbe_2019, Kuehn_1994, Crenshaw_2017, Warner_2017 |
Virtala_1996, Quigley_1994 |
| 6 |
Schweer_2018 |
Impact of PRRSV infection and dietary soybean meal on ileal amino acid digestibility and endogenous amino acid losses in growing pigs() |
Schweer, Wesley P; Patience, John F; Burrough, Eric R; Kerr, Brian J; Gabler, Nicholas K |
2018 |
2018-03-09 |
PMC |
N |
PMC6140837 |
29534187.0 |
10.1093/jas/sky093 |
e157ua8p |
0.632454 |
Crenshaw_2017, Kuehn_1994, Curry_2018 |
|
| 7 |
Neary_2018 |
Successful treatment of suckling Red Angus calves for bovine respiratory disease is not associated with increased mean pulmonary arterial pressures at weaning |
Neary, Joseph M; Church, Dee; Reeves, Nathan; Rathmann, Ryan J |
2018 |
2018-05-12 |
PMC |
N |
PMC6095343 |
29762738.0 |
10.1093/jas/sky189 |
iwo25sjy |
0.600413 |
Luebbe_2019 |
|
| 8 |
Ryan_2015 |
Supplemental trace minerals (zinc, copper, and manganese) as sulfates, organic amino acid complexes, or hydroxy trace-mineral sources for shipping-stressed calves |
Ryan, A.W.; Kegley, E.B.; Hawley, J.; Powell, J.G.; Hornsby, J.A.; Reynolds, J.L.; Laudert, S.B. |
2015 |
2015-08-31 |
PMC |
N |
PMC7147669 |
|
10.15232/pas.2014-01383 |
3g4gzu3g |
0.599135 |
Kuehn_1994, Eppard_1982, Crenshaw_2017, Warner_2017, Summers_2015 |
Krueger_2016, Davenport_2000, Stabel_2019 |
| 9 |
Drennan_2009 |
Performance of spring-calving beef suckler cows and their progeny to slaughter on intensive and extensive grassland management systems |
Drennan, M.J.; McGee, M. |
2009 |
2009-01-31 |
PMC |
N |
PMC7102801 |
|
10.1016/j.livsci.2008.04.013 |
0luxbfzt |
0.548353 |
Kuehn_1994, Luebbe_2019, Summers_2015, Warner_2017, Crenshaw_2017 |
Luebbe_2019, Warner_2017 |
| 10 |
Er_C_2014 |
Adverse effects of Influenza A(H1N1)pdm09 virus infection on growth performance of Norwegian pigs - a longitudinal study at a boar testing station |
Er, Chiek; Lium, Bjørn; Tavornpanich, Saraya; Hofmo, Peer Ola; Forberg, Hilde; Hauge, Anna Germundsson; Grøntvedt, Carl Andreas; Framstad, Tore; Brun, Edgar |
2014 |
2014-12-04 |
COMM-USE |
N |
PMC4300606 |
25472551.0 |
10.1186/s12917-014-0284-6 |
m35szlis |
0.495553 |
Kuehn_1994, Luebbe_2019, Summers_2015, Dezfouli_2006 |
|
| 11 |
Che_T_2012 |
Mannan oligosaccharide increases serum concentrations of antibodies and inflammatory mediators in weanling pigs experimentally infected with porcine reproductive and respiratory syndrome virus(,)(2) |
Che, T. M.; Song, M.; Liu, Y.; Johnson, R. W.; Kelley, K. W.; Van Alstine, W. G.; Dawson, K. A.; Pettigrew, J. E. |
2012 |
2012-08-23 |
PMC |
N |
PMC7110021 |
22367071.0 |
10.2527/jas.2011-4518 |
supdzy06 |
0.469296 |
|
|
| 12 |
Summers_2015 |
Impact of supplemental protein source offered to primiparous heifers during gestation on II. Progeny performance and carcass characteristics |
Summers, A. F.; Blair, A. D.; Funston, R. N. |
2015 |
2015-04-23 |
PMC |
N |
PMC7110259 |
26020209.0 |
10.2527/jas.2014-8297 |
sqhebpyg |
0.396683 |
Kuehn_1994, Luebbe_2019, Crenshaw_2017, Warner_2017 |
Luebbe_2019, Wallace_2017 |
| 13 |
Luebbe_2019 |
Influence of weaning date and late gestation supplementation on beef system productivity I: animal performance() |
Luebbe, Kelsey M; Stalker, Leslie A; Klopfenstein, Terry J; Funston, Richard N |
2019 |
2019-07-12 |
NONCOMM |
N |
PMC7107260 |
|
10.1093/tas/txz116 |
akr0yanq |
0.357368 |
Summers_2015, Kuehn_1994, Warner_2017, Sasaki_2017 |
Summers_2015, Wallace_2017 |
| 14 |
Campolina_2020 |
Effects of a blend of essential oils in milk replacer on performance, rumen fermentation, blood parameters and health scores of dairy heifers |
Joana P. Campolina; Sandra G. Coelho; Anna Luiza Belli; Fernanda S. Machado; Luiz G. R. Pereira; Thierry R. Tomich; Wanessa A. Carvalho; Rodrigo O. S. Silva; Alessandra L. Voorsluys; David V. Jacob; Mariana M. Campos |
2020 |
2020-03-17 |
BioRxiv |
N |
|
|
10.1101/2<IP_ADDRESS>5209 |
nwrv0152 |
0.318352 |
Kuehn_1994, Summers_2015, Crenshaw_2017, Luebbe_2019, Franklin_2003 |
Gruse_2016, Berge_2009 |
| 15 |
Sandelin_2020 |
Field trial to evaluate the effect of an intranasal respiratory vaccine protocol on bovine respiratory disease incidence and growth in a commercial calf rearing unit |
Sandelin, Atte; Härtel, Heidi; Seppä-Lassila, Leena; Kaartinen, Liisa; Rautala, Helena; Soveri, Timo; Simojoki, Heli |
2020 |
2020-03-04 |
COMM-USE |
N |
PMC7055024 |
32131825.0 |
10.1186/s12917-020-02294-7 |
a5gg2mn1 |
0.310861 |
Luebbe_2019, Waltner-Toews_1986, Summers_2015 |
|


I saw a werewolf with a Chinese menu in his hand. Walking through the streets of Soho in the rain. He was looking for a place called Lee Ho Fook's. Gonna get a big dish of beef chow mein. My purple class link.
He's the hairy-handed gent who ran amuck in Kent.
Lately he's been overheard in Mayfair.
Better stay away from him.
He'll rip your lungs out, Jim.
I'd like to meet his tailor.


Former All Black sees Leinster visit as a chance for Lyon to prove their European pedigree
The sides meet in the Heineken Champions Cup on Saturday.
by AFPLYON’S FORMER NEW Zealand centre Charlie Ngatai says hosting record four-time winners Leinster in the Heineken Champions Cup on Saturday will be “massive” for the inexperienced club at the highest level of European rugby.
The French outfit, who lead the Top 14, are only in the competition for the second time and lost all six of their pool matches last season.
“It’s going to be massive. They’re going to want to come down here and give it their best,” Ngatai told AFP.
“I guess we have a chance to put a foot forward to show how we can hold our own against a big team. We had a taste of it last year, we know what the standards are and we have to lift our standards each game.”
The 25-14 defeat to Northampton last weekend was their second defeat in three games after having remained unbeaten for the opening seven rounds of the domestic campaign.
“It wasn’t where our standards have been this season. We were disappointed in our own performance. At this level you can’t give away as many penalties,” Ngatai said.
Lining up outside the one-time All Black Ngatai could be Fiji winger Josua Tuisova, who joined ‘The Wolves’ from Toulon for the new campaign.
The 2016 seven-a-side Olympic champion is an injury doubt due to an ankle problem but has scored once in two games following his arrival at the Matmut Stadium after being knocked out of the Rugby World Cup pool stages.
“He can turn nothing into something. You just give him the ball and he feeds off that. You can see his raw power and his ability to break the line,” Ngatai said.
“The more ball we can give him, the more dangerous it is for the opposition to try and defend him. He pulls in two or three defenders which they have to worry about. He opens up more space for us,” he added.


| XCmdBase |
根指令集对象
|
| XCmdBase.XResult |
查询状态
|
| XCmdM100 |
M100指令集
|
| XCmdM100.Ack100Lock |
|
| XCmdM100.AckM100Get |
|
| XCmdM100.AckM100Inventory |
轮询类
|
| XCmdM100.AckM100Kill |
|
| XCmdM100.AckM100Read |
|
| XCmdM100.AckM100Set |
|
| XCmdM100.AckM100SetAntenna |
|
| XCmdM100.AckM100Write |
|
| XCmdR2k |
R2000指令集
|
| XCmdR2k.AckR2KGet |
取
|
| XCmdR2k.AckR2KInit |
初始化
|
| XCmdR2k.AckR2KInventory |
轮询
|
| XCmdR2k.AckR2KKill |
杀
|
| XCmdR2k.AckR2KLock |
锁
|
| XCmdR2k.AckR2KRead |
读
|
| XCmdR2k.AckR2KReset |
复位
|
| XCmdR2k.AckR2KSet |
设
|
| XCmdR2k.AckR2KWrite |
写
|


WWE makes a big announcement for Royal Rumble weekend
by Shruti SadbhavWWE have confirmed the network special event Worlds Collide 2020 will take place during the Royal Rumble weekend in January. As per the official announcement, the WWE Universe will see the Superstars from NXT and NXT UK engage in a battle for brand supremacy on January 25, 2020.
NXT picked up a historic win at Survivor Series 2019 after defeating RAW and SmackDown in their first-ever appearance at the PPV. The Black and Gold brand dominated the entire show with commendable performances.
Now, both divisions of NXT will prepare to lock horns at the Toyota Center in Houston, Texas to kickstart the Royal Rumble weekend.
Soon after the conclusion of Survivor Series 2019, Triple H took to Twitter to announce the next event that will see NXT and NXT: UK Superstars head into a war to determine the superior brand.
Triple H's tweet read, "What will happen when @WWENXT battles @NXTUK? Worlds. Will. Collide. #WorldsCollide @ToyotaCenter Saturday, January 25th during #RoyalRumble weekend LIVE on @WWENetwork... Tickets go on sale next Friday, December 6th at 10am CT at https://NXTTickets.com! #WeAreNXT"
WWE also confirmed that the tickets sales for the event will go live on December 6, 2019. Fans can purchase their tickets via NXTTickets.com starting from next Friday, after 10:00 AM.
WWE's official statement regarding the event reads:
Tickets for WWE Worlds Collide: NXT vs. NXT UK during Royal Rumble weekend in Houston available Dec. 6. On the eve of the 2020 Royal Rumble event, the stars of NXT and NXT UK will clash for brand supremacy at WWE Worlds Collide 2020.
The WWE Network special, taking place at Houston's Toyota Center on Jan. 25, 2020, will feature Superstars like NXT Champion Adam Cole, WWE United Kingdom Champion WALTER, NXT Women's Champion Shayna Baszler, NXT UK Women's Champion Kay Lee Ray, The Undisputed ERA, Imperium and more.
Tickets for this must-see event will be available at NXTTickets.com starting next Friday, Dec. 6 at 10 a.m. local time. Don't miss your chance to see Worlds Collide live and in person during Royal Rumble weekend!
Now you can rate RAW, SmackDown and NXT matches on Sportskeeda !


#include <core.h>
|
| static bool | pressed (uint8_t buttons) |
| | Returns true if button or specific combination of buttons is not pressed. Returns true if button or specific combination of buttons is pressed. More...
|
| |
| static bool | notPressed (uint8_t buttons) |
| | Returns true if button or specific combination of buttons is not pressed. Returns true if button or specific combination of buttons is not pressed. More...
|
| |
| static uint8_t | buttonsState () |
| | Returns bits of all pressed buttons. More...
|
| |
| static void | connectCustomKeys (TNanoEngineGetButtons handler) |
| |
| static void | connectZKeypad (uint8_t analogPin) |
| | Enables engine to use Z-Keypad. Enables engine to use Z-Keypad. Please refer to arkanoid example for schematics. More...
|
| |
|
static void | connectArduboyKeys () |
| | Configures NanoEngine8 to use Arduboy keys layout. Configures NanoEngine8 to use Arduboy keys layout.
|
| |
| static void | connectGpioKeypad (const uint8_t *gpioKeys) |
| | Enables engine to use GPIO keys. More...
|
| |
Class for keys processing functionality
Definition at line 64 of file core.h.
◆ NanoEngineInputs()
| NanoEngineInputs::NanoEngineInputs |
( |
| ) |
|
|
inlineprotected |
Initializes Nano Engine Inputs object.
Definition at line 70 of file core.h.
◆ buttonsState()
| static uint8_t NanoEngineInputs::buttonsState |
( |
| ) |
|
|
inlinestatic |
Returns bits of all pressed buttons.
Returns bits of all pressed buttons. For example, to check if Down button is pressed you need to write if (result & BUTTON_DOWN) {}
. Available constants are: BUTTON_DOWN, BUTTON_LEFT, BUTTON_RIGHT, BUTTON_UP, BUTTON_A, BUTTON_B.
Definition at line 96 of file core.h.
◆ connectCustomKeys()
Configures NanoEngine8 to use custom key handler. You can implement in your handler any keyboard layout, you use in your schematics.
◆ connectGpioKeypad()
| static void NanoEngineInputs::connectGpioKeypad |
( |
const uint8_t * |
gpioKeys | ) |
|
|
static |
Enables engine to use GPIO keys.
Enables engine to use gpio-keys. You need to pass globally defined array, containing GPIO pin numbers for the 6 buttons in the following order: Down, Left, Right, Up, A, B. If you don't want to use some specific button, then just set not used button to 0. Once you call this function, you can read buttons state via buttonsState().
- Parameters
-
| gpioKeys | pointer to 6-button pins array. |
- See also
- buttonsState()
◆ connectZKeypad()
| static void NanoEngineInputs::connectZKeypad |
( |
uint8_t |
analogPin | ) |
|
|
static |
Enables engine to use Z-Keypad. Enables engine to use Z-Keypad. Please refer to arkanoid example for schematics.
- Parameters
-
| analogPin | - pin, which Z-Keypad is connected to. |
◆ notPressed()
| static bool NanoEngineInputs::notPressed |
( |
uint8_t |
buttons | ) |
|
|
static |
Returns true if button or specific combination of buttons is not pressed. Returns true if button or specific combination of buttons is not pressed.
- Parameters
-
| buttons | - buttons to check |
- Returns
- true of false
◆ pressed()
| static bool NanoEngineInputs::pressed |
( |
uint8_t |
buttons | ) |
|
|
static |
Returns true if button or specific combination of buttons is not pressed. Returns true if button or specific combination of buttons is pressed.
- Parameters
-
| buttons | - buttons to check |
- Returns
- true or false
◆ m_onButtons
Callback to call if buttons state needs to be updated
Definition at line 149 of file core.h.
The documentation for this class was generated from the following file:


When we write html and css files, sometimes we want to select element in html and change them in css file. At this time, classes and ids can help us.
For example, you want to write a paragraph like "My favourite fruit is apple. Apple is very sweet and healthy." You see the paragraph is blue but the word "apple" we want red color.
Here in html file can be: or
And css file for the class one can be: or the css file for the id one:
Now we know how to use class and id in html and css, but we may confuse the difference between them. To use ids, we can only use one time, but for classes, we can use many times.
For example, also the paragraph "
" We can see this time, the paragraph is navy but the two words "sweet" and "healthy" are green. Then how do we use classes and ids to implement it? Using classes: in html is and in css is It's obvious that the same named class can be used in different places. But ids are different. Using ids: in html is and in css isIt's better for use to do more practices to understand deeper how to use classes and ids and the differences between them. Create sites to try and we can get it easily!


Selects
Reference by id
Select one
One
Two
Nice choice!
Reference by name
Select2
One
Two
Makes sense!
Select with initial value
Select3
One
Two
Three
Toggle me
Select with multiple attribute
Select two
One
Two
Three
Don't you tiered of 'two's?


{% include "component/head.html" %}
Looks you are using Cardiff first time, please initial your first repository with your name and email.
This repository will be used to store all versions of file. Current VCS is: {{ vcs }}.
Go to Setup


This package implements the interfaces defined in org.epics.pvdata.pv.
It provides everything required for creating pvData. It provides the following factories:
Although pvDataFactory can provide the implementation for all supported data types, often it is desirable to provide other implementations. To make it easy to create alternate implementations a set of abstract and base classes are supplied.


An array is a container object that holds a fixed number of values of a single type.
var pages2 = [ ["pages/divsandspans.html", "Divs & Spans"], ["pages/dom.html", "DOM"], ["pages/floats.html", "Floats"], ["pages/forms.html", "Forms"], ["pages/grid-system.html", "Grid System"], ["pages/inline-elements.html", "Inline Elements"], ["pages/javascript-arithmetic.html", "JS Arithmetic"], ["pages/jquery.html", "jQuery"] ];


How to play: Use your arrow keys to move the tiles. When two tiles with the same number touch, they merge into one!
This is a clone of Gabriele Cirulli's game 2048


--- layout: post date: 2010-10-17 time: "09:00:00" authors: ["Greg Wilson"] title: Ratings Revised tags: ["Community", "Content"] ---
We asked, you answered: here are the latest results from our survey of what topics you'd most like us to cover, with links to the ones that have been posted. A few notes:
Conclusion: more data ≠ more insight.
| 2.53 | Automating Repetitive Tasks |
| 2.51 | Basic Programming |
| 2.47 | Build a Desktop User Interface |
| 2.45 | Coding Style |
| 2.42 | Computational Complexity |
| 2.40 | Create a Web Service |
| 2.38 | Data Structures |
| 2.38 | Data Visualization |
| 2.37 | Debugging with a Debugger |
| 2.34 | Design Patterns |
| 2.34 | Designing a Data Model |
| 2.33 | Functional Languages |
| 2.27 | Geographic Information Systems |
| 2.22 | Handling Binary Data |
| 2.18 | Image Processing |
| 2.17 | Integrating with C and Fortran |
| 2.13 | Introduction |
| 2.09 | Matrix Algebra |
| 2.07 | Object-Oriented Programming |
| 2.07 | Packaging Code for Release |
| 2.05 | Parallel Programming |
| 2.03 | Performance Optimization |
| 1.99 | Refactoring |
| 1.95 | Reproducible Research |
| 1.95 | Static and Dynamic Code Analysis Tools |
| 1.82 | Systems Programming |
| 1.76 | Testing and Quality Assurance |
| 1.74 | Using the Unix Shell |
| 1.73 | Version Control |
| 1.65 | Working in Teams/on Large Projects |
| 1.40 | XML |


class Response
Response represents an HTTP response.
HTTP_CONTINUE = 100; |
|
HTTP_SWITCHING_PROTOCOLS = 101; |
|
HTTP_PROCESSING = 102; // RFC2518 |
|
HTTP_OK = 200; |
|
HTTP_CREATED = 201; |
|
HTTP_ACCEPTED = 202; |
|
HTTP_NON_AUTHORITATIVE_INFORMATION = 203; |
|
HTTP_NO_CONTENT = 204; |
|
HTTP_RESET_CONTENT = 205; |
|
HTTP_PARTIAL_CONTENT = 206; |
|
HTTP_MULTI_STATUS = 207; // RFC4918 |
|
HTTP_ALREADY_REPORTED = 208; // RFC5842 |
|
HTTP_IM_USED = 226; // RFC3229 |
|
HTTP_MULTIPLE_CHOICES = 300; |
|
HTTP_MOVED_PERMANENTLY = 301; |
|
HTTP_FOUND = 302; |
|
HTTP_SEE_OTHER = 303; |
|
HTTP_NOT_MODIFIED = 304; |
|
HTTP_USE_PROXY = 305; |
|
HTTP_RESERVED = 306; |
|
HTTP_TEMPORARY_REDIRECT = 307; |
|
HTTP_PERMANENTLY_REDIRECT = 308; // RFC7238 |
|
HTTP_BAD_REQUEST = 400; |
|
HTTP_UNAUTHORIZED = 401; |
|
HTTP_PAYMENT_REQUIRED = 402; |
|
HTTP_FORBIDDEN = 403; |
|
HTTP_NOT_FOUND = 404; |
|
HTTP_METHOD_NOT_ALLOWED = 405; |
|
HTTP_NOT_ACCEPTABLE = 406; |
|
HTTP_PROXY_AUTHENTICATION_REQUIRED = 407; |
|
HTTP_REQUEST_TIMEOUT = 408; |
|
HTTP_CONFLICT = 409; |
|
HTTP_GONE = 410; |
|
HTTP_LENGTH_REQUIRED = 411; |
|
HTTP_PRECONDITION_FAILED = 412; |
|
HTTP_REQUEST_ENTITY_TOO_LARGE = 413; |
|
HTTP_REQUEST_URI_TOO_LONG = 414; |
|
HTTP_UNSUPPORTED_MEDIA_TYPE = 415; |
|
HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416; |
|
HTTP_EXPECTATION_FAILED = 417; |
|
HTTP_I_AM_A_TEAPOT = 418; // RFC2324 |
|
HTTP_MISDIRECTED_REQUEST = 421; // RFC7540 |
|
HTTP_UNPROCESSABLE_ENTITY = 422; // RFC4918 |
|
HTTP_LOCKED = 423; // RFC4918 |
|
HTTP_FAILED_DEPENDENCY = 424; // RFC4918 |
|
HTTP_RESERVED_FOR_WEBDAV_ADVANCED_COLLECTIONS_EXPIRED_PROPOSAL = 425; // RFC2817 |
|
HTTP_UPGRADE_REQUIRED = 426; // RFC2817 |
|
HTTP_PRECONDITION_REQUIRED = 428; // RFC6585 |
|
HTTP_TOO_MANY_REQUESTS = 429; // RFC6585 |
|
HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431; // RFC6585 |
|
HTTP_UNAVAILABLE_FOR_LEGAL_REASONS = 451; |
|
HTTP_INTERNAL_SERVER_ERROR = 500; |
|
HTTP_NOT_IMPLEMENTED = 501; |
|
HTTP_BAD_GATEWAY = 502; |
|
HTTP_SERVICE_UNAVAILABLE = 503; |
|
HTTP_GATEWAY_TIMEOUT = 504; |
|
HTTP_VERSION_NOT_SUPPORTED = 505; |
|
HTTP_VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL = 506; // RFC2295 |
|
HTTP_INSUFFICIENT_STORAGE = 507; // RFC4918 |
|
HTTP_LOOP_DETECTED = 508; // RFC5842 |
|
HTTP_NOT_EXTENDED = 510; // RFC2774 |
|
HTTP_NETWORK_AUTHENTICATION_REQUIRED = 511; // RFC6585 |
|
ResponseHeaderBag
|
$headers |
||
protected string
|
$content |
||
protected string
|
$version |
||
protected int
|
$statusCode |
||
protected string
|
$statusText |
||
protected string
|
$charset |
||
static array
|
$statusTexts |
Status codes translation table. |
public
|
|
__construct($content = '', $status = 200, array $headers = array())
|
No description | |
public static
|
Response |
create(mixed $content = '', int $status = 200, array $headers = array())
|
Factory method for chainability. | |
public
|
string |
__toString()
|
Returns the Response as an HTTP string. | |
public
|
|
__clone()
|
Clones the current Response instance. | |
public
|
$this |
prepare(Request $request)
|
Prepares the Response before it is sent to the client. | |
public
|
$this |
sendHeaders()
|
Sends HTTP headers. | |
public
|
$this |
sendContent()
|
Sends content for the current web response. | |
public
|
$this |
send()
|
Sends HTTP headers and content. | |
public
|
$this |
setContent(mixed $content)
|
Sets the response content. | |
public
|
string |
getContent()
|
Gets the current response content. | |
public
|
$this |
setProtocolVersion($version)
|
Sets the HTTP protocol version (1.0 or 1.1). | |
public
|
|
getProtocolVersion()
|
Gets the HTTP protocol version. | |
public
|
$this |
setStatusCode($code, $text = null)
|
Sets the response status code. | |
public
|
|
getStatusCode()
|
Retrieves the status code for the current web response. | |
public
|
$this |
setCharset($charset)
|
Sets the response charset. | |
public
|
|
getCharset()
|
Retrieves the response charset. | |
public
|
|
isCacheable()
|
Returns true if the response may safely be kept in a shared (surrogate) cache. | |
public
|
|
isFresh()
|
Returns true if the response is "fresh". | |
public
|
|
isValidateable()
|
Returns true if the response includes headers that can be used to validate the response with the origin server using a conditional GET request. | |
public
|
$this |
setPrivate()
|
Marks the response as "private". | |
public
|
$this |
setPublic()
|
Marks the response as "public". | |
public
|
$this |
setImmutable($immutable = true)
|
Marks the response as "immutable". | |
public
|
|
isImmutable()
|
Returns true if the response is marked as "immutable". | |
public
|
|
mustRevalidate()
|
Returns true if the response must be revalidated by caches. | |
public
|
|
getDate()
|
Returns the Date header as a DateTime instance. | |
public
|
$this |
setDate(DateTimeInterface $date)
|
Sets the Date header. | |
public
|
|
getAge()
|
Returns the age of the response in seconds. | |
public
|
$this |
expire()
|
Marks the response stale by setting the Age header to be equal to the maximum age of the response. | |
public
|
|
getExpires()
|
Returns the value of the Expires header as a DateTime instance. | |
public
|
$this |
setExpires(DateTimeInterface $date = null)
|
Sets the Expires HTTP header with a DateTime instance. | |
public
|
|
getMaxAge()
|
Returns the number of seconds after the time specified in the response's Date header when the response should no longer be considered fresh. | |
public
|
$this |
setMaxAge($value)
|
Sets the number of seconds after which the response should no longer be considered fresh. | |
public
|
$this |
setSharedMaxAge($value)
|
Sets the number of seconds after which the response should no longer be considered fresh by shared caches. | |
public
|
|
getTtl()
|
Returns the response's time-to-live in seconds. | |
public
|
$this |
setTtl($seconds)
|
Sets the response's time-to-live for shared caches in seconds. | |
public
|
$this |
setClientTtl($seconds)
|
Sets the response's time-to-live for private/client caches in seconds. | |
public
|
|
getLastModified()
|
Returns the Last-Modified HTTP header as a DateTime instance. | |
public
|
$this |
setLastModified(DateTimeInterface $date = null)
|
Sets the Last-Modified HTTP header with a DateTime instance. | |
public
|
|
getEtag()
|
Returns the literal value of the ETag HTTP header. | |
public
|
$this |
setEtag(string|null $etag = null, bool $weak = false)
|
Sets the ETag value. | |
public
|
$this |
setCache($options)
|
Sets the response's cache headers (validation and/or expiration). | |
public
|
$this |
setNotModified()
|
Modifies the response so that it conforms to the rules defined for a 304 status code. | |
public
|
|
hasVary()
|
Returns true if the response includes a Vary header. | |
public
|
|
getVary()
|
Returns an array of header names given in the Vary header. | |
public
|
$this |
setVary(string|array $headers, bool $replace = true)
|
Sets the Vary header. | |
public
|
bool |
isNotModified(Request $request)
|
Determines if the Response validators (ETag, Last-Modified) match a conditional value specified in the Request. | |
public
|
|
isInvalid()
|
Is response invalid? | |
public
|
|
isInformational()
|
Is response informative? | |
public
|
|
isSuccessful()
|
Is response successful? | |
public
|
|
isRedirection()
|
Is the response a redirect? | |
public
|
|
isClientError()
|
Is there a client error? | |
public
|
|
isServerError()
|
Was there a server side error? | |
public
|
|
isOk()
|
Is the response OK? | |
public
|
|
isForbidden()
|
Is the response forbidden? | |
public
|
|
isNotFound()
|
Is the response a not found error? | |
public
|
|
isRedirect($location = null)
|
Is the response a redirect of some form? | |
public
|
|
isEmpty()
|
Is the response empty? | |
public static
|
|
closeOutputBuffers($targetLevel, $flush)
|
Cleans or flushes output buffers up to target level. | |
protected
|
|
ensureIEOverSSLCompatibility(Request $request)
|
Checks if we need to remove Cache-Control for SSL encrypted downloads when using IE < 9. |
__construct()
public __construct($content = '', $status = 200, array $headers = array())
$content |
||
$status |
||
array |
$headers |
| InvalidArgumentException | When the HTTP status code is not valid |
create()
public static Response create(mixed $content = '', int $status = 200, array $headers = array())
Factory method for chainability.
Example:
return Response::create($body, 200)
->setSharedMaxAge(300);
mixed |
$content |
The response content, see setContent() |
int |
$status |
The response status code |
array |
$headers |
An array of response headers |
Response |
__toString()
public string __toString()
Returns the Response as an HTTP string.
The string representation of the Response is the same as the one that will be sent to the client only if the prepare() method has been called before.
string |
The Response as an HTTP string |
| prepare() |
__clone()
public __clone()
Clones the current Response instance.
Prepares the Response before it is sent to the client.
This method tweaks the Response to ensure that it is compliant with RFC 2616. Most of the changes are based on the Request that is "associated" with this Response.
Request |
$request |
$this |
sendHeaders()
public $this sendHeaders()
Sends HTTP headers.
$this |
sendContent()
public $this sendContent()
Sends content for the current web response.
$this |
send()
public $this send()
Sends HTTP headers and content.
$this |
setContent()
public $this setContent(mixed $content)
Sets the response content.
Valid types are strings, numbers, null, and objects that implement a __toString() method.
mixed |
$content |
Content that can be cast to string |
$this |
| UnexpectedValueException |
getContent()
public string getContent()
Gets the current response content.
string |
Content |
setProtocolVersion()
public $this setProtocolVersion($version)
Sets the HTTP protocol version (1.0 or 1.1).
$version |
$this |
getProtocolVersion()
public getProtocolVersion()
Gets the HTTP protocol version.
setStatusCode()
public $this setStatusCode($code, $text = null)
Sets the response status code.
If the status text is null it will be automatically populated for the known status codes and left empty otherwise.
$code |
||
$text |
$this |
| InvalidArgumentException | When the HTTP status code is not valid |
getStatusCode()
public getStatusCode()
Retrieves the status code for the current web response.
setCharset()
public $this setCharset($charset)
Sets the response charset.
$charset |
$this |
getCharset()
public getCharset()
Retrieves the response charset.
isCacheable()
public isCacheable()
Returns true if the response may safely be kept in a shared (surrogate) cache.
Responses marked "private" with an explicit Cache-Control directive are considered uncacheable.
Responses with neither a freshness lifetime (Expires, max-age) nor cache validator (Last-Modified, ETag) are considered uncacheable because there is no way to tell when or how to remove them from the cache.
Note that RFC 7231 and RFC 7234 possibly allow for a more permissive implementation, for example "status codes that are defined as cacheable by default [...] can be reused by a cache with heuristic expiration unless otherwise indicated" (https://tools.ietf.org/html/rfc7231#section-6.1)
isFresh()
public isFresh()
Returns true if the response is "fresh".
Fresh responses may be served from cache without any interaction with the origin. A response is considered fresh when it includes a Cache-Control/max-age indicator or Expires header and the calculated age is less than the freshness lifetime.
isValidateable()
public isValidateable()
Returns true if the response includes headers that can be used to validate the response with the origin server using a conditional GET request.
setPrivate()
public $this setPrivate()
Marks the response as "private".
It makes the response ineligible for serving other clients.
$this |
setPublic()
public $this setPublic()
Marks the response as "public".
It makes the response eligible for serving other clients.
$this |
setImmutable()
public $this setImmutable($immutable = true)
Marks the response as "immutable".
$immutable |
$this |
isImmutable()
public isImmutable()
Returns true if the response is marked as "immutable".
mustRevalidate()
public mustRevalidate()
Returns true if the response must be revalidated by caches.
This method indicates that the response must not be served stale by a cache in any circumstance without first revalidating with the origin. When present, the TTL of the response should not be overridden to be greater than the value provided by the origin.
getDate()
public getDate()
Returns the Date header as a DateTime instance.
| RuntimeException | When the header is not parseable |
setDate()
public $this setDate(DateTimeInterface $date)
getAge()
public getAge()
Returns the age of the response in seconds.
expire()
public $this expire()
Marks the response stale by setting the Age header to be equal to the maximum age of the response.
$this |
getExpires()
public getExpires()
Returns the value of the Expires header as a DateTime instance.
setExpires()
public $this setExpires(DateTimeInterface $date = null)
Sets the Expires HTTP header with a DateTime instance.
Passing null as value will remove the header.
DateTimeInterface |
$date |
$this |
getMaxAge()
public getMaxAge()
Returns the number of seconds after the time specified in the response's Date header when the response should no longer be considered fresh.
First, it checks for a s-maxage directive, then a max-age directive, and then it falls back on an expires header. It returns null when no maximum age can be established.
setMaxAge()
public $this setMaxAge($value)
Sets the number of seconds after which the response should no longer be considered fresh.
This methods sets the Cache-Control max-age directive.
$value |
$this |
setSharedMaxAge()
public $this setSharedMaxAge($value)
Sets the number of seconds after which the response should no longer be considered fresh by shared caches.
This methods sets the Cache-Control s-maxage directive.
$value |
$this |
getTtl()
public getTtl()
Returns the response's time-to-live in seconds.
It returns null when no freshness information is present in the response.
When the responses TTL is <= 0, the response may not be served from cache without first revalidating with the origin.
setTtl()
public $this setTtl($seconds)
Sets the response's time-to-live for shared caches in seconds.
This method adjusts the Cache-Control/s-maxage directive.
$seconds |
$this |
setClientTtl()
public $this setClientTtl($seconds)
Sets the response's time-to-live for private/client caches in seconds.
This method adjusts the Cache-Control/max-age directive.
$seconds |
$this |
getLastModified()
public getLastModified()
Returns the Last-Modified HTTP header as a DateTime instance.
| RuntimeException | When the HTTP header is not parseable |
setLastModified()
public $this setLastModified(DateTimeInterface $date = null)
Sets the Last-Modified HTTP header with a DateTime instance.
Passing null as value will remove the header.
DateTimeInterface |
$date |
$this |
getEtag()
public getEtag()
Returns the literal value of the ETag HTTP header.
setEtag()
public $this setEtag(string|null $etag = null, bool $weak = false)
Sets the ETag value.
string|null |
$etag |
The ETag unique identifier or null to remove the header |
bool |
$weak |
Whether you want a weak ETag or not |
$this |
setCache()
public $this setCache($options)
Sets the response's cache headers (validation and/or expiration).
Available options are: etag, last_modified, max_age, s_maxage, private, public and immutable.
$options |
$this |
| InvalidArgumentException |
setNotModified()
public $this setNotModified()
Modifies the response so that it conforms to the rules defined for a 304 status code.
This sets the status, removes the body, and discards any headers that MUST NOT be included in 304 responses.
$this |
| http://tools.ietf.org/html/rfc2616#section-10.3.5 |
hasVary()
public hasVary()
Returns true if the response includes a Vary header.
getVary()
public getVary()
Returns an array of header names given in the Vary header.
setVary()
public $this setVary(string|array $headers, bool $replace = true)
Sets the Vary header.
string|array |
$headers |
|
bool |
$replace |
Whether to replace the actual value or not (true by default) |
$this |
Determines if the Response validators (ETag, Last-Modified) match a conditional value specified in the Request.
If the Response is not modified, it sets the status code to 304 and removes the actual content by calling the setNotModified() method.
Request |
$request |
bool |
true if the Response validators match the Request, false otherwise |
isInvalid()
public isInvalid()
Is response invalid?
| http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html |
isInformational()
public isInformational()
Is response informative?
isSuccessful()
public isSuccessful()
Is response successful?
isRedirection()
public isRedirection()
Is the response a redirect?
isClientError()
public isClientError()
Is there a client error?
isServerError()
public isServerError()
Was there a server side error?
isOk()
public isOk()
Is the response OK?
isForbidden()
public isForbidden()
Is the response forbidden?
isNotFound()
public isNotFound()
Is the response a not found error?
isRedirect()
public isRedirect($location = null)
Is the response a redirect of some form?
$location |
isEmpty()
public isEmpty()
Is the response empty?
closeOutputBuffers()
public static closeOutputBuffers($targetLevel, $flush)
Cleans or flushes output buffers up to target level.
Resulting level can be greater than target level if a non-removable buffer has been encountered.
$targetLevel |
||
$flush |
ensureIEOverSSLCompatibility()
protected ensureIEOverSSLCompatibility(Request $request)
Checks if we need to remove Cache-Control for SSL encrypted downloads when using IE < 9.
Request |
$request |
| http://support.microsoft.com/kb/323308 |
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier<EMAIL_ADDRESS>*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Khan\Component\HttpFoundation;
/**
* Response represents an HTTP response.
*
* @author Fabien Potencier<EMAIL_ADDRESS>*/
class Response
{
const HTTP_CONTINUE = 100;
const HTTP_SWITCHING_PROTOCOLS = 101;
const HTTP_PROCESSING = 102; // RFC2518
const HTTP_OK = 200;
const HTTP_CREATED = 201;
const HTTP_ACCEPTED = 202;
const HTTP_NON_AUTHORITATIVE_INFORMATION = 203;
const HTTP_NO_CONTENT = 204;
const HTTP_RESET_CONTENT = 205;
const HTTP_PARTIAL_CONTENT = 206;
const HTTP_MULTI_STATUS = 207; // RFC4918
const HTTP_ALREADY_REPORTED = 208; // RFC5842
const HTTP_IM_USED = 226; // RFC3229
const HTTP_MULTIPLE_CHOICES = 300;
const HTTP_MOVED_PERMANENTLY = 301;
const HTTP_FOUND = 302;
const HTTP_SEE_OTHER = 303;
const HTTP_NOT_MODIFIED = 304;
const HTTP_USE_PROXY = 305;
const HTTP_RESERVED = 306;
const HTTP_TEMPORARY_REDIRECT = 307;
const HTTP_PERMANENTLY_REDIRECT = 308; // RFC7238
const HTTP_BAD_REQUEST = 400;
const HTTP_UNAUTHORIZED = 401;
const HTTP_PAYMENT_REQUIRED = 402;
const HTTP_FORBIDDEN = 403;
const HTTP_NOT_FOUND = 404;
const HTTP_METHOD_NOT_ALLOWED = 405;
const HTTP_NOT_ACCEPTABLE = 406;
const HTTP_PROXY_AUTHENTICATION_REQUIRED = 407;
const HTTP_REQUEST_TIMEOUT = 408;
const HTTP_CONFLICT = 409;
const HTTP_GONE = 410;
const HTTP_LENGTH_REQUIRED = 411;
const HTTP_PRECONDITION_FAILED = 412;
const HTTP_REQUEST_ENTITY_TOO_LARGE = 413;
const HTTP_REQUEST_URI_TOO_LONG = 414;
const HTTP_UNSUPPORTED_MEDIA_TYPE = 415;
const HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
const HTTP_EXPECTATION_FAILED = 417;
const HTTP_I_AM_A_TEAPOT = 418; // RFC2324
const HTTP_MISDIRECTED_REQUEST = 421; // RFC7540
const HTTP_UNPROCESSABLE_ENTITY = 422; // RFC4918
const HTTP_LOCKED = 423; // RFC4918
const HTTP_FAILED_DEPENDENCY = 424; // RFC4918
const HTTP_RESERVED_FOR_WEBDAV_ADVANCED_COLLECTIONS_EXPIRED_PROPOSAL = 425; // RFC2817
const HTTP_UPGRADE_REQUIRED = 426; // RFC2817
const HTTP_PRECONDITION_REQUIRED = 428; // RFC6585
const HTTP_TOO_MANY_REQUESTS = 429; // RFC6585
const HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431; // RFC6585
const HTTP_UNAVAILABLE_FOR_LEGAL_REASONS = 451;
const HTTP_INTERNAL_SERVER_ERROR = 500;
const HTTP_NOT_IMPLEMENTED = 501;
const HTTP_BAD_GATEWAY = 502;
const HTTP_SERVICE_UNAVAILABLE = 503;
const HTTP_GATEWAY_TIMEOUT = 504;
const HTTP_VERSION_NOT_SUPPORTED = 505;
const HTTP_VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL = 506; // RFC2295
const HTTP_INSUFFICIENT_STORAGE = 507; // RFC4918
const HTTP_LOOP_DETECTED = 508; // RFC5842
const HTTP_NOT_EXTENDED = 510; // RFC2774
const HTTP_NETWORK_AUTHENTICATION_REQUIRED = 511; // RFC6585
/**
* @var \Symfony\Component\HttpFoundation\ResponseHeaderBag
*/
public $headers;
/**
* @var string
*/
protected $content;
/**
* @var string
*/
protected $version;
/**
* @var int
*/
protected $statusCode;
/**
* @var string
*/
protected $statusText;
/**
* @var string
*/
protected $charset;
/**
* Status codes translation table.
*
* The list of codes is complete according to the
* {@link http://www.iana.org/assignments/http-status-codes/ Hypertext Transfer Protocol (HTTP) Status Code Registry}
* (last updated 2016-03-01).
*
* Unless otherwise noted, the status code is defined in RFC2616.
*
* @var array
*/
public static $statusTexts = array(
100 => 'Continue',
101 => 'Switching Protocols',
102 => 'Processing', // RFC2518
103 => 'Early Hints',
200 => 'OK',
201 => 'Created',
202 => 'Accepted',
203 => 'Non-Authoritative Information',
204 => 'No Content',
205 => 'Reset Content',
206 => 'Partial Content',
207 => 'Multi-Status', // RFC4918
208 => 'Already Reported', // RFC5842
226 => 'IM Used', // RFC3229
300 => 'Multiple Choices',
301 => 'Moved Permanently',
302 => 'Found',
303 => 'See Other',
304 => 'Not Modified',
305 => 'Use Proxy',
307 => 'Temporary Redirect',
308 => 'Permanent Redirect', // RFC7238
400 => 'Bad Request',
401 => 'Unauthorized',
402 => 'Payment Required',
403 => 'Forbidden',
404 => 'Not Found',
405 => 'Method Not Allowed',
406 => 'Not Acceptable',
407 => 'Proxy Authentication Required',
408 => 'Request Timeout',
409 => 'Conflict',
410 => 'Gone',
411 => 'Length Required',
412 => 'Precondition Failed',
413 => 'Payload Too Large',
414 => 'URI Too Long',
415 => 'Unsupported Media Type',
416 => 'Range Not Satisfiable',
417 => 'Expectation Failed',
418 => 'I\'m a teapot', // RFC2324
421 => 'Misdirected Request', // RFC7540
422 => 'Unprocessable Entity', // RFC4918
423 => 'Locked', // RFC4918
424 => 'Failed Dependency', // RFC4918
425 => 'Reserved for WebDAV advanced collections expired proposal', // RFC2817
426 => 'Upgrade Required', // RFC2817
428 => 'Precondition Required', // RFC6585
429 => 'Too Many Requests', // RFC6585
431 => 'Request Header Fields Too Large', // RFC6585
451 => 'Unavailable For Legal Reasons', // RFC7725
500 => 'Internal Server Error',
501 => 'Not Implemented',
502 => 'Bad Gateway',
503 => 'Service Unavailable',
504 => 'Gateway Timeout',
505 => 'HTTP Version Not Supported',
506 => 'Variant Also Negotiates', // RFC2295
507 => 'Insufficient Storage', // RFC4918
508 => 'Loop Detected', // RFC5842
510 => 'Not Extended', // RFC2774
511 => 'Network Authentication Required', // RFC6585
);
/**
* @throws \InvalidArgumentException When the HTTP status code is not valid
*/
public function __construct($content = '', $status = 200, array $headers = array())
{
$this->headers = new ResponseHeaderBag($headers);
$this->setContent($content);
$this->setStatusCode($status);
$this->setProtocolVersion('1.0');
}
/**
* Factory method for chainability.
*
* Example:
*
* return Response::create($body, 200)
* ->setSharedMaxAge(300);
*
* @param mixed $content The response content, see setContent()
* @param int $status The response status code
* @param array $headers An array of response headers
*
* @return static
*/
public static function create($content = '', $status = 200, $headers = array())
{
return new static($content, $status, $headers);
}
/**
* Returns the Response as an HTTP string.
*
* The string representation of the Response is the same as the
* one that will be sent to the client only if the prepare() method
* has been called before.
*
* @return string The Response as an HTTP string
*
* @see prepare()
*/
public function __toString()
{
return
sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText)."\r\n".
$this->headers."\r\n".
$this->getContent();
}
/**
* Clones the current Response instance.
*/
public function __clone()
{
$this->headers = clone $this->headers;
}
/**
* Prepares the Response before it is sent to the client.
*
* This method tweaks the Response to ensure that it is
* compliant with RFC 2616. Most of the changes are based on
* the Request that is "associated" with this Response.
*
* @return $this
*/
public function prepare(Request $request)
{
$headers = $this->headers;
if ($this->isInformational() || $this->isEmpty()) {
$this->setContent(null);
$headers->remove('Content-Type');
$headers->remove('Content-Length');
} else {
// Content-type based on the Request
if (!$headers->has('Content-Type')) {
$format = $request->getRequestFormat();
if (null !== $format && $mimeType = $request->getMimeType($format)) {
$headers->set('Content-Type', $mimeType);
}
}
// Fix Content-Type
$charset = $this->charset ?: 'UTF-8';
if (!$headers->has('Content-Type')) {
$headers->set('Content-Type', 'text/html; charset='.$charset);
} elseif (0 === stripos($headers->get('Content-Type'), 'text/') && false === stripos($headers->get('Content-Type'), 'charset')) {
// add the charset
$headers->set('Content-Type', $headers->get('Content-Type').'; charset='.$charset);
}
// Fix Content-Length
if ($headers->has('Transfer-Encoding')) {
$headers->remove('Content-Length');
}
if ($request->isMethod('HEAD')) {
// cf. RFC2616 14.13
$length = $headers->get('Content-Length');
$this->setContent(null);
if ($length) {
$headers->set('Content-Length', $length);
}
}
}
// Fix protocol
if ('HTTP/1.0' != $request->server->get('SERVER_PROTOCOL')) {
$this->setProtocolVersion('1.1');
}
// Check if we need to send extra expire info headers
if ('1.0' == $this->getProtocolVersion() && false !== strpos($this->headers->get('Cache-Control'), 'no-cache')) {
$this->headers->set('pragma', 'no-cache');
$this->headers->set('expires', -1);
}
$this->ensureIEOverSSLCompatibility($request);
return $this;
}
/**
* Sends HTTP headers.
*
* @return $this
*/
public function sendHeaders()
{
// headers have already been sent by the developer
if (headers_sent()) {
return $this;
}
// headers
foreach ($this->headers->allPreserveCaseWithoutCookies() as $name => $values) {
foreach ($values as $value) {
header($name.': '.$value, false, $this->statusCode);
}
}
// status
header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText), true, $this->statusCode);
// cookies
foreach ($this->headers->getCookies() as $cookie) {
if ($cookie->isRaw()) {
setrawcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly());
} else {
setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly());
}
}
return $this;
}
/**
* Sends content for the current web response.
*
* @return $this
*/
public function sendContent()
{
echo $this->content;
return $this;
}
/**
* Sends HTTP headers and content.
*
* @return $this
*/
public function send()
{
$this->sendHeaders();
$this->sendContent();
if (function_exists('fastcgi_finish_request')) {
fastcgi_finish_request();
} elseif (!\in_array(PHP_SAPI, array('cli', 'phpdbg'), true)) {
static::closeOutputBuffers(0, true);
}
return $this;
}
/**
* Sets the response content.
*
* Valid types are strings, numbers, null, and objects that implement a __toString() method.
*
* @param mixed $content Content that can be cast to string
*
* @return $this
*
* @throws \UnexpectedValueException
*/
public function setContent($content)
{
if (null !== $content && !is_string($content) && !is_numeric($content) && !is_callable(array($content, '__toString'))) {
throw new \UnexpectedValueException(sprintf('The Response content must be a string or object implementing __toString(), "%s" given.', gettype($content)));
}
$this->content = (string) $content;
return $this;
}
/**
* Gets the current response content.
*
* @return string Content
*/
public function getContent()
{
return $this->content;
}
/**
* Sets the HTTP protocol version (1.0 or 1.1).
*
* @return $this
*
* @final
*/
public function setProtocolVersion($version)
{
$this->version = $version;
return $this;
}
/**
* Gets the HTTP protocol version.
*
* @final
*/
public function getProtocolVersion()
{
return $this->version;
}
/**
* Sets the response status code.
*
* If the status text is null it will be automatically populated for the known
* status codes and left empty otherwise.
*
* @return $this
*
* @throws \InvalidArgumentException When the HTTP status code is not valid
*
* @final
*/
public function setStatusCode($code, $text = null)
{
$this->statusCode = $code;
if ($this->isInvalid()) {
throw new \InvalidArgumentException(sprintf('The HTTP status code "%s" is not valid.', $code));
}
if (null === $text) {
$this->statusText = isset(self::$statusTexts[$code]) ? self::$statusTexts[$code] : 'unknown status';
return $this;
}
if (false === $text) {
$this->statusText = '';
return $this;
}
$this->statusText = $text;
return $this;
}
/**
* Retrieves the status code for the current web response.
*
* @final
*/
public function getStatusCode()
{
return $this->statusCode;
}
/**
* Sets the response charset.
*
* @return $this
*
* @final
*/
public function setCharset($charset)
{
$this->charset = $charset;
return $this;
}
/**
* Retrieves the response charset.
*
* @final
*/
public function getCharset()
{
return $this->charset;
}
/**
* Returns true if the response may safely be kept in a shared (surrogate) cache.
*
* Responses marked "private" with an explicit Cache-Control directive are
* considered uncacheable.
*
* Responses with neither a freshness lifetime (Expires, max-age) nor cache
* validator (Last-Modified, ETag) are considered uncacheable because there is
* no way to tell when or how to remove them from the cache.
*
* Note that RFC 7231 and RFC 7234 possibly allow for a more permissive implementation,
* for example "status codes that are defined as cacheable by default [...]
* can be reused by a cache with heuristic expiration unless otherwise indicated"
* (https://tools.ietf.org/html/rfc7231#section-6.1)
*
* @final
*/
public function isCacheable()
{
if (!in_array($this->statusCode, array(200, 203, 300, 301, 302, 404, 410))) {
return false;
}
if ($this->headers->hasCacheControlDirective('no-store') || $this->headers->getCacheControlDirective('private')) {
return false;
}
return $this->isValidateable() || $this->isFresh();
}
/**
* Returns true if the response is "fresh".
*
* Fresh responses may be served from cache without any interaction with the
* origin. A response is considered fresh when it includes a Cache-Control/max-age
* indicator or Expires header and the calculated age is less than the freshness lifetime.
*
* @final
*/
public function isFresh()
{
return $this->getTtl() > 0;
}
/**
* Returns true if the response includes headers that can be used to validate
* the response with the origin server using a conditional GET request.
*
* @final
*/
public function isValidateable()
{
return $this->headers->has('Last-Modified') || $this->headers->has('ETag');
}
/**
* Marks the response as "private".
*
* It makes the response ineligible for serving other clients.
*
* @return $this
*
* @final
*/
public function setPrivate()
{
$this->headers->removeCacheControlDirective('public');
$this->headers->addCacheControlDirective('private');
return $this;
}
/**
* Marks the response as "public".
*
* It makes the response eligible for serving other clients.
*
* @return $this
*
* @final
*/
public function setPublic()
{
$this->headers->addCacheControlDirective('public');
$this->headers->removeCacheControlDirective('private');
return $this;
}
/**
* Marks the response as "immutable".
*
* @return $this
*
* @final
*/
public function setImmutable($immutable = true)
{
if ($immutable) {
$this->headers->addCacheControlDirective('immutable');
} else {
$this->headers->removeCacheControlDirective('immutable');
}
return $this;
}
/**
* Returns true if the response is marked as "immutable".
*
* @final
*/
public function isImmutable()
{
return $this->headers->hasCacheControlDirective('immutable');
}
/**
* Returns true if the response must be revalidated by caches.
*
* This method indicates that the response must not be served stale by a
* cache in any circumstance without first revalidating with the origin.
* When present, the TTL of the response should not be overridden to be
* greater than the value provided by the origin.
*
* @final
*/
public function mustRevalidate()
{
return $this->headers->hasCacheControlDirective('must-revalidate') || $this->headers->hasCacheControlDirective('proxy-revalidate');
}
/**
* Returns the Date header as a DateTime instance.
*
* @throws \RuntimeException When the header is not parseable
*
* @final
*/
public function getDate()
{
return $this->headers->getDate('Date');
}
/**
* Sets the Date header.
*
* @return $this
*
* @final
*/
public function setDate(\DateTimeInterface $date)
{
if ($date instanceof \DateTime) {
$date = \DateTimeImmutable::createFromMutable($date);
}
$date = $date->setTimezone(new \DateTimeZone('UTC'));
$this->headers->set('Date', $date->format('D, d M Y H:i:s').' GMT');
return $this;
}
/**
* Returns the age of the response in seconds.
*
* @final
*/
public function getAge()
{
if (null !== $age = $this->headers->get('Age')) {
return (int) $age;
}
return max(time() - $this->getDate()->format('U'), 0);
}
/**
* Marks the response stale by setting the Age header to be equal to the maximum age of the response.
*
* @return $this
*/
public function expire()
{
if ($this->isFresh()) {
$this->headers->set('Age', $this->getMaxAge());
}
return $this;
}
/**
* Returns the value of the Expires header as a DateTime instance.
*
* @final
*/
public function getExpires()
{
try {
return $this->headers->getDate('Expires');
} catch (\RuntimeException $e) {
// according to RFC 2616 invalid date formats (e.g. "0" and "-1") must be treated as in the past
return \DateTime::createFromFormat('U', time() - 172800);
}
}
/**
* Sets the Expires HTTP header with a DateTime instance.
*
* Passing null as value will remove the header.
*
* @return $this
*
* @final
*/
public function setExpires(\DateTimeInterface $date = null)
{
if (null === $date) {
$this->headers->remove('Expires');
return $this;
}
if ($date instanceof \DateTime) {
$date = \DateTimeImmutable::createFromMutable($date);
}
$date = $date->setTimezone(new \DateTimeZone('UTC'));
$this->headers->set('Expires', $date->format('D, d M Y H:i:s').' GMT');
return $this;
}
/**
* Returns the number of seconds after the time specified in the response's Date
* header when the response should no longer be considered fresh.
*
* First, it checks for a s-maxage directive, then a max-age directive, and then it falls
* back on an expires header. It returns null when no maximum age can be established.
*
* @final
*/
public function getMaxAge()
{
if ($this->headers->hasCacheControlDirective('s-maxage')) {
return (int) $this->headers->getCacheControlDirective('s-maxage');
}
if ($this->headers->hasCacheControlDirective('max-age')) {
return (int) $this->headers->getCacheControlDirective('max-age');
}
if (null !== $this->getExpires()) {
return (int) ($this->getExpires()->format('U') - $this->getDate()->format('U'));
}
return null;
}
/**
* Sets the number of seconds after which the response should no longer be considered fresh.
*
* This methods sets the Cache-Control max-age directive.
*
* @return $this
*
* @final
*/
public function setMaxAge($value)
{
$this->headers->addCacheControlDirective('max-age', $value);
return $this;
}
/**
* Sets the number of seconds after which the response should no longer be considered fresh by shared caches.
*
* This methods sets the Cache-Control s-maxage directive.
*
* @return $this
*
* @final
*/
public function setSharedMaxAge($value)
{
$this->setPublic();
$this->headers->addCacheControlDirective('s-maxage', $value);
return $this;
}
/**
* Returns the response's time-to-live in seconds.
*
* It returns null when no freshness information is present in the response.
*
* When the responses TTL is <= 0, the response may not be served from cache without first
* revalidating with the origin.
*
* @final
*/
public function getTtl()
{
$maxAge = $this->getMaxAge();
return null !== $maxAge ? $maxAge - $this->getAge() : null;
}
/**
* Sets the response's time-to-live for shared caches in seconds.
*
* This method adjusts the Cache-Control/s-maxage directive.
*
* @return $this
*
* @final
*/
public function setTtl($seconds)
{
$this->setSharedMaxAge($this->getAge() + $seconds);
return $this;
}
/**
* Sets the response's time-to-live for private/client caches in seconds.
*
* This method adjusts the Cache-Control/max-age directive.
*
* @return $this
*
* @final
*/
public function setClientTtl($seconds)
{
$this->setMaxAge($this->getAge() + $seconds);
return $this;
}
/**
* Returns the Last-Modified HTTP header as a DateTime instance.
*
* @throws \RuntimeException When the HTTP header is not parseable
*
* @final
*/
public function getLastModified()
{
return $this->headers->getDate('Last-Modified');
}
/**
* Sets the Last-Modified HTTP header with a DateTime instance.
*
* Passing null as value will remove the header.
*
* @return $this
*
* @final
*/
public function setLastModified(\DateTimeInterface $date = null)
{
if (null === $date) {
$this->headers->remove('Last-Modified');
return $this;
}
if ($date instanceof \DateTime) {
$date = \DateTimeImmutable::createFromMutable($date);
}
$date = $date->setTimezone(new \DateTimeZone('UTC'));
$this->headers->set('Last-Modified', $date->format('D, d M Y H:i:s').' GMT');
return $this;
}
/**
* Returns the literal value of the ETag HTTP header.
*
* @final
*/
public function getEtag()
{
return $this->headers->get('ETag');
}
/**
* Sets the ETag value.
*
* @param string|null $etag The ETag unique identifier or null to remove the header
* @param bool $weak Whether you want a weak ETag or not
*
* @return $this
*
* @final
*/
public function setEtag($etag = null,$weak = false)
{
if (null === $etag) {
$this->headers->remove('Etag');
} else {
if (0 !== strpos($etag, '"')) {
$etag = '"'.$etag.'"';
}
$this->headers->set('ETag', (true === $weak ? 'W/' : '').$etag);
}
return $this;
}
/**
* Sets the response's cache headers (validation and/or expiration).
*
* Available options are: etag, last_modified, max_age, s_maxage, private, public and immutable.
*
* @return $this
*
* @throws \InvalidArgumentException
*
* @final
*/
public function setCache($options)
{
if ($diff = array_diff(array_keys($options), array('etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public', 'immutable'))) {
throw new \InvalidArgumentException(sprintf('Response does not support the following options: "%s".', implode('", "', array_values($diff))));
}
if (isset($options['etag'])) {
$this->setEtag($options['etag']);
}
if (isset($options['last_modified'])) {
$this->setLastModified($options['last_modified']);
}
if (isset($options['max_age'])) {
$this->setMaxAge($options['max_age']);
}
if (isset($options['s_maxage'])) {
$this->setSharedMaxAge($options['s_maxage']);
}
if (isset($options['public'])) {
if ($options['public']) {
$this->setPublic();
} else {
$this->setPrivate();
}
}
if (isset($options['private'])) {
if ($options['private']) {
$this->setPrivate();
} else {
$this->setPublic();
}
}
if (isset($options['immutable'])) {
$this->setImmutable((bool) $options['immutable']);
}
return $this;
}
/**
* Modifies the response so that it conforms to the rules defined for a 304 status code.
*
* This sets the status, removes the body, and discards any headers
* that MUST NOT be included in 304 responses.
*
* @return $this
*
* @see http://tools.ietf.org/html/rfc2616#section-10.3.5
*
* @final
*/
public function setNotModified()
{
$this->setStatusCode(304);
$this->setContent(null);
// remove headers that MUST NOT be included with 304 Not Modified responses
foreach (array('Allow', 'Content-Encoding', 'Content-Language', 'Content-Length', 'Content-MD5', 'Content-Type', 'Last-Modified') as $header) {
$this->headers->remove($header);
}
return $this;
}
/**
* Returns true if the response includes a Vary header.
*
* @final
*/
public function hasVary()
{
return null !== $this->headers->get('Vary');
}
/**
* Returns an array of header names given in the Vary header.
*
* @final
*/
public function getVary()
{
if (!$vary = $this->headers->get('Vary', null, false)) {
return array();
}
$ret = array();
foreach ($vary as $item) {
$ret = array_merge($ret, preg_split('/[\s,]+/', $item));
}
return $ret;
}
/**
* Sets the Vary header.
*
* @param string|array $headers
* @param bool $replace Whether to replace the actual value or not (true by default)
*
* @return $this
*
* @final
*/
public function setVary($headers, $replace = true)
{
$this->headers->set('Vary', $headers, $replace);
return $this;
}
/**
* Determines if the Response validators (ETag, Last-Modified) match
* a conditional value specified in the Request.
*
* If the Response is not modified, it sets the status code to 304 and
* removes the actual content by calling the setNotModified() method.
*
* @return bool true if the Response validators match the Request, false otherwise
*
* @final
*/
public function isNotModified(Request $request)
{
if (!$request->isMethodCacheable()) {
return false;
}
$notModified = false;
$lastModified = $this->headers->get('Last-Modified');
$modifiedSince = $request->headers->get('If-Modified-Since');
if ($etags = $request->getETags()) {
$notModified = in_array($this->getEtag(), $etags) || in_array('*', $etags);
}
if ($modifiedSince && $lastModified) {
$notModified = strtotime($modifiedSince) >= strtotime($lastModified) && (!$etags || $notModified);
}
if ($notModified) {
$this->setNotModified();
}
return $notModified;
}
/**
* Is response invalid?
*
* @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
*
* @final
*/
public function isInvalid()
{
return $this->statusCode < 100 || $this->statusCode >= 600;
}
/**
* Is response informative?
*
* @final
*/
public function isInformational()
{
return $this->statusCode >= 100 && $this->statusCode < 200;
}
/**
* Is response successful?
*
* @final
*/
public function isSuccessful()
{
return $this->statusCode >= 200 && $this->statusCode < 300;
}
/**
* Is the response a redirect?
*
* @final
*/
public function isRedirection()
{
return $this->statusCode >= 300 && $this->statusCode < 400;
}
/**
* Is there a client error?
*
* @final
*/
public function isClientError()
{
return $this->statusCode >= 400 && $this->statusCode < 500;
}
/**
* Was there a server side error?
*
* @final
*/
public function isServerError()
{
return $this->statusCode >= 500 && $this->statusCode < 600;
}
/**
* Is the response OK?
*
* @final
*/
public function isOk()
{
return 200 === $this->statusCode;
}
/**
* Is the response forbidden?
*
* @final
*/
public function isForbidden()
{
return 403 === $this->statusCode;
}
/**
* Is the response a not found error?
*
* @final
*/
public function isNotFound()
{
return 404 === $this->statusCode;
}
/**
* Is the response a redirect of some form?
*
* @final
*/
public function isRedirect($location = null)
{
return in_array($this->statusCode, array(201, 301, 302, 303, 307, 308)) && (null === $location ?: $location == $this->headers->get('Location'));
}
/**
* Is the response empty?
*
* @final
*/
public function isEmpty()
{
return in_array($this->statusCode, array(204, 304));
}
/**
* Cleans or flushes output buffers up to target level.
*
* Resulting level can be greater than target level if a non-removable buffer has been encountered.
*
* @final
*/
public static function closeOutputBuffers($targetLevel, $flush)
{
$status = ob_get_status(true);
$level = count($status);
$flags = PHP_OUTPUT_HANDLER_REMOVABLE | ($flush ? PHP_OUTPUT_HANDLER_FLUSHABLE : PHP_OUTPUT_HANDLER_CLEANABLE);
while ($level-- > $targetLevel && ($s = $status[$level]) && (!isset($s['del']) ? !isset($s['flags']) || ($s['flags'] & $flags) === $flags : $s['del'])) {
if ($flush) {
ob_end_flush();
} else {
ob_end_clean();
}
}
}
/**
* Checks if we need to remove Cache-Control for SSL encrypted downloads when using IE < 9.
*
* @see http://support.microsoft.com/kb/323308
*
* @final
*/
protected function ensureIEOverSSLCompatibility(Request $request)
{
if (false !== stripos($this->headers->get('Content-Disposition'), 'attachment') && 1 == preg_match('/MSIE (.*?);/i', $request->server->get('HTTP_USER_AGENT'), $match) && true === $request->isSecure()) {
if ((int) preg_replace('/(MSIE )(.*?);/', '$2', $match[0]) < 9) {
$this->headers->remove('Cache-Control');
}
}
}
}


Responsive embed - 16:9 aspect ratio
Allow browsers to determine video or slideshow dimensions based on the width of their containing block by creating an intrinsic ratio that will properly scale on any device.
Rules are directly applied to <iframe>
, <embed>
, and
<object>
elements; optionally use an explicit descendant class
.embed-responsive-item
when you want to match the
styling for other attributes.