Tag Archives: programming

Art And Algorithms And Code And Cash

#!/usr/bin/perl
# 472-byte qrpff, Keith Winstein and Marc Horowitz <sipb-iap-dvd@mit.edu>
# MPEG 2 PS VOB file -> descrambled output on stdout.
# usage: perl -I <k1>:<k2>:<k3>:<k4>:<k5> qrpff
# where k1..k5 are the title key bytes in least to most-significant order

s''$/=\2048;while(<>){G=29;R=142;if((@a=unqT="C*",_)[20]&48){D=89;_=unqb24,qT,@
b=map{ord qB8,unqb8,qT,_^$a[--D]}@INC;s/...$/1$&/;Q=unqV,qb25,_;H=73;O=$b[4]<<9
|256|$b[3];Q=Q>>8^(P=(E=255)&(Q>>12^Q>>4^Q/8^Q))<<17,O=O>>8^(E&(F=(S=O>>14&7^O)
^S*8^S<<6))<<9,_=(map{U=_%16orE^=R^=110&(S=(unqT,"\xb\ntd\xbz\x14d")[_/16%8]);E
^=(72,@z=(64,72,G^=12*(U-2?0:S&17)),H^=_%64?12:0,@z)[_%8]}(16..271))[_]^((D>>=8
)+=P+(~F&E))for@a[128..$#a]}print+qT,@a}';s/[D-HO-U_]/\$$&/g;s/q/pack+/g;eval

You know that hacking has gone mainstream when the WSJ features it on the from page. Further, you know it must be passé when the WSJ claims that the art world is now purveying chunks of code as, well, art. You have to love this country for its entrepreneurial capitalist acumen!

So, if you are an enterprising (ex-)coder and have some cool Fortran, C++, or better yet, Assembler, lying around, dust off the diskette (or floppy, or better, yet, a punch card) and make haste to your nearest art gallery. You could become the first Picasso of programming — onward to the Gagosian! My story began with PL/1, IMS and then C, so my code may only be worthy of the artistic C-list.

From WSJ:

In March, Daniel Benitez, a cinema executive in Miami, paid $2,500 for a necktie. It wasn’t just any strip of designer neckwear. Imprinted on the blue silk were six lines of computer code that once brought the motion picture industry to its knees.

To the unschooled eye, the algorithm script on the tie, known formally as “qrpff,” looks like a lengthy typographical error.

But to Mr. Benitez and other computer cognoscenti, the algorithm it encodes is an artifact of rare beauty that embodies a kind of performance art. He framed it.

The algorithm sets out a procedure for what copyright holders once deemed a criminal act: picking the software lock on the digital scrambling system that Hollywood uses to protect its DVDs. At the turn of the century, hackers encoded it in many ways and distributed them freely—as programs, lines of poetry, lyrics in a rock song, and a square dance routine. They printed it on T-shirts and ties, like the item Mr. Benitez purchased. They proclaimed it free speech. No matter how many times the entertainment industry sued, their lawyers found the algorithm as hard to eradicate as kudzu.

Now it is exhibit A in the art world’s newest collecting trend.

Dealers in digital art are amassing algorithms, the computerized formulas that automate processes from stock-market sales to social networks.

In March, the online art brokerage Artsy and a digital code gallery called Ruse Laboratories held the world’s first algorithm art auction in New York. The Cooper Hewitt, Smithsonian Design Museum, where the auction was held as a fundraiser, is assembling a collection of computer code. In April, the Museum of Modern Art convened a gathering of computer experts and digital artists to discuss algorithms and design.

It is a small step for technology but a leap, perhaps, for the art world. “It is a whole new dimension we are trying to grapple with,” said curatorial director Cara McCarty at the Cooper Hewitt museum. “The art term I keep hearing is code.”

Read the entire article here.

Code snippet: Qrpff. A Perl script for decoding DVD content scrambling.

An Ode to the Sinclair ZX81

Sinclair-ZX81What do the PDP-11, Commodore PET, APPLE II and Sinclair’s ZX81 have in common? And, more importantly, for anyone under the age of 35, what on earth are they?  Well, these are respectively, the first time-share mainframe, first personal computer, first Apple computer, and the first home-based computer programmed by theDiagonal’s friendly editor back in the pioneering days of computation.

The article below on technological nostalgia pushed the recall button, bringing back vivid memories of dot matrix printers, FORTRAN, large floppy diskettes (5 1/4 inch), reel-to-reel tape storage, and the 1Kb of programmable memory on the ZX81. In fact, despite the tremendous and now laughable limitations of the ZX81 — one had to save and load programs via a tape cassette — programming the device at home was a true revelation.

Some would go so far as to say that the first computer is very much like the first kiss or the first date. Well, not so. But fun nonetheless, and responsible for much in the way of future career paths.

From ars technica:

Being a bunch of technology journalists who make our living on the Web, we at Ars all have a fairly intimate relationship with computers dating back to our childhood—even if for some of us, that childhood is a bit more distant than others. And our technological careers and interests are at least partially shaped by the devices we started with.

So when Cyborgology’s David Banks recently offered up an autobiography of himself based on the computing devices he grew up with, it started a conversation among us about our first computing experiences. And being the most (chronologically) senior of Ars’ senior editors, the lot fell to me to pull these recollections together—since, in theory, I have the longest view of the bunch.

Considering the first computer I used was a Digital Equipment Corp. PDP-10, that theory is probably correct.

The DEC PDP-10 and DECWriter II Terminal

In 1979, I was a high school sophomore at Longwood High School in Middle Island, New York, just a short distance from the Department of Energy’s Brookhaven National Labs. And it was at Longwood that I got the first opportunity to learn how to code, thanks to a time-share connection we had to a DEC PDP-10 at the State University of New York at Stony Brook.

The computer lab at Longwood, which was run by the math department and overseen by my teacher Mr. Dennis Schultz, connected over a leased line to SUNY. It had, if I recall correctly, six LA36 DECWriter II terminals connected back to the mainframe—essentially dot-matrix printers with keyboards on them. Turn one on while the mainframe was down, and it would print over and over:

PDP-10 NOT AVAILABLE

Time at the terminals was a precious resource, so we were encouraged to write out all of our code by hand first on graph paper and then take a stack of cards over to the keypunch. This process did wonders for my handwriting. I spent an inordinate amount of time just writing BASIC and FORTRAN code in block letters on graph-paper notebooks.

One of my first fully original programs was an aerial combat program that used three-dimensional arrays to track the movement of the player’s and the programmed opponent’s airplanes as each maneuvered to get the other in its sights. Since the program output to pin-fed paper, that could be a tedious process.

At a certain point, Mr. Shultz, who had been more than tolerant of my enthusiasm, had to crack down—my code was using up more than half the school’s allotted system storage. I can’t imagine how much worse it would have been if we had video terminals.

Actually, I can imagine, because in my senior year I was introduced to the Apple II, video, and sound. The vastness of 360 kilobytes of storage and the ability to code at the keyboard were such a huge luxury after the spartan world of punch cards that I couldn’t contain myself. I soon coded a student parking pass database for my school—while also coding a Dungeons & Dragons character tracking system, complete with combat resolution and hit point tracking.

—Sean Gallagher

A printer terminal and an acoustic coupler

I never saw the computer that gave me my first computing experience, and I have little idea what it actually was. In fact, if I ever knew where it was located, I’ve since forgotten. But I do distinctly recall the gateway to it: a locked door to the left of the teacher’s desk in my high school biology lab. Fortunately, the guardian—commonly known as Mr. Dobrow—was excited about introducing some of his students to computers, and he let a number of us spend our lunch hours experimenting with the system.

And what a system it was. Behind the physical door was another gateway, this one electronic. Since the computer was located in another town, you had to dial in by modem. The modems of the day were something different entirely from what you may recall from AOL’s dialup heyday. Rather than plugging straight in to your phone line, you dialed in manually—on a rotary phone, no less—then dropped the speaker and mic carefully into two rubber receptacles spaced to accept the standard-issue hardware of the day. (And it was standard issue; AT&T was still a monopoly at the time.)

That modem was hooked into a sort of combination of line printer and keyboard. When you were entering text, the setup acted just like a typewriter. But as soon as you hit the return key, it transmitted, and the mysterious machine at the other end responded, sending characters back that were dutifully printed out by the same machine. This meant that an infinite loop would unleash a spray of paper, and it had to be terminated by hanging up the phone.

It took us a while to get to infinite loops, though. Mr. Dobrow started us off on small simulations of things like stock markets and malaria control. Eventually, we found a way to list all the programs available and discovered a Star Trek game. Photon torpedoes were deadly, but the phasers never seemed to work, so before too long one guy had the bright idea of trying to hack the game (although that wasn’t the term that we used). We were off.

John Timmer

Read the entire article here.

Image: Sinclair ZX81. Courtesy of Wikipedia.

The Benefits of BingeTV

Netflix_logoThe boss of Netflix, Ted Sarandos, is planning to kill you, with kindness. Actually, joy. His plan to recast our consumption of television programming aims to deliver mountains of joyful entertainment in place of the current wasteland of incremental TV-dross punctuated with schlock-TV.

While the plan is still in work, the fruits of Netflix’s labor are becoming apparent — binge-watching is rapidly assuming the momentum of a cultural wave in the US. The super-sized viewing gulp, from say thirteen successive hours of House of Cards or Orange is the New Black, is quickly replacing the national attention deficit disorder enabled by the once anxious and restless trigger finger on the TV-remote, as viewers flip from one mindless show to the next. Yet, by making Netflix into the next great media and entertainment empire Sarandos may be laying the foundation for an unintended, and more important, benefit — lengthening the attention-span of the average adult.

From the Guardian:

Is Ted Sarandos a force for evil? It’s a theory. Consider the evidence. Britain is already a country beset by various health-ruining, bank balance-depleting behaviours – binge-drinking, chain-smoking, overeating, watching football. Since January 2012 when Netflix launched its UK operation, Sarandos, its chief content officer, has created a new demographic of bingeing Britons –1.5 million subscribers who spend £5.99 a month to gorge on TV online.

To get a sense of what the 49-year-old Arizonan is doing to TV culture, imagine that you’ve just finished watching episode five of Joss Whedon’s Firefly on your laptop, courtesy of Netflix. You’ve got places to go, people to meet. But up pops a little box on screen saying the next episode starts in 12 seconds. Five hours later, you dimly realise that you’ve forgotten to pick up your kids from school and/or your boss has texted you 12 times wondering if you’re planning to show up today.

Dooes he feel responsible for creating this binge culture, not just here but across the world (Netflix has 38 million subscribers in 40 countries, who watch about a billion hours of TV shows and films each month), I ask Sarandos when we meet in a London hotel? He laughs. “I love it when it happens that you just have to watch. It only takes that little bit of prodding.”

Sarandos feels it is legitimate to prod the audience so that they can get what they want. Or what he thinks they want. All 13 episodes of, say, political thriller House of Cards with Kevin Spacey, or the same number of prison comedy drama Orange is the New Black with Taylor Schilling, released in one great virtual lump.

Why? “The television business is based on managed dissatisfaction. You’re watching a great television show you’re really wrapped up in? You might get 50 minutes of watching a week and then 18,000 minutes of waiting until the next episode comes along. I’d rather make it all about the joy.”

Sarandos says he got an intimation of the pleasures of binge-viewing as a teenager in Phoenix, Arizona. On Sundays in the mid-70s, he and his family would gather round the telly to watch Mary Hartman, Mary Hartman, a satire on soap operas. “If you worked, the only way could catch up with the five episodes they showed in the week was watching them back to back on Sunday night. So bingeing was already big in my subconscious.”

Years later, Sarandos binged again. “I really loved the Sopranos but didn’t have HBO. So someone would send me tapes of the show with three or four episodes. I would watch one episode and go: ‘Oh my God, I’ve got to watch one more.’ I’d watch the whole tape and champ at the bit for the next one.”

The TV revolution for which Sarandos and Netflix are responsible involves eliminating bit-champing and monetising instant gratification. Netflix has done well from that revolution: its reported net income was $29.5m for the quarter ending 30 June. Profits quintupled compared with the same period in 2012 – in part due to its new UK operation.

Sarandos hasn’t done badly either. He and his wife, former US ambassador Nicole Avant, have a $5.4m Beverly Hills property and recently bought comedian David Spade’s beachside Malibu home for $10.2m. Sarandos argues viewers have long been battling schedulers bent on stopping them seeing what they want, when they want. “Before time shifting, they would use VCRs to collect episodes and view them whenever they wanted. And, more importantly, in whatever doses they wanted. Then DVD box sets and later DVRs made that self-dosing even more sophisticated.”

He began studying how viewers consumed TV while working part-time in a strip-mall video store in the early 1980s. By 30, he was an executive for a company supplying Blockbuster with videos. In 2000, he was hired by Netflix to develop its service posting rental DVDs to customers. “We saw that people would return those discs for TV series very quickly, given they had three hours of programming on them – more quickly than they would a movie. They wanted the next hit.”

Netflix mutated from a DVD-by-post service to an on-demand internet network for films and TV series, and Sarandos found himself cutting deals with traditional TV networks to broadcast shows online a season after they were originally shown, instead of waiting for several years for them to be available for syndication.

Thanks to Netflix and its competitors, the old TV set in the living room is becoming redundant. That living-room fixture has been replaced by a host of mobile surrogates – tablet, laptop, Xbox and even smart phone.

Were that all Sarandos had achieved, he would have been minor player in the idiot box revolution. But a couple of years ago, he decided Netflix should commission its own drama series and release them globally in season-sized bundles. In making that happen, he radically changed not just how but what we watch.

Why bother? “Up till a couple of years ago, a network would make every pilot for a series into a one-off show. I started getting worried, thinking nobody’s going to make series any more, and so we wouldn’t be able to buy them [for Netflix] a season after they’ve been broadcast. So we said maybe we should develop that muscle ourselves.” Sarandos has a $2bn annual content budget, and spends as much as 10% on developing that muscle.

Strikingly, he didn’t spend that money on movies, but TV. Why? “Movies are becoming more global, which is making them less intimate. If you make a movie for the world, you don’t make it for any country.

“I think television is going in the opposite direction – richer characterisation, denser storylines – and so much more like reading a novel. It is a golden age for TV, but only because the best writers and directors increasingly like to work outside Hollywood.” Hence, perhaps, the successes of The Sopranos, The West Wing, The Wire, Downton Abbey, and by this time next year – he hopes – Netflix series such as the Wachowskis’ sci-fi drama Sense 8. TV, if Sarandos has his way, is the new Hollywood.

Netflix’s first foray into original drama came only last year with Lilyhammer, in which Steve Van Zandt, who played mobster Silvio Dante in The Sopranos, reprised his gangster chops as Frank “The Fixer” Tagliano, a mobster starting a new life in Lillehammer, Norway. The whole season of eight episodes was released on Netflix at the same time, delighting those suffering withdrawal symptoms after the end of The Sopranos. A second season is soon to be released.

Sarandos suggests Lilyhammer points the way to a new globalised future for TV drama – more than a fifth of Norway’s population watched the show. “It opened a world of possibilities – mainstream viewing of subtitled programming in the US and releasing in every language and every territory at the exact same moment. To me, that’s what the future will be like.”

Sarandos also tore up another page of the TV rulebook, the one that says each episode of a series must be the same length. “If you watched Arrested Development [the sitcom he recommissioned in May, seven years after it last broadcast] none of those episodes has the same running time – some were 28 minutes, some 47 minutes. I’m saying take as much time as you need to tell the story well. You couldn’t really do that on linear television because you have a grid, commercial breaks and the like.”

House of Cards, his second commissioned drama series whose first season was released in February, even better demonstrates Sarandos’s diabolical genius (if that is what it is). He once described himself as “a human algorithm” for his ability, developed in that Phoenix strip mall, for recommending movies based on a customer’s previous rentals. He did something similar when he commissioned House of Cards.

“It was generated by algorithm,” Sarandos says, grinning. But he’s not entirely joking. “I didn’t use data to make the show, but I used data to determine the potential audience to a level of accuracy very few people can do.”

It worked like this. In 2011, he learned that Hollywood director David Fincher, then working on his movie adaptation of The Girl with the Dragon Tattoo, was pitching his first TV series. Based on a script by Oscar-nominated writer Beau Willimon, it was to be a remake the 1990 BBC series House of Cards, and would star Kevin Spacey as an amoral US senator.

Some networks were sceptical, but Sarandos – not least because he’s a political junkie who loves political thrillers and, along with his wife, helped raise nearly $700m for Obama’s re-election campaign – was tempted. He unleashed his spreadsheets, using Netflix data to determine how many subscribers watched political dramas such as The West Wing or the original House of Cards.

“We’ve been collecting data for a long time. It showed how many Netflix members love The West Wing and the original House of Cards. It also showed who loved David Fincher’s films and Kevin Spacey’s.”

Armed with this data, Sarandos made the biggest gamble of his life. He went to David Fincher’s West Hollywood office and announced he wanted to spend $100m on not one, but two 13-part seasons of House of Cards. Based on his calculations, he says: “I felt that sounded like a pretty safe bet.”

Read the entire article here.

Image: Netflix logo. Courtesy of Wikipedia / Netflix.