Saturday, March 21, 2020

Its In The Third Quarter The Essays

Its In The Third Quarter The Essays Its In The Third Quarter The Essays It’s in the third quarter. The fifth game of the 1980 NBA Finals. Lakers versus Seventy-Sixers. Maurice Cheeks is bringing the ball up the court for the Sixers. He snaps the rock off to Julius Erving, and Julius is driving to the basket from the right side of the lane against Kareem Abdul-Jabbar. Julius takes the ball in one hand and elevates, leaves the floor. Kareem goes up to block his path, arms above his head. Julius ducks, passes under Kareem’s outside arm and then under the backboard. He looks like he’s flying out of bounds. But no! Somehow, Erving turns his body in the air, reaches back under the backboard from behind; and lays the ball up into the basket from the left side! When Erving makes this shot, I rise into the air and hang there for an instant, held aloft by sympathetic magic. When I return to earth, everybody in the room is screaming, â€Å"I gotta see the replay!† They replay it. And there it is again. Jesus, what an amazing play! Just the celestial athleticism of it is stunning, but the tenacity and purposefulness of it, the fluid stream of instantaneous micro-decisions that go into Erving’s completing it†¦ Well, it just breaks your heart. It’s everything you want to do by way of finishing under pressure, beyond the point of no return, faced with adversity, and I am still amazed when I think of it. In retrospect, however, I am less intrigued by the play itself than by the joy attendant upon Erving’s making it, because it was well nigh universal. Everyone who cares about basketball knows this play, has seen it replayed a thousand times, and marveled at it. Everyone who writes about basketball has written about it. At the time, the crowd went completely berserk. Even Kareem, after the game, remarked that he would pay to see Doctor J make that play against someone else. Kareem’s remark clouds the issue, however, because the play was as much his as it was Erving’s, since it was Kareem’s perfect defense that made Erving’s instantaneous, pluperfect response to it both necessary and possible- thus the joy, because everyone behaved perfectly, eloquently, with mutual respect, and something magic happened- thus the joy, at the triumph of civil society in an act that was clearly the product of talent and will accommodating itself to liberating rules. Consider this for a moment: Julius Erving’s play was at once new and fair! The rules, made by people who couldn’t begin to imagine Erving’s play, made it possible. If this doesn’t intrigue you, it certainly intrigues me, because, to be blunt, I have always had a problem with â€Å"the rules,† as much now as when I was younger. Thanks to an unruled and unruly childhood, however, I have never doubted the necessity of having them, even though they all go bad, and despite the fact that I have never been able to internalize them. To this day, I never stop at a stop sign without mentally patting myself on the back for my act of good citizenship, but I do stop (usually) because the alternative to living with rules- as I discovered when I finally learned some- is just hell. It is a life of perpetual terror, self-conscious wariness, and self-deluding ferocity, which is not just barbarity, but the condition of not knowing that you are a barbarian. And this is never to know the lightness of joy- or even the possibility of it- because such joys as are attendant upon Julius Erving’s play require civilizing rules that attenuate violence and defer death. They require rules that translate the pain of violent conflict into the pleasures of disputation- into the excitements of politics, the delights of rhetorical art, and competitive sport. Moreover, the maintenance of such joys requires that we recognize, as Thomas Jefferson did, that the liberating rule that civilized us yesterday will, almost inevitably, seek to govern us tomorrow, by suppressing both the pleasure and the disputation. In so doing, it becomes a form of violence itself. An instance: I can remember being buoyed up, as a youth, by reading

Wednesday, March 4, 2020

The Require Method in Ruby

The Require Method in Ruby In order to create reusable components, ones that can be easily used in other programs, a programming language must have some way of smoothly importing that code at run-time. In Ruby, the require method is used to load another file and execute all its statements. This serves to import all class and method definitions in the file. In addition to simply executing all of the statements in the file, the require method also keeps track of which files have been previously required and, thus, will not require a file twice. Using the 'require' Method The require method takes the name of the file to require, as a string, as a single argument. This can either be a path to the file, such as ./lib/some_library.rb or a shortened name, such as some_library. If the argument is a path and complete filename, the require method will look there for the file. However, if the argument is a shortened name, the require method will search through a number of pre-defined directories on your system for that file. Using the shortened name is the most common way of using the require method. The following example demonstrates how to use the require statement. The file test_library.rb is in the first code block. This file prints a message and defines a new class. The second code block is the file test_program.rb. This file loads the test_library.rb file using the require method and creates a new TestClass object. puts test_library includedclass TestClassdef initializeputs TestClass object createdendend #!/usr/bin/env rubyrequire test_library.rbt TestClass.new Avoid Name Clashes When writing reusable components, its best not to declare many variables in the global scope outside any classes or methods or by using the $ prefix. This is to prevent something called namespace pollution. If you declare too many names, another program or library might declare the same name and cause a name clash. When two completely unrelated libraries start changing each others variables accidentally, things will break seemingly at random. This is a very difficult bug to track down and its best just to avoid it. To avoid name clashes, you can enclose everything in your library inside of a module statement. This will require people to refer to your classes and method by a fully qualified name such as MyLibrary::my_method, but its worth it since name clashes generally wont occur. For people who want to have all of your class and method names in the global scope, they can do that using the include statement. The following example repeats the previous example but encloses everything in a MyLibrary module. Two versions of my_program.rb are given; one that uses the include statement and one that does not. puts test_library includedmodule MyLibraryclass TestClassdef initializeputs TestClass object createdendendend #!/usr/bin/env rubyrequire test_library2.rbt MyLibrary::TestClass.new #!/usr/bin/env rubyrequire test_library2.rbinclude MyLibraryt TestClass.new Avoid Absolute Paths Because reusable components often get moved around, its also best not to use absolute paths in your require calls. An absolute path is a path like /home/user/code/library.rb. Youll notice that the file must be in that exact location in order to work. If the script is ever moved or your home directory ever changes, that require statement will stop working. Instead of absolute paths, its often common to create a ./lib directory in your Ruby programs directory. The ./lib directory is added to the $LOAD_PATH variable which stores the directories in which the require method searches for Ruby files. After that, if the file my_library.rb is stored in the lib directory, it can be loaded into your program with a simple require my_library statement. The following example is the same as the previous test_program.rb examples. However, it assumes the test_library.rb file is stored in the ./lib directory and loads it using the method described above. #!/usr/bin/env ruby$LOAD_PATH ./librequire test_library.rbt TestClass.new