<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Wiser Coder</title>
	<atom:link href="http://wisercoder.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://wisercoder.com</link>
	<description>Tips, tricks and snippets for smart programmers</description>
	<lastBuildDate>Mon, 05 Feb 2018 20:02:21 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=3.9.24</generator>
	<item>
		<title>Ubuntu: apt-get -f fails, &#8220;no space left on device&#8221;, apt-get autoremove doesn&#8217;t work.</title>
		<link>http://wisercoder.com/ubuntu-apt-get-f-fails-no-space-left-on-device-apt-get-autoremove-doesnt-work/</link>
		<comments>http://wisercoder.com/ubuntu-apt-get-f-fails-no-space-left-on-device-apt-get-autoremove-doesnt-work/#comments</comments>
		<pubDate>Mon, 05 Feb 2018 20:02:21 +0000</pubDate>
		<dc:creator><![CDATA[Nicolas Bouliane]]></dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[apt-get]]></category>
		<category><![CDATA[dpkg]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://wisercoder.com/?p=1170</guid>
		<description><![CDATA[<p>After getting this issue on two different servers, I thought I&#8217;d write a tutorial for everyone else. What&#8217;s the problem? First, you try to install some packages, either with apt-get install or apt-get update. For some reason, it fails with an error like this one: You might want to run 'apt-get -f install' to correct [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://wisercoder.com/ubuntu-apt-get-f-fails-no-space-left-on-device-apt-get-autoremove-doesnt-work/">Ubuntu: apt-get -f fails, &#8220;no space left on device&#8221;, apt-get autoremove doesn&#8217;t work.</a> appeared first on <a rel="nofollow" href="http://wisercoder.com">Wiser Coder</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>After getting this issue on two different servers, I thought I&#8217;d write a tutorial for everyone else.</p>
<h2>What&#8217;s the problem?</h2>
<p>First, you try to install some packages, either with <code>apt-get install</code> or <code>apt-get update</code>. For some reason, it fails with an error like this one:</p>
<pre><code>You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 linux-image-extra-4.4.0-112-generic : Depends: linux-image-4.4.0-112-generic but it is not going to be installed
 linux-image-extra-4.4.0-93-generic : Depends: linux-image-4.4.0-93-generic but it is not going to be installed
 linux-image-generic : Depends: linux-image-4.4.0-112-generic but it is not going to be installed
                       Recommends: thermald but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
</code></pre>
<p>So you type <code>apt-get -f install</code>, and that fails too, this time with an error like this one:</p>
<pre><code>Unpacking linux-image-4.4.0-112-generic (4.4.0-112.135) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-4.4.0-112-generic_4.4.0-112.135_amd64.deb (--unpack):
 cannot copy extracted data for './boot/System.map-4.4.0-112-generic' to '/boot/System.map-4.4.0-112-generic.dpkg-new': failed to write (No space     left on device)
No apport report written because the error message indicates a disk full error
                                                                              dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
...
E: Sub-process /usr/bin/dpkg returned an error code (1)
</code></pre>
<p>You do a bit of research and find something about running out of inodes, so you type <code>df -i</code>, but you are using under 10% of the inodes on all devices. Another post suggests running <code>apt-get autoremove</code>, but that gives you the same error message as before:</p>
<pre><code>You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 linux-image-extra-4.4.0-112-generic : Depends: linux-image-4.4.0-112-generic but it is not installed
 linux-image-extra-4.4.0-93-generic : Depends: linux-image-4.4.0-93-generic but it is not installed
 linux-image-generic : Depends: linux-image-4.4.0-112-generic but it is not installed
                       Recommends: thermald but it is not installed
E: Unmet dependencies. Try using -f.
</code></pre>
<p>So what&#8217;s the f***ing deal?!</p>
<h2>How to solve that problem</h2>
<p>Long story short, you don&#8217;t have enough space to fit the new Linux kernel, so you have to delete some of the old ones. You can delete those manually, but it&#8217;s a long, tricky manual process, and if you&#8217;re like me, you only understand half of what&#8217;s going on and you just want the damn thing to work.</p>
<p>You might have found <a href="http://www.mogilowski.net/lang/en-us/2014/04/14/remove-old-kernel-packages-from-ubuntu/">this solution</a> or a variant of it, but once more you&#8217;ll get one of the error messages above:</p>
<pre><code>Unmet dependencies. Try 'apt-get -f install' with no packages
</code></pre>
<p>Well, you were almost there! All you need is to use <code>dpkg</code> instead of <code>apt-get purge</code>.</p>
<p>Before you try that, run this command to see which packages will be removed. This command has no side effects and will not delete anything:</p>
<pre><code>dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d'
</code></pre>
<p>Make sure that your current kernel version is not in that list. You can see your kernel version by running <code>uname -a</code>.</p>
<p>Once you are sure that you want to delete these kernel files, run this command to run <code>dpkg --remove</code> on each of them:</p>
<pre><code>dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs dpkg --remove
</code></pre>
<p>After that, you can run <code>apt-get -f install</code> without problems, then do whatever you wanted to do in the first place. See, Linux isn&#8217;t that complicated!</p>
<h2>Help! That didn&#8217;t work!</h2>
<p>If you run into an error like this one:</p>
<pre><code>gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
...
Errors were encountered while processing:
 linux-image-extra-4.4.0-31-generic
 linux-image-extra-4.4.0-47-generic
 linux-image-extra-4.4.0-75-generic
 linux-image-extra-4.4.0-79-generic
 linux-image-extra-4.4.0-81-generic
 linux-image-extra-4.4.0-83-generic
 linux-image-extra-4.4.0-87-generic
 linux-image-extra-4.4.0-89-generic
</code></pre>
<p>&#8230;don&#8217;t panic! <em>Some</em> of the kernels will likely removed, so you can run <code>apt-get -f autoremove</code> to clear up some space, and then you can run the long command above again.</p>
<h2>tl;dr</h2>
<pre><code>dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs dpkg --remove
apt-get -f install
</code></pre>
<p>The post <a rel="nofollow" href="http://wisercoder.com/ubuntu-apt-get-f-fails-no-space-left-on-device-apt-get-autoremove-doesnt-work/">Ubuntu: apt-get -f fails, &#8220;no space left on device&#8221;, apt-get autoremove doesn&#8217;t work.</a> appeared first on <a rel="nofollow" href="http://wisercoder.com">Wiser Coder</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://wisercoder.com/ubuntu-apt-get-f-fails-no-space-left-on-device-apt-get-autoremove-doesnt-work/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to fix &#8220;READ ERROR&#8221; on Fujifilm cameras</title>
		<link>http://wisercoder.com/how-to-fix-read-error-on-fujifilm-cameras/</link>
		<comments>http://wisercoder.com/how-to-fix-read-error-on-fujifilm-cameras/#comments</comments>
		<pubDate>Sat, 25 Nov 2017 19:49:37 +0000</pubDate>
		<dc:creator><![CDATA[Nicolas Bouliane]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://wisercoder.com/?p=1164</guid>
		<description><![CDATA[<p>You might get a grey screen that says &#8220;READ ERROR&#8221; when you try to view your photos on a Fujifilm camera. I had this issue on my X-T10 camera, but this issue happens with all Fujifilm X-series cameras. The issue is caused by hidden files and folders created on the memory card when you read [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://wisercoder.com/how-to-fix-read-error-on-fujifilm-cameras/">How to fix &#8220;READ ERROR&#8221; on Fujifilm cameras</a> appeared first on <a rel="nofollow" href="http://wisercoder.com">Wiser Coder</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>You might get a grey screen that says &#8220;READ ERROR&#8221; when you try to view your photos on a Fujifilm camera. I had this issue on my X-T10 camera, but this issue happens with all Fujifilm X-series cameras.</p>
<p>The issue is caused by hidden files and folders created on the memory card when you read them on your computer. For instance, the .DS_Store files on OS X. Unfortunately, the bright minds at Fujifilm did not account for that when designing their cameras, and the problem remained unfixed for years.</p>
<p>The easiest solution is to lock your SD card before you read in on your computer. The other solution is to use software that disables the creation of hidden metadata files on external devices. This problem was documented <a href="https://www.slrlounge.com/psa-fuji-users-lock-your-sd-cards-when-accessing-files-on-a-mac-to-avoid-corruption/">here</a> and <a href="https://www.fujix-forum.com/threads/card-read-errors-x-t1-and-x-pro1.20682/page-3">here</a>.</p>
<p>If you already get a &#8220;READ ERROR&#8221; message, the only solution is to format your memory card. The long term solution is to stop buying Fujifilm cameras.</p>
<p>The post <a rel="nofollow" href="http://wisercoder.com/how-to-fix-read-error-on-fujifilm-cameras/">How to fix &#8220;READ ERROR&#8221; on Fujifilm cameras</a> appeared first on <a rel="nofollow" href="http://wisercoder.com">Wiser Coder</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://wisercoder.com/how-to-fix-read-error-on-fujifilm-cameras/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to fix ImportMismatchError in Python</title>
		<link>http://wisercoder.com/importmismatcherror-python-fix/</link>
		<comments>http://wisercoder.com/importmismatcherror-python-fix/#comments</comments>
		<pubDate>Mon, 25 Sep 2017 12:47:12 +0000</pubDate>
		<dc:creator><![CDATA[Nicolas Bouliane]]></dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[importerror]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://wisercoder.com/?p=1160</guid>
		<description><![CDATA[<p>If you get an ImportMismatchError when running a Python app, it&#8217;s likely that you have some Python bytecode files (*.pyc) from a different runtime. For example, this happens when I run my Python unit tests inside a Docker container, then try to run them again in PyCharm. Here is an example error message: /.../env/bin/python2.7 "/Applications/PyCharm [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://wisercoder.com/importmismatcherror-python-fix/">How to fix ImportMismatchError in Python</a> appeared first on <a rel="nofollow" href="http://wisercoder.com">Wiser Coder</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>If you get an <code>ImportMismatchError</code> when running a Python app, it&#8217;s likely that you have some Python bytecode files (<code>*.pyc</code>) from a different runtime. For example, this happens when I run my Python unit tests inside a Docker container, then try to run them again in PyCharm.</p>
<p>Here is an example error message:</p>
<pre><code>/.../env/bin/python2.7 "/Applications/PyCharm CE.app/Contents/helpers/pycharm/_jb_pytest_runner.py" --target app_test.py::TestAppThing
Testing started at 10:51 AM ...
Launching py.test with arguments app_test.py::TestGroundTruthGet in /Users/xxxxxxx/Projects/.../app
Traceback (most recent call last):
  File "/.../env/lib/python2.7/site-packages/_pytest/config.py", line 362, in _importconftest
    mod = conftestpath.pyimport()
  File "/.../env/lib/python2.7/site-packages/py/_path/local.py", line 680, in pyimport
    raise self.ImportMismatchError(modname, modfile, self)
ImportMismatchError: ('module.name.here', '/app/filename.py', local('/Users/xxxxxxx/.../filename.py'))
ERROR: could not load /Users/xxxxxxx/.../filename.py

Process finished with exit code 0
Empty test suite.
</code></pre>
<p>The solution to this error is simple: delete all <code>*.pyc</code> files in your project. You can do this with a simple command:</p>
<pre><code>find . -name \*.pyc -delete
</code></pre>
<p>Your Python code should now run properly.</p>
<p>The post <a rel="nofollow" href="http://wisercoder.com/importmismatcherror-python-fix/">How to fix ImportMismatchError in Python</a> appeared first on <a rel="nofollow" href="http://wisercoder.com">Wiser Coder</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://wisercoder.com/importmismatcherror-python-fix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to prevent Chrome from changing text color when printing</title>
		<link>http://wisercoder.com/how-to-prevent-chrome-from-changing-text-color-when-printing/</link>
		<comments>http://wisercoder.com/how-to-prevent-chrome-from-changing-text-color-when-printing/#comments</comments>
		<pubDate>Tue, 07 Mar 2017 15:00:38 +0000</pubDate>
		<dc:creator><![CDATA[Nicolas Bouliane]]></dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[print]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[webkit]]></category>

		<guid isPermaLink="false">http://wisercoder.com/?p=1156</guid>
		<description><![CDATA[<p>Chrome has a feature that turns light text to black before printing. For instance, if you have a light gray paragraph on the page, it will print as black text. While this feature might ensure that unoptimized pages are readable when printed, you might want to disable it so colors come out the way you [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://wisercoder.com/how-to-prevent-chrome-from-changing-text-color-when-printing/">How to prevent Chrome from changing text color when printing</a> appeared first on <a rel="nofollow" href="http://wisercoder.com">Wiser Coder</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>Chrome has a feature that turns light text to black before printing. For instance, if you have a light gray paragraph on the page, it will print as black text.</p>
<p>While this feature might ensure that unoptimized pages are readable when printed, you might want to disable it so colors come out the way you intended.</p>
<p>To ensure that background images, background colors and text colors remain the same while printing, use the following CSS rule:</p>
<pre><code>-webkit-print-color-adjust: exact
</code></pre>
<p>The post <a rel="nofollow" href="http://wisercoder.com/how-to-prevent-chrome-from-changing-text-color-when-printing/">How to prevent Chrome from changing text color when printing</a> appeared first on <a rel="nofollow" href="http://wisercoder.com">Wiser Coder</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://wisercoder.com/how-to-prevent-chrome-from-changing-text-color-when-printing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Office 2011 activation server unavailable? Here&#8217;s the fix</title>
		<link>http://wisercoder.com/office-2011-activation-server-unavailable-heres-the-fix/</link>
		<comments>http://wisercoder.com/office-2011-activation-server-unavailable-heres-the-fix/#comments</comments>
		<pubDate>Sat, 04 Feb 2017 10:48:25 +0000</pubDate>
		<dc:creator><![CDATA[Nicolas Bouliane]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[office]]></category>
		<category><![CDATA[office 2011]]></category>
		<category><![CDATA[outlook]]></category>
		<category><![CDATA[powerpoint]]></category>
		<category><![CDATA[word]]></category>

		<guid isPermaLink="false">http://wisercoder.com/?p=1153</guid>
		<description><![CDATA[<p>After almost a year after freshly installing MacOS, the time finally came for me to need the festering pile of ██ that is Microsoft Office 2011. Naturally, something was broken. The activation screen refused to accept the license key I had used 5 minutes earlier to download the installer, stating that the activation server was [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://wisercoder.com/office-2011-activation-server-unavailable-heres-the-fix/">Office 2011 activation server unavailable? Here&#8217;s the fix</a> appeared first on <a rel="nofollow" href="http://wisercoder.com">Wiser Coder</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>After almost a year after freshly installing MacOS, the time finally came for me to need the festering pile of  ██ that is Microsoft Office 2011. Naturally, something was broken.</p>
<p>The activation screen refused to accept the license key I had used 5 minutes earlier to download the installer, stating that the activation server was temporarily unavailable.</p>
<p>The solution was to look for updates to Office 2011. After the latest update was installed, the key was accepted and my installation was activated. If that doesn&#8217;t work, you can always activate it by phone.</p>
<p>The post <a rel="nofollow" href="http://wisercoder.com/office-2011-activation-server-unavailable-heres-the-fix/">Office 2011 activation server unavailable? Here&#8217;s the fix</a> appeared first on <a rel="nofollow" href="http://wisercoder.com">Wiser Coder</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://wisercoder.com/office-2011-activation-server-unavailable-heres-the-fix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing the &#8220;protocol error: bad pack header&#8221; error in git</title>
		<link>http://wisercoder.com/fixing-the-protocol-error-bad-pack-header-error-in-git/</link>
		<comments>http://wisercoder.com/fixing-the-protocol-error-bad-pack-header-error-in-git/#comments</comments>
		<pubDate>Tue, 06 Dec 2016 09:31:49 +0000</pubDate>
		<dc:creator><![CDATA[Nicolas Bouliane]]></dc:creator>
				<category><![CDATA[Git]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[gerrit]]></category>
		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://wisercoder.com/?p=1150</guid>
		<description><![CDATA[<p>When trying to push in git, you might get the following error message: fatal: internal server error remote: internal server error fatal: protocol error: bad pack header In my case, it was because I pulled a corrupted remote Gerrit repository, and tried to push the corrupted data back to the fixed remote. Everyone who had [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://wisercoder.com/fixing-the-protocol-error-bad-pack-header-error-in-git/">Fixing the &#8220;protocol error: bad pack header&#8221; error in git</a> appeared first on <a rel="nofollow" href="http://wisercoder.com">Wiser Coder</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>When trying to push in git, you might get the following error message:</p>
<pre><code>fatal: internal server error
remote: internal server error
fatal: protocol error: bad pack header
</code></pre>
<p>In my case, it was because I pulled a corrupted remote Gerrit repository, and tried to push the corrupted data back to the fixed remote. Everyone who had pulled the corrupted repository also ran into the same error.</p>
<p>Fortunately, the fix is really easy. All you have to do is run those four commands:</p>
<pre><code>cp .git/config .git/config.backup
git remote remove origin
mv .git/config.backup .git/config
git fetch
</code></pre>
<p>This fix comes from <a href="https://coderwall.com/p/h5_fya/fixing-a-corrupt-local-git-repository">Jordan Klassen</a>.</p>
<p>The post <a rel="nofollow" href="http://wisercoder.com/fixing-the-protocol-error-bad-pack-header-error-in-git/">Fixing the &#8220;protocol error: bad pack header&#8221; error in git</a> appeared first on <a rel="nofollow" href="http://wisercoder.com">Wiser Coder</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://wisercoder.com/fixing-the-protocol-error-bad-pack-header-error-in-git/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automatically tagging people for code review in Gerrit</title>
		<link>http://wisercoder.com/automatically-tagging-people-for-code-review-in-gerrit/</link>
		<comments>http://wisercoder.com/automatically-tagging-people-for-code-review-in-gerrit/#comments</comments>
		<pubDate>Tue, 29 Nov 2016 11:29:25 +0000</pubDate>
		<dc:creator><![CDATA[Nicolas Bouliane]]></dc:creator>
				<category><![CDATA[Git]]></category>
		<category><![CDATA[code reviews]]></category>
		<category><![CDATA[gerrit]]></category>
		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://wisercoder.com/?p=1146</guid>
		<description><![CDATA[<p>If your gerrit workflow requires you to automatically tag people, or if you always end up tagging the same people, there is a way to tag people by default for all your commits. To do so, edit .git/config to include the following lines and substitute the email with your colleague&#8217;s email: [remote "origin"] ... receivepack [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://wisercoder.com/automatically-tagging-people-for-code-review-in-gerrit/">Automatically tagging people for code review in Gerrit</a> appeared first on <a rel="nofollow" href="http://wisercoder.com">Wiser Coder</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>If your gerrit workflow requires you to automatically tag people, or if you always end up tagging the same people, there is a way to tag people by default for all your commits.</p>
<p>To do so, edit <code>.git/config</code> to include the following lines and substitute the email with your colleague&#8217;s email:</p>
<pre><code>[remote "origin"]
    ...
    receivepack = git receive-pack --reviewer "other.reviewer@company.com"
</code></pre>
<p>The post <a rel="nofollow" href="http://wisercoder.com/automatically-tagging-people-for-code-review-in-gerrit/">Automatically tagging people for code review in Gerrit</a> appeared first on <a rel="nofollow" href="http://wisercoder.com">Wiser Coder</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://wisercoder.com/automatically-tagging-people-for-code-review-in-gerrit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing Jasmine &#8220;encountered a declaration exception&#8221;</title>
		<link>http://wisercoder.com/fixing-jasmine-encountered-a-declaration-exception/</link>
		<comments>http://wisercoder.com/fixing-jasmine-encountered-a-declaration-exception/#comments</comments>
		<pubDate>Fri, 08 Jul 2016 09:59:39 +0000</pubDate>
		<dc:creator><![CDATA[Nicolas Bouliane]]></dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jasmine]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[karma]]></category>

		<guid isPermaLink="false">http://wisercoder.com/?p=565</guid>
		<description><![CDATA[<p>If you ever come upon a Jasmine unit test that ends with &#8220;encountered a declaration exception&#8221;, it&#8217;s likely because you have committed a simple, subtle mistake. Every few weeks, I would get that error, and forgetting how I fixed it the previous time, spend another 30 minutes to fix it. Here&#8217;s a screenshot of the [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://wisercoder.com/fixing-jasmine-encountered-a-declaration-exception/">Fixing Jasmine &#8220;encountered a declaration exception&#8221;</a> appeared first on <a rel="nofollow" href="http://wisercoder.com">Wiser Coder</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p>If you ever come upon a Jasmine unit test that ends with &#8220;encountered a declaration exception&#8221;, it&#8217;s likely because you have committed a simple, subtle mistake. Every few weeks, I would get that error, and forgetting how I fixed it the previous time, spend another 30 minutes to fix it.</p>
<p>Here&#8217;s a screenshot of the Karma output:</p>
<p><img src="http://wisercoder.com/wp-content/uploads/2016/07/Screen-Shot-2016-07-08-at-11.56.34.png" alt="enter image description here" /></p>
<p>Here&#8217;s the code that caused it:</p>
<pre><code>describe('should be hidden when the scope is destroyed', () =&gt; {
  this.scope.$broadcast('$destroy');
  expect(this.scope.helpTooltip.hide).toHaveBeenCalledWith();
});
</code></pre>
<p>Can you spot the problem? It&#8217;s simple: I used <code>describe</code> instead of <code>it</code>. Let&#8217;s fix this&#8230;</p>
<pre><code>it('should be hidden when the scope is destroyed', () =&gt; {
  this.scope.$broadcast('$destroy');
  expect(this.scope.helpTooltip.hide).toHaveBeenCalledWith();
});
</code></pre>
<p>Voilà! No more error! Sometimes, the solution is that simple.</p>
<p>The post <a rel="nofollow" href="http://wisercoder.com/fixing-jasmine-encountered-a-declaration-exception/">Fixing Jasmine &#8220;encountered a declaration exception&#8221;</a> appeared first on <a rel="nofollow" href="http://wisercoder.com">Wiser Coder</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://wisercoder.com/fixing-jasmine-encountered-a-declaration-exception/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to improve Angular performance by disabling debugging</title>
		<link>http://wisercoder.com/how-to-improve-angular-performance-by-disabling-debugging/</link>
		<comments>http://wisercoder.com/how-to-improve-angular-performance-by-disabling-debugging/#comments</comments>
		<pubDate>Fri, 06 May 2016 13:01:01 +0000</pubDate>
		<dc:creator><![CDATA[Nicolas Bouliane]]></dc:creator>
				<category><![CDATA[Angular.js]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[angular]]></category>
		<category><![CDATA[angularjs]]></category>
		<category><![CDATA[debug]]></category>

		<guid isPermaLink="false">http://wisercoder.com/?p=522</guid>
		<description><![CDATA[<p>Angular gives elements classes such as ng-scope and ng-isolate-scope to help tools such as Batarang and Protractor retrieve debugging information. In production, these are unnecessary, and can be disabled to speed up your client-side application. This is how you disable debugging information in Angular: myApp.config(['$compileProvider', function ($compileProvider) { $compileProvider.debugInfoEnabled(false); }]);</p>
<p>The post <a rel="nofollow" href="http://wisercoder.com/how-to-improve-angular-performance-by-disabling-debugging/">How to improve Angular performance by disabling debugging</a> appeared first on <a rel="nofollow" href="http://wisercoder.com">Wiser Coder</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p><img src="http://wisercoder.com/wp-content/uploads/2016/05/AngularJS_logo.svg_.png" alt="Angular JS" /></p>
<p>Angular gives elements classes such as <code>ng-scope</code> and <code>ng-isolate-scope</code> to help tools such as Batarang and Protractor retrieve debugging information. In production, these are unnecessary, and can be disabled to speed up your client-side application.</p>
<p>This is how you disable debugging information in Angular:</p>
<pre><code>myApp.config(['$compileProvider', function ($compileProvider) {
  $compileProvider.debugInfoEnabled(false);
}]);
</code></pre>
<p>The post <a rel="nofollow" href="http://wisercoder.com/how-to-improve-angular-performance-by-disabling-debugging/">How to improve Angular performance by disabling debugging</a> appeared first on <a rel="nofollow" href="http://wisercoder.com">Wiser Coder</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://wisercoder.com/how-to-improve-angular-performance-by-disabling-debugging/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LocalStorage gotchas in Internet Explorer and Safari</title>
		<link>http://wisercoder.com/localstorage-gotchas-in-internet-explorer-and-safari/</link>
		<comments>http://wisercoder.com/localstorage-gotchas-in-internet-explorer-and-safari/#comments</comments>
		<pubDate>Fri, 06 May 2016 09:50:42 +0000</pubDate>
		<dc:creator><![CDATA[Nicolas Bouliane]]></dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[internet explorer]]></category>
		<category><![CDATA[localstorage]]></category>
		<category><![CDATA[safari]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://wisercoder.com/?p=520</guid>
		<description><![CDATA[<p>localStorage.setItem will throw an &#8220;Access denied&#8221; error in Internet Explorer InPrivate Browsing mode. Likewise, Safari will give you QUOTA_EXCEEDED_ERR: DOM Exception 22: An attempt was made to add something to storage that exceeded the quota. To avoid those errors, you will need to wrap your localStorage access in a try/catch block.</p>
<p>The post <a rel="nofollow" href="http://wisercoder.com/localstorage-gotchas-in-internet-explorer-and-safari/">LocalStorage gotchas in Internet Explorer and Safari</a> appeared first on <a rel="nofollow" href="http://wisercoder.com">Wiser Coder</a>.</p>
]]></description>
				<content:encoded><![CDATA[<p><code>localStorage.setItem</code> will throw an &#8220;Access denied&#8221; error in Internet Explorer InPrivate Browsing mode. Likewise, Safari will give you <code>QUOTA_EXCEEDED_ERR: DOM Exception 22: An attempt was made to add something to storage that exceeded the quota.</code></p>
<p>To avoid those errors, you will need to wrap your localStorage access in a try/catch block.</p>
<p>The post <a rel="nofollow" href="http://wisercoder.com/localstorage-gotchas-in-internet-explorer-and-safari/">LocalStorage gotchas in Internet Explorer and Safari</a> appeared first on <a rel="nofollow" href="http://wisercoder.com">Wiser Coder</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://wisercoder.com/localstorage-gotchas-in-internet-explorer-and-safari/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
