Cross-Origin Resource Sharing, or CORS, defines a way to enable client-side cross-origin requests. So, if this API is used on http://siteA.org then a resource on http://siteB.org could opt in to this( e.g. by specifying Access-Control-Allow-Origin: http://siteA.org as a response header).
The problem it aims to solve is that AJAX calls that use XMLHttpRequest to do cross-domain requests (e.g. Site A wants to access a script on Site B) are forbidden by web browsers (see Same-origin policy: http://en.wikipedia.org/wiki/Same-origin_policy).
Note: WebSockets are not subject to the same-origin policy.
CORS is a W3 Recommendation released on 16th January 2014. See http://www.w3.org/TR/access-control/
Alternatives to CORS are:
- setting the document.domain property
- Cross-document messaging – e.g. calling the postMessage() method on a Window object
Browser support for CORS:
- >= Firefox 3.5
- >= Safari 4
- >= Chrome 3
- >= IE10 (IE8+ has partial support). i.e. IE9 in Compatibility View would not support CORS
- >= Opera 12
In addition to built-in coding assistance, PhpStorm provides code style check through integration with the PHP Code Sniffer tool, which validates your code for consistence with a coding standard of your choice. You can appoint one of the predefined coding standards or use your own previously defined coding standard with the root directory outside the default PHP Code Sniffer’s Standards directory. Moreover, you can share your custom coding style with your team fellows.
To use PHP Code Sniffer right from PhpStorm instead of from a command line, you need to register it in PhpStorm and configure it as a PhpStorm code inspection. Once installed and enabled in PhpStorm, the tool is available in any opened PHP file, so no steps are required from your side to launch it. The on-the-fly code check is activated upon every update in the file thus making it extremely easy to get rid of problems reported by PHP Code Sniffer.
Errors and warnings reported by PHP Code Sniffer on-the-fly are displayed as pop-up messages. When the tool is run in the batch mode, the errors and warnings are displayed in the Inspection tool window. Anyway, each message has the phpcs prefix to distinguish it from PhpStorm internal inspections.
On this page:
- The PEAR package manager is installed on your machine.
- PHP Code Sniffer is installed on your machine. To check it, switch to the directory with thepear.bat file and run the following command: phpcs –versionIf the tool is available, you will get a message in the following format: PHP_CodeSniffer version <version> (stable) by Squiz Pty Ltd. (http://www.squiz.net)
- To have code checked against your own custom coding standard, create it. Store the rules and the ruleset.xml file that points to them in the coding standard root directory.
- Open the project settings, and click Code Sniffer under the PHP node.
- In the PHP Code Sniffer path text box, specify the location of the Code Sniffer executablephpcs.bat. Type the path manually or click the Browse button and select the path in the dialog box, that opens.To check that the specified path to phpcs.bat ensures interaction between PhpStorm and Code Sniffer, that is, the tool can be launched from PhpStorm and PhpStorm will receive problem reports from it, click the Validate button. This validation is equal to running the phpcs –versioncommand. If validation passes successfully, PhpStorm displays the information on the detected Code Sniffer version.
PhpStorm provides the ability to specify advanced PHP Code Sniffer options and thus fine tune the PHP Code Sniffer process behavior depending on the configuration of your computer and the rule sets used.
- Open the project settings, and click Code Sniffer under the PHP node.
- In the Maximum number of messages per file text box, set the upper limit for the total number of messages to be reported for a file. All the messages above this limit will be rejected and PhpStorm will display the following warning right in the code:
Too many PHP Code Sniffer messages
- In the Tool process timeout text box, specify how long you want PhpStorm to wait for a result from PHP Code Sniffer, whereupon the process is killed to prevent excessive CPU and memory usage.
- Open the project settings, and click Inspections.
- On the Inspections page that opens, select the PHP Code Sniffer validation check box under the PHP node.
- On the right-hand pane of the page, configure the PHP Code Sniffer tool using the controls in theOptions area:
- From the Severity drop-down list, choose the severity degree for the Code Sniffer inspection. The selected value determines how serious the detected discrepancies will be treated by PhpStorm and presented in the inspection results.
- In the Coding standard drop-down list, appoint the coding style to check your code against. The list contains all the coding standards installed inside the main PHP_CodeSniffer directory structure.Use one of the predefined coding standards or choose Custom to appoint your own standard.
- Optionally, select the Ignore warnings check box to have only errors reported and suppress reporting warnings. This option is equal to the -n command line argument.
You can have code checked against your own previously defined coding standard with the root directory outside the default PHP Code Sniffer’s Standards directory. This root directory should contain the rules themselves and the ruleset.xml file that points to them.
- Open the project settings, click Inspections. The Inspections page opens. Select the PHP Code Sniffer validation check box under the PHP node.
- From the Coding standard drop-down list, choose Custom.
- Click the Browse button .
- In the Custom Coding Standard dialog box that opens, specify the path to the root directory of your own coding standard in the Root directory. Type the path manually or click the Browse button and choose the relevant folder in the dialog that opens.
The selected root directory should contain the ruleset.xml file that points to the rules.
- To run the inspection, choose on the main menu. Specify the inspection scope and profile.
- View the inspection results in the Inspection tool window. Errors and warnings reported by PHP Code Sniffer have the phpcs prefix to distinguish them from PhpStorm internal inspections.
When waiting for Code Sniffer response exceeds the limit specified in the Tool process timeoutfield on Code Sniffer page, PhpStorm suggests adding the file to the ignore list. This list is shown on the Code Sniffer page in the Ignored files area. For each file, PhpStorm displays its name and location.
- To delete a file from the list and have Code Sniffer process it again, select the file and click theRemove file button .
- To remove all the files from the list, click the Clean the list button .
Why does the Photos app take so much time to delete a photo?
Sometimes it literally takes over a minute. What’s worse it takes an indeterminate period of time. Sometimes seconds, sometimes minute .
It seems worse when there are Internet connection issue. All Google apps seem to be in the same boat – without Internet they suck big time.
http://www.snowcrash.eu/wp-content/uploads/2014/10/Screenshot_2014-10-10-19-10-54-576x1024.png 576w, http://www.snowcrash.eu/wp-content/uploads/2014/10/Screenshot_2014-10-10-19-10-54-588x1045.png 588w, http://www.snowcrash.eu/wp-content/uploads/2014/10/Screenshot_2014-10-10-19-10-54.png 1080w" sizes="(max-width: 168px) 100vw, 168px" />
The other thing is it’s unreliable. Sometimes it says the photo has been deleted then a minute later there it is again seemingly resurrected from the dead. I’ve occasionally deleted them multiple time .
Here’s another example – this time Google Docs . Why does it take so long to load a document?!
http://www.snowcrash.eu/wp-content/uploads/2014/10/Screenshot_2014-10-11-21-28-24-576x1024.png 576w, http://www.snowcrash.eu/wp-content/uploads/2014/10/Screenshot_2014-10-11-21-28-24-588x1045.png 588w, http://www.snowcrash.eu/wp-content/uploads/2014/10/Screenshot_2014-10-11-21-28-24.png 1080w" sizes="(max-width: 168px) 100vw, 168px" />
Sender Signatures are used to avoid spam.
If you’re using a service like Outlook or Gmail you won’t even be aware of this.
However, if you send an email programmatically then you need to say who the Sender is. You usually do that using a Reply-To header. Unfortunately spammers have being doing this forever so, to avoid an email being labelled as spam, you’ll need to sign your email.
There are two main methods of creating Sender Signatures: DKIM and SPF.
DKIM (DomainKeys Identified Mail) has emerged from IETF (one of the Internet governing bodies) specifications and uses a signer’s public key which is published in the DNS. More here: http://en.wikipedia.org/wiki/DomainKeys_Identified_Mail
SPF (Sender Policy Framework) adds the list of authorized sending hosts for a domain in a TXT record. More here: http://en.wikipedia.org/wiki/Sender_Policy_Framework
For other methods see: http://en.wikipedia.org/wiki/Email_authentication