Pages

February 17, 2015

Hackers: Heroes of the Computer Revolution by Steven Levy


Hackers: Heroes of the Computer Revolution by Steven Levy – very interesting book, which is not about testing, but about hardware and software history.

By sheer dint of hacking, the TX-0 no, the PDP-1 hackers had turned out a program in a weekend that it would have taken the computer industry weeks, maybe even months to pull off. It was a project that would probably not be undertaken by the computer industry without a long and tedious process of requisitions, studies, meetings, and executive vacillating, most likely with considerable compromise along the way. It might never have been done at all. The project was a triumph for the Hacker Ethic.

It is full of charming stories about how some things were invented and how hackers were dealing with problems.

One of Minsky's contributions to the growing canon of interesting hacks was a display program on the PDP-1 called the Circle Algorithm. It was discovered by mistake, actually while trying to bum an instruction out of a short program to make straight lines into curves or spirals, Minsky inadvertently mistook a "Y" character for a "Y prime," and instead of the display squiggling into inchoate spirals as expected, it drew a circle: an incredible discovery, which was later found to have profound mathematical implications.
He would help develop a program called "The Dictionary," which corrects an Apple user's spelling, but then would place a magazine advertisement for the product which contained ten spelling errors, including a misspelling of the word "misspell."
The joke is, if Draper were writing math routines for addition and he came up with the answer 2 + 2 = 5, he would put a clause in the program, if 2 + 2 = 5, then that answer is 4. That's generally the way he writes programs."

The book describes in great detail the Hacker Ethic and raises a lot of philosophical questions.

He'd [Ricky Greenblatt] twist back in his chair, looking not as rumpled as he did back as an undergraduate, when he was cherub-faced and dark-haired and painfully awkward of speech; the question, he figured, came down to whether hackers were born or made, and out came one of the notorious non sequiturs which came to be known as Blattisms: "If hackers are bom, then they're going to get made, and if they're made into it, they were bom."
The perfect algorithm. You'd have hacked right into the sweet spot, and anyone with half a brain would see that the straight line between two points had been drawn, and there was no sense trying to top it. "The Right Thing," Gosper would later explain, "very specifically meant the unique, correct, elegant solution ... the thing that satisfied all the constraints at the same time, which everyone seemed to believe existed for most problems."
"The technology has to be considered as larger than just the inanimate pieces of hardware," said Felsenstein. "The technology represents inanimate ways of thinking, objectified ways of thinking.
"To me, the best teachers tell me what I know is already right," Lee would later explain

Reading this book you may understand better why today's world is such as it is.

BASIC had spread all over the country, all over the world. And it helped Gates the fact that everybody had Altair BASIC and knew how it worked and how to fix it meant that when other computer companies came on line and needed a BASIC, they went to Gates' company. It became a de facto standard."

This book is filled with love for computers. If you ask yourself not only how, but also why – you may like it.

Les Solomon would speak in hushed terms of the project he was about to introduce to his readers: "The computer is a magic box. It's a tool. It's an art form. It's the ultimate martial art... There's no bullshit in there. Without truth, the computer won't work. You can't bullshit a computer, God damn it, the bit is there or the bit ain't there." He knew of the act of creation that is a natural outgrowth of working with the computer with a hacker's obsessive passion. "It's where every man can be a god," Les Solomon would say.

February 6, 2015

Colorize Your Logs With Rainbow

If you are tired of digging information from long monotone logs, then I suggest you to colorize them with Rainbow.

It's very simple tool (written in python), that basically colorizing (and do some other formatting too) any output that you can get: tail, less, vi, ping, ... .

Plain boring tail output:

Same output with rainbow parameter --red='.*ERROR.*', which means color all text red that matches regular expression .*ERROR.*:

One more example: --blue='irina' (make all mentions about me blue):

With rainbow you can also make config files, where you can describe how you want to process some file. Here is a simple configuration file:
And here is output with this configuration:

I've tried many different tools for colorizing logs and rainbow seems the best for me: it's very simple (you don't need to learn new syntax), it can work both individually and with configuration files, it works with any output that I need to make.

February 5, 2015

Getting Started With FireFox Extensions

Now two of my extensions are also available in FireFox – JIRA Issue Opener and URL With Parameter Opener.

Making extensions for FireFox is harder than making them for Chrome. Documentation and tutorials are tricky and the structure of files is more complicated. So writing hello-world extension for FF took me a long time.

But there is one thing, that is more convenient in FF than in Chrome – using properties/preferences/options. In Chrome you should create your own HTML page for that (in FF you can just list properties and they will appear in the standard addon's settings window). And for getting options in Chrome you should use asynchronous functions (which makes you to write ugly code) – in FF options are basically stored in array and it's really easy to get and set them.

I am not sure that I will convert my other extensions into FF (I made these two only because I personally know people who want to use them in FF), but it's really interesting to understand the difference between two browsers. I'd say, if you have free time converting extensions into FF (or vice versa) – it will be quite good time spending. And by "converting" I mean writing it from scratch – you know the functionality, you have some ready JavaScript functions (not all of them you can use), but you need to write whole thing again.