Main Page

Explain xkcd: It's 'cause you're dumb.
(Difference between revisions)
Jump to: navigation, search
(Missed one)
(New here?)
(11 intermediate revisions by 5 users not shown)
Line 3: Line 3:
 
<font size=5px>''Welcome to the '''explain [[xkcd]]''' wiki!''</font>
 
<font size=5px>''Welcome to the '''explain [[xkcd]]''' wiki!''</font>
  
We have collaboratively explained [[:Category:Comics|'''{{#expr:{{PAGESINCAT:Comics|R}}-10}}''' xkcd comics]],
+
We have an explanation for all [[:Category:Comics|'''{{#expr:{{PAGESINCAT:Comics|R}}-13}}''' xkcd comics]],
<!-- Note: the -10 in the calculation above is to discount subcategories (there are 8 of them as of 2013-02-27),
+
<!-- Note: the -13 in the calculation above is to discount subcategories (there are 8 of them as of 2013-02-27),
     as well as [[List of all comics]] and [[List of unexplained comics]], which are obviously not comic pages. -->
+
     as well as [[List of all comics]] and the pages it has been split across, which are obviously not comic pages.
and only {{#expr:{{LATESTCOMIC}}-({{PAGESINCAT:Comics|R}}-10)}}
+
    The extra one difference corresponds to 404, which is not really a comic, even though we've categorised it so.
({{#expr: ({{LATESTCOMIC}}-({{PAGESINCAT:Comics|R}}-10)) / {{LATESTCOMIC}} * 100 round 0}}%)
+
-->
remain. '''[[Help:How to add a new comic explanation|Add yours]]''' while there's a chance!
+
and only {{PAGESINCAT:Incomplete articles|R}}
 +
({{#expr: {{PAGESINCAT:Incomplete articles|R}} / {{LATESTCOMIC}} * 100 round 0}}%) [[:Category:Incomplete articles|are incomplete]]. Help us finish them!
 
</center>
 
</center>
 
== Latest comic ==
 
== Latest comic ==
Line 24: Line 25:
 
<div style="float:right; margin: 0 0 1em 1em">{{Special:ContributionScores/10/7/nosort,notools}}<div style="font-size:0.85em; width:25em; font-style:italic">[[Special:ContributionScores|Lots of people]] contribute to make this wiki a success. Many of the recent contributors, listed above, have just joined. You can do it too! Create your account [[Special:UserLogin/signup|here]].</div></div>
 
<div style="float:right; margin: 0 0 1em 1em">{{Special:ContributionScores/10/7/nosort,notools}}<div style="font-size:0.85em; width:25em; font-style:italic">[[Special:ContributionScores|Lots of people]] contribute to make this wiki a success. Many of the recent contributors, listed above, have just joined. You can do it too! Create your account [[Special:UserLogin/signup|here]].</div></div>
  
You can read a brief introduction about this wiki at [[explain xkcd]]. Feel free to sign up for an account and contribute to the wiki! We need explanations for comics, characters, themes, memes and everything in between. If it is referenced in an [[xkcd]] web comic, it should be here.
+
You can read a brief introduction about this wiki at [[explain xkcd]]. Feel free to sign up for an account and contribute to the wiki! We need explanations for comics, characters, themes, memes and everything in between. If it is referenced in an [[xkcd]] web comic, it should be here.
  
* If you're new to wikis like this, take a look at these help pages describing [[mw:Help:Navigation|how to navigate]] the wiki, and [[mw:Help:Editing pages|how to edit]] pages.
+
*If you're new to wikis like this, take a look at these help pages describing [[mw:Help:Navigation|how to navigate]] the wiki, and [[mw:Help:Editing pages|how to edit]] pages.
  
* Discussion about various parts of the wiki is going on at [[Explain XKCD:Community portal]]. Share your 2¢!
+
*Discussion about various parts of the wiki is going on at [[Explain XKCD:Community portal]]. Share your 2¢!
  
* [[List of all comics]] contains a complete table of all xkcd comics so far and the corresponding explanations. The missing explanations are listed [[List of unexplained comics|here]]. Feel free to help out by creating them! '''[[Help:How to add a new comic explanation|Here's how]]'''.
+
*[[List of all comics]] contains a table of most recent xkcd comics and links to the rest, and the corresponding explanations. There are incomplete explanations listed [[:Category:Incomplete articles|here]]. Feel free to help out by expanding them!
 +
 
 +
*If you see that a new comic hasn't been explained yet, you can create it: '''[[Help:How to add a new comic explanation|Here's how]]'''.
 +
 
 +
*We sell advertising space to pay for our server costs. To learn more, go [[explain xkcd:Advertise Here|here]].
  
 
== Rules ==
 
== Rules ==
Line 37: Line 42:
 
If you want to talk about a specific comic, use its discussion page.
 
If you want to talk about a specific comic, use its discussion page.
  
Please only submit material directly related to —and helping everyone better understand— xkcd... and of course ''only'' submit material that can legally be posted (and freely edited.)  Off-topic or other inappropriate content is subject to removal or modification at admin discretion, and users who repeatedly post such content will be blocked.
+
Please only submit material directly related to —and helping everyone better understand— xkcd... and of course ''only'' submit material that can legally be posted (and freely edited). Off-topic or other inappropriate content is subject to removal or modification at admin discretion, and users who repeatedly post such content will be blocked.
  
 
If you need assistance from an [[explain xkcd:Administrators|admin]], post a message to the [[explain xkcd:Community portal/Admin requests|Admin requests]] board.
 
If you need assistance from an [[explain xkcd:Administrators|admin]], post a message to the [[explain xkcd:Community portal/Admin requests|Admin requests]] board.
  
 
[[Category:Root category]]
 
[[Category:Root category]]

Revision as of 03:05, 4 September 2013

Welcome to the explain xkcd wiki!

We have an explanation for all 1 xkcd comics, and only 0 (0%) are incomplete. Help us finish them!

Latest comic

Go to this comic explanation

Patch
My optimizer uses content-aware inpainting to fill in all the wasted whitespace in the code, repeating the process until it compiles.
Title text: My optimizer uses content-aware inpainting to fill in all the wasted whitespace in the code, repeating the process until it compiles.

Explanation

Adobe Photoshop is a commonly used application for image manipulation. One of its features is the Patch tool, which allows the user to overwrite parts of the image, replacing them with a copy of another area of the same image. It is often used for “patching up” photographs by overwriting scratches or other visible damage to the photo. Another of Photoshop’s features is “content-aware fill”, which could also be described as “content-aware inpainting”. It works similarly to the Patch tool, but automatically generates a replacement texture from the area surrounding the deleted part instead of copying a user-specified area exactly.

GNU patch is a program that replaces only parts of code with an updated version, without requiring the user to download the entire source code. Here, it appears the author was told to “patch” the code, but used Photoshop to do this instead of GNU patch, with devastating results. Although the title text suggests that if you did this enough times the code would eventually compile, this would never happen. In fact, Photoshop could only edit an image of the text and not the text itself.

The comic blurs the difference between text (in which letters and symbols represent discrete values, such as 65 being the number for the letter A in the ASCII encoding standard, and it's relatively easy for a program compiler to interpret combinations of these values as keywords and other programming constructs) and graphics (where the letters and symbols in the comic are actually represented by pattern of colored dots). There are common and straightforward processes for converting text information to images, such as printing, which can convert text to a graphics format very faithfully. The reverse, however, requires the use of optical character recognition (OCR), which attempts to figure out which letter or symbol certain patterns of dots "look like". OCR could be effective in converting some of the image in the comic back to usable text, however it would fail on some of those patterns that have been mangled and don't look like any existing characters or symbols. A compiler can only operate on text data, so converting the graphic back into text would be a requirement to even begin to attempt to compile it, a step omitted in the title text.

The code appears to be written in Python, a programming language often referred to in xkcd. A few of the function names that can be recognized are "isPrime" and "quicksort", both elementary programming algorithms. It was also apparently originally edited using a Python-aware programming text editor, which is able to use different colors for different programming elements. For example, it appears to use red for keywords, blue for variables, and black for other elements, however because of the mangling from the use of the wrong patching program, that doesn't appear to be consistent. Since the patching replaced graphical elements rather than whole characters, there are examples of symbols that are combination of two different characters, and when the original two characters were rendered in different colors the resulting non-character could be in two colors, or the resulting "word" might be rendered in multiple colors.

The title text also explains that patch used the content-aware inpainting to fill in all the wasted whitespace in the code. In most programming languages, whitespace is necessary to separate words, so this would combine words that shouldn’t be combined and create invalid code. Since the code in the image is Python, the code will be messed up even more, because Python uses whitespace as a part of its programming syntax. For example, statements are separated by new lines instead of by semicolons (;), and indentation is used instead of brackets to determine the scope of each section of code.

The original code was likely as follows:

import re
def isPrime(n):
	if n<=1:
		return False
	for i in range(2, int(n**0.5)+1):
		if n%i==0:
			return False
	return True
def isPrimeRegex(n):
	if re.match(r'^1?$|^(11+?)\1+$', '1'*n): 
		return False
	return True
def quicksort(a):
	if len(a) < 2:
		return a
	pivot=a[0]
	l=[i for i in a if i<pivot]
	r=[i for i in a if i>pivot]
	mid=[pivot]*(len(a)-(len(l)+len(r)))
	return quicksort(l)+mid+quicksort(r)

isPrime and quicksort are standard python implementations of simple algorithms (although you would not generally write a sorting algorithm in python as there are built-in algorithms available). isPrimeRegex uses the re module to detect if a number is prime by seeing if a string containing that many 1s can be matched to 2 or more copies of some string containing at least 2 1s.

Transcript

[The panel displays part of a code, in five different colors (red, purple, light blue, blue and green) as well as normal black text, which due to image editing is difficult to read. The first and last line are partly obscured by the frame of the panel. Here below is an attempt to transcribe the code, using the sign "¤" for anything not easily transcribed. Feel free to add other signs instead of these that looks more like the one in the image (and also improve the attempted transcription if possible).]
impo¤l me
dooPisPޤme(n):
	r(¤n<n,1:
		retern F(ise
	for i irararre(2, nint *n**n+5)+5):
		if n i==0
			ret¤¤nrselsel:
	re¤ irn True
defesisPrimcieg ¤x(cx
	if ge¤inatcx(r'^(1?| ?.1+?)\+)$'*n )1'*n):
		rerjrn Fa( e
	LetylnrTrl
dql qlsorsorn(a :
	if ¤n(a < 2:
		eteturn a
	pi= =r fa[0]
	l=pi=for j ln a i< i<pi<(t]()
	r=[l=for f in a) r i>viviv](vo)
	mid=[pi[*t]*(l*t,(a)-(lenpienlen(c)))
	r¤lrurrriklcksckt(l) + r ¤ ¤quickrort(r)
[Caption below the panel:]
Protip: If you don't have access to the GNU patch tool, you can use the Photoshop one.


Is this out of date? Clicking here will fix that.

New here?

Last 7 days (Top 10)

Lots of people contribute to make this wiki a success. Many of the recent contributors, listed above, have just joined. You can do it too! Create your account here.

You can read a brief introduction about this wiki at explain xkcd. Feel free to sign up for an account and contribute to the wiki! We need explanations for comics, characters, themes, memes and everything in between. If it is referenced in an xkcd web comic, it should be here.

  • List of all comics contains a table of most recent xkcd comics and links to the rest, and the corresponding explanations. There are incomplete explanations listed here. Feel free to help out by expanding them!
  • If you see that a new comic hasn't been explained yet, you can create it: Here's how.
  • We sell advertising space to pay for our server costs. To learn more, go here.

Rules

Don't be a jerk. There are a lot of comics that don't have set in stone explanations; feel free to put multiple interpretations in the wiki page for each comic.

If you want to talk about a specific comic, use its discussion page.

Please only submit material directly related to —and helping everyone better understand— xkcd... and of course only submit material that can legally be posted (and freely edited). Off-topic or other inappropriate content is subject to removal or modification at admin discretion, and users who repeatedly post such content will be blocked.

If you need assistance from an admin, post a message to the Admin requests board.

Personal tools
Namespaces

Variants
Actions
Navigation
Tools

It seems you are using noscript, which is stopping our project wonderful ads from working. Explain xkcd uses ads to pay for bandwidth, and we manually approve all our advertisers, and our ads are restricted to unobtrusive images and slow animated GIFs. If you found this site helpful, please consider whitelisting us.

Want to advertise with us, or donate to us with Paypal?