Click on Debug -> Delete All Breakpoints or press the shortcut key combination Ctrl+Shift+F9
You are not authorized to access when trying to connect to TFS account in Visual Studio 2015
To solve this problem you have to clean the cache folder on your machine.
Press Win + R together to open the Run window
Type in %UserProfile%\AppData\Local and click on OK
Navigate to the Microsoft\Team Foundation\6.0\Cache folder and delete all contents
Restart Visual Studio and Re-Open your solution.
The error message will disappear and all should be working again.
The Visual Studio component cache is out of date. Please restart Visual Studio. (mscorlib) – Microsoft SQL Server Management Studio
To fix the error message open the Disk Cleanup utility in Windows. Tick the Temporary files tick box and click on OK.
Select Delete Files
Restart Microsoft SQL Server Management Studio and the error message will have disappeared.
How to embed images using PHPMailer
Use the AddEmbeddedImage method provided by the PHPMailer class. eg. $mail->AddEmbeddedImage(‘test.gif’,’testImage’,’test.gif’); Parameters for AddEmbeddedImage($path, $cid, $name = ”, $encoding = ‘base64’, $type = ‘application/octet-stream’) $path = Path to the attachment $cid = Content ID of the attachment. Use this to...
Comparison Operators
PHP comparison operators allows you to compare two values with each other. Below is a table of all the different comparison operators that are available for PHP Comparison Operators Example Name Result $a == $b Equal TRUE if $a is equal to $b. $a === $b Identical TRUE if $a is equal to $b, and they are of the same type. (introduced in PHP 4) $a != $b Not equal TRUE if $a is not equal to $b. $a...
How to subtract a number of days from todays date using PHP date function
$var = ‘2007-08-15’; $var_subtracted_date = date(‘Y-m-d’, strtotime(‘-2 days’, strtotime($var))); Explanation of PHP functions: 1) FUNCTION date DESCRIPTION string date ( string $format [, int $timestamp ] ) PARAMETERS USED IN THIS EXAMPLE Y = A full numeric representation of a year, 4 digits (Examples: 1999 or 2003) m = Numeric representation of a month, with...
How to print the contents of an array using PHP
//Array example $arr = array(‘one’,’two’,’three’,’four’); Use the print_r function. Example: print_r($arr); The example above will print out the following: Array ( [0] => one [1] => two [2] => three [3] => four ) NOTE: If you want to have the contents of the array displayed in a more readable format, add a echo...
How to get the Nameservers of a domain using PHP
Use the dns_get_record function with type DNS_NS Example: //Add this piece of code to your PHP will $result = dns_get_record(‘yourdomain.com‘,DNS_NS); Execute the script //An array will be returned similar as below Array ( [0] => Array ( [host] => yourdomain.com [type] => NS [target] => ns1.yourdomain.com [class] => IN [ttl] => 70144 ) [1] => Array ( [host] =>...
What is the purpose of the & Ampersand in front of PHP Variables
What this does it creates a reference to the original variable and thus does not copy the value of the original variable. $original_var = 500; &$ref_var = $original_var; //This will print the value 500 echo $ref_var; //Now we change the value of the original variable to 600 $original_var = 600; //Now we print the value of the reference variable, and the reference variable takes the value of...
How to remove duplicate values in a PHP array
Use the array_unique function array_unique (PHP 4 >= 4.0.1, PHP 5) array_unique (Takes an input array and returns a new array without duplicate values) array_unique (array $array [, int $sort_flags=SORT_STRING ] ) Example: CODE: <?php //Array with duplicate values $array...
How to embed images using PHPMailer
Use the AddEmbeddedImage method provided by the PHPMailer class. eg. $mail->AddEmbeddedImage(‘test.gif’,’testImage’,’test.gif’); Parameters for AddEmbeddedImage($path, $cid, $name = ”, $encoding = ‘base64’, $type = ‘application/octet-stream’) $path = Path to the attachment $cid = Content ID of the attachment. Use this to...
How to solve error: ‘PHP Warning: DOMDocument::createElement(): unterminated entity reference’ when creating a new element using the DOMDocument object model
DOMDocument = Represents an entire HTML or XML document; serves as the root of the document tree. (PHP 5) DOMDocument::createElement() = Create new element node. (PHP 5) Now to the solution! Solution: Use the htmlentitites function to convert all applicable characters to HTML entities. $dom->createElement(‘value’, htmlentities($text_value)); htmlentitites = Convert all applicable...
How to remove values in one array from another array using PHP
Example: I have array A with values and another array B. I need to remove the values in array A from the values in array B. Use the PHP function array_diff Description array array_diff ( array $array1 , array $array2 [, array $ … ] ) Compares array1 against array2 and returns the difference. Parameters array1 = The array to compare from array2 = An array to compare against Code...
How to check which version of PHP you are running on Linux
NOTE: Tested on Centos 4 & 5 and Ubuntu 9.04
In the command line type in the following command to get all PHP information and configurations
php -i
To get the Version number use the following command
php -v
Or this command:
php -i | grep 'PHP Version'
How to display code as content using PHP as your programming language
I have the following JavaScript code that I need to display as plain content on a page and when I add it the page handles it as code instead of content. The code below I need to display as content <script src="/fancybox/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script> Answer: Use the ‘htmlspecialchars‘ PHP function tdisplay the code as content...
How to remove the first element of an array using PHP and then storing the element in a variable
By using the PHP function ‘array_shift‘ we can remove the first value of an array array_shift – Shift an element off the beginning of array (PHP 4 & 5) Example: $array = array("apple","peach","pineapple","banana"); $first_element = array_shift($array); echo '<pre>'; print_r($array); echo '</pre>'; echo $first_element; In the above example we have an array with 4...
How to force a CSV file to download when clicking on a download link using PHP
Example: We have a CSV file called example.csv we want users to download to use as a template. Now some browsers will display the contents of the file instead of asking users to download the file. What we want to do is to force the downloadinstead of displaying the contents in the browser. Create a new PHP file called ‘download.php‘ Open the file for editing Copy the code below into...
How to convert all $_POST or $_GET values to Integers
By using the built-in PHP functions array_map and intval. array_map = Applies the callback to the elements of the given arrays, this applies the function for each value of an array (PHP 4 >= 4.0.6, PHP 5) intval = Get the integer value of a variable (PHP 4, PHP 5) Examples: {codecitation style=”brush: PHP;”} $post_int = array_map(‘intval’, $_POST); //Converting every...
Script to resize PNG, JPG and GIF images using PHP keeping the aspect ratio
How this script works: What this script does, it resizes any PNG, JPG or GIF image to the given width and height and stores the image to a specified location. If the width is set to 0 it will automatically calculate the width by using the height given by keeping the aspect ratio the same is. The same goes for when the height is set to 0 and the width is given. NOTE: Make sure the GD libraries are...