Time to Get Back to Learning to Code

There’s a lot of places to start. I’m starting with [Real Python][] this morning, as well as a bit of [Codecademy][]. I was a Kickstarter backer for _Real Python_, so this is my chance to see what kind of return I got on my investment.

[Real Python]: http://www.realpython.com
[Codecademy]: http://www.codecademy.com

If you need a reason for why you should start to learn to code: [Simon Peyton][] (link to Youtube video of TED talk) and [Yevgeniy Brikman][] tie it to learning to think.

There are plenty of places to start learning to code: [TED has a list][ted] and [Lifehacker has a tutorial for beginners][lh] — the tutorial addresses both abstract concepts as well as grounding you in actual coding. In this case, LH uses Javascript, which may or may not interest you.

Believe it or not, [Google has a nice curriculum](http://www.google.com/edu/tools-and-solutions/guide-for-technical-development/index.html).

[Simon Peyton]: https://www.youtube.com/watch?v=Ia55clAtdMs
[Yevgeniy Brikman]: http://brikis98.blogspot.com/2014/05/dont-learn-to-code-learn-to-think.html
[ted]: http://blog.ted.com/2013/01/29/10-places-where-anyone-can-learn-to-code/
[lh]: http://lifehacker.com/5744113/learn-to-code-the-full-beginners-guide

Review of “10 PRINT CHR$(205.5+RND(1)); : GOTO 10”

There’s an interesting [review of _10 PRINT CHR$(205.5+RND(1)); : GOTO 10_ at Slate][slate]. For those that don’t, like me, recognize that particular line of code, it’s from a Commodore 64 program that would create an ever-incrementing maze on the screen. The [book about the line of code][book] seems to be wide ranging and playful and thus, to my mind, worth a look. By the way, the book is available through a Creative Commons license and can be purchased in codex form in support of two nonprofits or downloaded for free as a PDF. My advice? Check out the PDF and if you like the book, buy the codex.

[slate]: http://www.slate.com/articles/technology/books/2012/11/computer_programming_10_print_chr_205_5_rnd_1_goto_10_from_mit_press_reviewed.single.html
[book]: http://10print.org

Python in XCode

If you want to use XCode for Python development, there’s a [way to do it][], but it’s not straightforward. Tyler Crompton’s instructions have 22 steps, but he insists that it’s easier than those steps make it look.

[way to do it]: http://stackoverflow.com/questions/5276967/python-in-xcode-4

Tinker … Learn

This is really cool. Given that I have been thinking about developing an iOS app for field researchers, the timing on this could not have been better: [TinkerLearn](https://www.tinkerlearn.com/xray) aims to teach you iOS development by showing you a real app and walking you through its source code. What you get is an Xcode project with lots and lots of comments. You can run it yourself and then see what works and what doesn’t work.

If we taught writing the way programming is often taught, we would never have students read any kind of writing before asking them to write themselves, which is somewhat nonsensical. The way we learn so much of what we learn is through mimicry, mimicry leads competency, and, with desire and discipline, competency can lead to mastery.

And I love the logo:

Xray 3895018b0d6f2110795a349393a45af5

Splitting a File

Make no mistake: my coding fu remains quite weak. Still, something as simple as splitting a text file into smaller files based on a small string that sits on a line by itself shouldn’t be too hard of a problem. Well, the splitting isn’t that hard when someone hands you a Perl script. What’s hard is finding a way to split the files for yourself and also to have the files named after the string by which they were split.

What do I mean by this? I have a large text file, two of them actually, which are made up of over one hundred texts each. Each text begins with `–###–` and proceeds for some number of lines before the next `–###–` occurs.

I would like to split these larger files into their constituent parts and have each of those parts be contained in a file named, `###`. This shouldn’t be as hard as it is. I have tried:

split -p ‘^–[0-9][0-9][0-9]–‘ mytext.txt


csplit -k individuals.txt /–[0-9][0-9][0-9]–/

And that’s just to split the file. (Neither worked.) This Perl script did:


@arr = split(‘–[0-9][0-9][0-9]–‘);
for $c (@arr)
print FO $c;

But it simply labels the files by number, which loses their original identifying number.

It turns out that [StackOverflow is not all that friendly](http://stackoverflow.com/questions/11090292/break-text-file-into-multiple-text-files), or at least the subset that decided to close the question I had asked. (You’d think you could only close a question if you had either opened it or tried to answer it. Ah, Internet moderation, you are a beast that feeds the self-righteous.)