1685 : Patch

This forum is for the individual discussion thread that goes with each new comic.

Moderators: Moderators General, Prelates, Magistrates

User avatar
serutan
Posts: 100
Joined: Mon May 17, 2010 2:18 pm UTC
Location: Baja Arizona

1685 : Patch

Postby serutan » Wed May 25, 2016 4:59 am UTC

Image

Text : My optimizer uses content-aware inpainting to fill in all the wasted whitespace in the code,
repeating the process until it compiles. (EDIT : better late than never).

Looks to me more like "Here's how you can create tons of syntax errors with unique misspellings of 'return' ".
Last edited by serutan on Thu May 26, 2016 4:40 am UTC, edited 1 time in total.
For a sentient herbivore, discretion is the only part of valor. - Larry Niven

Ae7flux
Posts: 24
Joined: Tue Feb 18, 2014 10:45 am UTC

Re: 1685 : Patch

Postby Ae7flux » Wed May 25, 2016 5:27 am UTC

Geekiest. XKCD. Ever.
There is an x such that x entirely fails to signify just in case x lacks a specific combination of rotary and reciprocating motion.

User avatar
Coyne
Posts: 1061
Joined: Fri Dec 18, 2009 12:07 am UTC
Location: Orlando, Florida
Contact:

Re: 1685 : Patch

Postby Coyne » Wed May 25, 2016 5:35 am UTC

serutan wrote:Text : My optimizer uses content-aware inpainting to fill in all the wasted whitespace in the code,
repeating the process until it completes.


(Glitch: the last word should be "compiles", not "completes.")

Repeating the process until it compiles sounds...non-optimal.
In all fairness...

User avatar
rhomboidal
Posts: 791
Joined: Wed Jun 15, 2011 5:25 pm UTC
Contact:

Re: 1685 : Patch

Postby rhomboidal » Wed May 25, 2016 5:43 am UTC

Wow, who GNU.

Mikeski
Posts: 1039
Joined: Sun Jan 13, 2008 7:24 am UTC
Location: Minnesota, USA

Re: 1685 : Patch

Postby Mikeski » Wed May 25, 2016 5:58 am UTC

Ae7flux wrote:Geekiest. XKCD. Ever.


When the first page of comments on the forum is half "I don't get it", one-quarter "here's an explainxkcd link", and one-quarter "here's an explanation (that's fundamentally incorrect)", it'll be up there with the best ones. Horrible use of photoshop isn't geeky; it's the core of the social-media explosion.

Coyne wrote:Repeating the process until it compiles sounds...non-optimal.


Eh, I've done it. Failure to compile due to mismatching { } pairs, with too many {'s? Add }'s to the end of the program until it compiles, compile, and then run to see where they actually belong.

I assume this is why hardware engineers are not usually allowed to write code. :mrgreen:

FOARP
Posts: 83
Joined: Wed Jun 08, 2011 7:36 am UTC

Re: 1685 : Patch

Postby FOARP » Wed May 25, 2016 7:05 am UTC

I don't use Photoshop, but I assume this is related to a patch tool it has that creates the effect you see in the picture?

User avatar
Kalium_Puceon
Posts: 66
Joined: Mon Aug 31, 2015 12:44 pm UTC
Location: Cape Town, South Africa
Contact:

Re: 1685 : Patch

Postby Kalium_Puceon » Wed May 25, 2016 7:06 am UTC

A friend of mine found a python autocomplete that evaluates your code to figure out the autocomplete, so that's kind of like compiling it? I mean I know that Python can't be compiled by definition but that the same concepts, at least.
"You never get over the desire to do stupid things. You simply have to overrule your stupid urges with an acquired sense of fear."

-Dr. Richard Weisiger

User avatar
Neil_Boekend
Posts: 3220
Joined: Fri Mar 01, 2013 6:35 am UTC
Location: Yes.

Re: 1685 : Patch

Postby Neil_Boekend » Wed May 25, 2016 7:54 am UTC

Do I understand this correctly: this takes non-compiling code and adds stuff until it compiles? So it is a random code generator that uses non-compiling code as a seed?
Mikeski wrote:A "What If" update is never late. Nor is it early. It is posted precisely when it should be.

patzer's signature wrote:
flicky1991 wrote:I'm being quoted too much!

he/him/his

User avatar
Eternal Density
Posts: 5551
Joined: Thu Oct 02, 2008 12:37 am UTC
Contact:

Re: 1685 : Patch

Postby Eternal Density » Wed May 25, 2016 8:37 am UTC

This doesn't seem like a good idea.
Play the game of Time! castle.chirpingmustard.com Hotdog Vending Supplier But what is this?
In the Marvel vs. DC film-making war, we're all winners.

User avatar
Wee Red Bird
Posts: 188
Joined: Wed Apr 24, 2013 11:50 am UTC
Location: In a tree

Re: 1685 : Patch

Postby Wee Red Bird » Wed May 25, 2016 9:51 am UTC

I've patched in Photoshop.

When you've modified some code and printed a copy to PDF for review by a third party. You've noticed a mistake (the wrong variable name used or a comment that isn't right) and can't get on the machine used to edit it (yep, we have some compilers that only run on one machine due to licencing and other people can be using it for other work) the only way to ready it for review is to fix in photoshop. Have to make sure you have notes on what you change so you can put it in the source file when you eventually gain access to it again.

User avatar
cellocgw
Posts: 1947
Joined: Sat Jun 21, 2008 7:40 pm UTC

Re: 1685 : Patch

Postby cellocgw » Wed May 25, 2016 11:32 am UTC

Wee Red Bird wrote:I've patched in Photoshop.

When you've modified some code and printed a copy to PDF for review by a third party. You've noticed a mistake (the wrong variable name used or a comment that isn't right) and can't get on the machine used to edit it (yep, we have some compilers that only run on one machine due to licencing and other people can be using it for other work) the only way to ready it for review is to fix in photoshop. Have to make sure you have notes on what you change so you can put it in the source file when you eventually gain access to it again.


Sacre bleu!! Vous etes totally gotta be kidding!!!!ONEONEONE.

If you find a mistake, fix the source and re-export to PDF.
Or did I just get trolled :roll:

Meanwhile, the original comic left out a critical sequence:

1) print out the photoshop image
2) place on wooden table
3) snap a photo
4) scan into a jpg

(as all thedailywtf.com fans know well)
https://app.box.com/witthoftresume
Former OTTer
Vote cellocgw for President 2020. #ScienceintheWhiteHouse http://cellocgw.wordpress.com
"The Planck length is 3.81779e-33 picas." -- keithl
" Earth weighs almost exactly π milliJupiters" -- what-if #146, note 7

richP
Posts: 189
Joined: Wed Aug 17, 2011 3:28 pm UTC

Re: 1685 : Patch

Postby richP » Wed May 25, 2016 1:44 pm UTC

Mikeski wrote:
Eh, I've done it. Failure to compile due to mismatching { } pairs, with too many {'s? Add }'s to the end of the program until it compiles, compile, and then run to see where they actually belong.

I assume this is why hardware engineers are not usually allowed to write code. :mrgreen:


Re: matching {}s: control b, control b, arrow to next pair. repeat until your cursor either doesn't move or it moves to a completely unrelated block of code. Swear profusely, add missing brace, recompile.

Re: hardware engineers coding: Nah, the chips and wires guys are too used to microcontrollers and assembly. We commit grave sins against "good coding" due to working in that environment (load a library to multiply, but the chip has a perfectly good rotate instruction!).

richP
Posts: 189
Joined: Wed Aug 17, 2011 3:28 pm UTC

Re: 1685 : Patch

Postby richP » Wed May 25, 2016 1:49 pm UTC

Neil_Boekend wrote:Do I understand this correctly: this takes non-compiling code and adds stuff until it compiles? So it is a random code generator that uses non-compiling code as a seed?


Someone saw Boxcar2D and tried to make a code generator out of the same concept?

Skynet in 127538229 generations. mutation level set to 5, max number of GOTOs set to 10.

User avatar
Kalium_Puceon
Posts: 66
Joined: Mon Aug 31, 2015 12:44 pm UTC
Location: Cape Town, South Africa
Contact:

Re: 1685 : Patch

Postby Kalium_Puceon » Wed May 25, 2016 2:22 pm UTC

Patch is Photoshop's auto-fill function, it tries to blend the image over deleted sections so that it looks like nothing was there. This is good enough for like, clearing a person out of a beach scene but obviously won't work for text.
"You never get over the desire to do stupid things. You simply have to overrule your stupid urges with an acquired sense of fear."

-Dr. Richard Weisiger

JudeMorrigan
Posts: 1254
Joined: Tue Jan 26, 2010 1:26 pm UTC

Re: 1685 : Patch

Postby JudeMorrigan » Wed May 25, 2016 2:24 pm UTC

cellocgw wrote:
Wee Red Bird wrote:I've patched in Photoshop.

When you've modified some code and printed a copy to PDF for review by a third party. You've noticed a mistake (the wrong variable name used or a comment that isn't right) and can't get on the machine used to edit it (yep, we have some compilers that only run on one machine due to licencing and other people can be using it for other work) the only way to ready it for review is to fix in photoshop. Have to make sure you have notes on what you change so you can put it in the source file when you eventually gain access to it again.


Sacre bleu!! Vous etes totally gotta be kidding!!!!ONEONEONE.

If you find a mistake, fix the source and re-export to PDF.
Or did I just get trolled :roll:

Did you miss the part where they didn't have access to the source?

User avatar
sfmans
Posts: 104
Joined: Mon Jun 23, 2014 9:09 am UTC
Location: High Peak, UK

Re: 1685 : Patch

Postby sfmans » Wed May 25, 2016 2:27 pm UTC

cellocgw wrote:Meanwhile, the original comic left out a critical sequence:

1) print out the photoshop image
2) place on wooden table
3) snap a photo
4) scan into a jpg

(as all thedailywtf.com fans know well)


Brillant!

Photoshop has got a scripting engine embedded in it, allowing youi to automate Photoshop through (it would seem) AppleScript, VBScript, and Javascript, so you can indeed while away many a happy day patching code in Photoshop.

What little exposure I've had to Photoshop made Eclipse and Visual Studio seem much less hostile environments to spend any time working in ...

User avatar
Soupspoon
You have done something you shouldn't. Or are about to.
Posts: 3660
Joined: Thu Jan 28, 2016 7:00 pm UTC
Location: 53-1

Re: 1685 : Patch

Postby Soupspoon » Wed May 25, 2016 2:38 pm UTC

richP wrote:Someone saw Boxcar2D and tried to make a code generator out of the same concept?
I must dig out/recreate my RedCode (CoreWars) code evolver. It forcibly commented out (added to the comments... the whole idea was to have Junk DNA analogue evolve as non-compiled repositories of once-and-maybe-future useful code features) anything that was actually fatal to the MARS 'Compiler'. Not that there was much of this, given the nature of the pseudo-assembly specification and the clever nature of the splicing algorithm.

(I'm also more a GIMP person, and I'm pretty sure that any comment being made regarding Photoshop can be similarly made for GIMP. But for free!)

rmsgrey
Posts: 3455
Joined: Wed Nov 16, 2011 6:35 pm UTC

Re: 1685 : Patch

Postby rmsgrey » Wed May 25, 2016 3:49 pm UTC

The real question is whether, having got something that compiles, you dare to run it...

Justin Lardinois
Posts: 47
Joined: Wed Aug 26, 2015 4:47 pm UTC

Re: 1685 : Patch

Postby Justin Lardinois » Wed May 25, 2016 5:01 pm UTC

Wee Red Bird wrote:I've patched in Photoshop.

When you've modified some code and printed a copy to PDF for review by a third party. You've noticed a mistake (the wrong variable name used or a comment that isn't right) and can't get on the machine used to edit it (yep, we have some compilers that only run on one machine due to licencing and other people can be using it for other work) the only way to ready it for review is to fix in photoshop. Have to make sure you have notes on what you change so you can put it in the source file when you eventually gain access to it again.


So you have a third party code reviewer that wants your code delivered as a PDF? Fucking why?

speising
Posts: 2281
Joined: Mon Sep 03, 2012 4:54 pm UTC
Location: wien

Re: 1685 : Patch

Postby speising » Wed May 25, 2016 5:09 pm UTC

JudeMorrigan wrote:
cellocgw wrote:
Wee Red Bird wrote:I've patched in Photoshop.

When you've modified some code and printed a copy to PDF for review by a third party. You've noticed a mistake (the wrong variable name used or a comment that isn't right) and can't get on the machine used to edit it (yep, we have some compilers that only run on one machine due to licencing and other people can be using it for other work) the only way to ready it for review is to fix in photoshop. Have to make sure you have notes on what you change so you can put it in the source file when you eventually gain access to it again.


Sacre bleu!! Vous etes totally gotta be kidding!!!!ONEONEONE.

If you find a mistake, fix the source and re-export to PDF.
Or did I just get trolled :roll:

Did you miss the part where they didn't have access to the source?

There are so many things wrong with that.
Source doesn't solely reside on the sole build machine.
Pdf for code review is just crazy.
Source->pdf is still text and ps is for images

User avatar
Locoluis
Posts: 99
Joined: Mon Dec 11, 2006 7:30 pm UTC
Location: Santiago, Chile
Contact:

Re: 1685 : Patch

Postby Locoluis » Wed May 25, 2016 5:25 pm UTC

There is at least one programming language where applying a patch with Photoshop makes sense.
Sueños del Sur - A webcomic about four siblings, their family, friends, adventures and dreams.
http://sds.lgm.cl/

User avatar
Soupspoon
You have done something you shouldn't. Or are about to.
Posts: 3660
Joined: Thu Jan 28, 2016 7:00 pm UTC
Location: 53-1

Re: 1685 : Patch

Postby Soupspoon » Wed May 25, 2016 7:40 pm UTC

Justin Lardinois wrote:So you have a third party code reviewer that wants your code delivered as a PDF? Fucking why?
At a guess, the code is for a highly regulated industry requiring sign-offs, and electronic-signing of official electronic records is a thing, like it might under 21CFR Part 11, something I had to work with/towards in the past.

Which is not to say that there aren't better ways (e.g. PGP-like signatures appended to the plaintext source-files, to cement the accurate datestamp for a particular code-state, in a confirmable way), but it could just be a continuation of the original "print off, sign and date, store in the physical archive" process, except now in that method's direct digital analogue (IYSWIM).

It might include actual scanned signatures, but going back in and paintshopping something might mean a small drift away from the spirit of the original intention, there... ;)

JudeMorrigan
Posts: 1254
Joined: Tue Jan 26, 2010 1:26 pm UTC

Re: 1685 : Patch

Postby JudeMorrigan » Wed May 25, 2016 8:11 pm UTC

speising wrote:Source doesn't solely reside on the sole build machine.

Barring some security-related reason that would seemingly preclude PDFs of the code, I also struggle to think of a *good* reason for source to exist only on a single machine. But it's been my considered experience that cumbersome, nonsensical procedures are all too common. Wee Red Bird's anecdote seems entirely plausible to me, even putting aside the possibility that there's actual good logic at play that I'm missing.

xtifr
Posts: 331
Joined: Wed Oct 01, 2008 6:38 pm UTC

Re: 1685 : Patch

Postby xtifr » Wed May 25, 2016 9:16 pm UTC

If you think the photoshop (or gimp) patch is tricky, wait till you try the photoshop/gimp merge!
"[T]he author has followed the usual practice of contemporary books on graph theory, namely to use words that are similar but not identical to the terms used in other books on graph theory."
-- Donald Knuth, The Art of Computer Programming, Vol I, 3rd ed.

keldor
Posts: 71
Joined: Thu Jan 26, 2012 9:18 am UTC

Re: 1685 : Patch

Postby keldor » Wed May 25, 2016 11:55 pm UTC

Why bother with patch when you can have your computer generate your code for you??

http://karpathy.github.io/2015/05/21/rnn-effectiveness/

(Check toward the bottom. They have that thing generating C code after training on the source for a Linux kernel.)

jrogers
Posts: 8
Joined: Wed Jan 16, 2013 7:04 pm UTC

Re: 1685 : Patch

Postby jrogers » Thu May 26, 2016 1:48 am UTC

Kalium_Puceon wrote:A friend of mine found a python autocomplete that evaluates your code to figure out the autocomplete, so that's kind of like compiling it? I mean I know that Python can't be compiled by definition but that the same concepts, at least.


Like the vast majority of modern language implementations, all implementations of Python compile the code before executing it. Just because you don't have to run a standalone compile command doesn't mean it didn't happen.

rmsgrey
Posts: 3455
Joined: Wed Nov 16, 2011 6:35 pm UTC

Re: 1685 : Patch

Postby rmsgrey » Thu May 26, 2016 1:50 am UTC

JudeMorrigan wrote:
speising wrote:Source doesn't solely reside on the sole build machine.

Barring some security-related reason that would seemingly preclude PDFs of the code, I also struggle to think of a *good* reason for source to exist only on a single machine. But it's been my considered experience that cumbersome, nonsensical procedures are all too common. Wee Red Bird's anecdote seems entirely plausible to me, even putting aside the possibility that there's actual good logic at play that I'm missing.


Duplicating source across multiple machines means spending resources maintaining the accuracy of the duplicates. Having a single authoritative copy eliminates all the problems of merging divergent branches (though it does introduce problems of only allowing one person to work on that project at any given time).

Sure, it's generally more efficient to have a source code management system that lets two people work on the same file at the same time, but if you usually only have one person working on a given project, the cost of setting up systems to allow more than one person is going to be more than the cost of not being able to have a second person working on it on the rare occasions when it would be useful.

User avatar
serutan
Posts: 100
Joined: Mon May 17, 2010 2:18 pm UTC
Location: Baja Arizona

Re: 1685 : Patch

Postby serutan » Thu May 26, 2016 4:52 am UTC

rmsgrey wrote:Duplicating source across multiple machines means spending resources maintaining the accuracy of the duplicates. Having a single authoritative copy eliminates all the problems of merging divergent branches (though it does introduce problems of only allowing one person to work on that project at any given time).


It also creates a single point of failure. If the disk crashes, or gets accidentally reformatted, you're D-E-D dead.

rmsgrey wrote:Sure, it's generally more efficient to have a source code management system that lets two people work on the same file at the same time, but if you usually only have one person working on a given project, the cost of setting up systems to allow more than one person is going to be more than the cost of not being able to have a second person working on it on the rare occasions when it would be useful.


Even if it's one person, it's amazing how you can have a big byte taken out of the gluteus muscles by configuration foulups.
Also you kill two birds with one stone by having a backup (which justifies the cost), and you get some modicum of configuration
management and future expansion as bonuses.
For a sentient herbivore, discretion is the only part of valor. - Larry Niven

User avatar
Wee Red Bird
Posts: 188
Joined: Wed Apr 24, 2013 11:50 am UTC
Location: In a tree

Re: 1685 : Patch

Postby Wee Red Bird » Thu May 26, 2016 7:28 am UTC

speising wrote:
JudeMorrigan wrote:
cellocgw wrote:
Wee Red Bird wrote:I've patched in Photoshop.

When you've modified some code and printed a copy to PDF for review by a third party. You've noticed a mistake (the wrong variable name used or a comment that isn't right) and can't get on the machine used to edit it (yep, we have some compilers that only run on one machine due to licencing and other people can be using it for other work) the only way to ready it for review is to fix in photoshop. Have to make sure you have notes on what you change so you can put it in the source file when you eventually gain access to it again.


Sacre bleu!! Vous etes totally gotta be kidding!!!!ONEONEONE.

If you find a mistake, fix the source and re-export to PDF.
Or did I just get trolled :roll:

Did you miss the part where they didn't have access to the source?

There are so many things wrong with that.
Source doesn't solely reside on the sole build machine.
Pdf for code review is just crazy.
Source->pdf is still text and ps is for images


Yes, the source isn't just on that one machine, as it gets backed up to a nice safe server, but the editor is. Some systems, your source isn't always a nice flat text file (anyone who works with PLCs will tell you that) and can only be viewed in the one specific editing package. And sometimes you have a syntactic highlighter (as per the cartoon's image) which doesn't show with notepad.exe

Some modification tracking systems do require code modifications to be printed off and signed for in reviews and have to be filed away somewhere safe.

Yes, it would be nice to fix and re-export to PDF. But if its just a wonky comment, it isn't going to hurt that much to shop it when you don't have access to the machine for the next day or two.

User avatar
Archgeek
Posts: 200
Joined: Wed May 02, 2007 6:00 am UTC
Location: Central US
Contact:

Re: 1685 : Patch

Postby Archgeek » Thu May 26, 2016 2:26 pm UTC

Dear crud that system is complete insanity.
rmsgrey wrote:
JudeMorrigan wrote:
speising wrote:Source doesn't solely reside on the sole build machine.

Barring some security-related reason that would seemingly preclude PDFs of the code, I also struggle to think of a *good* reason for source to exist only on a single machine. But it's been my considered experience that cumbersome, nonsensical procedures are all too common. Wee Red Bird's anecdote seems entirely plausible to me, even putting aside the possibility that there's actual good logic at play that I'm missing.


Duplicating source across multiple machines means spending resources maintaining the accuracy of the duplicates. Having a single authoritative copy eliminates all the problems of merging divergent branches (though it does introduce problems of only allowing one person to work on that project at any given time).

Sure, it's generally more efficient to have a source code management system that lets two people work on the same file at the same time, but if you usually only have one person working on a given project, the cost of setting up systems to allow more than one person is going to be more than the cost of not being able to have a second person working on it on the rare occasions when it would be useful.


That's what version control systems are for. The greatest authority would be held in the most recent tagged trunk version. Also, the cost of an SVN repository approaches zero, as does that for a low-level github account or a just a private git repository. Even if only one being is working on the code at a time, these things allow many to look upon it as they see fit, so long as they have authorization for the repo.

Wee Red Bird wrote:"Yes, the source isn't just on that one machine, as it gets backed up to a nice safe server, but the editor is. Some systems, your source isn't always a nice flat text file (anyone who works with PLCs will tell you that) and can only be viewed in the one specific editing package. And sometimes you have a syntactic highlighter (as per the cartoon's image) which doesn't show with notepad.exe


What, like labview and the like? (I can actually see using photoshop to edit a labview screenshot in lieu of a target having the ability to see the graphical version of the source otherwise.) If it at least bears a textual representation, things like Notepad++ and Atom will open almost anything and have syntax highlighting schemes for huge lists of programming languages. NPP currently has by default a giant list from Ada to VHDL, to freaking Smalltalk, to something called KIXtart.
"That big tube down the side was officially called a "systems tunnel", which is aerospace contractor speak for "big tube down the side."

rmsgrey
Posts: 3455
Joined: Wed Nov 16, 2011 6:35 pm UTC

Re: 1685 : Patch

Postby rmsgrey » Thu May 26, 2016 6:42 pm UTC

Archgeek wrote:Dear crud that system is complete insanity.
rmsgrey wrote:
JudeMorrigan wrote:
speising wrote:Source doesn't solely reside on the sole build machine.

Barring some security-related reason that would seemingly preclude PDFs of the code, I also struggle to think of a *good* reason for source to exist only on a single machine. But it's been my considered experience that cumbersome, nonsensical procedures are all too common. Wee Red Bird's anecdote seems entirely plausible to me, even putting aside the possibility that there's actual good logic at play that I'm missing.


Duplicating source across multiple machines means spending resources maintaining the accuracy of the duplicates. Having a single authoritative copy eliminates all the problems of merging divergent branches (though it does introduce problems of only allowing one person to work on that project at any given time).

Sure, it's generally more efficient to have a source code management system that lets two people work on the same file at the same time, but if you usually only have one person working on a given project, the cost of setting up systems to allow more than one person is going to be more than the cost of not being able to have a second person working on it on the rare occasions when it would be useful.


That's what version control systems are for. The greatest authority would be held in the most recent tagged trunk version. Also, the cost of an SVN repository approaches zero, as does that for a low-level github account or a just a private git repository. Even if only one being is working on the code at a time, these things allow many to look upon it as they see fit, so long as they have authorization for the repo.


First you have to learn that Git/SVN/Mercurial/whatever exists, then decide which to go for, then do the one-time setup...

I'm not saying it can't be done, but if you're only developing software as a sideline, you might not have the background to know where/how to look for these things.

Sure, anyone who knows what they're doing will be able to set something up, but there are plenty of situations where that level of experience and/or competence isn't available. And depending on the management involved, it may not be worth the effort of getting it approved even if you do know all about it.

User avatar
PM 2Ring
Posts: 3652
Joined: Mon Jan 26, 2009 3:19 pm UTC
Location: Mid north coast, NSW, Australia

Re: 1685 : Patch

Postby PM 2Ring » Mon May 30, 2016 11:29 am UTC

jrogers wrote:
Kalium_Puceon wrote:A friend of mine found a python autocomplete that evaluates your code to figure out the autocomplete, so that's kind of like compiling it? I mean I know that Python can't be compiled by definition but that the same concepts, at least.


Like the vast majority of modern language implementations, all implementations of Python compile the code before executing it. Just because you don't have to run a standalone compile command doesn't mean it didn't happen.


A small clarification: Standard Python (aka CPython) doesn't get compiled to machine code, it gets compiled to Python bytecode. If you want to see a human-readable representation of that bytecode you can use the dis module to disassemble it.

OTOH, there are other Python implementations, including Cython, PyPy, Jython, and IronPython.

Hafting
Posts: 62
Joined: Thu Feb 24, 2011 11:23 am UTC

Re: 1685 : Patch

Postby Hafting » Wed Jun 08, 2016 12:05 pm UTC

Wee Red Bird wrote:I've patched in Photoshop.

When you've modified some code and printed a copy to PDF for review by a third party. You've noticed a mistake (the wrong variable name used or a comment that isn't right) and can't get on the machine used to edit it (yep, we have some compilers that only run on one machine due to licencing and other people can be using it for other work) the only way to ready it for review is to fix in photoshop. Have to make sure you have notes on what you change so you can put it in the source file when you eventually gain access to it again.


What language would that be? The common programming languages uses ascii (or sometimes unicode) text, so just send the text for review. No need for PDF for this, unless your code actually is in a graphic format?

Provided that the format is textual, grabbing text out of a PDF by cut & paste isn't hard, so no need to fix things in photoshop. Unless the PDF production is so brainless it turns the text into images. Uark.

User avatar
ucim
Posts: 6563
Joined: Fri Sep 28, 2012 3:23 pm UTC
Location: The One True Thread

Re: 1685 : Patch

Postby ucim » Wed Jun 08, 2016 2:23 pm UTC

Hafting wrote:Provided that the format is textual, grabbing text out of a PDF by cut & paste isn't hard,
... or unless it's multi column. Then you get an interlaced mess.

Jose
Order of the Sillies, Honoris Causam - bestowed by charlie_grumbles on NP 859 * OTTscar winner: Wordsmith - bestowed by yappobiscuts and the OTT on NP 1832 * Ecclesiastical Calendar of the Order of the Holy Contradiction * Please help addams if you can. She needs all of us.

User avatar
Soupspoon
You have done something you shouldn't. Or are about to.
Posts: 3660
Joined: Thu Jan 28, 2016 7:00 pm UTC
Location: 53-1

Re: 1685 : Patch

Postby Soupspoon » Wed Jun 08, 2016 4:20 pm UTC

ucim wrote:
Hafting wrote:Provided that the format is textual, grabbing text out of a PDF by cut & paste isn't hard,
... or unless it's multi column. Then you get an interlaced mess.

There's a PDF I download, periodically, so I can make use of the 'tabular' information in it in creating my own spreadsheet version of some documents that the originators never quite get right.

Much apart from the obvious problems of direct copy-pasting (or even Paste Special, All except text-style and objects!) into the spreadsheet, I've learnt to go via a plain text editor. It's easier to Search-and-replace line patterns to put (more) tabs in, get that right, then copypasta into the spreadsheet without worrying about anything but column alignment.

But there's always something odd. Like two columns appearing as concatenated, or page 2 being above page 1. The reasons might be trivial. The former probably due to a column being manually split, sometime in post-production, the latter maybe from shuffling whole pages in layout to fit the title page in. But it's different each time.

(Last time, I got line-feeds between cells on the same row (as well as at end-of-row. I copied it in as a single column, wrote a few formulae to work out whether it should be an Nth-column entry or not, and borrow from above to make the exploded-and-staggered table into a shark's tooth repetition, from which I could sort be 'line length' and extract completed lines only... Quicker than it sounds, much quicker than manually editing. And slightly slower than shoving it through a custom Perl script that I would have written, normally, but I didn't have Perl on that machine and beggars can't be choosers.)

In short, too many different ways to convert from non-PDF formats into such, then possibly edit the PDF after the fact, I find. But that's not the only conversion problem that's out there, just the one I've encountered most frequently most recently.

User avatar
ucim
Posts: 6563
Joined: Fri Sep 28, 2012 3:23 pm UTC
Location: The One True Thread

Re: 1685 : Patch

Postby ucim » Wed Jun 08, 2016 4:26 pm UTC

Soupspoon wrote:...But there's always something odd. Like two columns appearing as concatenated, or page 2 being above page 1...
All these problems could be solved by making a gif image of the PDF page and importing it into a video format where it can be uploaded to youtube. Then use flash-download to download the converted .flv file and take a picture of it right off the screen. Use a film camera, not a digital one, since film has higher resolution.

Develop the film, print it, cut the columns out and paste them together. Scan it back in with a photo scanner, and then use OCR.

Jose
Order of the Sillies, Honoris Causam - bestowed by charlie_grumbles on NP 859 * OTTscar winner: Wordsmith - bestowed by yappobiscuts and the OTT on NP 1832 * Ecclesiastical Calendar of the Order of the Holy Contradiction * Please help addams if you can. She needs all of us.

Mikeski
Posts: 1039
Joined: Sun Jan 13, 2008 7:24 am UTC
Location: Minnesota, USA

Re: 1685 : Patch

Postby Mikeski » Wed Jun 08, 2016 7:37 pm UTC

ucim wrote:[pseudocode for Rube Goldberg's photocopy machine]

I think there was supposed to be a cassette player and a text-to-speech application in there somewhere.

User avatar
Copper Bezel
Posts: 2426
Joined: Wed Oct 12, 2011 6:35 am UTC
Location: Web exclusive!

Re: 1685 : Patch

Postby Copper Bezel » Thu Jun 09, 2016 5:07 am UTC

Soupspoon wrote:Much apart from the obvious problems of direct copy-pasting (or even Paste Special, All except text-style and objects!) into the spreadsheet, I've learnt to go via a plain text editor. It's easier to Search-and-replace line patterns to put (more) tabs in, get that right, then copypasta into the spreadsheet without worrying about anything but column alignment.

I'm pretty sure you've either reinvented CSV, or should consider doing so.
So much depends upon a red wheel barrow (>= XXII) but it is not going to be installed.

she / her / her

User avatar
Soupspoon
You have done something you shouldn't. Or are about to.
Posts: 3660
Joined: Thu Jan 28, 2016 7:00 pm UTC
Location: 53-1

Re: 1685 : Patch

Postby Soupspoon » Thu Jun 09, 2016 6:54 am UTC

Copper Bezel wrote:I'm pretty sure you've either reinvented CSV, or should consider doing so.
Oh, I've used CSV too (and, in fact, manually edited a CSV file a couple of hours ago), but, at least in every Windows spreadsheet that I can recall since at least the mid '90s, copying tab-delineated text straight into/onto a prepared table (spreadsheet/embedded table in word-type doc, etc) is by far the easiest way.

(The difficulty is ensuring that you don't get confused with whitespace used to align your fixed-width 'text table' translating badly into columnation. I tend to 'line up for visuals' with multiple tabs (spaces only for interstitial whitespace, e.g.
the gap in "Some Text", quotes not necessary!) so that the longest of any columns 'cells' needs just one tab before the next cell, lining and the shorter ones use multiple. Then when I'm happy with all alignments (and put 'placeholders' of some convenient kind in blank cell positions, like a "/" character or lone zero) I perform that text-editor's equivalent of s/\t\t/\t/g until there are no more replacements made (and s/<placeholder>// after that!). Then ctrl-A, ctrl-C and over on the spreadsheet ctrl-V1. Simple freehand editing, where the data in use isn't consistent enough to be able to script something suitable without having to modify it each and every time to deal with surprises.)


1 Then check for messes, due to PEBCAK errors. If it looks too awkward to shift/split/join cells in their new situ, ctrl-Z, edit the pre-copy text and repeat the transfer until good enough to only need to start worrying about adding formatting, adjusting column-widths, defining print areas and the rest. You can almost do it in your sleep. Sometimes, it seems I do... ;)

User avatar
orthogon
Posts: 2992
Joined: Thu May 17, 2012 7:52 am UTC
Location: The Airy 1830 ellipsoid

Re: 1685 : Patch

Postby orthogon » Thu Jun 09, 2016 8:49 am UTC

I'm convinced that pasting table-like stuff into Excel is non-deterministic. I'm sure I've pasted exactly the same thing, and yet one time it will put tab-separated values into different columns and another time each row will end up in a single cell.
xtifr wrote:... and orthogon merely sounds undecided.


Return to “Individual XKCD Comic Threads”

Who is online

Users browsing this forum: No registered users and 34 guests