Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

JavaScript

Fix broken images automatically

1
2
3
$('img').error(function(){
	$(this).attr('src', 'img/broken.png');
});
https://snipt.net/embed/11b46d468543c142594c407058013be4/
https://snipt.net/raw/11b46d468543c142594c407058013be4/
11b46d468543c142594c407058013be4
js
JavaScript
3
2016-12-08T03:55:22
True
False
False
/api/public/snipt/109800/
fix-broken-images-automatically
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nx">$</span><span class="p">(</span><span class="s1">&#39;img&#39;</span><span class="p">).</span><span class="nx">error</span><span class="p">(</span><span class="kd">function</span><span class="p">(){</span> </span><span id="L-2"><a name="L-2"></a> <span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">).</span><span class="nx">attr</span><span class="p">(</span><span class="s1">&#39;src&#39;</span><span class="p">,</span> <span class="s1">&#39;img/broken.png&#39;</span><span class="p">);</span> </span><span id="L-3"><a name="L-3"></a><span class="p">});</span> </span></pre></div> </td></tr></table>
broken, fix, image, img, jquery, placeholder

Bash

Fix broken packages in Ubuntu and Debian

1
2
3
4
5
6
7
8
dpkg --configure -a
apt-get install -f

# If the problem of a broken package still exist, the solution is to edit the dpkg status file manually.

nano /var/lib/dpkg/status

# Locate the corrupt package, and remove the whole block of information about it and save the file.
https://snipt.net/embed/c909f1463882443c12d770afa20dd0d1/
https://snipt.net/raw/c909f1463882443c12d770afa20dd0d1/
c909f1463882443c12d770afa20dd0d1
bash
Bash
8
2016-12-07T12:40:08
True
False
False
Dec 04, 2013 at 02:34 AM
/api/public/snipt/98414/
fix-broken-packages-in-ubuntu-and-debian
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>dpkg --configure -a </span><span id="L-2"><a name="L-2"></a>apt-get install -f </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="c1"># If the problem of a broken package still exist, the solution is to edit the dpkg status file manually.</span> </span><span id="L-5"><a name="L-5"></a> </span><span id="L-6"><a name="L-6"></a>nano /var/lib/dpkg/status </span><span id="L-7"><a name="L-7"></a> </span><span id="L-8"><a name="L-8"></a><span class="c1"># Locate the corrupt package, and remove the whole block of information about it and save the file.</span> </span></pre></div> </td></tr></table>
apt, broken, debian, dpkg, fix, packages, status, ubuntu

Batchfile

fuh.bat

1
2
3
4
5
:: Fix issue where hidden folders can not be unhidden, because of a malware execution.
:: -----------------------------------------------------------------------------------
:: http://mybroadband.co.za/vb/showthread.php/352368-Can-t-quot-UNHIDE-quot-Hidden-files?s=2178d779b3dcb064b2b7b00e30e7c907&p=6535122&viewfull=1#post6535122
@echo off
attrib /S /D *.* -s -r -h
https://snipt.net/embed/c93bb303b469fabd56fbc22934d6c284/
https://snipt.net/raw/c93bb303b469fabd56fbc22934d6c284/
c93bb303b469fabd56fbc22934d6c284
bat
Batchfile
5
2016-12-04T21:44:31
True
False
False
/api/public/snipt/66472/
fuhbat
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="p">:</span><span class="c1">: Fix issue where hidden folders can not be unhidden, because of a malware execution.</span> </span><span id="L-2"><a name="L-2"></a><span class="p">:</span><span class="c1">: -----------------------------------------------------------------------------------</span> </span><span id="L-3"><a name="L-3"></a><span class="p">:</span><span class="c1">: http://mybroadband.co.za/vb/showthread.php/352368-Can-t-quot-UNHIDE-quot-Hidden-files?s=2178d779b3dcb064b2b7b00e30e7c907&amp;p=6535122&amp;viewfull=1#post6535122</span> </span><span id="L-4"><a name="L-4"></a><span class="p">@</span><span class="k">echo</span> off </span><span id="L-5"><a name="L-5"></a>attrib /S /D *.* -s -r -h </span></pre></div> </td></tr></table>
"file system", "flash drive", directory, fix, malware, pendrive

Text only

Fix remote desktop copy and Paste

--Execute to fix remote copy and past
rdpclip.exe
https://snipt.net/embed/db3c01a73ad3d52ba12d8980a20f1697/
https://snipt.net/raw/db3c01a73ad3d52ba12d8980a20f1697/
db3c01a73ad3d52ba12d8980a20f1697
text
Text only
2
2016-12-09T11:23:09
True
False
False
/api/public/snipt/34589/
fix-remote-desktop-copy-and-paste
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>--Execute to fix remote copy and past </span><span id="L-2"><a name="L-2"></a>rdpclip.exe </span></pre></div> </td></tr></table>
bash, fix, server

SQL

String or binary data would be truncated.

1
2
3
4
--Disable String or binary data would be truncated.
SET ANSI_WARNINGS off
--Enable String or binary data would be truncated.
SET ANSI_WARNINGS on
https://snipt.net/embed/37d2f69f2deec3d1d37e15efe8056c98/
https://snipt.net/raw/37d2f69f2deec3d1d37e15efe8056c98/
37d2f69f2deec3d1d37e15efe8056c98
sql
SQL
4
2016-12-09T11:23:31
True
False
False
/api/public/snipt/33994/
string-or-binary-data-would-be-truncated
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1">--Disable String or binary data would be truncated.</span> </span><span id="L-2"><a name="L-2"></a><span class="k">SET</span> <span class="n">ANSI_WARNINGS</span> <span class="k">off</span> </span><span id="L-3"><a name="L-3"></a><span class="c1">--Enable String or binary data would be truncated.</span> </span><span id="L-4"><a name="L-4"></a><span class="k">SET</span> <span class="n">ANSI_WARNINGS</span> <span class="k">on</span> </span></pre></div> </td></tr></table>
fix, sql

Text only

Drupal access denied to page

1
2
3
4
5
6
Access Denied, You are not authorized to access this page
http://ericlondon.com/access-denied-you-are-not-authorized-access-page

I just encountered a tricky "Acess Denied" error message. After creating a new user, and adding them to a role that has permissions to edit all node types, they were still unable to edit certain nodes. Everything looked fine on the access control settings page. It turns out, they did not have access to the Full HTML Filter, which was used to originally create the nodes. As soon as I granted them permission to the input filter, they were able to edit the nodes.

http://yoursite.tld/admin/settings/filters
https://snipt.net/embed/4f3c5e9e1222dfbc9ac716f94f63c861/
https://snipt.net/raw/4f3c5e9e1222dfbc9ac716f94f63c861/
4f3c5e9e1222dfbc9ac716f94f63c861
text
Text only
6
2016-12-09T11:32:50
True
False
False
/api/public/snipt/33786/
drupal-access-denied-to-page
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a>Access Denied, You are not authorized to access this page </span><span id="L-2"><a name="L-2"></a>http://ericlondon.com/access-denied-you-are-not-authorized-access-page </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a>I just encountered a tricky &quot;Acess Denied&quot; error message. After creating a new user, and adding them to a role that has permissions to edit all node types, they were still unable to edit certain nodes. Everything looked fine on the access control settings page. It turns out, they did not have access to the Full HTML Filter, which was used to originally create the nodes. As soon as I granted them permission to the input filter, they were able to edit the nodes. </span><span id="L-5"><a name="L-5"></a> </span><span id="L-6"><a name="L-6"></a>http://yoursite.tld/admin/settings/filters </span></pre></div> </td></tr></table>
accesscontrol, drupal, fix
Copyrighted, illegal, or inappropriate content? Email [email protected].