<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>Comments for Wiser Coder</title>
	<atom:link href="http://wisercoder.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://wisercoder.com</link>
	<description>Tips, tricks and snippets for smart programmers</description>
	<lastBuildDate>Wed, 31 Jan 2018 10:45:17 +0000</lastBuildDate>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=3.9.24</generator>
	<item>
		<title>Comment on Drag and drop image upload directive for Angular.js by Sreeraj R</title>
		<link>http://wisercoder.com/drag-drop-image-upload-directive-angular-js/#comment-96669</link>
		<dc:creator><![CDATA[Sreeraj R]]></dc:creator>
		<pubDate>Wed, 31 Jan 2018 10:45:17 +0000</pubDate>
		<guid isPermaLink="false">http://wisercoder.com/?p=147#comment-96669</guid>
		<description><![CDATA[This is a good Idea. Can someone who has done it please provide demo.
]]></description>
		<content:encoded><![CDATA[<p>This is a good Idea. Can someone who has done it please provide demo.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Drag and drop image upload directive for Angular.js by Sreeraj R</title>
		<link>http://wisercoder.com/drag-drop-image-upload-directive-angular-js/#comment-96668</link>
		<dc:creator><![CDATA[Sreeraj R]]></dc:creator>
		<pubDate>Wed, 31 Jan 2018 10:23:41 +0000</pubDate>
		<guid isPermaLink="false">http://wisercoder.com/?p=147#comment-96668</guid>
		<description><![CDATA[HI,
 I tried the drag and drop directive specified here. But facing a small issue. The file am dropping is getting loaded up, but while trying to pass the value to controller via

&lt;code&gt;var file = $scope.uploadedFile;
&lt;/code&gt;

is  giving me undefined. Can u help me with this. Also is it necesary to have  the function name same as :

&lt;code&gt;$scope.imageDropped = function(){
&lt;/code&gt;

as  &lt;strong&gt;imageDropped&lt;/strong&gt;  itself, i have made a function of my on and linked it.

Regards,
Sreeraj
]]></description>
		<content:encoded><![CDATA[<p>HI,<br />
 I tried the drag and drop directive specified here. But facing a small issue. The file am dropping is getting loaded up, but while trying to pass the value to controller via</p>
<p><code>var file = $scope.uploadedFile;<br />
</code></p>
<p>is  giving me undefined. Can u help me with this. Also is it necesary to have  the function name same as :</p>
<p><code>$scope.imageDropped = function(){<br />
</code></p>
<p>as  <strong>imageDropped</strong>  itself, i have made a function of my on and linked it.</p>
<p>Regards,<br />
Sreeraj</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on XAMPP for OS X: How to access MySQL from the command line by Nicolas Bouliane</title>
		<link>http://wisercoder.com/xampp-for-os-x-how-to-access-mysql-from-the-command-line/#comment-95350</link>
		<dc:creator><![CDATA[Nicolas Bouliane]]></dc:creator>
		<pubDate>Sat, 25 Nov 2017 19:48:32 +0000</pubDate>
		<guid isPermaLink="false">http://wisercoder.com/?p=70#comment-95350</guid>
		<description><![CDATA[&lt;p&gt;There&#039;s a chance MySQL is in a different directory&lt;/p&gt;
]]></description>
		<content:encoded><![CDATA[<p>There&#8217;s a chance MySQL is in a different directory</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on XAMPP for OS X: How to access MySQL from the command line by Hemant Mali</title>
		<link>http://wisercoder.com/xampp-for-os-x-how-to-access-mysql-from-the-command-line/#comment-94004</link>
		<dc:creator><![CDATA[Hemant Mali]]></dc:creator>
		<pubDate>Fri, 29 Sep 2017 07:11:09 +0000</pubDate>
		<guid isPermaLink="false">http://wisercoder.com/?p=70#comment-94004</guid>
		<description><![CDATA[-bash: /Applications/xampp/xamppfiles/bin/mysql: No such file or directory
]]></description>
		<content:encoded><![CDATA[<p>-bash: /Applications/xampp/xamppfiles/bin/mysql: No such file or directory</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Drag and drop image upload directive for Angular.js by Jerome</title>
		<link>http://wisercoder.com/drag-drop-image-upload-directive-angular-js/#comment-93988</link>
		<dc:creator><![CDATA[Jerome]]></dc:creator>
		<pubDate>Thu, 28 Sep 2017 09:38:54 +0000</pubDate>
		<guid isPermaLink="false">http://wisercoder.com/?p=147#comment-93988</guid>
		<description><![CDATA[Thanks for this it help me a lot to build my own directive.

I have a issue when multiple page with the same directive the equivalent of your &lt;strong&gt;scope.imageDropped&lt;/strong&gt; function was call multiple time.

I realise that you need to unbind all you event on scope destroy.

-- by the way bind and unbind are deprecated you should use on and off now. --

&lt;code&gt;// create a drop method that you use when you bind the event
var drop = function (e) {
    onDragEnd(e);
    loadFile(e.originalEvent.dataTransfer.files[0]);
};

// then on scope destroy
scope.$on(&#039;$destroy&#039;, function () {
    $document.unbind(&quot;dragover&quot;, onDragOver);
    element.unbind(&quot;dragleave&quot;, onDragEnd);
    element.unbind(&quot;drop&quot;, onDrop);
});
&lt;/code&gt;

Then you tidy when your change of page or anything!

Et voilà
]]></description>
		<content:encoded><![CDATA[<p>Thanks for this it help me a lot to build my own directive.</p>
<p>I have a issue when multiple page with the same directive the equivalent of your <strong>scope.imageDropped</strong> function was call multiple time.</p>
<p>I realise that you need to unbind all you event on scope destroy.</p>
<p>&#8211; by the way bind and unbind are deprecated you should use on and off now. &#8211;</p>
<p><code>// create a drop method that you use when you bind the event<br />
var drop = function (e) {<br />
    onDragEnd(e);<br />
    loadFile(e.originalEvent.dataTransfer.files[0]);<br />
};</p>
<p>// then on scope destroy<br />
scope.$on('$destroy', function () {<br />
    $document.unbind("dragover", onDragOver);<br />
    element.unbind("dragleave", onDragEnd);<br />
    element.unbind("drop", onDrop);<br />
});<br />
</code></p>
<p>Then you tidy when your change of page or anything!</p>
<p>Et voilà</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Fixing Jasmine &#8220;encountered a declaration exception&#8221; by jojo</title>
		<link>http://wisercoder.com/fixing-jasmine-encountered-a-declaration-exception/#comment-93731</link>
		<dc:creator><![CDATA[jojo]]></dc:creator>
		<pubDate>Mon, 11 Sep 2017 17:03:02 +0000</pubDate>
		<guid isPermaLink="false">http://wisercoder.com/?p=565#comment-93731</guid>
		<description><![CDATA[Thanks for the blog entry, stupid error by me and you solved it for me!
]]></description>
		<content:encoded><![CDATA[<p>Thanks for the blog entry, stupid error by me and you solved it for me!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on How to remove the dropdown arrow in Internet Explorer by Joe Campbell</title>
		<link>http://wisercoder.com/how-to-remove-the-dropdown-arrow-in-internet-explorer/#comment-92156</link>
		<dc:creator><![CDATA[Joe Campbell]]></dc:creator>
		<pubDate>Tue, 27 Jun 2017 15:34:50 +0000</pubDate>
		<guid isPermaLink="false">http://wisercoder.com/?p=120#comment-92156</guid>
		<description><![CDATA[Did you find a solution for IE11
]]></description>
		<content:encoded><![CDATA[<p>Did you find a solution for IE11</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Fixing Jasmine &#8220;encountered a declaration exception&#8221; by John</title>
		<link>http://wisercoder.com/fixing-jasmine-encountered-a-declaration-exception/#comment-92115</link>
		<dc:creator><![CDATA[John]]></dc:creator>
		<pubDate>Mon, 26 Jun 2017 09:31:21 +0000</pubDate>
		<guid isPermaLink="false">http://wisercoder.com/?p=565#comment-92115</guid>
		<description><![CDATA[Thanks for the help!
]]></description>
		<content:encoded><![CDATA[<p>Thanks for the help!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on XAMPP for OS X: How to access MySQL from the command line by ROD</title>
		<link>http://wisercoder.com/xampp-for-os-x-how-to-access-mysql-from-the-command-line/#comment-91170</link>
		<dc:creator><![CDATA[ROD]]></dc:creator>
		<pubDate>Thu, 18 May 2017 13:30:08 +0000</pubDate>
		<guid isPermaLink="false">http://wisercoder.com/?p=70#comment-91170</guid>
		<description><![CDATA[gone up to where it asks the password, and all three attempts have returned a null. what do I do next?
]]></description>
		<content:encoded><![CDATA[<p>gone up to where it asks the password, and all three attempts have returned a null. what do I do next?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on How to really validate an integer in PHP (with tests) by Anthony Rutledge</title>
		<link>http://wisercoder.com/check-for-integer-in-php/#comment-90378</link>
		<dc:creator><![CDATA[Anthony Rutledge]]></dc:creator>
		<pubDate>Mon, 10 Apr 2017 12:55:34 +0000</pubDate>
		<guid isPermaLink="false">http://wisercoder.com/?p=289#comment-90378</guid>
		<description><![CDATA[I am using PHP 5.6.20.

Scenario: unknown data source.

&quot;Your first reflex would be to try is_int, also known as is_integer, but you would be wrong. These functions will return false for a string, even if it contains an integer.&quot;

The purpose of is_int() is to check a primitive to see if it is in fact the data type integer. Thus, even if your data source in unknown, using is_int() is appropriate. It&#039;s how you use it, your logic, that matters. While you setup a basic test and provide results, something else needs to be said here.

The string &quot;123&quot; is a string. If your code is robust, you would also be using is_scalar(), or !is_array(), to make sure your value was not an array. You might use is_null(), or !is_null, in some fashion if necessary. There is also FILTER_REQUIRE_SCALAR to help out when using PHP filter functions.

For strings representing integers, yes, a regular expression in combination with casting can be useful. Thus, this takes care of, octal, hex, floats, and other thing that represent numbers.

In regards to ctype_digit(), when the input has been determined to be a string, the solution is to set your logic up to check for negative integers first, then all other integers, zero to the max integer for PHP. In other words, ctype_digit() is a good tool, but only on the proper branch of logic (testing zero through max integer), and only after determining the value is not negative.

However, you have left out a fundamental test in your article--range checking. It is not enough to just get an integer and test it for type. For most scenarios, you need to know if an integer is within the allowed domain. Going strictly by what you wrote in the beginning, zero is not in your valid domain. Integers include negative whole numbers, zero, and positive whole numbers.

While true, it does take a combination of functions to get at the truth, one has to realize that the modular nature of this is intentional (to account for the many, many combinations and scenarios). Knowing the combinations and scenarios is anyone&#039;s job as a programmer, not PHP&#039;s.

You wrote a good article, but more can be done to make truly robust (in PHP) by not treating the entire range of integers equally, given the tools at your disposal.

****Force scalar (is_scalar, !is_array, FILTER_INPUT_SCALAR)****
Determine data type of the value.
If string, 
----Use regular expression with preg_match() to start the neg int checking logic
----Cast to integer if, and when, appropriate

Use is_int()
Range check the value.
Return the value to be used in the application, false, or throw an exception.
]]></description>
		<content:encoded><![CDATA[<p>I am using PHP 5.6.20.</p>
<p>Scenario: unknown data source.</p>
<p>&#8220;Your first reflex would be to try is_int, also known as is_integer, but you would be wrong. These functions will return false for a string, even if it contains an integer.&#8221;</p>
<p>The purpose of is_int() is to check a primitive to see if it is in fact the data type integer. Thus, even if your data source in unknown, using is_int() is appropriate. It&#8217;s how you use it, your logic, that matters. While you setup a basic test and provide results, something else needs to be said here.</p>
<p>The string &#8220;123&#8243; is a string. If your code is robust, you would also be using is_scalar(), or !is_array(), to make sure your value was not an array. You might use is_null(), or !is_null, in some fashion if necessary. There is also FILTER_REQUIRE_SCALAR to help out when using PHP filter functions.</p>
<p>For strings representing integers, yes, a regular expression in combination with casting can be useful. Thus, this takes care of, octal, hex, floats, and other thing that represent numbers.</p>
<p>In regards to ctype_digit(), when the input has been determined to be a string, the solution is to set your logic up to check for negative integers first, then all other integers, zero to the max integer for PHP. In other words, ctype_digit() is a good tool, but only on the proper branch of logic (testing zero through max integer), and only after determining the value is not negative.</p>
<p>However, you have left out a fundamental test in your article&#8211;range checking. It is not enough to just get an integer and test it for type. For most scenarios, you need to know if an integer is within the allowed domain. Going strictly by what you wrote in the beginning, zero is not in your valid domain. Integers include negative whole numbers, zero, and positive whole numbers.</p>
<p>While true, it does take a combination of functions to get at the truth, one has to realize that the modular nature of this is intentional (to account for the many, many combinations and scenarios). Knowing the combinations and scenarios is anyone&#8217;s job as a programmer, not PHP&#8217;s.</p>
<p>You wrote a good article, but more can be done to make truly robust (in PHP) by not treating the entire range of integers equally, given the tools at your disposal.</p>
<p>****Force scalar (is_scalar, !is_array, FILTER_INPUT_SCALAR)****<br />
Determine data type of the value.<br />
If string,<br />
&#8212;-Use regular expression with preg_match() to start the neg int checking logic<br />
&#8212;-Cast to integer if, and when, appropriate</p>
<p>Use is_int()<br />
Range check the value.<br />
Return the value to be used in the application, false, or throw an exception.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
