<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Russell Japheth on Medium]]></title>
        <description><![CDATA[Stories by Russell Japheth on Medium]]></description>
        <link>https://medium.com/@russell_japheth?source=rss-1c090c333d5e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*YBTFBH1qDRiPO92N8YFLmg.png</url>
            <title>Stories by Russell Japheth on Medium</title>
            <link>https://medium.com/@russell_japheth?source=rss-1c090c333d5e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 23:45:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@russell_japheth/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Debugging 101: 9 steps to stress free coding!]]></title>
            <link>https://medium.com/ph-devconnect/debugging-101-9-steps-to-stress-free-coding-525d419c7aaa?source=rss-1c090c333d5e------2</link>
            <guid isPermaLink="false">https://medium.com/p/525d419c7aaa</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[debugging]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Russell Japheth]]></dc:creator>
            <pubDate>Mon, 19 Jun 2017 09:50:02 GMT</pubDate>
            <atom:updated>2017-06-19T09:50:02.184Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*0QI6z8OFYkAvC-6LFiJIzQ.jpeg" /></figure><blockquote>In this post, we’re going to review some guidelines that can make debugging easier (or at least less traumatic or terrifying whatever word suits you) or even help you avoid bugs in the first place.</blockquote><ol><li>Every bug or error has a cause. Yes, the very first rule in debugging (in my rule book of course) is: Every bug has a cause. no bug magically appears, there are no gremlins that create them while you’re asleep.</li><li>Follow best practices. more often than not, following best practices can save you a lot of stress especially when you’re upgrading or integrating with another project.</li><li>Test your code often. Don’t wait until you’ve written hundreds of statements before you test your code. Testing it after a few statements or changes will make it easier to spot and resolve new errors. And remember to always use comments, it’ll help you remember what you we’re doing.</li><li>Read the error message. At times once you get an error notice, you race off to your code looking for errors without first reading through the error message, needless to say, this approach (which I must admit I’m also guilty of) is counter-productive, as you’ll probably end up going in circles or even causing more errors. So remember: always read through the error message first.</li><li>Get a second opinion. At times it helps to get a second opinion and by that, I don’t necessarily mean asking someone else, you could try a different method of doing the same thing, this often helps in spotting the problem. Or if for instance your program to insert a couple of records in a database doesn’t work, you could try accessing the database from a database administration software like phpmyadmin for mysql and sqlite db browser for sqlite just to be sure.</li><li>Use the internet. More often than not the error you encountered or a variation of it already has a solution online. It could be in a blog or a forum or even in the documentation of the framework, library or language you’re using. So a quick Google search might save you hours of unnecessary bug hunting.</li><li>Separate your code. It’s a good practice to separate your code, let’s say one class one file or one action per function, that way when errors appear its easier to spot compared to when everything is muddled up.</li><li>Take a break. Now this is really important, after bug hunting for a while you should take a break, even If you think a solution is in sight. You might not feel tired but your brain might be sound asleep! Or, who knows, maybe your just hungry.</li><li>Move on! At times the reason you’ve not been able to get that snippet to work is is because you’re not ready for it yet (like when I was trying to understand Object Oriented PHP without first understanding how functions work). So it might be wise to move on to something else, and I’m sure when you return to it, you’ll be a better developer and you’ll probably make it work!</li></ol><blockquote>Summary: In this post we’ve covered 9 tips that could make debugging easier. Did I miss any? Share tips that have worked for you in the comments section. Happy Coding and bug hunting!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=525d419c7aaa" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ph-devconnect/debugging-101-9-steps-to-stress-free-coding-525d419c7aaa">Debugging 101: 9 steps to stress free coding!</a> was originally published in <a href="https://medium.com/ph-devconnect">PH DevConnect</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Copying files from server to server using PHP and CURL]]></title>
            <link>https://medium.com/ph-devconnect/copying-files-from-server-to-server-using-php-and-curl-e5d08368c56b?source=rss-1c090c333d5e------2</link>
            <guid isPermaLink="false">https://medium.com/p/e5d08368c56b</guid>
            <category><![CDATA[get-file-size]]></category>
            <category><![CDATA[servers]]></category>
            <category><![CDATA[curl]]></category>
            <category><![CDATA[copying-files]]></category>
            <category><![CDATA[php]]></category>
            <dc:creator><![CDATA[Russell Japheth]]></dc:creator>
            <pubDate>Wed, 07 Jun 2017 21:27:19 GMT</pubDate>
            <atom:updated>2019-02-17T13:35:08.487Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*c5GztTLeXhtCRt94OPdSAg.png" /></figure><blockquote>Before we begin you’ll need a basic understanding of PHP and a little knowledge about cURL wouldn’t hurt.</blockquote><h3>What is curl?</h3><p>cURL is a computer software project providing a library and command-line tool for transferring data using various protocols. PHP implements libcurl which is is a product of cURL. Libcurl is a free client-side URL transfer library, supporting cookies, FTP, FTPS, HTTP, HTTPS, IMAP etc.</p><blockquote>Source: <a href="https://en.wikipedia.org/wiki/CURL">https://en.wikipedia.org/wiki/CURL</a></blockquote><p>We’ve all at some point needed to copy a file (or a bunch of files) from one server to the other and really didn’t want to download it just to upload it again, or there is an image you just got off a Google search and would like to include in your web site or project, granted PHP has a couple of functions like `copy()` and `file_get_contents()` but using these might not always be as convenient or as reliable (especially when you’ve got page redirects) as you would like.</p><p>So in this post we’re basically gonna build something like a MADS (Modify, Add, Delete, Show) app to do that for us.</p><p>Here is the downloadFileclass we’ll be using. It will:</p><ul><li>get the name of the file from the url</li><li>check if a file with that name already exists and add a time-stamp if it does and then copy the file and return info about the file and where its stored</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d6fa09269c48329199e40432ed825a7c/href">https://medium.com/media/d6fa09269c48329199e40432ed825a7c/href</a></iframe><p>First off well create a form.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d0c60b5993abb2a7aeafcb75aefae13b/href">https://medium.com/media/d0c60b5993abb2a7aeafcb75aefae13b/href</a></iframe><blockquote>IMPORTANT: The form method must be set to <strong>method=&quot;post&quot; </strong>else you may get a 403 error on some servers due mod_security rules!</blockquote><p>Next well check if the form has been submitted</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7fe3bd855a6d6988d8350bbf5f83ecf6/href">https://medium.com/media/7fe3bd855a6d6988d8350bbf5f83ecf6/href</a></iframe><p>If the form has been submitted,</p><ul><li>We will set the max_execution_time to 0 so we can copy large files</li><li>Next we’ll include the download file class and create an instance of it</li><li>Then we’ll use the getSize() method to get the size of the file</li><li>Now here is where we actually copy the file, we’ll use the saveFile() method to do this</li><li>finally we’ll log the download using the logDownload() method and print out the returned data and the file’s size.</li></ul><p>Here is the completed script</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e30f4a1f06adc1a4f03e6570318850dd/href">https://medium.com/media/e30f4a1f06adc1a4f03e6570318850dd/href</a></iframe><p>In the example above $returnData is an array that contains the data returned by the script.</p><ul><li>$returnData[0] Returns true or false depending on the result of the curl_exec() function</li><li>$returnData[1] is the name of the directory where the file is stored</li><li>$returnData[2] is the url that was copied</li><li>$returnData[3] is the name of the stored file</li><li>$returnData[4] is the path to the new file</li></ul><p>You can use the url of an image from pexels.com (<em>eg. </em><a href="https://images.pexels.com/photos/92904/pexels-photo-92904.jpeg?h=350&amp;auto=compress&amp;cs=tinysrgb"><em>https://images.pexels.com/photos/92904/pexels-photo-92904.jpeg?h=350&amp;auto=compress&amp;cs=tinysrgb</em></a>)to try it out. Did you notice that when you change h=350 in the url, the copied file has a different size?</p><blockquote>Remember this was done using just PHP so feel free to customize or improve it till it suits whatever you want!</blockquote><p><strong><em>Update: While this script is great for getting to know how CURL works. For your projects I’d recommend </em></strong><a href="https://github.com/php-curl-class/php-curl-class"><strong><em>php-curl-class</em></strong></a><strong><em> or </em></strong><a href="https://github.com/guzzle/guzzle"><strong><em>guzzle</em></strong></a><strong><em>.</em></strong></p><blockquote><strong>PHDevConnect</strong> is a free, open community of Port Harcourt based Developers, UI / UX Designers, Project managers, Architects etc who can create their own digital team or join other teams for paid/open sourced projects.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e5d08368c56b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ph-devconnect/copying-files-from-server-to-server-using-php-and-curl-e5d08368c56b">Copying files from server to server using PHP and CURL</a> was originally published in <a href="https://medium.com/ph-devconnect">PH DevConnect</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>