<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Bugfix</title><link>https://jwheel.org/tags/bugfix/</link><description>Homepage of Justin Wheeler, an Open Source contributor and Free Software advocate from Georgia, USA.</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><managingEditor>Justin Wheeler</managingEditor><lastBuildDate>Mon, 15 Feb 2016 00:00:00 +0000</lastBuildDate><atom:link href="https://jwheel.org/rss/tags/bugfix/index.xml" rel="self" type="application/rss+xml"/><item><title>HFOSS: Double bugfix</title><link>https://jwheel.org/blog/2016/02/hfoss-double-bugfix/</link><pubDate>Mon, 15 Feb 2016 00:00:00 +0000</pubDate><guid>https://jwheel.org/blog/2016/02/hfoss-double-bugfix/</guid><description><![CDATA[<p>This article is a further addition to the series of blog posts for my <a href="https://hfoss-ritjoe.rhcloud.com/">Humanitarian Free and Open Source Software Development</a> course at <a href="https://www.rit.edu/">RIT</a>. For this week&rsquo;s homework, we are tasked with finding an open source project, looking at known bugs or finding new ones, and <a href="https://hfoss-ritjoe.rhcloud.com/hw/bugfix">submitting a bugfix</a>. I focused on two projects to begin with: <a href="https://github.com/fedora-infra/mote">møte</a> and <a href="https://github.com/FOSSRIT/FOSSProfiles">FOSSProfiles</a>.</p>

<h2 id="step-1-identifying-the-bugfix">Step 1: Identifying the bugfix&nbsp;<a class="hanchor" href="#step-1-identifying-the-bugfix" aria-label="Anchor link for: Step 1: Identifying the bugfix">🔗</a></h2>

<h4 id="møte">møte&nbsp;<a class="hanchor" href="#m%c3%b8te" aria-label="Anchor link for: møte">🔗</a></h4>
<p><a href="/blog/2016/02/Fedora-Booth-Wide.jpg">
<figure>
  <img src="/blog/2016/02/Fedora-Booth-Wide.jpg" alt="HFOSS bugfix: Looking at møte" loading="lazy">
</figure>
</a></p>
<p>When I started this homework assignment, there was originally one project I had in mind. As a non-code contributor to the Fedora Project, I frequently interact with Fedora&rsquo;s own implementation of Meetbot. <a href="https://wiki.debian.org/MeetBot">Meetbot</a> is an IRC bot that adds meeting functionality to IRC channels. It makes it easy to highlight important info and summarize the meeting into a tidy HTML summary afterwards.</p>
<p>Fedora has a custom front-end for the Meetbot bot. This project is called <a href="https://github.com/fedora-infra/mote">møte</a> and is developed by Fedora contributors <a href="https://github.com/cydrobolt">Chaoyi Zha</a>, <a href="https://github.com/ralphbean">Ralph Bean</a>, and <a href="https://github.com/fedora-infra/mote/graphs/contributors">many others</a>. One of its features is clustering Fedora sub-projects into teams and sorting their meetings together with JSON mappings.</p>
<p>Some Fedora sub-projects do not have their alias or meeting names set in these JSON files, making it difficult for their own team members or the general public from finding the records of their meetings. This inadvertently reduces transparency. Seeing as Fedora is an open project not only in code, but also in action, it made sense to try to clarify these mappings in a better way.</p>

<h4 id="fossprofiles">FOSSProfiles&nbsp;<a class="hanchor" href="#fossprofiles" aria-label="Anchor link for: FOSSProfiles">🔗</a></h4>
<p>More recently than møte, I am working with <a href="https://www.rit.edu/gccis/stephen-jacobs">Prof. Stephen Jacobs</a> this semester with <a href="http://magic.rit.edu/foss/">FOSS@MAGIC</a>. I am on an independent study on Open Source Journalism to help assist with marketing and growing additional exposure for the program. The website for the program is dated in its current form, and one of the goals this semester is to get it rewritten with a more modern, up-to-date layout and information.</p>
<p>One thing we want to have on the site is profiles of our students, alumni, mentors, and faculty. A Jinja-powered HTML generator for student profiles was made over a year ago, titled <a href="https://github.com/FOSSRIT/FOSSProfiles">FOSSProfiles</a>. In this project, students add their information to the repo in the form of YAML files. A user runs a Python script, and the program generates a raw HTML template with all of the students&rsquo; information in the repository. Wow! Useful.</p>
<p>When I went to try running it, I immediately ran into an issue and the program spat out a stacktrace at me. After troubleshooting the program and reading logs, I found two issues:</p>
<ol>
<li>Student biography lines could not be over 140 characters</li>
<li>Python script did not support Python3</li>
</ol>

<h2 id="step-2-doing-the-bugfix">Step 2: Doing the bugfix&nbsp;<a class="hanchor" href="#step-2-doing-the-bugfix" aria-label="Anchor link for: Step 2: Doing the bugfix">🔗</a></h2>

<h4 id="møte-1">møte&nbsp;<a class="hanchor" href="#m%c3%b8te-1" aria-label="Anchor link for: møte">🔗</a></h4>
<p>My commits ranged throughout the month of January and I tried to accomplish a number of things. Before I cloned the repo and started making changes, I crawled around møte for a while to find any teams or meetings that may not have been added.</p>
<p>Thanks to the power of <a href="http://www.fedmsg.com">fedmsg</a>, I was able to make a week of observations about teams that were frequently meeting in Fedora. As I observed for a week about what teams were active or inactive, I made bookmarks to their meeting pages to revisit later on.</p>
<p>After comparing the teams that were present in møte to the meetings I observed in a week, I began adding aliases and mappings for the teams that were lacking in the <a href="https://github.com/fedora-infra/mote/blob/master/name_mappings.json"><code>name_mappings.json</code></a> file. I also added a new category to the <a href="https://github.com/fedora-infra/mote/blob/master/category_mappings.json"><code>category_mappings.json</code></a> file for the <a href="https://fedoraproject.org/wiki/CommOps">Fedora Community Operations</a> team (where I spend a lot of my own time in Fedora).</p>
<p>The Fedora teams I helped identify and add to møte are as follows.</p>
<ul>
<li>CommOps</li>
<li>EMEA (Europe, Middle East, Africa) Ambassadors</li>
<li>Fedora Council (formerly known as Fedora Board)</li>
<li>LATAM (Latin America) Ambassadors</li>
<li>Fedora Magazine editorial board meetings</li>
</ul>
<p>During my time of my bugfix, I made <a href="https://github.com/fedora-infra/mote/commits?author=jflory7">13 commits</a> to the repository. I&rsquo;m not planning to stop there, either – there&rsquo;s a few more teams I hope to try adding to møte in the near future, like the Fedora Workstation, Server, and Cloud special interest groups.</p>
<p>Also in the process of contributing, I discovered a handful of problems and reported them in the issue tracker (see: <a href="https://github.com/fedora-infra/mote/issues/75">#75</a> and <a href="https://github.com/fedora-infra/mote/issues/83">#83</a>).</p>
<p>You can see my bugfix changes live in møte <a href="https://meetbot.fedoraproject.org/browse/">here</a>! Thanks Chaoyi for helping mentor me along in contributing.</p>

<h4 id="fossprofiles-1">FOSSProfiles&nbsp;<a class="hanchor" href="#fossprofiles-1" aria-label="Anchor link for: FOSSProfiles">🔗</a></h4>

<h6 id="140-char-maximum">140 char maximum&nbsp;<a class="hanchor" href="#140-char-maximum" aria-label="Anchor link for: 140 char maximum">🔗</a></h6>
<p>My first step with this bugfix was in troubleshooting the stacktrace I was given running the program in Python2. The stacktrace confirmed the error was that a profile biography was over 140 characters long, and I began sorting through all existing profiles to find any that were over the limit. After a little bit of searching, I found that <a href="https://github.com/FOSSRIT/FOSSProfiles/blob/4b680e03e0a113e874687403b0de797b7f8a5d62/profiles/student/wilfriedE.yaml"><code>wilfriedE.yaml</code></a> was the one over the 140 character limit. This was an easy correction and after making changes, I was able to run the program with Python2.</p>

<h6 id="python3-support">Python3 support&nbsp;<a class="hanchor" href="#python3-support" aria-label="Anchor link for: Python3 support">🔗</a></h6>
<p>Lastly, I wanted to add support for Python3 to this program so it would run in a modern and current workstation. This in particular required a lot of research for me to look into as I had never programmed in Python before.</p>
<p>My first problem with running the script in Python3 was an ImportError for a specific module, <a href="https://docs.python.org/2/library/itertools.html#itertools.ifilter"><code>ifilter</code></a>. After searching for an answer, I found an easy fix. It was supported by default in Python3! To fix this error was as simple as removing the line.</p>
<p>Secondly, after fixing the ImportError, I found a certain string was required to be encoded as <a href="https://en.wikipedia.org/wiki/UTF-8">UTF-8</a> before Python3 was able to handle it. After looking up the <a href="http://pythoncentral.io/encoding-and-decoding-strings-in-python-3-x/">encode() method</a> and figuring out how it worked, I simply encoded the string to UTF-8. That wasn&rsquo;t so bad…</p>

<h2 id="step-3-post-bugfix-analysis">Step 3: Post-bugfix analysis&nbsp;<a class="hanchor" href="#step-3-post-bugfix-analysis" aria-label="Anchor link for: Step 3: Post-bugfix analysis">🔗</a></h2>
<p>For me, the most fun part was the optional part of the assignment to the end. As part of the assignment, we could add our projects to OpenHub. <a href="https://www.openhub.net/">OpenHub</a> is an aggregator of open source projects that makes it easy to discover, track, and compare open source projects across the web.</p>
<p>I added a project page for <a href="https://www.openhub.net/p/mote-meetbot">møte</a> and <a href="https://www.openhub.net/p/FOSSatMAGIC-FOSSProfiles">FOSSProfiles</a> and claimed my contributions as a contributor.</p>
<p>I&rsquo;m also playing around with other projects in OpenHub… you can find my profile <a href="https://www.openhub.net/accounts/jflory7">here</a>.</p>]]></description></item><item><title>WordPress Cron, CloudFlare, and SSL</title><link>https://jwheel.org/blog/2015/12/wordpress-cron-cloudflare-ssl/</link><pubDate>Wed, 16 Dec 2015 00:00:00 +0000</pubDate><guid>https://jwheel.org/blog/2015/12/wordpress-cron-cloudflare-ssl/</guid><description><![CDATA[<p><em>Edit</em>: I haven&rsquo;t tried this in a while, but this is one of my most popular blog posts. If you try this and it works, please consider leaving a comment and let me know if anything can be improved. Thanks!</p>
<hr>
<p>Thanks to the power of <a href="https://letsencrypt.org/">LetsEncrypt</a>, I recently moved most of my sites over to using HTTPS, or in other words, SSL. I also use <a href="https://www.cloudflare.com/">CloudFlare</a> for managing most of my sites as well. What I wasn&rsquo;t fully aware of was that CloudFlare also limits scripts to increase performance (among other things). This broke WordPress cron, without my knowledge! How does one fix this issue?</p>
<p>
<figure>
  <img src="/blog/2015/12/cloudflare-banner.png" alt="WordPress cron, CloudFlare, and SSL are not always friends" loading="lazy">
  <figcaption>CloudFlare is a service that aims to make websites faster and more secure.</figcaption>
</figure>
</p>

<h2 id="wordpress-cron-scheduling-breaks">WordPress cron scheduling breaks&nbsp;<a class="hanchor" href="#wordpress-cron-scheduling-breaks" aria-label="Anchor link for: WordPress cron scheduling breaks">🔗</a></h2>
<p>Shortly after I transitioned from HTTP to HTTPS, I began noticing that many of my posts began missing their originally scheduled time. This was frustrating, as I often schedule my posts for hours when I am away or asleep, to best reach international audiences. I would wake up the following day to see that my posts failed to go out.</p>
<p>Using the <a href="http://wp-cli.org/">wp-cli utility</a>, I was able to find that my WordPress site&rsquo;s cron functionality was effectively broken. Using <code>wp-cli cron test</code> resulted in the following output:</p>
<pre tabindex="0"><code>Error: WP-Cron spawn failed with error: Cannot communicate securely with peer: no common encryption algorithm(s).
</code></pre><p>Aha! So now I knew what the issue was. Unfortunately, finding hits on Google with similarly worded searches were unsuccessful. I remembered that this was a problem that was recently encountered on the <a href="https://fedoramagazine.org/">Fedora Magazine</a>, so I asked puiterwijk, member of the Fedora Infrastructure team, about what his experience was when he fixed the same issue for the Magazine. However, his answer was completely different than what I thought the problem might be.</p>

<h2 id="fixing-wordpress-cron">Fixing WordPress cron&nbsp;<a class="hanchor" href="#fixing-wordpress-cron" aria-label="Anchor link for: Fixing WordPress cron">🔗</a></h2>
<p>The way to resolve this issue is simple. You need to map your blog&rsquo;s domain or sub-domain on your machine to the loopback address in order for your site to communicate securely with CloudFlare without the script being blocked. To do this, open your favorite text editing utility and edit <code>/etc/hosts</code> on your machine. The file should look something like this.</p>
<pre tabindex="0"><code>127.0.0.1 localhost
127.0.0.1 blog.example.com
</code></pre><p>Once you make this change, it&rsquo;s time to test. You can test whether all is functioning by either using the wp-cli test or using <code>curl</code> to verify the file is not being blocked.</p>
<pre tabindex="0"><code>$ curl -i https://jwfblog.wpenginepowered.com/wp-cron.php
HTTP/1.1 200 OK
Server: nginx/1.6.3
Date: Tue, 08 Dec 2015 01:12:47 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/5.4.16
</code></pre><p>Alternatively, if you chose to use the wp-cli utility, you should try running the cron test command. Your output should be similar.</p>
<pre tabindex="0"><code>$ wp cron test
Success: WP-Cron spawning is working as expected.
</code></pre><p>Congratulations! Your WordPress cron scheduling is back to normal.</p>

<h6 id="credit">Credit&nbsp;<a class="hanchor" href="#credit" aria-label="Anchor link for: Credit">🔗</a></h6>
<p>All credit for the findings behind this article are thanks to <a href="http://fedoraproject.org/wiki/User:Puiterwijk">puiterwijk</a> from the Fedora Infrastructure team! It would have taken me a longer time to figure this out on my own. If you&rsquo;re in a Fedora IRC channel, you should give Patrick a cookie (<code>puiterwijk++</code>). This guy does so much for Fedora and his dedication is astounding!</p>]]></description></item></channel></rss>