## P vs. NP and the Computational Complexity ZooMay 20 2016

When Grade-A nerds get together and talk about programming and math, a popular topic is P vs NP complexity. There's a lot to P vs NP, but boiled down to its essence, according to the video:

Does being able to quickly recognize correct answers [to problems] mean there's also a quick way to find [correct answers]?

Most people suspect that the answer to that question is "no", but it remains famously unproven.

In fact, one of the outstanding problems in computer science is determining whether questions exist whose answer can be quickly checked, but which require an impossibly long time to solve by any direct procedure. Problems like the one listed above certainly seem to be of this kind, but so far no one has managed to prove that any of them really are so hard as they appear, i.e., that there really is no feasible way to generate an answer with the help of a computer.

## A regular expression for finding prime numbersFeb 12 2015

Given that there's so much mathematicians don't know about prime numbers, you might be surprised to learn that there's a very simple regular expression for detecting prime numbers:

`/^1?\$|^(11+?)\\1+\$/`

If you've got access to Perl on the command line, try it out with some of these (just replace [number] with any integer):

`perl -wle 'print "Prime" if (1 x shift) !~ /^1?\$|^(11+?)\\1+\$/' [number]`

An explanation is here which I admit I did not quite follow. A commenter at Hacker News adds a bit more context:

However while cute, it is very slow. It tries every possible factorization as a pattern match. When it succeeds, on a string of length n that means that n times it tries to match a string of length n against a specific pattern. This is O(n^2). Try it on primes like 35509, 195341, 526049 and 1030793 and you can observe the slowdown.

## Lauren IpsumNov 21 2014

Lauren Ipsum is a book about computer science for kids (age 10 and up) published by No Starch Press.

Meet Lauren, an adventurer who knows all about solving problems. But she's lost in the fantastical world of Userland, where mail is delivered by daemons and packs of wild jargon roam.

Lauren sets out for home, traveling through a journey of puzzles, from the Push and Pop Cafe to the Garden of the Forking Paths. As she discovers the secrets of Userland, Lauren learns about computer science without even realizing it-and so do you!

Sounds intriguing. And 1000 bonus points for making the protagonist a girl. There's an older self-published version of the book that's been out for a couple of years. I like the older description slightly better:

Laurie is lost in Userland. She knows where she is, or where she's going, but maybe not at the same time. The only way out is through Jargon-infested swamps, gates guarded by perfect logic, and the perils of breakfast time at the Philosopher's Diner. With just her wits and the help of a lizard who thinks he's a dinosaur, Laurie has to find her own way home.

Lauren Ipsum is a children's story about computer science. In 20 chapters she encounters dozens of ideas from timing attacks to algorithm design, the subtle power of names, and how to get a fair flip out of even the most unfair coin.

## Tweet programmingSep 19 2014

You can now program by tweeting snippets of Wolfram Language code to their Tweet-a-Program bot, @WolframTaP. To test it out, I tweeted:

And got back:

Cool!

## Getting high on programmingJun 20 2014

David Auerbach writes about the high you get from coding.

These days I write more than I code, but one of the things I miss about programming is the coder's high: those times when, for hours on end, I would lock my vision straight at the computer screen, trance out, and become a human-machine hybrid zipping through the virtual architecture that my co-workers and I were building. Hunger, thirst, sleepiness, and even pain all faded away while I was staring at the screen, thinking and typing, until I'd reach the point of exhaustion and it would come crashing down on me.

It was good for me, too. Coding had a smoothing, calming effect on my psyche, what I imagine meditation does to you if you master it.

Auerbach asserts that there's something different about the flow state one enters while programming, compared to those brought on by making art, writing, etc. Over the years, I've written, designed, and programmed for a living, and programming is, by far, the thing that gets me the best high. I've definitely had productive multi-hour Photoshop and writing benders, but coding blocks out the world and the rest of myself like nothing else. In attempting to articulate to friends why I enjoy programming more than design or writing, I've been explaining it like this: for me, the coding process is all or nothing and has a definitive end.

When code doesn't work within the specifications, it's 100% broken. It won't compile, the web server throws an error, or gives the wrong output. Writing and design almost always sorta work...even a first draft or an initial design communicates something to the reader/viewer. When the code works within the specifications, it's done. The writing or design process is never done; even a great piece of writing or the best design can be improved incrementally or even scrapped altogether to go in a different and potentially more fruitful direction. Maybe, for me, programming's definite ending is what makes it so enjoyable. The flow state comes from knowing that, while the journey is difficult and maddening and messily creative (just as with writing or design), there's a definite point at which it's done and you can move on to the next challenge. (via 5 intriguing things)

## The infinitely large .zip fileJun 16 2014

It's possible to make a .zip file that contains itself infinitely many times. So a 440 byte file could conceivably be expanded into eleventy dickety two zootayunafliptobytes of data and beyond. Here's the full explanation.

## Folk dancing sortsApr 24 2014

Programming sorting techniques visualized through Eastern European folk dancing. For instance, here's the bubble sort with Hungarian dancing:

## Wolfram Language demoFeb 27 2014

Stephen Wolfram (of Mathematica and A New Kind of Science fame) says the upcoming Wolfram Language is his company's "most important technology project yet".

We call it the Wolfram Language because it is a language. But it's a new and different kind of language. It's a general-purpose knowledge-based language. That covers all forms of computing, in a new way.

There are plenty of existing general-purpose computer languages. But their vision is very different -- and in a sense much more modest -- than the Wolfram Language. They concentrate on managing the structure of programs, keeping the language itself small in scope, and relying on a web of external libraries for additional functionality. In the Wolfram Language my concept from the very beginning has been to create a single tightly integrated system in which as much as possible is included right in the language itself.

The demo video is a little mind-melting in parts:

Not sure if this will take off or not, but the idea behind it all is worth exploring.

## Sorting algorithms visualizedNov 13 2013

This video visualization of 15 different sorting algorithms is mesmerizing. (Don't forget the sound.)

## Legend of the Black PerlSep 23 2013

Black Perl is a poem written in valid Perl 3 code:

```BEFOREHAND: close door, each window & exit; wait until time.
open spellbook, study, read (scan, select, tell us);
write it, print the hex while each watches,
reverse its length, write again;
kill spiders, pop them, chop, split, kill them.
unlink arms, shift, wait & listen (listening, wait),
sort the flock (then, warn the "goats" & kill the "sheep");
kill them, dump qualms, shift moralities,
values aside, each one;
die sheep! die to reverse the system
you accept (reject, respect);
next step,
kill the next sacrifice, each sacrifice,
wait, redo ritual until "all the spirits are pleased";
do it ("as they say").
do it(*everyone***must***participate***in***forbidden**s*e*x*).
return last victim; package body;
exit crypt (time, times & "half a time") & close it,
select (quickly) & warn your next victim;
AFTERWORDS: tell nobody.
wait, wait until time;
wait until next year, next decade;
sleep, sleep, die yourself,
die at last
# Larry Wall```

It's not Shakespeare, but it's not bad for executable code.

## Regex crossword puzzlesJul 16 2013

This is a surprisingly helpful activity for learning about regular expressions. (via @bdeskin)

## How to efficiently sort socksJan 22 2013

From Stack Overflow, a question about how to efficient sort a pile of socks.

Yesterday I was pairing the socks from the clean laundry, and figured out the way I was doing it is not very efficient. I was doing a naive search -- picking one sock and "iterating" the pile in order to find its pair. This requires iterating over n/2 * n/4 = n^2/8 socks on average.

As a computer scientist I was thinking what I could do? sorting (according to size/color/...) of course came into mind to achieve O(NlogN) solution.

And everyone gets it wrong. The correct answer is actually:

1) Throw all your socks out.

2) Go to Uniqlo and buy 15 identical pairs of black socks.

3) When you want to wear socks, pick any two out of the drawer.

4) When you notice your socks are wearing out, goto step 1.

QED

## Source code for Apollo and Gemini programsApr 25 2012

An extensive collection gathered from all over the internet of the source code and documentation for NASA's Apollo and Gemini programs. Here's part of the source code for Apollo 11's guidance computer.

And here's an interesting tidbit about the core rope memory used for the Apollo's guidance computer:

Fun fact: the actual programs in the spacecraft were stored in core rope memory, an ancient memory technology made by (literally) weaving a fabric/rope, where the bits were physical rings of ferrite material.

"Core" memory is resistant to cosmic rays. The state of a core bit will not change when bombarded by radiation in Outer Space. Can't say the same of solid state memory.

Woven memory! Also called LOL memory:

Software written by MIT programmers was woven into core rope memory by female workers in factories. Some programmers nicknamed the finished product LOL memory, for Little Old Lady memory.

## A search for programming knowledge and _whyMar 15 2012

For her yearly month-long project at Slate, Annie Lowrey wanted to learn how to code. She picked Ruby and became interested in the story of _why, the mysterious Ruby hacker who disappeared suddenly in 2009. In a long article at Slate, Lowrey shares her experience learning to program and, oh, by the way, tracks down _why. Sort of.

The pickaxe book first shows you how to install Ruby on your computer. (That leads to a strange ontological question: Is a programming language a program? Basically, yes. You can download it from the Internet so that your computer will know how to speak it.)

Then the pickaxe book moves on to stuff like this: "Ruby is a genuine object-oriented language. Everything you manipulate is an object, and the results of those manipulations are themselves objects. However, many languages make the same claim, and their users often have a different interpretation of what object-oriented means and a different terminology for the concepts they employ."

Programming manual, or Derrida? As I pressed on, it got little better. Nearly every page required aggressive Googling, followed by dull confusion. The vocabulary alone proved huge and complex. Strings! Arrays! Objects! Variables! Interactive shells! I kind of got it, I would promise myself. But the next morning, I had retained nothing. Ruby remained little more than Greek to me.

## Beginner's guide to developing iOS appsFeb 29 2012

Very much trying not to read the entirety of this beginner's guide to developing iOS apps published by Apple because then I'll be tempted to actually make one.

We think Codify is the most beautiful code editor you'll use, and it's easy. Codify is designed to let you touch your code. Want to change a number? Just tap and drag it. How about a color, or an image? Tapping will bring up visual editors that let you choose exactly what you want.

Codify is built on the Lua programming language. A simple, elegant language that doesn't rely too much on symbols -- a perfect match for iPad.

(via df)

## Commit Logs From Last NightOct 18 2011

Sort of a nerdy version of Texts From Last Night, Commit Logs From Last Night chronicles the often frustrating process of committing working code.

SUPER ugly, but it works

Added a bunch of semi colons that were missing for some balls weird reason.

Oops, left some debugging crap

## RIP Dennis RitchieOct 13 2011

Dennis Richie passed away last week. Richie created the C programming language, was a key contributer to UNIX, and wrote an early definitive work on programming, The C Programming Language.

We lost a tech giant today. Dennis MacAlistair Ritchie, co-creator of Unix and the C programming language with Ken Thompson, has passed away at the age of 70. Ritchie has made a tremendous amount of contribution to the computer industry, directly and indirectly affecting (improving) the lives of most people in the world, whether you know it or not.

These sorts of comparisons are inexact at best, but Richie's contribution to the technology industry rivals that of Steve Jobs'...Richie's was just less noticed by non-programmers.

## Scripting language comparisonsAug 17 2011

An extensive side-by-side reference sheet of four scripting languages (PHP, Python, Perl, and Ruby) with which you can compare how the different languages handle variable declarations, concatenations, objects, and hundreds of other things. Great cheatsheet for learning a new language when you're already familar with one of the others.

## Weird software bugsApr 28 2011

From Wikipedia, a list of unusual software bugs, including the Mandelbug and Heisenbug. My favorite is the Schrödinbug:

A schrödinbug is a bug that manifests only after someone reading source code or using the program in an unusual way notices that it never should have worked in the first place, at which point the program promptly stops working for everybody until fixed.

(via @greglopp)

## Regular expression testerApr 18 2011

Related to the regex generator I posted last week, here's a regular expression tester...you plug in your regex and it'll match test strings as you type. (thx, chris)

## Magical regular expression generatorApr 13 2011

On text2re.com, you can input some text you want to use a regular expression on, click on what you want to match, and it'll generate the regular expression for you.

This system acts as a regular expression generator. Instead of trying to build the regular expression, you start off with the string that you want to search. You paste this into the site, click submit and the site finds recognisable patterns in your string. You then select the patterns that you are interested in and it writes a fully fledged program that extracts those patterns from that string. You then copy the program into your editor or IDE and play with it to integrate it into your program.

This just totally broke my brain.

## On weekend web appsDec 20 2010

Andre Torrez offers some advice for those who think that they can clone a popular web app over the weekend. The best part -- or the worst, if you're the aspiring weekend programmer -- is that each item on the list is a little Pandora's box of Alice's rabbit holes. Like this:

Lost password flow. You'll want to generate a key and store it someplace for when someone requests to reset their password. So that's another email that has to go out.

If you actually want your email to arrive at its destination, you're gonna have to worry about all this. Or go through a third-party service, which is another interface (and bill (and moving part)) that you need to worry about. You get the point...making a web app work for more than just one person is hard, way harder than it looks unless you've done it.

Ok, so it's not Gaga (and certainly not Christopher Walken), but she does work "object oriented" into the lyrics.

This is possibly the best production of the worst idea I've ever seen.

## Ada Lovelace, the first computer programmerJun 18 2010

Charles Babbage built one of the first mechanical calculating machines but Ada Lovelace was the first to show how the machine's arithmetic function could be abstracted to produce things other than numbers: language, graphics, or music.

There are several other Information Pioneers shorts available on Vimeo, including profiles of Tim Berners-Lee, Alan Turing, and Hedy Lamarr.

## When programming errors attack!Mar 23 2010

From a bunch of security experts, the top 25 most dangerous programming errors that can lead to serious software vulnerabilities.

Cross-site scripting and SQL injection are the 1-2 punch of security weaknesses in 2010. Even when a software package doesn't primarily run on the web, there's a good chance that it has a web-based management interface or HTML-based output formats that allow cross-site scripting. For data-rich software applications, SQL injection is the means to steal the keys to the kingdom. The classic buffer overflow comes in third, while more complex buffer overflow variants are sprinkled in the rest of the Top 25.

## Programming lessonsJan 13 2010

A programmer lists 20 lessons learned in the past 20 years.

5. You are not the best at programming. Live with it. -- I always thought that I knew so much about programming, but there is always someone out there better than you. Always. Learn from them.

(via @h_fj)

## Step by stepDec 15 2009

If you're Dan Bricklin, co-inventor of the spreadsheet, how do you go about learning a new programming environment? Just like everyone else:

In mid-September I purchased a shiny new 24" Apple iMac and an iPhone 3GS. I signed up for the Apple iPhone Developer Program. I bought some books and started doing the tutorials, step by step. I came up with the idea for an app I needed and built a prototype, then plunged in and started creating a full app that would be good for others, too.

Personally, I find this really inspiring.

## A dogcow makes a moofMay 15 2009

Hackers Can Sidejack Cookies, a poem by Heather McHugh.

Designs succumbing
to creeping featuritis
are banana problems.
("I know how to spell banana,
but I don't know when to stop.")

## Green Eggs and HamFeb 20 2009

After writing The Cat in the Hat in 1955 using only 223 words, Dr. Seuss bet his publisher that he could write a book using only 50 words. Seuss collected on the wager in 1960 with the publication of Green Eggs and Ham. Here are the 50 distinct words used in the book:

a am and anywhere are be boat box car could dark do eat eggs fox goat good green ham here house I if in let like may me mouse not on or rain Sam say see so thank that the them there they train tree try will with would you

From a programming perspective, one of the fun things about Green Eggs and Ham is because the text contains so little information repeated in a cumulative tale, the story could be more efficiently represented as an algorithm. A simple loop would take the place of the following excerpt:

I do not like them in a box.
I do not like them with a fox.
I do not like them in a house.
I do not like them with a mouse.
I do not like them here or there.
I do not like them anywhere.
I do not like green eggs and ham.
I do not like them, Sam I am.

But I don't know...`foreach (\\$items as \\$value)` doesn't quite have the same sense of poetry as the original Seuss.

## The Chef programming languageDec 18 2008

I have no idea how to describe the Chef programing language to you, but here is its Hello World program, in the form of a souffle:

Ingredients.
72 g haricot beans
101 eggs
108 g lard
111 cups oil
32 zucchinis
119 ml water
114 g red salmon
100 g dijon mustard
33 potatoes

Method.
Put potatoes into the mixing bowl. Put dijon mustard into the mixing bowl. Put lard into the mixing bowl. Put red salmon into the mixing bowl. Put oil into the mixing bowl. Put water into the mixing bowl. Put zucchinis into the mixing bowl. Put oil into the mixing bowl. Put lard into the mixing bowl. Put lard into the mixing bowl. Put eggs into the mixing bowl. Put haricot beans into the mixing bowl. Liquefy contents of the mixing bowl. Pour contents of the mixing bowl into the baking dish.

Serves 1.

Ok, I think I get it now...the programs look like food recipes but act like code when run through the proper interpreter. Mmmm, fibonacci with caramel sauce! (via ben fry)

## The Elements of [programming] StyleOct 14 2008

5.21. Prefer the standard to the offbeat
Young writers Inexperienced programmers will be draw at every turn toward eccentricities in language. They will hear the beat of new vocabularies abstractions, the exciting rhythms of special segments of their society industry, each speaking a language of its own. All of us come under the spell of these unsettling drums; the problem for beginners is to listen to them, learn the words, feel the vibrations, and not be carried away.

## A guy who started working as aMar 12 2008

A guy who started working as a game programmer for Atari when he was 21 years old recounts his experiences, notably his work on the Donkey Kong cartridge.

Basically, Atari's marketing folks would negotiate a license to ship GameCorp's "Foobar Blaster" on a cartridge for the Atari Home Computer System. That was it. That was the entirety of the deal. We got ZERO help from the original developers of the games. No listings, no talking to the engineers, no design documents, nothing. In fact, we had to buy our own copy of the arcade machine and simply get good at the game (which was why I was playing it at the hotel - our copy of the game hadn't even been delivered yet).

(via girlhacker)

## The programmers profiled in the 1986 book, ProgrammersFeb 22 2008

The programmers profiled in the 1986 book, Programmers at Work...where are they now?

Bill Gates. Then: founder of Microsoft, popularizer of the word "super". Now: richest guy in the world. After a stint in the 90s as pure evil, semi-retired to focus on philanthropic work.

## An extensive collection of cheat sheets forFeb 21 2008

An extensive collection of cheat sheets for programming languages and applications. There are 10 PHP cheat sheets alone and more for related things like Drupal and CakePHP.

## Processing: A Programming Handbook for Visual Designers and ArtistsOct 02 2007

Casey Reas and Ben Fry, inventors of the Processing programming language (that's Proce55ing to you old schoolers), have just come out with a book on the topic that looks fantastic. In addition to programming tutorials are essays and interviews with other heavy hitters in the programmatic arts like Golan Levin, Alex Galloway, Auriea Harvey, and Jared Tarbell. The site for the book features a table of contents, sample chapters, and every single code example in the book, freely available for download. Amazon's got the book but they're saying it's 4-6 weeks for delivery so I suggest hoofing it over to your local bookstore for a look-see instead.

## A brief history of programming languages fromSep 12 2007

A brief history of programming languages from the September 1995 issue of Byte magazine. Amazing how many of these languages are now extinct or otherwise not widely used...and that Perl, PHP, Java, JavaScript, etc. didn't make the list.

Update: I corrected the above statement about Perl et. al. not existing and modified it to read that they didn't make the list. Perl, Ruby, nd Java all existed in one form or another in 1995. (thx to everyone who sent this in)

## I was telling a friend this weekendMay 07 2007

I was telling a friend this weekend about an article I'd read long ago about Larry Wall approaching the development of Perl as if it were a natural language. I think this is the article in question. Perl, the first postmodern computer language and a conversation with Larry Wall also touch on Perl and linguistics.

Update: Here's the original post to comp.lang.perl.misc by Wall. (thx, marc)

## CodeIDE is an browser-based IDE for editingFeb 21 2007

CodeIDE is an browser-based IDE for editing code. Supported languages include LISP, HTML, Basic, Perl, and JavaScript. My favorite bit is the scrolling list of results and error messages from other users.

## Some of the onscreen special effects onJan 30 2006

Some of the onscreen special effects on Doctor Who were generated by a home computer called the BBC Micro. "A brief sequence during this program actually showed the BBC Basic and assembler code used to create the console display"

## Bakeoff! A Gladwell article from back inNov 30 2005

Bakeoff! A Gladwell article from back in September on a project that used different team methodologies to attempt to create the perfect cookie: an open source approach, an approach based on extreme programming, and a traditional hierarchical team. You may be surprised which team won.

## We ran across the nerdiest board gameSep 11 2005

We ran across the nerdiest board game today called c-jump, the computer programming game. More info: "Skiers and snowboarders line up at the start location and race along the ski trails. Spaces on the board show statements of programming language. First player to move all skiers past the finish line is the winner."

Update: here's the game's web site. "This game eliminates intimidation of many kids and their parents, bored by the mention of 'computer programming', often associated with visions of geeky guys glued to their computers."

## Here's a story that mentions that SlashdotJul 15 2005

Here's a story that mentions that Slashdot commenter that outsourced his job. "About a year ago I hired a developer in India to do my job. I pay him \$12,000 out of the \$67,000 I get. He's happy to have the work. I'm happy that I have to work only 90 minutes a day just supervising the code. My employer thinks I'm telecommuting. Now I'm considering getting a second job and doing the same thing."

## Impressive demonstration of Ruby on RailsJul 11 2005

Impressive demonstration of Ruby on Rails. "How to build a blog engine in 15 minutes with Ruby on Rails".

## Processing, a programming environment for designers andApr 21 2005

Processing, a programming environment for designers and artists, is in beta. It's the first public release.