<?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>Code Tips Archives - Pikemere Web Services</title>
	<atom:link href="https://www.pikemere.co.uk/category/code-tips/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.pikemere.co.uk/category/code-tips/</link>
	<description>Computer Repair and Website Design in Alsager, Staffordshire and Cheshire</description>
	<lastBuildDate>Sun, 24 Apr 2022 22:56:43 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.11</generator>

<image>
	<url>https://www.pikemere.co.uk/wp-content/uploads/2019/04/P-Isolated-transparency-150x150.png</url>
	<title>Code Tips Archives - Pikemere Web Services</title>
	<link>https://www.pikemere.co.uk/category/code-tips/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Laradock &#038; Docker blocked from loading on Windows 10/11</title>
		<link>https://www.pikemere.co.uk/laradock-docker-blocked-from-loading-on-windows-10-11/</link>
		
		<dc:creator><![CDATA[Chris Ford]]></dc:creator>
		<pubDate>Sun, 24 Apr 2022 12:37:17 +0000</pubDate>
				<category><![CDATA[Code Tips]]></category>
		<guid isPermaLink="false">https://www.pikemere.co.uk/?p=659</guid>

					<description><![CDATA[<p>For most of our Laravel projects we use Laradock and Docker to locally test and develop. Our most recent fresh start was slightly frustrated by an error within docker itself. We had git deployed our<a class="moretag" href="https://www.pikemere.co.uk/laradock-docker-blocked-from-loading-on-windows-10-11/"> Read more&#8230;</a></p>
<p>The post <a href="https://www.pikemere.co.uk/laradock-docker-blocked-from-loading-on-windows-10-11/">Laradock &#038; Docker blocked from loading on Windows 10/11</a> appeared first on <a href="https://www.pikemere.co.uk">Pikemere Web Services</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div id="pl-659"  class="panel-layout" ><div id="pg-659-0"  class="panel-grid panel-no-style" ><div id="pgc-659-0-0"  class="panel-grid-cell" ><div id="panel-659-0-0-0" class="so-panel widget widget_sow-editor panel-first-child panel-last-child" data-index="0" ><div
			
			class="so-widget-sow-editor so-widget-sow-editor-base"
			
		><h3 class="widget-title">Problem</h3>
<div class="siteorigin-widget-tinymce textwidget">
	<p>For most of our Laravel projects we use Laradock and Docker to locally test and develop. Our most recent fresh start was slightly frustrated by an error within docker itself. We had git deployed our Laradock environment but when we came to start the container we received the following errors</p>
<blockquote>
<p>Error response from daemon: Ports are not available: listen tcp 0.0.0.0:2222: bind: An attempt was made to access a socket in a way forbidden by its access permissions.</p>
</blockquote>
<p>&nbsp;</p>
<blockquote>
<p>Error response from daemon: Ports are not available: listen tcp 0.0.0.0:3001: bind: An attempt was made to access a socket in a way forbidden by its access permissions.</p>
</blockquote>
<p>&nbsp;</p>
</div>
</div></div></div></div><div id="pg-659-1"  class="panel-grid panel-no-style" ><div id="pgc-659-1-0"  class="panel-grid-cell" ><div id="panel-659-1-0-0" class="so-panel widget widget_sow-editor panel-first-child panel-last-child" data-index="1" ><div
			
			class="so-widget-sow-editor so-widget-sow-editor-base"
			
		><h3 class="widget-title">Solution</h3>
<div class="siteorigin-widget-tinymce textwidget">
	<p>This particular development environment uses Windows 10 which had recently been updated. After some research we ran the following command within PowerShell.</p>
<blockquote>
<p>netsh interface ipv4 show excludedportrange protocol=tcp</p>
</blockquote>
<p>This returned a list of ports that were blocked on this<a href="https://www.pikemere.co.uk/wp-content/uploads/2022/04/ports-blocked.jpg"><img fetchpriority="high" decoding="async" src="https://www.pikemere.co.uk/wp-content/uploads/2022/04/ports-blocked-300x297.jpg" alt="" width="300" height="297" class="size-medium wp-image-660 alignright" srcset="https://www.pikemere.co.uk/wp-content/uploads/2022/04/ports-blocked-300x297.jpg 300w, https://www.pikemere.co.uk/wp-content/uploads/2022/04/ports-blocked-150x150.jpg 150w, https://www.pikemere.co.uk/wp-content/uploads/2022/04/ports-blocked.jpg 311w" sizes="(max-width: 300px) 100vw, 300px" /></a> particular machine.</p>
<p>This showed that both of those two ports required by docker (ports 2222, 3000 &amp; 3001) were all added to an exclusion list and thus inaccessible to Docker.</p>
<p>Further digging uncovered Windows Network Address translation service as the trouble maker in our particular instance.</p>
<p>To resolve it we first stopped the service using the following command</p>
<blockquote>
<p>net stop winnat</p>
</blockquote>
<p>Following this we need to reserve that port for docker so that no other service can take that port. (Be careful with this command if you are unsure what that port is doing). The following will exclude port 2222, if you need others simply change the start port number.</p>
<blockquote>
<p>netsh int ipv4 add excludedportrange protocol=tcp startport=2222 numberofports=1</p>
</blockquote>
</div>
</div></div></div></div></div><p>The post <a href="https://www.pikemere.co.uk/laradock-docker-blocked-from-loading-on-windows-10-11/">Laradock &#038; Docker blocked from loading on Windows 10/11</a> appeared first on <a href="https://www.pikemere.co.uk">Pikemere Web Services</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Adding Headers and Footers to Snappy PDF in Laravel</title>
		<link>https://www.pikemere.co.uk/adding-headers-and-footers-to-snappy-pdf-in-laravel/</link>
		
		<dc:creator><![CDATA[Chris Ford]]></dc:creator>
		<pubDate>Sat, 02 Nov 2019 16:54:27 +0000</pubDate>
				<category><![CDATA[Code Tips]]></category>
		<guid isPermaLink="false">http://design.pikemere.co.uk/pikemere/?p=230</guid>

					<description><![CDATA[<p>Once again I have been busy beavering away with Laravel. I have recently been working with the Snappy plugin to create PDF files direct from Laravel pages. I found very limited information with regard to<a class="moretag" href="https://www.pikemere.co.uk/adding-headers-and-footers-to-snappy-pdf-in-laravel/"> Read more&#8230;</a></p>
<p>The post <a href="https://www.pikemere.co.uk/adding-headers-and-footers-to-snappy-pdf-in-laravel/">Adding Headers and Footers to Snappy PDF in Laravel</a> appeared first on <a href="https://www.pikemere.co.uk">Pikemere Web Services</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Once again I have been busy beavering away with Laravel. I have recently been working with the Snappy plugin to create PDF files direct from Laravel pages. I found very limited information with regard to adding headers and footers to PDFs using snappy so thought I&#8217;d detail the requirements, our trials and tribulations and most importantly the code!</p>
<p>For this example I&#8217;m using some very simple code;</p>
<pre><pre class="brush: php; title: ; notranslate">
$pdfcontent = '
&amp;lt;pre&amp;gt;
&amp;lt;h1&amp;gt;This, believe it or not, is content&amp;lt;/h1&amp;gt;
&amp;lt;/pre&amp;gt;
';
$pdfname = 'PikemereTest.pdf';

$snappy = App::make('snappy.pdf');
$snappy-&amp;amp;gt;setOption('page-width', 200);
$snappy-&amp;amp;gt;setOption('page-height', 287);
$snappy-&amp;amp;gt;generateFromHtml($pdfcontent , 'C:\xampp\htdocs\pikemere\public\\' . $pdfname);
</pre>
<p>The code above loads a bite sized chunk of HTML into our $pdfcontent variable and starts the creation of the PDF file and outputs the file to our laravel public folder. To this we need to add the code to put our header into place, shown by the code below, which can easily be added to the existing SetOptions.</p>
<pre><pre class="brush: php; title: ; notranslate">
$snappy-&amp;amp;amp;amp;amp;amp;amp;amp;gt;setOption('header-html', 'http://www.pikemere.co.uk/testerpdf.html');
</pre>
<p>That option will then add your HTML header in place. One very important note here is that the HTML file that you stipulate must have its DOCTYPE set at the start of the file.</p>
<p>To add a footer you can simply add the following code to your setOptions</p>
<pre><pre class="brush: php; title: ; notranslate">
$snappy-&amp;amp;amp;amp;amp;amp;amp;amp;gt;setOption('footer-html', 'http://www.pikemere.co.uk/testerpdf.html');
</pre>
<p>That really is it! Just make sure you have your DOCTYPE in place and all should work perfectly.</p>
<p>The post <a href="https://www.pikemere.co.uk/adding-headers-and-footers-to-snappy-pdf-in-laravel/">Adding Headers and Footers to Snappy PDF in Laravel</a> appeared first on <a href="https://www.pikemere.co.uk">Pikemere Web Services</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
