3 ms·
Brilliant on so many levels, thank you for this...I can't count the number of times I've tried to explain a snippet of code via GMail...it's already painful eno
by danso 11y ago
Brilliant on so many levels, thank you for this...I can't count the number of times I've tried to explain a snippet of code via GMail...it's already painful enough to highlight the text and convert it to monospace (which an annoying number of people fail to do)...nevermind also producing human-readable colors.
I actually think I'll stick to the command-line/pipeable script you link to...for teaching purposes, I've wanted to make myself a utility that converts syntax-higlighted code into a PNG...so that I can show the code but make it much more difficult to just copy/paste.
edit: And of course, the thing that I want, someone has already made and yet I couldn't even bother to RTFM. From running `highlight --h` at the command line:
SVG output options:
--height set image height (units allowed)
--width set image width (see --height)
- Retra 11y agoI really don't see why you'd want PNGs of text. I get that you don't want people to copy, but it is readable text. Don't show people code if you don't want them to have the exact same code. And anyone willing to copy/paste has already committed to wasting their time. Also, this kind of thing already exists: http://www.free-ocr.com/ http://www.free-ocr.com/
- z1mm32m4n 11y agoI'd guess maybe educational purposes? Forcing people to write the code line by line can have instructive value.
- danso 11y agoThis is for teaching code. I want people to see my code, but I want to remove as many of the conveniences that enable them to just copy-paste that I can -- while not severely hindering my own ability to write and maintain lessons (once code is in PNG...it's quite difficult to grep and/or re-edit), because I believe having to just physically type out code slows you enough that you actually think about the code. Also, having to type out code pretty much forces you to get into the habit of using keyboard shortcuts, particularly auto-complete.
- Retra 11y agoYou can achieve that just by having them write code that doesn't do exactly the same thing you've shown them.
- danso 11y agoThat's what the homework is for. But for new students who have never written code or experienced even a prompt (the closest thing to that now is the web browser address bar, which stops being a prompt as soon as you click to bring focus to it) -- it's helpful to confirm for themselves that a code snippet works as described, from the typing of the first character to the actual execution. Too often, beginners (and frankly, experienced programmers such as myself) believe that they truly understand a snippet of code just because they read it. And being beginners, they lack the discipline and the wisdom to know that code is not just human-readable machine instructions, to be read as if it were a stilted essay, but something to be interactively tested and changed. Also, those new to coding don't realize that copying/reusing code is just fine. But understanding what it does before you attempt to re-use it -- that's the challenge.