1464 1574585529458 httpcache-v1
Method: POST
URL: https://www.notion.so/api/v3/getRecordValues
Body:+110
{
  "requests": [
    {
      "id": "b8c67c89-29cf-4b98-bd67-2e4dc5f745e9",
      "table": "block"
    }
  ]
}
Response:+1264
{
  "results": [
    {
      "role": "comment_only",
      "value": {
        "alive": true,
        "content": [
          "7434255a-bc09-4fc6-b646-31ec8dc05e63",
          "41e51e80-fcb5-44e1-a29b-f696ef8f8bfa",
          "328efc95-92a3-48d2-a3e4-f1081e97c6cc",
          "df9bb084-85ec-42f3-ba31-9e2566d64d9b"
        ],
        "created_by": "bb760e2d-d679-4b64-b2a9-03005b21870a",
        "created_by_id": "bb760e2d-d679-4b64-b2a9-03005b21870a",
        "created_by_table": "notion_user",
        "created_time": 1550447709965,
        "format": {
          "page_full_width": true,
          "page_small_text": true
        },
        "id": "b8c67c89-29cf-4b98-bd67-2e4dc5f745e9",
        "ignore_block_count": true,
        "last_edited_by": "bb760e2d-d679-4b64-b2a9-03005b21870a",
        "last_edited_by_id": "bb760e2d-d679-4b64-b2a9-03005b21870a",
        "last_edited_by_table": "notion_user",
        "last_edited_time": 1550447709965,
        "parent_id": "14ad6c73-b15c-4c75-8f07-1c859944f790",
        "parent_table": "block",
        "properties": {
          "title": [
            [
              "Translucent Navigation and Status Bars API 19"
            ]
          ]
        },
        "type": "page",
        "version": 7
      }
    }
  ]
}
22748 1574585529459 httpcache-v1
Method: POST
URL: https://www.notion.so/api/v3/loadPageChunk
Body:+152
{
  "chunkNumber": 0,
  "cursor": {
    "stack": []
  },
  "limit": 50,
  "pageId": "b8c67c89-29cf-4b98-bd67-2e4dc5f745e9",
  "verticalColumns": false
}
Response:+22507
{
  "cursor": {
    "stack": []
  },
  "recordMap": {
    "block": {
      "14ad6c73-b15c-4c75-8f07-1c859944f790": {
        "role": "comment_only",
        "value": {
          "alive": true,
          "content": [
            "7327cefd-c1b5-4fe2-975e-d39f4e7444ea",
            "e532553e-da5d-47b9-95d0-3d34d0faf8cb",
            "1ce47de0-bf41-4c0b-87b7-250c76b609fa",
            "9216171e-383e-4a51-9337-9c0759371e07",
            "7850a080-b8f2-4312-ba3b-7e0a3a6eb9ab",
            "76d47bef-edbd-47a6-b2a1-ae63c550f71c",
            "a2389bd4-1322-427a-b12a-39cef6dce301",
            "c3665fe4-a0bd-433b-bd29-3b6ae198429c",
            "b8c67c89-29cf-4b98-bd67-2e4dc5f745e9",
            "d79c2b8e-8b67-47c8-99f1-0c196ed0d541",
            "a6bc787f-932e-4731-90d2-626df233c752",
            "d4219be0-7fa0-4d3d-bec5-7feaf0a08ac5"
          ],
          "created_by": "bb760e2d-d679-4b64-b2a9-03005b21870a",
          "created_time": 1550447700000,
          "format": {
            "page_full_width": true,
            "page_small_text": true
          },
          "id": "14ad6c73-b15c-4c75-8f07-1c859944f790",
          "last_edited_by": "bb760e2d-d679-4b64-b2a9-03005b21870a",
          "last_edited_time": 1550448060000,
          "parent_id": "f90b0a6b-6483-43e2-8dc5-ed6e8f5c0780",
          "parent_table": "block",
          "permissions": [
            {
              "role": "editor",
              "type": "user_permission",
              "user_id": "bb760e2d-d679-4b64-b2a9-03005b21870a"
            }
          ],
          "properties": {
            "title": [
              [
                "Theme Style Attribute"
              ]
            ]
          },
          "type": "page",
          "version": 43
        }
      },
      "328efc95-92a3-48d2-a3e4-f1081e97c6cc": {
        "role": "comment_only",
        "value": {
          "alive": true,
          "created_by": "bb760e2d-d679-4b64-b2a9-03005b21870a",
          "created_time": 1550447709965,
          "id": "328efc95-92a3-48d2-a3e4-f1081e97c6cc",
          "ignore_block_count": true,
          "last_edited_by": "bb760e2d-d679-4b64-b2a9-03005b21870a",
          "last_edited_time": 1550447709965,
          "parent_id": "b8c67c89-29cf-4b98-bd67-2e4dc5f745e9",
          "parent_table": "block",
          "properties": {
            "title": [
              [
                "The Status Bar (top of the screen) can be made transparent, by applying this attribute to the style:"
              ]
            ]
          },
          "type": "text",
          "version": 1
        }
      },
      "41e51e80-fcb5-44e1-a29b-f696ef8f8bfa": {
        "role": "comment_only",
        "value": {
          "alive": true,
          "created_by": "bb760e2d-d679-4b64-b2a9-03005b21870a",
          "created_time": 1550447709964,
          "id": "41e51e80-fcb5-44e1-a29b-f696ef8f8bfa",
          "ignore_block_count": true,
          "last_edited_by": "bb760e2d-d679-4b64-b2a9-03005b21870a",
          "last_edited_time": 1550447709964,
          "parent_id": "b8c67c89-29cf-4b98-bd67-2e4dc5f745e9",
          "parent_table": "block",
          "properties": {
            "language": [
              [
                "Plain Text"
              ]
            ],
            "title": [
              [
                "\u003cstyle name=\"AppTheme\" parent=\"Theme.AppCompat\"\u003e\n    \u003citem name=\"android:windowTranslucentNavigation\"\u003etrue\u003c/item\u003e\n\u003c/style\u003e"
              ]
            ]
          },
          "type": "code",
          "version": 1
        }
      },
      "7434255a-bc09-4fc6-b646-31ec8dc05e63": {
        "role": "comment_only",
        "value": {
          "alive": true,
          "created_by": "bb760e2d-d679-4b64-b2a9-03005b21870a",
          "created_time": 1550447709961,
          "id": "7434255a-bc09-4fc6-b646-31ec8dc05e63",
          "ignore_block_count": true,
          "last_edited_by": "bb760e2d-d679-4b64-b2a9-03005b21870a",
          "last_edited_time": 1550447709961,
          "parent_id": "b8c67c89-29cf-4b98-bd67-2e4dc5f745e9",
          "parent_table": "block",
          "properties": {
            "title": [
              [
                "The navigation bar (at the bottom of the screen) can be transparent. Here is the way to achieve it."
              ]
            ]
          },
          "type": "text",
          "version": 1
        }
      },
      "b8c67c89-29cf-4b98-bd67-2e4dc5f745e9": {
        "role": "comment_only",
        "value": {
          "alive": true,
          "content": [
            "7434255a-bc09-4fc6-b646-31ec8dc05e63",
            "41e51e80-fcb5-44e1-a29b-f696ef8f8bfa",
            "328efc95-92a3-48d2-a3e4-f1081e97c6cc",
            "df9bb084-85ec-42f3-ba31-9e2566d64d9b"
          ],
          "created_by": "bb760e2d-d679-4b64-b2a9-03005b21870a",
          "created_by_id": "bb760e2d-d679-4b64-b2a9-03005b21870a",
          "created_by_table": "notion_user",
          "created_time": 1550447709965,
          "format": {
            "page_full_width": true,
            "page_small_text": true
          },
          "id": "b8c67c89-29cf-4b98-bd67-2e4dc5f745e9",
          "ignore_block_count": true,
          "last_edited_by": "bb760e2d-d679-4b64-b2a9-03005b21870a",
          "last_edited_by_id": "bb760e2d-d679-4b64-b2a9-03005b21870a",
          "last_edited_by_table": "notion_user",
          "last_edited_time": 1550447709965,
          "parent_id": "14ad6c73-b15c-4c75-8f07-1c859944f790",
          "parent_table": "block",
          "properties": {
            "title": [
              [
                "Translucent Navigation and Status Bars API 19"
              ]
            ]
          },
          "type": "page",
          "version": 7
        }
      },
      "df9bb084-85ec-42f3-ba31-9e2566d64d9b": {
        "role": "comment_only",
        "value": {
          "alive": true,
          "created_by": "bb760e2d-d679-4b64-b2a9-03005b21870a",
          "created_time": 1550447709965,
          "id": "df9bb084-85ec-42f3-ba31-9e2566d64d9b",
          "ignore_block_count": true,
          "last_edited_by": "bb760e2d-d679-4b64-b2a9-03005b21870a",
          "last_edited_time": 1550447709965,
          "parent_id": "b8c67c89-29cf-4b98-bd67-2e4dc5f745e9",
          "parent_table": "block",
          "properties": {
            "language": [
              [
                "Plain Text"
              ]
            ],
            "title": [
              [
                "\u003cstyle name=\"AppTheme\" parent=\"Theme.AppCompat\"\u003e\n    \u003citem name=\"android:windowTranslucentStatus\"\u003etrue\u003c/item\u003e\n\u003c/style\u003e"
              ]
            ]
          },
          "type": "code",
          "version": 1
        }
      },
      "f90b0a6b-6483-43e2-8dc5-ed6e8f5c0780": {
        "role": "comment_only",
        "value": {
          "alive": true,
          "content": [
            "27fdf592-c1e2-48bf-ad9e-f2f466767a20",
            "354073c9-7040-4528-8c35-dbbbf7992ed5",
            "40c765e7-6562-4ee9-8ed0-8024e3def515",
            "b9098913-7e61-4386-8d02-ca92ab88b324",
            "f23a5cf1-4ba4-434a-b57a-4f6b72fa1dfd",
            "4b7449f0-077a-4e41-841b-d5c551629808",
            "f7aa3cbf-18e0-4aee-8ec1-725bd9ccb0bc",
            "b12b5220-f26c-4aeb-8130-af5506f0f546",
            "ffa90cd3-3eea-424c-8f80-34de4ba10bac",
            "3cf74dd2-01e2-497e-a2e0-ef450e2751fd",
            "60c44f62-2826-4f4e-b62c-62999d7b5b08",
            "b504a8f4-8c84-4c2e-8acd-bca678ce8ae8",
            "58b149d4-6a66-400d-bae4-6d84bc9e8211",
            "b81f95e2-9af4-43b2-ae8a-eacf3d61b9e0",
            "dad79538-df78-4fb3-ab61-93449f54b92e",
            "e5da3f10-048a-4ac6-8dfe-d0f8b834b9b8",
            "09fb42bc-c08a-479e-85ec-dcd14413d8e1",
            "9cd3cdb2-fb8b-4bc2-916b-a38f0022b43b",
            "a2530ba9-8b01-4c7b-ad00-037bf9f232a2",
            "20f73399-dea2-4d47-bee6-68060ec883f9",
            "3061cbb2-214c-4375-b975-440c3b41e566",
            "577ee794-a9c3-4ded-8824-6307ea4044f3",
            "e851dd0d-078a-4cf4-b0e2-4fb9a34577ba",
            "daef7c65-a1e3-4cb4-a562-7e81aabc337c",
            "edbd8f8d-6b57-43d2-9269-0b0cf3e6165c",
            "ae4c3948-e722-49ba-a5df-65778b9c1e91",
            "b698fa46-dece-4676-a681-eecc1a3388d2",
            "7519d0d9-ef43-40c7-bea1-eb520af1f62f",
            "f2b20dc9-ee75-45ae-b0ee-88e0ced263c9",
            "2d6f6857-e53d-4b60-b433-e156d81c55e5",
            "1096b9a5-3f3a-425e-ac66-0adc4166be45",
            "6190cb6e-dc43-458e-9fc6-34c0e0c69fa6",
            "b33bd62e-4631-43c5-a9ae-ac47eadfb3e0",
            "e5dfd590-a7f4-4ea2-b744-e87d7d45fabf",
            "e5dbc80b-9ce3-4932-9808-0a7fbefb59b3",
            "2bfda67f-291e-4f52-a037-53bdbbc944bc",
            "7145866f-7d62-48b0-a57b-66c494eb5a9f",
            "3ffccc71-cbb9-4ebc-8ff8-78efb3575845",
            "3fe483f2-e060-41f7-9bc7-8fa4711fa6bb",
            "826a2947-547d-46b5-8714-0282f94a1967",
            "45ae2e3d-3201-45c2-9924-4c3dd873a5c3",
            "1ef1aff9-7d3c-456d-abfd-937eb8756547",
            "6a6fe5f1-6362-47c6-bac7-61c76a0a464d",
            "fad6acf8-b0d5-4770-85ab-bd87a2e5410d",
            "f505a59f-f887-4749-88d5-2d8b5be7947f",
            "621f346c-f9c6-4d5c-8e6e-6106d643fcce",
            "6a7c57a2-8f24-43b5-974d-d38ab99fdee8",
            "80a93a9d-a581-423a-8907-8a480a93f52d",
            "6ffff372-f722-4664-9978-ad7101e6d3c6",
            "cf2c473f-5e00-4648-971f-43398123cc33",
            "1930100d-c8dd-4c8d-ab3f-7ad60a4616a4",
            "6349c926-1894-426b-9bd7-9ce6b6ce8b2f",
            "f5d212d3-d5ba-4aa5-b670-a737a4d6a212",
            "19ac457b-73f1-4fa2-960e-88f42ddbee76",
            "42ecfc4e-4f11-4487-8d7a-15abe78a4672",
            "3d7c457d-2120-4fab-9620-ddd6e746e8ef",
            "c170b80b-c39f-46ce-b311-2debae2f2082",
            "14ad6c73-b15c-4c75-8f07-1c859944f790",
            "16002345-cebc-40e9-8de5-7cc0659be0f3",
            "331f90f3-9311-486a-8bcd-c5e4e171ee84",
            "2e2716b4-5b9a-4670-8a00-377992b3a547",
            "9cbb47b7-a65c-4cc4-865d-1a66536aefa1",
            "7bedcd95-c04f-4865-a298-247d34206277",
            "8abb0bb2-e8f7-4eec-bab7-3a47c7c1bffd",
            "5186a864-9440-434b-b19a-c32d326a3fef",
            "e8b25d81-c867-4e20-8829-1264867cb1b8",
            "e3584a94-a9f0-4362-8875-ecc7887d08a7",
            "47b7faa3-6e5d-420d-8798-507e43f9639f",
            "9c91430d-940a-46b8-894c-258836f7d0f4",
            "f16ce3be-cc8a-428d-aa92-06106c08bb78",
            "322f7adc-aa8e-4dd0-90bc-e3822856448b",
            "6f9a7fa3-564a-46a2-a9f0-375a21c8e251",
            "c5099681-f7f6-42fc-90d3-a6a0ee90f908",
            "92a41c6c-4c93-4fb6-a347-2f5cf0a7d2db",
            "199c82a7-fe1c-4163-8405-c17464a5f76c",
            "9491365b-e249-4a75-ac25-cc1cc02f408f",
            "22af4132-01f0-4467-9bea-e645f470fd96",
            "ca11d4e6-9cd7-4136-9232-859b2e1467de",
            "c78edde1-b73e-43d7-ab97-ddf82241f21f",
            "a50a635e-1226-4210-baec-32b24d8676e4",
            "7822bd2e-1f30-4ca7-9aec-dc44e8b70697",
            "91c05e15-76e6-4d60-ba05-c776f6f8fda9",
            "b608fb79-1b53-486d-8fde-90d4b61fc2f1",
            "862b5ddf-f996-490c-9d71-0fcfa7309bad",
            "095bece4-4a5b-4544-a96a-9b32ab97785f",
            "4ed76ccc-0516-40c8-97cc-501741884fac",
            "09da8235-6e71-43ae-825b-1e3ee72d1ad9",
            "6068a6db-1477-454d-9131-f7d2eef506e8",
            "32904bc0-ceb7-4a01-b5ef-8a0bf7941852",
            "6838a528-7474-4647-bef7-4cf6c1e816b5",
            "3be0ee0d-3f99-4321-870f-1c84f52188a9",
            "761f15e8-3ef3-4bb0-bef6-598eb45647a6",
            "d1699fdd-2bda-4161-96bb-2b2502fb6e0a",
            "db56e9e4-397a-4b38-a33f-a2324e683304",
            "d75c0cae-6a9d-433a-91d1-96901cb34d26",
            "95044da4-c747-4fa5-b31f-4fb3ed5adb6c",
            "4521a76c-21a4-4542-8b83-322d8ffd692c",
            "5472d135-1ceb-48a7-856f-747de64f3e6b",
            "c1066830-e268-4ff2-9f0f-37841d485046",
            "963e797e-dea4-4392-8454-e58d4d898886",
            "016f7476-6abd-4773-ada7-0c01bafd51ea",
            "44d0c151-0367-453d-9879-ef7e4d456c6c",
            "7a899cd4-cc0a-4ef1-b758-42cf9f5b48b9",
            "8011ec06-ee27-49a4-bcbc-493592df26b0",
            "574bb08c-f784-4dcb-b2e1-98fb6ef32949",
            "e1987a71-9e13-4ebe-855e-e347fd6cc937",
            "9b6546ec-87e7-4f0d-97af-9dd8a76e52a2",
            "669038f0-8cb0-496b-9673-04b1042e0e5c",
            "8dc4486d-cab9-46ba-a583-6946731415e6",
            "03c9507a-d4bc-4e38-a41b-437f05849261",
            "1e659fc3-474d-4557-a94d-835ee0c85264",
            "d6acfbca-5bf9-4a01-93a6-9c974a46400e",
            "2ea54c48-49ac-4fde-be2b-e43bbc4bbf66",
            "830c8731-8c33-4c19-ae58-4b8ff19d4cc7",
            "2d77e910-ecf3-4151-95e5-d2476592ed5f",
            "b4ea2393-6248-4273-be5c-b3ff2586a146",
            "41515ac4-ab76-4fea-b463-e1a26b6f69bb",
            "e8c3ea27-aa2b-44ad-a95b-4ea00469fc83",
            "f752bf5b-91bd-44d1-8388-898770ff7adb",
            "4d9ab42a-8f21-4c13-9db4-9eecf9315a5d",
            "0cd1dd2f-b110-4916-a707-6a988d46c973",
            "a52e40c1-3556-4e99-a114-0488389ebe90",
            "d5074d5e-8d31-43ae-8069-c4edd1cc1ddb",
            "c88c7b1a-46a1-4423-b1b9-859c4b025b3d",
            "4748d604-7768-48d9-86be-1ce724d425ce",
            "ded10fc3-bae1-4c26-8166-2d92cbfe0f49",
            "68e828c6-f314-441c-b64a-ba28f0d1cc35",
            "f337f4f5-1ff3-4215-a0a8-1980b7c8d662",
            "a4053bc6-4f68-4f49-baf6-41ba500ed7c7",
            "94542bbc-752e-48c7-ac75-9b3e818d84eb",
            "3ce1e736-2768-4f19-9c41-5c91c15b7dfb",
            "51bc39d7-7e67-4f75-bc6d-697297d52287",
            "f8d5ea25-5e82-4f79-924b-0049690bfc32",
            "77f833e9-2996-4ded-b5af-7e17de12e8bf",
            "038616cc-b67b-4c1f-a9ad-af80ec2fb110",
            "97ef53c0-5293-453a-aff1-0439da147a44",
            "c5f8b539-4640-4ad9-85bc-1c855ef9dfde",
            "839cd454-9096-4e4d-9665-a3fb54dd4705",
            "c47838e4-3cab-4329-a3c4-d1afd70fdcb9",
            "56e44bd4-0e66-480f-b26a-730a862f5652",
            "24941973-4747-4d43-8317-8aad489543af",
            "d61fb0ab-dd90-4099-b2ec-024f6a2c279f",
            "3d365296-5561-464b-9301-04d4f320fea9",
            "7948e7ab-b399-4557-8504-4f81f50dc8ec",
            "8f925deb-b6fa-4c08-9646-5c7646eb4b89",
            "65a401f2-544a-4a8a-ab65-a3071f51031e",
            "dc81327b-cb66-4261-865d-bb7d14306f11",
            "e624cc34-7c87-4335-9bb5-d350a02910f5",
            "f6365667-18d0-4273-9222-c5586157da7d",
            "905db9f7-4839-45af-b211-113a4a6999aa",
            "96cf5a86-7732-431c-be7c-7c753d92a46a",
            "0af82c96-4dd6-4720-a409-bf67041be6e0",
            "710dbb9e-bd86-4ba2-a18a-5401a3046ece",
            "677b8f26-3ed2-4974-8569-2df0f1293a73",
            "3c934d65-d622-4b05-a0d0-bb5e84d75218",
            "8dcd9530-0e0f-4f14-b111-afc50cc08324",
            "2d086d76-fb34-4b13-bbc7-3d5dc05ef97d",
            "a23d145a-771f-4f05-b84c-07d16a56a6aa",
            "b240a8de-0f36-4239-9c95-bc79a5dddd40",
            "8e556e15-f5fd-43fa-bf95-98cee5a7bc8f",
            "82f1624b-f3af-4c45-a893-f8bca5957cf0",
            "deb49da5-8f12-4105-b9da-710ff265582f",
            "524569ba-6a1f-44a4-8a5d-5439de5b2a40",
            "ac526877-fd57-46f4-b83b-972b1c58fad6",
            "47e0b249-e53b-4f62-a257-6d0813594d72",
            "acd0006b-0353-4ba6-8a0b-87336f61c97d",
            "9d26f612-3468-4d2c-a80b-ad718b6e877e",
            "4cad6e5b-3f30-4564-8735-751ca7db042c",
            "b4034989-a291-40b9-9713-ee02a8ac0da2",
            "3360b9ba-8b02-41c9-bd93-6f6a02109330",
            "f15f4120-70ca-4a10-be77-f9d582fb8790",
            "f1c95c46-1481-4241-a8ee-571b2f83a310",
            "8090fbc5-84d0-4f94-b1f9-ed8020f780d3",
            "c6e1394e-9cad-4673-bd57-f2405d39c2cf",
            "27c2cc4b-0924-448f-ab99-7a67b399c2ab",
            "cf75254e-e8e2-41e2-81e9-77d30e203cb5",
            "db5df703-aa7a-4910-b457-cd3a922a981e",
            "c8ac0909-a19f-471e-a271-487222887abd",
            "fe8b6a8a-2e2d-43a0-a149-73689c84f390",
            "10d74f61-cdd5-494d-8c51-8312b3ba8de8",
            "fdb69422-5411-4296-b9d8-962b4d7831c2",
            "110fdb13-f9c4-46fc-9fa4-10ffd91c395f",
            "7fd7fa0a-adbb-469e-be55-da9a0c015ed8",
            "705eba44-ab0e-462d-9b8d-1773c364e997",
            "8678671e-3d0f-4498-ba9e-00f1a91c2dec",
            "d0f4d361-3ebe-433f-8d61-aa782fae1629",
            "509e8fc8-6805-42af-92e1-71d6eabd0266",
            "da4ebfb0-d0f7-4d87-b12a-91812d2c6a04",
            "9a1c0f18-5ce2-448f-a802-d53af20a31c1",
            "d392164c-cafa-46be-8893-b28c2272b578",
            "56de8949-916b-48d9-b3ed-5e5600fc9ca2",
            "8fb3ee5c-576a-4bf5-ba7e-b2edb63764dc",
            "cf617cc7-abc9-4c02-b109-8817de9e1fe8",
            "32623ca4-06d3-4b9b-9941-e741eb577347",
            "f44828a7-258c-4f49-a93d-61c1a597943f",
            "cc215dc0-9705-46ac-9ab1-1396de51bf7c",
            "71e5a001-12f9-41d1-aa62-8c79dd517256",
            "0240c422-4914-40ff-84e3-4f91c035951c",
            "1ed90bad-9ded-4cad-879b-073029c2669a",
            "82649e41-2072-452a-afc0-98a8e55e8d07",
            "b08308eb-a210-4991-8937-c9bbd18c4d9c",
            "7747dd70-20a4-4759-b346-990b9ab27c0c",
            "64e3b499-cbcc-4659-bb34-dbd1bb2f2e94",
            "4f2bdf6e-5f2e-4181-9559-dd8fc0fd7782",
            "124ec7ef-0d81-4d96-af62-32ba7e181dc2",
            "5ae01620-6217-429c-a6ee-f3c90a1813fe",
            "cea43ac2-635b-47f0-8e22-31dd43944c2b",
            "80ed906b-d3d8-4eff-a382-f3ccfe770fbd",
            "a6284cb9-0ec4-4644-ac38-9df2c430d565",
            "0e61b3b3-d822-42b9-b2db-e1147a055864",
            "e10e6b37-8c81-449f-8b06-953d9e7232e3",
            "742574bd-3734-45df-81cb-664bc6fc3d9b",
            "f3a57f3d-21ee-498d-99ee-965ce6b883a4",
            "73695f31-fd69-4514-b8d6-d72c6cdbb87c",
            "ad0c3fdb-eee5-4ba0-bc81-169b78ed8365",
            "fd7264ef-c538-432f-848b-1d838ced284a",
            "ba1fc3a4-bf86-41a3-98d4-3ca0974b9be8",
            "9fe092dc-5c09-4876-b941-b37ae675d813",
            "b0ec8c0c-dd90-4b58-b356-37134394c78d",
            "015b7891-f102-4c8f-b06d-9269dd58b44d",
            "3bbdbd66-d299-4cba-8c12-51c8786d3091",
            "2baf451b-0056-4891-8d40-684b89573e1b",
            "73f8cadc-ec5d-4f49-a839-67d47b03c77f",
            "f0b1f166-bf21-4323-a98c-97cb5ce7179b",
            "5430b2ef-658c-4221-aa29-4325b466d13f",
            "c80231fa-3653-43c4-83ec-af2060de32e6",
            "30d7bc46-2e9e-48f7-935c-807f4d3a3874",
            "187a4b2d-7c67-4c5a-b15d-04a9f83933c2",
            "021946e3-c36d-4a13-b45d-198da0ecadfc",
            "b3067692-7417-4b7d-8599-72f2c733f340",
            "58505de6-57ea-4156-83ec-21d3e032fcee",
            "90bf0114-63fa-4f8f-beac-8c8844a22459",
            "5f4ad035-8ade-4422-a698-42777d881b04",
            "1214e547-4439-466c-b7cf-0dfce91ca8a9",
            "6f41ff49-d3e3-4067-8644-4ed8b7416461",
            "114e231f-0e4f-4f0c-b594-af8e235bb7ba",
            "85d3184b-facb-42d7-9fa2-68a756ba59ff",
            "242333a5-01c6-4a03-a125-aa9fe7a1566c",
            "21c58509-8ad4-4956-93ec-9e01f51f7731",
            "a57c3cbd-cbcb-4b79-bbd2-bc492cc4c6de",
            "e74c5ca7-a98f-4cee-8a20-402df5f04c12",
            "20896cc4-7e6c-4191-90ca-0fcbaf782a1a",
            "ac2e3135-2507-45a0-9eb5-eb87267b5aa3",
            "f8a97bdd-4988-408e-b26b-09909b8984f4",
            "ca128910-13b5-4ca4-bb5d-59b2a0923021",
            "608881e1-3112-44fb-8163-a0e1375bdab0",
            "011dfad9-c5b2-433c-8550-1f442912c6b3",
            "e64074c1-1af7-4c9b-b712-3fc5e62da994",
            "5bc3338f-922a-47ff-aae1-08fb7b8dde43",
            "19cb62d2-9b26-4a60-aab3-cc40a4aef43a",
            "9d27e5e1-c938-4f26-a90d-25a7b894cc4a",
            "c4ce4396-9c90-4cec-9485-46cea79f4295",
            "af0972ed-d3b8-4ac2-90ab-75ce1bb915d6",
            "71277395-eef6-428b-9609-e3637eda9594",
            "e659044e-5803-4435-846f-2c49eb9f27ef",
            "1132475f-3f52-4abc-8b7e-1d1ad503adaa",
            "cbfdead0-07e3-4ff0-960c-65310ce08197",
            "c2583e33-3aa5-444b-9369-d1257f91d902",
            "b3f557a3-b586-4969-9586-4e7548d1c510",
            "174f69df-274c-48fb-87c1-579d48cbd326",
            "786f5a33-fe08-45e1-b4a3-d87fee25c003",
            "25357792-eaea-49a7-a61f-3c39c0385ebe",
            "03d85aeb-9a2e-46de-8eee-c72d3db4f4ec",
            "eaf84068-3115-4f77-a190-8dda88806b57",
            "2bfa597a-3cc4-4bc0-88a4-357178faaf9e",
            "45431a02-f4a1-43f5-b9cb-bde2609e996c",
            "9dcef566-3377-416f-9a07-00a81f06c66d",
            "0a7e7d49-fbc6-48a3-b125-26138aebe090",
            "358395f1-b91c-4d7b-8673-1b3e1c3879f5",
            "aa8e64b4-0552-4771-b979-5178b6269656"
          ],
          "created_by": "bb760e2d-d679-4b64-b2a9-03005b21870a",
          "created_time": 1550443475316,
          "format": {
            "page_full_width": true,
            "page_small_text": true
          },
          "id": "f90b0a6b-6483-43e2-8dc5-ed6e8f5c0780",
          "last_edited_by": "bb760e2d-d679-4b64-b2a9-03005b21870a",
          "last_edited_time": 1571298720000,
          "parent_id": "c74c72f4-6ba6-4002-83c5-0fe2e400a3bc",
          "parent_table": "block",
          "permissions": [
            {
              "allow_search_engine_indexing": false,
              "role": "comment_only",
              "type": "public_permission"
            }
          ],
          "properties": {
            "title": [
              [
                "Essential Android"
              ]
            ]
          },
          "type": "page",
          "version": 363
        }
      }
    },
    "notion_user": {
      "bb760e2d-d679-4b64-b2a9-03005b21870a": {
        "role": "reader",
        "value": {
          "clipper_onboarding_completed": true,
          "email": "kkowalczyk@gmail.com",
          "family_name": "Kowalczyk",
          "given_name": "Krzysztof",
          "id": "bb760e2d-d679-4b64-b2a9-03005b21870a",
          "mobile_onboarding_completed": true,
          "onboarding_completed": true,
          "profile_photo": "https://s3-us-west-2.amazonaws.com/public.notion-static.com/2dcaa66c-7674-4ff6-9924-601785b63561/head-bw-640x960.png",
          "version": 230
        }
      }
    },
    "space": {}
  }
}

{'repo_name': 'essentialbooks/books', 'stars': '405', 'repo_language': 'Go', 'file_name': 'cd15d428bae84880a76e1f4a06c84838.txt', 'mime_type': 'text/plain', 'hash': 1328328253693955412, 'source_dataset': 'data'}


/*
 *
 * Copyright (c) 2013 - 2020 Lijun Liao
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.xipki.datasource;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

import org.xipki.util.Args;

/**
 * JDBC state codes for a particular database. It is the first two digits (the SQL state "class").
 *
 * @author Lijun Liao
 * @since 2.0.0
 */
public class SqlStateCodes {

  private static class DB2 extends SqlStateCodes {

    DB2() {
      super();
      // 57: out-of-memory exception / database not started
      // 58: unexpected system error
      dataAccessResourceFailureCodes = addToSet(dataAccessResourceFailureCodes, "57", "58");

      // 51: communication failure
      transientDataAccessResourceCodes = addToSet(transientDataAccessResourceCodes, "51");
    }

  } // class DB2

  private static class H2 extends SqlStateCodes {

    H2() {
    }

  } // class H2

  // CHECKSTYLE:SKIP
  private static class HSQL extends SqlStateCodes {

    HSQL() {
    }

  } // class HSQL

  // CHECKSTYLE:SKIP
  private static class MySQL extends SqlStateCodes {
    MySQL() {
    }
  }

  // CHECKSTYLE:SKIP
  private static class MariaDB extends MySQL {
    MariaDB() {
    }
  }

  private static class Oracle extends SqlStateCodes {

    Oracle() {
      // 65: unknown identifier
      badSqlGrammarCodes = addToSet(badSqlGrammarCodes, "65");
      // 61: deadlock
      concurrencyFailureCodes = addToSet(concurrencyFailureCodes, "61");
    }

  } // class Oracle

  // CHECKSTYLE:SKIP
  private static class PostgreSQL extends SqlStateCodes {

    PostgreSQL() {
      // 53: insufficient resources (e.g. disk full)
      // 54: program limit exceeded (e.g. statement too complex)
      dataAccessResourceFailureCodes = addToSet(dataAccessResourceFailureCodes, "53", "54");
    }

  } // class PostgreSQL

  // bad grammar error
  private static final String BGE_DYNAMIC_SQL_ERROR = "07";

  private static final String BGE_CARDINALITY_VIOLATION = "21";

  private static final String BGE_SYNTAX_ERROR_DIRECT_SQL = "2A";

  private static final String BGE_SYNTAX_ERROR_DYNAMIC_SQL = "37";

  private static final String BGE_GENERAL_SQL_SYNTAX_ERROR = "42";

  // data integrity violation
  private static final String DIV_DATA_TRUNCATION = "01";

  private static final String DIV_NO_DATA_FOUND = "02";

  private static final String DIV_VALUE_OUTOF_RANGE = "22";

  private static final String DIV_INTEGRITY_CONSTRAINT_VIOLATION = "23";

  private static final String DIV_TRIGGERED_DATA_CHANGE_VIOLATION = "27";

  private static final String DIV_WITH_CHECK_VIOLATION = "44";

  // data access resource failure
  private static final String DRF_CONNECTION_EXCEPTION = "08";

  // transient data access resource
  private static final String TDR_COMMUNICATION_FAILURE = "S1";

  // concurrency failure
  private static final String CF_TRANSACTION_ROLLBACK = "40";

  Set<String> badSqlGrammarCodes;

  Set<String> dataIntegrityViolationCodes;

  Set<String> dataAccessResourceFailureCodes;

  Set<String> transientDataAccessResourceCodes;

  Set<String> concurrencyFailureCodes;

  private SqlStateCodes() {
    badSqlGrammarCodes = toSet(BGE_DYNAMIC_SQL_ERROR, BGE_CARDINALITY_VIOLATION,
        BGE_SYNTAX_ERROR_DIRECT_SQL, BGE_SYNTAX_ERROR_DYNAMIC_SQL, BGE_GENERAL_SQL_SYNTAX_ERROR);
    dataIntegrityViolationCodes = toSet(DIV_DATA_TRUNCATION, DIV_INTEGRITY_CONSTRAINT_VIOLATION,
        DIV_NO_DATA_FOUND, DIV_TRIGGERED_DATA_CHANGE_VIOLATION,
        DIV_VALUE_OUTOF_RANGE, DIV_WITH_CHECK_VIOLATION);
    dataAccessResourceFailureCodes = toSet(DRF_CONNECTION_EXCEPTION);
    transientDataAccessResourceCodes = toSet(TDR_COMMUNICATION_FAILURE);
    concurrencyFailureCodes = toSet(CF_TRANSACTION_ROLLBACK);
  }

  public static SqlStateCodes newInstance(DatabaseType dbType) {
    Args.notNull(dbType, "dbType");
    switch (dbType) {
      case DB2:
        return new DB2();
      case H2:
        return new H2();
      case HSQL:
        return new HSQL();
      case MYSQL:
        return new MySQL();
      case MARIADB:
        return new MariaDB();
      case ORACLE:
        return new Oracle();
      case POSTGRES:
        return new PostgreSQL();
      case UNKNOWN:
        return new SqlStateCodes();
      default:
        throw new IllegalStateException("should not reach here, unknown database type " + dbType);
    }
  } // method newInstance

  private static Set<String> toSet(String... strs) {
    if (strs == null || strs.length == 0) {
      return Collections.emptySet();
    }

    Set<String> set = new HashSet<String>();
    for (String str : strs) {
      set.add(str);
    }
    return Collections.unmodifiableSet(set);
  } // method toSet

  private static Set<String> addToSet(Set<String> baseSet, String... strs) {
    if (strs == null || strs.length == 0) {
      return baseSet;
    }
    Set<String> newSet = new HashSet<String>(baseSet.size() + strs.length);
    newSet.addAll(baseSet);
    for (String str : strs) {
      newSet.add(str);
    }
    return Collections.unmodifiableSet(newSet);
  } // method addToSet

}

{'repo_name': 'xipki/xipki', 'stars': '275', 'repo_language': 'Java', 'file_name': 'OcspQa.java', 'mime_type': 'text/x-java', 'hash': -1413123803009519643, 'source_dataset': 'data'}


/*!
 * Angular Material Design
 * https://github.com/angular/material
 * @license MIT
 * v1.0.6
 */
(function( window, angular, undefined ){
"use strict";

/**
 * @ngdoc module
 * @name material.components.radioButton
 * @description radioButton module!
 */
angular.module('material.components.radioButton', [
  'material.core'
])
  .directive('mdRadioGroup', mdRadioGroupDirective)
  .directive('mdRadioButton', mdRadioButtonDirective);

/**
 * @ngdoc directive
 * @module material.components.radioButton
 * @name mdRadioGroup
 *
 * @restrict E
 *
 * @description
 * The `<md-radio-group>` directive identifies a grouping
 * container for the 1..n grouped radio buttons; specified using nested
 * `<md-radio-button>` tags.
 *
 * As per the [material design spec](http://www.google.com/design/spec/style/color.html#color-ui-color-application)
 * the radio button is in the accent color by default. The primary color palette may be used with
 * the `md-primary` class.
 *
 * Note: `<md-radio-group>` and `<md-radio-button>` handle tabindex differently
 * than the native `<input type='radio'>` controls. Whereas the native controls
 * force the user to tab through all the radio buttons, `<md-radio-group>`
 * is focusable, and by default the `<md-radio-button>`s are not.
 *
 * @param {string} ng-model Assignable angular expression to data-bind to.
 * @param {boolean=} md-no-ink Use of attribute indicates flag to disable ink ripple effects.
 *
 * @usage
 * <hljs lang="html">
 * <md-radio-group ng-model="selected">
 *
 *   <md-radio-button
 *        ng-repeat="d in colorOptions"
 *        ng-value="d.value" aria-label="{{ d.label }}">
 *
 *          {{ d.label }}
 *
 *   </md-radio-button>
 *
 * </md-radio-group>
 * </hljs>
 *
 */
function mdRadioGroupDirective($mdUtil, $mdConstant, $mdTheming, $timeout) {
  RadioGroupController.prototype = createRadioGroupControllerProto();

  return {
    restrict: 'E',
    controller: ['$element', RadioGroupController],
    require: ['mdRadioGroup', '?ngModel'],
    link: { pre: linkRadioGroup }
  };

  function linkRadioGroup(scope, element, attr, ctrls) {
    $mdTheming(element);
    var rgCtrl = ctrls[0];
    var ngModelCtrl = ctrls[1] || $mdUtil.fakeNgModel();

    rgCtrl.init(ngModelCtrl);

    scope.mouseActive = false;
    element.attr({
              'role': 'radiogroup',
              'tabIndex': element.attr('tabindex') || '0'
            })
            .on('keydown', keydownListener)
            .on('mousedown', function(event) {
              scope.mouseActive = true;
              $timeout(function() {
                scope.mouseActive = false;
              }, 100);
            })
            .on('focus', function() {
              if(scope.mouseActive === false) { rgCtrl.$element.addClass('md-focused'); }
            })
            .on('blur', function() { rgCtrl.$element.removeClass('md-focused'); });

    /**
     *
     */
    function setFocus() {
      if (!element.hasClass('md-focused')) { element.addClass('md-focused'); }
    }

    /**
     *
     */
    function keydownListener(ev) {
      var keyCode = ev.which || ev.keyCode;

      // Only listen to events that we originated ourselves
      // so that we don't trigger on things like arrow keys in
      // inputs.

      if (keyCode != $mdConstant.KEY_CODE.ENTER &&
          ev.currentTarget != ev.target) {
        return;
      }

      switch (keyCode) {
        case $mdConstant.KEY_CODE.LEFT_ARROW:
        case $mdConstant.KEY_CODE.UP_ARROW:
          ev.preventDefault();
          rgCtrl.selectPrevious();
          setFocus();
          break;

        case $mdConstant.KEY_CODE.RIGHT_ARROW:
        case $mdConstant.KEY_CODE.DOWN_ARROW:
          ev.preventDefault();
          rgCtrl.selectNext();
          setFocus();
          break;

        case $mdConstant.KEY_CODE.ENTER:
          var form = angular.element($mdUtil.getClosest(element[0], 'form'));
          if (form.length > 0) {
            form.triggerHandler('submit');
          }
          break;
      }

    }
  }

  function RadioGroupController($element) {
    this._radioButtonRenderFns = [];
    this.$element = $element;
  }

  function createRadioGroupControllerProto() {
    return {
      init: function(ngModelCtrl) {
        this._ngModelCtrl = ngModelCtrl;
        this._ngModelCtrl.$render = angular.bind(this, this.render);
      },
      add: function(rbRender) {
        this._radioButtonRenderFns.push(rbRender);
      },
      remove: function(rbRender) {
        var index = this._radioButtonRenderFns.indexOf(rbRender);
        if (index !== -1) {
          this._radioButtonRenderFns.splice(index, 1);
        }
      },
      render: function() {
        this._radioButtonRenderFns.forEach(function(rbRender) {
          rbRender();
        });
      },
      setViewValue: function(value, eventType) {
        this._ngModelCtrl.$setViewValue(value, eventType);
        // update the other radio buttons as well
        this.render();
      },
      getViewValue: function() {
        return this._ngModelCtrl.$viewValue;
      },
      selectNext: function() {
        return changeSelectedButton(this.$element, 1);
      },
      selectPrevious: function() {
        return changeSelectedButton(this.$element, -1);
      },
      setActiveDescendant: function (radioId) {
        this.$element.attr('aria-activedescendant', radioId);
      }
    };
  }
  /**
   * Change the radio group's selected button by a given increment.
   * If no button is selected, select the first button.
   */
  function changeSelectedButton(parent, increment) {
    // Coerce all child radio buttons into an array, then wrap then in an iterator
    var buttons = $mdUtil.iterator(parent[0].querySelectorAll('md-radio-button'), true);

    if (buttons.count()) {
      var validate = function (button) {
        // If disabled, then NOT valid
        return !angular.element(button).attr("disabled");
      };

      var selected = parent[0].querySelector('md-radio-button.md-checked');
      var target = buttons[increment < 0 ? 'previous' : 'next'](selected, validate) || buttons.first();

      // Activate radioButton's click listener (triggerHandler won't create a real click event)
      angular.element(target).triggerHandler('click');

    }
  }

}
mdRadioGroupDirective.$inject = ["$mdUtil", "$mdConstant", "$mdTheming", "$timeout"];

/**
 * @ngdoc directive
 * @module material.components.radioButton
 * @name mdRadioButton
 *
 * @restrict E
 *
 * @description
 * The `<md-radio-button>`directive is the child directive required to be used within `<md-radio-group>` elements.
 *
 * While similar to the `<input type="radio" ng-model="" value="">` directive,
 * the `<md-radio-button>` directive provides ink effects, ARIA support, and
 * supports use within named radio groups.
 *
 * @param {string} ngModel Assignable angular expression to data-bind to.
 * @param {string=} ngChange Angular expression to be executed when input changes due to user
 *    interaction with the input element.
 * @param {string} ngValue Angular expression which sets the value to which the expression should
 *    be set when selected.
 * @param {string} value The value to which the expression should be set when selected.
 * @param {string=} name Property name of the form under which the control is published.
 * @param {string=} aria-label Adds label to radio button for accessibility.
 * Defaults to radio button's text. If no text content is available, a warning will be logged.
 *
 * @usage
 * <hljs lang="html">
 *
 * <md-radio-button value="1" aria-label="Label 1">
 *   Label 1
 * </md-radio-button>
 *
 * <md-radio-button ng-model="color" ng-value="specialValue" aria-label="Green">
 *   Green
 * </md-radio-button>
 *
 * </hljs>
 *
 */
function mdRadioButtonDirective($mdAria, $mdUtil, $mdTheming) {

  var CHECKED_CSS = 'md-checked';

  return {
    restrict: 'E',
    require: '^mdRadioGroup',
    transclude: true,
    template: '
' +
                '

' +
                '

' +
              '
' +
              '

',
    link: link
  };

  function link(scope, element, attr, rgCtrl) {
    var lastChecked;

    $mdTheming(element);
    configureAria(element, scope);

    initialize();

    /**
     *
     */
    function initialize(controller) {
      if ( !rgCtrl ) {
        throw 'RadioGroupController not found.';
      }

      rgCtrl.add(render);
      attr.$observe('value', render);

      element
        .on('click', listener)
        .on('$destroy', function() {
          rgCtrl.remove(render);
        });
    }

    /**
     *
     */
    function listener(ev) {
      if (element[0].hasAttribute('disabled')) return;

      scope.$apply(function() {
        rgCtrl.setViewValue(attr.value, ev && ev.type);
      });
    }

    /**
     *  Add or remove the `.md-checked` class from the RadioButton (and conditionally its parent).
     *  Update the `aria-activedescendant` attribute.
     */
    function render() {
      var checked = (rgCtrl.getViewValue() == attr.value);
      if (checked === lastChecked) {
        return;
      }

      lastChecked = checked;
      element.attr('aria-checked', checked);

      if (checked) {
        markParentAsChecked(true);
        element.addClass(CHECKED_CSS);

        rgCtrl.setActiveDescendant(element.attr('id'));

      } else {
        markParentAsChecked(false);
        element.removeClass(CHECKED_CSS);
      }

      /**
       * If the radioButton is inside a div, then add class so highlighting will work...
       */
      function markParentAsChecked(addClass ) {
        if ( element.parent()[0].nodeName != "MD-RADIO-GROUP") {
          element.parent()[ !!addClass ? 'addClass' : 'removeClass'](CHECKED_CSS);
        }

      }
    }

    /**
     * Inject ARIA-specific attributes appropriate for each radio button
     */
    function configureAria( element, scope ){
      scope.ariaId = buildAriaID();

      element.attr({
        'id' :  scope.ariaId,
        'role' : 'radio',
        'aria-checked' : 'false'
      });

      $mdAria.expectWithText(element, 'aria-label');

      /**
       * Build a unique ID for each radio button that will be used with aria-activedescendant.
       * Preserve existing ID if already specified.
       * @returns {*|string}
       */
      function buildAriaID() {
        return attr.id || ( 'radio' + "_" + $mdUtil.nextUid() );
      }
    }
  }
}
mdRadioButtonDirective.$inject = ["$mdAria", "$mdUtil", "$mdTheming"];

})(window, window.angular);

{'repo_name': 'skepticfx/hookish', 'stars': '122', 'repo_language': 'JavaScript', 'file_name': 'FileSaver.js', 'mime_type': 'text/plain', 'hash': -6812527056518629140, 'source_dataset': 'data'}


{'repo_name': 'cloud-custodian/cloud-custodian', 'stars': '2986', 'repo_language': 'Python', 'file_name': 'settings.json.sample', 'mime_type': 'text/plain', 'hash': 7782077386622092338, 'source_dataset': 'data'}


/* Teensyduino Core Library
 * http://www.pjrc.com/teensy/
 * Copyright (c) 2013 PJRC.COM, LLC.
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * 1. The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * 2. If the Software is incorporated into a build system that allows
 * selection among a list of target devices, then similar target
 * devices manufactured by PJRC.COM must be included in the list of
 * target devices and selectable in the same manner.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

#include "kinetis.h"
#include "core_pins.h"
#include "HardwareSerial.h"

#ifdef HAS_KINETISK_UART5

////////////////////////////////////////////////////////////////
// Tunable parameters (relatively safe to edit these numbers)
////////////////////////////////////////////////////////////////

#ifndef SERIAL6_TX_BUFFER_SIZE
#define SERIAL6_TX_BUFFER_SIZE     40 // number of outgoing bytes to buffer
#endif
#ifndef SERIAL6_RX_BUFFER_SIZE
#define SERIAL6_RX_BUFFER_SIZE     64 // number of incoming bytes to buffer
#endif
#define RTS_HIGH_WATERMARK 40 // RTS requests sender to pause
#define RTS_LOW_WATERMARK  26 // RTS allows sender to resume
#define IRQ_PRIORITY  64  // 0 = highest priority, 255 = lowest

////////////////////////////////////////////////////////////////
// changes not recommended below this point....
////////////////////////////////////////////////////////////////

#ifdef SERIAL_9BIT_SUPPORT
static uint8_t use9Bits = 0;
#define BUFTYPE uint16_t
#else
#define BUFTYPE uint8_t
#define use9Bits 0
#endif

static volatile BUFTYPE tx_buffer[SERIAL6_TX_BUFFER_SIZE];
static volatile BUFTYPE rx_buffer[SERIAL6_RX_BUFFER_SIZE];
static volatile uint8_t transmitting = 0;
static volatile uint8_t *transmit_pin=NULL;
#define transmit_assert()   *transmit_pin = 1
#define transmit_deassert() *transmit_pin = 0
static volatile uint8_t *rts_pin=NULL;
#define rts_assert()        *rts_pin = 0
#define rts_deassert()      *rts_pin = 1
#if SERIAL6_TX_BUFFER_SIZE > 255
static volatile uint16_t tx_buffer_head = 0;
static volatile uint16_t tx_buffer_tail = 0;
#else
static volatile uint8_t tx_buffer_head = 0;
static volatile uint8_t tx_buffer_tail = 0;
#endif
#if SERIAL6_RX_BUFFER_SIZE > 255
static volatile uint16_t rx_buffer_head = 0;
static volatile uint16_t rx_buffer_tail = 0;
#else
static volatile uint8_t rx_buffer_head = 0;
static volatile uint8_t rx_buffer_tail = 0;
#endif

static uint8_t tx_pin_num = 34;

// UART0 and UART1 are clocked by F_CPU, UART2 is clocked by F_BUS
// UART0 has 8 byte fifo, UART1 and UART2 have 1 byte buffer

#define C2_ENABLE		UART_C2_TE | UART_C2_RE | UART_C2_RIE
#define C2_TX_ACTIVE		C2_ENABLE | UART_C2_TIE
#define C2_TX_COMPLETING	C2_ENABLE | UART_C2_TCIE
#define C2_TX_INACTIVE		C2_ENABLE

void serial6_begin(uint32_t divisor)
{
	SIM_SCGC1 |= SIM_SCGC1_UART5;	// turn on clock, TODO: use bitband
	rx_buffer_head = 0;
	rx_buffer_tail = 0;
	tx_buffer_head = 0;
	tx_buffer_tail = 0;
	transmitting = 0;
	CORE_PIN47_CONFIG = PORT_PCR_PE | PORT_PCR_PS | PORT_PCR_PFE | PORT_PCR_MUX(3);
	CORE_PIN48_CONFIG = PORT_PCR_DSE | PORT_PCR_SRE | PORT_PCR_MUX(3);
	UART5_BDH = (divisor >> 13) & 0x1F;
	UART5_BDL = (divisor >> 5) & 0xFF;
	UART5_C4 = divisor & 0x1F;
	UART5_C1 = 0;
	UART5_PFIFO = 0;
	UART5_C2 = C2_TX_INACTIVE;
	NVIC_SET_PRIORITY(IRQ_UART5_STATUS, IRQ_PRIORITY);
	NVIC_ENABLE_IRQ(IRQ_UART5_STATUS);
}

void serial6_format(uint32_t format)
{
	uint8_t c;

	c = UART5_C1;
	c = (c & ~0x13) | (format & 0x03);	// configure parity
	if (format & 0x04) c |= 0x10;		// 9 bits (might include parity)
	UART5_C1 = c;
	if ((format & 0x0F) == 0x04) UART5_C3 |= 0x40; // 8N2 is 9 bit with 9th bit always 1
	c = UART5_S2 & ~0x10;
	if (format & 0x10) c |= 0x10;		// rx invert
	UART5_S2 = c;
	c = UART5_C3 & ~0x10;
	if (format & 0x20) c |= 0x10;		// tx invert
	UART5_C3 = c;
#ifdef SERIAL_9BIT_SUPPORT
	c = UART5_C4 & 0x1F;
	if (format & 0x08) c |= 0x20;		// 9 bit mode with parity (requires 10 bits)
	UART5_C4 = c;
	use9Bits = format & 0x80;
#endif
	// For T3.5 See about turning on 2 stop bit mode
	if ( format & 0x100) {
		uint8_t bdl = UART5_BDL;
		UART5_BDH |= UART_BDH_SBNS;		// Turn on 2 stop bits - was turned off by set baud
		UART5_BDL = bdl;		// Says BDH not acted on until BDL is written
	}
}

void serial6_end(void)
{
	if (!(SIM_SCGC1 & SIM_SCGC1_UART5)) return;
	while (transmitting) yield();  // wait for buffered data to send
	NVIC_DISABLE_IRQ(IRQ_UART5_STATUS);
	UART5_C2 = 0;
	CORE_PIN47_CONFIG = PORT_PCR_PE | PORT_PCR_PS | PORT_PCR_MUX(1);
	CORE_PIN48_CONFIG = PORT_PCR_PE | PORT_PCR_PS | PORT_PCR_MUX(1);
	rx_buffer_head = 0;
	rx_buffer_tail = 0;
	if (rts_pin) rts_deassert();
}

void serial6_set_transmit_pin(uint8_t pin)
{
	while (transmitting) ;
	pinMode(pin, OUTPUT);
	digitalWrite(pin, LOW);
	transmit_pin = portOutputRegister(pin);
}

void serial6_set_tx(uint8_t pin, uint8_t opendrain)
{
	uint32_t cfg;

	if (opendrain) pin |= 128;
	if (pin == tx_pin_num) return;
	if ((SIM_SCGC4 & SIM_SCGC4_UART2)) {
		switch (tx_pin_num & 127) {
			case 48:  CORE_PIN48_CONFIG = 0; break; // PTE24
		}
		if (opendrain) {
			cfg = PORT_PCR_DSE | PORT_PCR_ODE;
		} else {
			cfg = PORT_PCR_DSE | PORT_PCR_SRE;
		}
		switch (pin & 127) {
			case 48:  CORE_PIN48_CONFIG = cfg | PORT_PCR_MUX(3); break;
		}
	}
	tx_pin_num = pin;
}

void serial6_set_rx(uint8_t pin)
{
}

int serial6_set_rts(uint8_t pin)
{
	if (!(SIM_SCGC1 & SIM_SCGC1_UART5)) return 0;
	if (pin < CORE_NUM_DIGITAL) {
		rts_pin = portOutputRegister(pin);
		pinMode(pin, OUTPUT);
		rts_assert();
	} else {
		rts_pin = NULL;
		return 0;
	}
	return 1;
}

int serial6_set_cts(uint8_t pin)
{
	if (!(SIM_SCGC1 & SIM_SCGC1_UART5)) return 0;
	if (pin == 56) {
		CORE_PIN56_CONFIG = PORT_PCR_MUX(3) | PORT_PCR_PE; // weak pulldown
	} else {
		UART5_MODEM &= ~UART_MODEM_TXCTSE;
		return 0;
	}
	UART5_MODEM |= UART_MODEM_TXCTSE;
	return 1;
}

void serial6_putchar(uint32_t c)
{
	uint32_t head, n;

	if (!(SIM_SCGC1 & SIM_SCGC1_UART5)) return;
	if (transmit_pin) transmit_assert();
	head = tx_buffer_head;
	if (++head >= SERIAL6_TX_BUFFER_SIZE) head = 0;
	while (tx_buffer_tail == head) {
		int priority = nvic_execution_priority();
		if (priority <= IRQ_PRIORITY) {
			if ((UART5_S1 & UART_S1_TDRE)) {
				uint32_t tail = tx_buffer_tail;
				if (++tail >= SERIAL6_TX_BUFFER_SIZE) tail = 0;
				n = tx_buffer[tail];
				if (use9Bits) UART5_C3 = (UART5_C3 & ~0x40) | ((n & 0x100) >> 2);
				UART5_D = n;
				tx_buffer_tail = tail;
			}
		} else if (priority >= 256) {
			yield(); // wait
		}
	}
	tx_buffer[head] = c;
	transmitting = 1;
	tx_buffer_head = head;
	UART5_C2 = C2_TX_ACTIVE;
}

void serial6_write(const void *buf, unsigned int count)
{
	const uint8_t *p = (const uint8_t *)buf;
	while (count-- > 0) serial6_putchar(*p++);
}

void serial6_flush(void)
{
	while (transmitting) yield(); // wait
}

int serial6_write_buffer_free(void)
{
	uint32_t head, tail;

	head = tx_buffer_head;
	tail = tx_buffer_tail;
	if (head >= tail) return SERIAL6_TX_BUFFER_SIZE - 1 - head + tail;
	return tail - head - 1;
}

int serial6_available(void)
{
	uint32_t head, tail;

	head = rx_buffer_head;
	tail = rx_buffer_tail;
	if (head >= tail) return head - tail;
	return SERIAL6_RX_BUFFER_SIZE + head - tail;
}

int serial6_getchar(void)
{
	uint32_t head, tail;
	int c;

	head = rx_buffer_head;
	tail = rx_buffer_tail;
	if (head == tail) return -1;
	if (++tail >= SERIAL6_RX_BUFFER_SIZE) tail = 0;
	c = rx_buffer[tail];
	rx_buffer_tail = tail;
	if (rts_pin) {
		int avail;
		if (head >= tail) avail = head - tail;
		else avail = SERIAL6_RX_BUFFER_SIZE + head - tail;
		if (avail <= RTS_LOW_WATERMARK) rts_assert();
	}
	return c;
}

int serial6_peek(void)
{
	uint32_t head, tail;

	head = rx_buffer_head;
	tail = rx_buffer_tail;
	if (head == tail) return -1;
	if (++tail >= SERIAL6_RX_BUFFER_SIZE) tail = 0;
	return rx_buffer[tail];
}

void serial6_clear(void)
{
	rx_buffer_head = rx_buffer_tail;
	if (rts_pin) rts_assert();
}

// status interrupt combines
//   Transmit data below watermark  UART_S1_TDRE
//   Transmit complete		    UART_S1_TC
//   Idle line			    UART_S1_IDLE
//   Receive data above watermark   UART_S1_RDRF
//   LIN break detect		    UART_S2_LBKDIF
//   RxD pin active edge	    UART_S2_RXEDGIF

void uart5_status_isr(void)
{
	uint32_t head, tail, n;
	uint8_t c;

	if (UART5_S1 & UART_S1_RDRF) {
		if (use9Bits && (UART5_C3 & 0x80)) {
			n = UART5_D | 0x100;
		} else {
			n = UART5_D;
		}
		head = rx_buffer_head + 1;
		if (head >= SERIAL6_RX_BUFFER_SIZE) head = 0;
		if (head != rx_buffer_tail) {
			rx_buffer[head] = n;
			rx_buffer_head = head;
		}
		if (rts_pin) {
			int avail;
			tail = tx_buffer_tail;
			if (head >= tail) avail = head - tail;
			else avail = SERIAL6_RX_BUFFER_SIZE + head - tail;
			if (avail >= RTS_HIGH_WATERMARK) rts_deassert();
		}
	}
	c = UART5_C2;
	if ((c & UART_C2_TIE) && (UART5_S1 & UART_S1_TDRE)) {
		head = tx_buffer_head;
		tail = tx_buffer_tail;
		if (head == tail) {
			UART5_C2 = C2_TX_COMPLETING;
		} else {
			if (++tail >= SERIAL6_TX_BUFFER_SIZE) tail = 0;
			n = tx_buffer[tail];
			if (use9Bits) UART5_C3 = (UART5_C3 & ~0x40) | ((n & 0x100) >> 2);
			UART5_D = n;
			tx_buffer_tail = tail;
		}
	}
	if ((c & UART_C2_TCIE) && (UART5_S1 & UART_S1_TC)) {
		transmitting = 0;
		if (transmit_pin) transmit_deassert();
		UART5_C2 = C2_TX_INACTIVE;
	}
}

#endif // HAS_KINETISK_UART5

{'repo_name': 'apmorton/teensy-template', 'stars': '154', 'repo_language': 'C', 'file_name': 'delay.h', 'mime_type': 'text/x-c', 'hash': -2530775180219146442, 'source_dataset': 'data'}


package com.platform.spark.spark.page;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import com.platform.spark.constant.Constants;
import com.platform.spark.dao.ITaskDAO;
import com.platform.spark.dao.factory.DAOFactory;
import com.platform.spark.domain.PageSplitConvertRate;
import com.platform.spark.util.SparkUtils;
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaPairRDD;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.api.java.function.FlatMapFunction;
import org.apache.spark.api.java.function.PairFlatMapFunction;
import org.apache.spark.api.java.function.PairFunction;
import org.apache.spark.broadcast.Broadcast;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.SQLContext;

import scala.Tuple2;

import com.alibaba.fastjson.JSONObject;
import com.platform.spark.dao.IPageSplitConvertRateDAO;
import com.platform.spark.domain.Task;
import com.platform.spark.util.DateUtils;
import com.platform.spark.util.NumberUtils;
import com.platform.spark.util.ParamUtils;

/**
 * 页面单跳转化率模块spark作业
 * @author wulinhao
 *
 */
public class PageOneStepConvertRateSpark {

	public static void main(String[] args) {
		// 1、构造Spark上下文
		SparkConf conf = new SparkConf()
				.setAppName(Constants.SPARK_APP_NAME_PAGE);
		SparkUtils.setMaster(conf);

		JavaSparkContext sc = new JavaSparkContext(conf);
		SQLContext sqlContext = SparkUtils.getSQLContext(sc.sc());

		// 2、生成模拟数据
		SparkUtils.mockData(sc, sqlContext);

		// 3、查询任务，获取任务的参数
		Long taskid = ParamUtils.getTaskIdFromArgs(args, Constants.SPARK_LOCAL_TASKID_PAGE);

		ITaskDAO taskDAO = DAOFactory.getTaskDAO();
		Task task = taskDAO.findById(taskid);
		if(task == null) {
			System.out.println(new Date() + ": cannot find this task with id [" + taskid + "].");
			return;
		}

		JSONObject taskParam = JSONObject.parseObject(task.getTaskParam());

		// 4、查询指定日期范围内的用户访问行为数据
		JavaRDD<Row> actionRDD = SparkUtils.getActionRDDByDateRange(
				sqlContext, taskParam);

		// 对用户访问行为数据做一个映射，将其映射为<sessionid,访问行为>的格式
		// 咱们的用户访问页面切片的生成，是要基于每个session的访问数据，来进行生成的
		// 脱离了session，生成的页面访问切片，是没有意义的
		// 举例，比如用户A，访问了页面3和页面5
		// 用于B，访问了页面4和页面6
		// 漏了一个前提，使用者指定的页面流筛选条件，比如页面3->页面4->页面7
		// 你能不能说，是将页面3->页面4，串起来，作为一个页面切片，来进行统计呢
		// 当然不行
		// 所以说呢，页面切片的生成，肯定是要基于用户session粒度的

		JavaPairRDD<String, Row> sessionid2actionRDD = getSessionid2actionRDD(actionRDD);
		sessionid2actionRDD = sessionid2actionRDD.cache(); // persist(StorageLevel.MEMORY_ONLY)

		// 对<sessionid,访问行为> RDD，做一次groupByKey操作
		// 因为我们要拿到每个session对应的访问行为数据，才能够去生成切片
		JavaPairRDD<String, Iterable<Row>> sessionid2actionsRDD = sessionid2actionRDD.groupByKey();

		// 最核心的一步，每个session的单跳页面切片的生成，以及页面流的匹配，算法
		JavaPairRDD<String, Integer> pageSplitRDD = generateAndMatchPageSplit(
				sc, sessionid2actionsRDD, taskParam);
		Map<String, Long> pageSplitPvMap = pageSplitRDD.countByKey();

		// 使用者指定的页面流是3,2,5,8,6
		// 咱们现在拿到的这个pageSplitPvMap，3->2，2->5，5->8，8->6
		Long startPagePv = getStartPagePv(taskParam, sessionid2actionsRDD);

		// 计算目标页面流的各个页面切片的转化率
		Map<String, Double> convertRateMap = computePageSplitConvertRate(
				taskParam, pageSplitPvMap, startPagePv);

		// 持久化页面切片转化率
		persistConvertRate(taskid, convertRateMap);
	}

	/**
	 * 获取<sessionid,用户访问行为>格式的数据
	 * @param actionRDD 用户访问行为RDD
	 * @return <sessionid,用户访问行为>格式的数据
	 */
	private static JavaPairRDD<String, Row> getSessionid2actionRDD(
			JavaRDD<Row> actionRDD) {
		return actionRDD.mapToPair(new PairFunction<Row, String, Row>() {

			private  final Long serialVersionUID = 1L;

			@Override
			public Tuple2<String, Row> call(Row row) throws Exception {
				String sessionid = row.getString(2);
				return new Tuple2<String, Row>(sessionid, row);
			}

		});
	}

	/**
	 * 页面切片生成与匹配算法
	 * @param sc
	 * @param sessionid2actionsRDD
	 * @param taskParam
	 * @return
	 */
	private static JavaPairRDD<String, Integer> generateAndMatchPageSplit(
			JavaSparkContext sc,
			JavaPairRDD<String, Iterable<Row>> sessionid2actionsRDD,
			JSONObject taskParam) {
		String targetPageFlow = ParamUtils.getParam(taskParam, Constants.PARAM_TARGET_PAGE_FLOW);
		final Broadcast<String> targetPageFlowBroadcast = sc.broadcast(targetPageFlow);

		return sessionid2actionsRDD.flatMapToPair(

				new PairFlatMapFunction<Tuple2<String,Iterable<Row>>, String, Integer>() {

					private  final Long serialVersionUID = 1L;

					@Override
					public Iterator<Tuple2<String, Integer>> call(
							Tuple2<String, Iterable<Row>> tuple)
							throws Exception {
						// 定义返回list
						List<Tuple2<String, Integer>> list =
								new ArrayList<Tuple2<String, Integer>>();
						// 获取到当前session的访问行为的迭代器
						Iterator<Row> iterator = tuple._2.iterator();
						// 获取使用者指定的页面流
						// 使用者指定的页面流，1,2,3,4,5,6,7
						// 1->2的转化率是多少？2->3的转化率是多少？
						String[] targetPages = targetPageFlowBroadcast.value().split(",");

						// 这里，我们拿到的session的访问行为，默认情况下是乱序的
						// 比如说，正常情况下，我们希望拿到的数据，是按照时间顺序排序的
						// 但是问题是，默认是不排序的
						// 所以，我们第一件事情，对session的访问行为数据按照时间进行排序

						// 举例，反例
						// 比如，3->5->4->10->7
						// 3->4->5->7->10
						// 排序

						List<Row> rows = new ArrayList<Row>();
						while(iterator.hasNext()) {
							rows.add(iterator.next());
						}

						Collections.sort(rows, new Comparator<Row>() {

							@Override
							public int compare(Row o1, Row o2) {
								String actionTime1 = o1.getString(4);
								String actionTime2 = o2.getString(4);

								Date date1 = DateUtils.parseTime(actionTime1);
								Date date2 = DateUtils.parseTime(actionTime2);

								return (int)(date1.getTime() - date2.getTime());
							}

						});

						// 页面切片的生成，以及页面流的匹配
						Long lastPageId = null;

						for(Row row : rows) {
							Long pageid = row.getLong(3);

							if(lastPageId == null) {
								lastPageId = pageid;
								continue;
							}

							// 生成一个页面切片
							// 3,5,2,1,8,9
							// lastPageId=3
							// 5，切片，3_5

							String pageSplit = lastPageId + "_" + pageid;

							// 对这个切片判断一下，是否在用户指定的页面流中
							for(int i = 1; i < targetPages.length; i++) {
								// 比如说，用户指定的页面流是3,2,5,8,1
								// 遍历的时候，从索引1开始，就是从第二个页面开始
								// 3_2
								String targetPageSplit = targetPages[i - 1] + "_" + targetPages[i];

								if(pageSplit.equals(targetPageSplit)) {
									list.add(new Tuple2<String, Integer>(pageSplit, 1));
									break;
								}
							}

							lastPageId = pageid;
						}

						return list.iterator();
					}

				});
	}

	/**
	 * 获取页面流中初始页面的pv
	 * @param taskParam
	 * @param sessionid2actionsRDD
	 * @return
	 */
	private static Long getStartPagePv(JSONObject taskParam,
			JavaPairRDD<String, Iterable<Row>> sessionid2actionsRDD) {
		String targetPageFlow = ParamUtils.getParam(taskParam,
				Constants.PARAM_TARGET_PAGE_FLOW);
		final Long startPageId = Long.valueOf(targetPageFlow.split(",")[0]);

		JavaRDD<Long> startPageRDD = sessionid2actionsRDD.flatMap(

				new FlatMapFunction<Tuple2<String,Iterable<Row>>, Long>() {

					private  final Long serialVersionUID = 1L;

					@Override
					public Iterator<Long> call(
							Tuple2<String, Iterable<Row>> tuple)
							throws Exception {
						List<Long> list = new ArrayList<Long>();

						Iterator<Row> iterator = tuple._2.iterator();

						while(iterator.hasNext()) {
							Row row = iterator.next();
							Long pageid = row.getLong(3);

							if(pageid == startPageId) {
								list.add(pageid);
							}
						}

						return list.iterator();
					}

				});

		return startPageRDD.count();
	}

	/**
	 * 计算页面切片转化率
	 * @param pageSplitPvMap 页面切片pv
	 * @param startPagePv 起始页面pv
	 * @return
	 */
	private static Map<String, Double> computePageSplitConvertRate(
			JSONObject taskParam,
			Map<String, Long> pageSplitPvMap,
			Long startPagePv) {
		Map<String, Double> convertRateMap = new HashMap<String, Double>();

		String[] targetPages = ParamUtils.getParam(taskParam,
				Constants.PARAM_TARGET_PAGE_FLOW).split(",");

		Long lastPageSplitPv = 0L;

		// 3,5,2,4,6
		// 3_5
		// 3_5 pv / 3 pv
		// 5_2 rate = 5_2 pv / 3_5 pv

		// 通过for循环，获取目标页面流中的各个页面切片（pv）
		for(int i = 1; i < targetPages.length; i++) {
			String targetPageSplit = targetPages[i - 1] + "_" + targetPages[i];
			Long targetPageSplitPv = Long.valueOf(String.valueOf(
					pageSplitPvMap.get(targetPageSplit)));

			double convertRate = 0.0;

			if(i == 1) {
				convertRate = NumberUtils.formatDouble(
						(double)targetPageSplitPv / (double)startPagePv, 2);
			} else {
				convertRate = NumberUtils.formatDouble(
						(double)targetPageSplitPv / (double)lastPageSplitPv, 2);
			}

			convertRateMap.put(targetPageSplit, convertRate);

			lastPageSplitPv = targetPageSplitPv;
		}

		return convertRateMap;
	}

	/**
	 * 持久化转化率
	 * @param convertRateMap
	 */
	private static void persistConvertRate(Long taskid,
			Map<String, Double> convertRateMap) {
		StringBuffer buffer = new StringBuffer("");

		for(Map.Entry<String, Double> convertRateEntry : convertRateMap.entrySet()) {
			String pageSplit = convertRateEntry.getKey();
			double convertRate = convertRateEntry.getValue();
			buffer.append(pageSplit + "=" + convertRate + "|");
		}

		String convertRate = buffer.toString();
		convertRate = convertRate.substring(0, convertRate.length() - 1);

		PageSplitConvertRate pageSplitConvertRate = new PageSplitConvertRate();
		pageSplitConvertRate.setTaskid(taskid);
		pageSplitConvertRate.setConvertRate(convertRate);

		IPageSplitConvertRateDAO pageSplitConvertRateDAO = DAOFactory.getPageSplitConvertRateDAO();
		pageSplitConvertRateDAO.insert(pageSplitConvertRate);
	}

}

{'repo_name': 'KangU4/BigDataPlatform', 'stars': '180', 'repo_language': 'Java', 'file_name': 'web.xml', 'mime_type': 'text/plain', 'hash': -1199855439683993730, 'source_dataset': 'data'}


/**
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * SPDX-License-Identifier: Apache-2.0.
 */

#pragma once
#include <aws/dms/DatabaseMigrationService_EXPORTS.h>
#include <aws/dms/DatabaseMigrationServiceRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/dms/model/SourceType.h>
#include <aws/core/utils/DateTime.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/dms/model/Filter.h>
#include <utility>

namespace Aws
{
namespace DatabaseMigrationService
{
namespace Model
{

  /**
   *

See Also:
   AWS
   * API Reference

   */
  class AWS_DATABASEMIGRATIONSERVICE_API DescribeEventsRequest : public DatabaseMigrationServiceRequest
  {
  public:
    DescribeEventsRequest();

    // Service request name is the Operation name which will send this request out,
    // each operation should has unique request name, so that we can get operation's name from this request.
    // Note: this is not true for response, multiple operations may have the same response name,
    // so we can not get operation's name from response.
    inline virtual const char* GetServiceRequestName() const override { return "DescribeEvents"; }

    Aws::String SerializePayload() const override;

    Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;

    /**
     *
 The identifier of an event source.

     */
    inline const Aws::String& GetSourceIdentifier() const{ return m_sourceIdentifier; }

    /**
     *
 The identifier of an event source.

     */
    inline bool SourceIdentifierHasBeenSet() const { return m_sourceIdentifierHasBeenSet; }

    /**
     *
 The identifier of an event source.

     */
    inline void SetSourceIdentifier(const Aws::String& value) { m_sourceIdentifierHasBeenSet = true; m_sourceIdentifier = value; }

    /**
     *
 The identifier of an event source.

     */
    inline void SetSourceIdentifier(Aws::String&& value) { m_sourceIdentifierHasBeenSet = true; m_sourceIdentifier = std::move(value); }

    /**
     *
 The identifier of an event source.

     */
    inline void SetSourceIdentifier(const char* value) { m_sourceIdentifierHasBeenSet = true; m_sourceIdentifier.assign(value); }

    /**
     *
 The identifier of an event source.

     */
    inline DescribeEventsRequest& WithSourceIdentifier(const Aws::String& value) { SetSourceIdentifier(value); return *this;}

    /**
     *
 The identifier of an event source.

     */
    inline DescribeEventsRequest& WithSourceIdentifier(Aws::String&& value) { SetSourceIdentifier(std::move(value)); return *this;}

    /**
     *
 The identifier of an event source.

     */
    inline DescribeEventsRequest& WithSourceIdentifier(const char* value) { SetSourceIdentifier(value); return *this;}

    /**
     *
The type of AWS DMS resource that generates events.

Valid values:
     * replication-instance | replication-task

     */
    inline const SourceType& GetSourceType() const{ return m_sourceType; }

    /**
     *
The type of AWS DMS resource that generates events.

Valid values:
     * replication-instance | replication-task

     */
    inline bool SourceTypeHasBeenSet() const { return m_sourceTypeHasBeenSet; }

    /**
     *
The type of AWS DMS resource that generates events.

Valid values:
     * replication-instance | replication-task

     */
    inline void SetSourceType(const SourceType& value) { m_sourceTypeHasBeenSet = true; m_sourceType = value; }

    /**
     *
The type of AWS DMS resource that generates events.

Valid values:
     * replication-instance | replication-task

     */
    inline void SetSourceType(SourceType&& value) { m_sourceTypeHasBeenSet = true; m_sourceType = std::move(value); }

    /**
     *
The type of AWS DMS resource that generates events.

Valid values:
     * replication-instance | replication-task

     */
    inline DescribeEventsRequest& WithSourceType(const SourceType& value) { SetSourceType(value); return *this;}

    /**
     *
The type of AWS DMS resource that generates events.

Valid values:
     * replication-instance | replication-task

     */
    inline DescribeEventsRequest& WithSourceType(SourceType&& value) { SetSourceType(std::move(value)); return *this;}

    /**
     *
The start time for the events to be listed.

     */
    inline const Aws::Utils::DateTime& GetStartTime() const{ return m_startTime; }

    /**
     *
The start time for the events to be listed.

     */
    inline bool StartTimeHasBeenSet() const { return m_startTimeHasBeenSet; }

    /**
     *
The start time for the events to be listed.

     */
    inline void SetStartTime(const Aws::Utils::DateTime& value) { m_startTimeHasBeenSet = true; m_startTime = value; }

    /**
     *
The start time for the events to be listed.

     */
    inline void SetStartTime(Aws::Utils::DateTime&& value) { m_startTimeHasBeenSet = true; m_startTime = std::move(value); }

    /**
     *
The start time for the events to be listed.

     */
    inline DescribeEventsRequest& WithStartTime(const Aws::Utils::DateTime& value) { SetStartTime(value); return *this;}

    /**
     *
The start time for the events to be listed.

     */
    inline DescribeEventsRequest& WithStartTime(Aws::Utils::DateTime&& value) { SetStartTime(std::move(value)); return *this;}

    /**
     *
The end time for the events to be listed.

     */
    inline const Aws::Utils::DateTime& GetEndTime() const{ return m_endTime; }

    /**
     *
The end time for the events to be listed.

     */
    inline bool EndTimeHasBeenSet() const { return m_endTimeHasBeenSet; }

    /**
     *
The end time for the events to be listed.

     */
    inline void SetEndTime(const Aws::Utils::DateTime& value) { m_endTimeHasBeenSet = true; m_endTime = value; }

    /**
     *
The end time for the events to be listed.

     */
    inline void SetEndTime(Aws::Utils::DateTime&& value) { m_endTimeHasBeenSet = true; m_endTime = std::move(value); }

    /**
     *
The end time for the events to be listed.

     */
    inline DescribeEventsRequest& WithEndTime(const Aws::Utils::DateTime& value) { SetEndTime(value); return *this;}

    /**
     *
The end time for the events to be listed.

     */
    inline DescribeEventsRequest& WithEndTime(Aws::Utils::DateTime&& value) { SetEndTime(std::move(value)); return *this;}

    /**
     *
The duration of the events to be listed.

     */
    inline int GetDuration() const{ return m_duration; }

    /**
     *
The duration of the events to be listed.

     */
    inline bool DurationHasBeenSet() const { return m_durationHasBeenSet; }

    /**
     *
The duration of the events to be listed.

     */
    inline void SetDuration(int value) { m_durationHasBeenSet = true; m_duration = value; }

    /**
     *
The duration of the events to be listed.

     */
    inline DescribeEventsRequest& WithDuration(int value) { SetDuration(value); return *this;}

    /**
     *
A list of event categories for the source type that you've chosen.

     */
    inline const Aws::Vector<Aws::String>& GetEventCategories() const{ return m_eventCategories; }

    /**
     *
A list of event categories for the source type that you've chosen.

     */
    inline bool EventCategoriesHasBeenSet() const { return m_eventCategoriesHasBeenSet; }

    /**
     *
A list of event categories for the source type that you've chosen.

     */
    inline void SetEventCategories(const Aws::Vector<Aws::String>& value) { m_eventCategoriesHasBeenSet = true; m_eventCategories = value; }

    /**
     *
A list of event categories for the source type that you've chosen.

     */
    inline void SetEventCategories(Aws::Vector<Aws::String>&& value) { m_eventCategoriesHasBeenSet = true; m_eventCategories = std::move(value); }

    /**
     *
A list of event categories for the source type that you've chosen.

     */
    inline DescribeEventsRequest& WithEventCategories(const Aws::Vector<Aws::String>& value) { SetEventCategories(value); return *this;}

    /**
     *
A list of event categories for the source type that you've chosen.

     */
    inline DescribeEventsRequest& WithEventCategories(Aws::Vector<Aws::String>&& value) { SetEventCategories(std::move(value)); return *this;}

    /**
     *
A list of event categories for the source type that you've chosen.

     */
    inline DescribeEventsRequest& AddEventCategories(const Aws::String& value) { m_eventCategoriesHasBeenSet = true; m_eventCategories.push_back(value); return *this; }

    /**
     *
A list of event categories for the source type that you've chosen.

     */
    inline DescribeEventsRequest& AddEventCategories(Aws::String&& value) { m_eventCategoriesHasBeenSet = true; m_eventCategories.push_back(std::move(value)); return *this; }

    /**
     *
A list of event categories for the source type that you've chosen.

     */
    inline DescribeEventsRequest& AddEventCategories(const char* value) { m_eventCategoriesHasBeenSet = true; m_eventCategories.push_back(value); return *this; }

    /**
     *
Filters applied to events.

     */
    inline const Aws::Vector<Filter>& GetFilters() const{ return m_filters; }

    /**
     *
Filters applied to events.

     */
    inline bool FiltersHasBeenSet() const { return m_filtersHasBeenSet; }

    /**
     *
Filters applied to events.

     */
    inline void SetFilters(const Aws::Vector<Filter>& value) { m_filtersHasBeenSet = true; m_filters = value; }

    /**
     *
Filters applied to events.

     */
    inline void SetFilters(Aws::Vector<Filter>&& value) { m_filtersHasBeenSet = true; m_filters = std::move(value); }

    /**
     *
Filters applied to events.

     */
    inline DescribeEventsRequest& WithFilters(const Aws::Vector<Filter>& value) { SetFilters(value); return *this;}

    /**
     *
Filters applied to events.

     */
    inline DescribeEventsRequest& WithFilters(Aws::Vector<Filter>&& value) { SetFilters(std::move(value)); return *this;}

    /**
     *
Filters applied to events.

     */
    inline DescribeEventsRequest& AddFilters(const Filter& value) { m_filtersHasBeenSet = true; m_filters.push_back(value); return *this; }

    /**
     *
Filters applied to events.

     */
    inline DescribeEventsRequest& AddFilters(Filter&& value) { m_filtersHasBeenSet = true; m_filters.push_back(std::move(value)); return *this; }

    /**
     *
 The maximum number of records to include in the response. If more records
     * exist than the specified MaxRecords value, a pagination token
     * called a marker is included in the response so that the remaining results can be
     * retrieved.

Default: 100

Constraints: Minimum 20, maximum 100.

     */
    inline int GetMaxRecords() const{ return m_maxRecords; }

    /**
     *
 The maximum number of records to include in the response. If more records
     * exist than the specified MaxRecords value, a pagination token
     * called a marker is included in the response so that the remaining results can be
     * retrieved.

Default: 100

Constraints: Minimum 20, maximum 100.

     */
    inline bool MaxRecordsHasBeenSet() const { return m_maxRecordsHasBeenSet; }

    /**
     *
 The maximum number of records to include in the response. If more records
     * exist than the specified MaxRecords value, a pagination token
     * called a marker is included in the response so that the remaining results can be
     * retrieved.

Default: 100

Constraints: Minimum 20, maximum 100.

     */
    inline void SetMaxRecords(int value) { m_maxRecordsHasBeenSet = true; m_maxRecords = value; }

    /**
     *
 The maximum number of records to include in the response. If more records
     * exist than the specified MaxRecords value, a pagination token
     * called a marker is included in the response so that the remaining results can be
     * retrieved.

Default: 100

Constraints: Minimum 20, maximum 100.

     */
    inline DescribeEventsRequest& WithMaxRecords(int value) { SetMaxRecords(value); return *this;}

    /**
     *
 An optional pagination token provided by a previous request. If this
     * parameter is specified, the response includes only records beyond the marker, up
     * to the value specified by MaxRecords.

     */
    inline const Aws::String& GetMarker() const{ return m_marker; }

    /**
     *
 An optional pagination token provided by a previous request. If this
     * parameter is specified, the response includes only records beyond the marker, up
     * to the value specified by MaxRecords.

     */
    inline bool MarkerHasBeenSet() const { return m_markerHasBeenSet; }

    /**
     *
 An optional pagination token provided by a previous request. If this
     * parameter is specified, the response includes only records beyond the marker, up
     * to the value specified by MaxRecords.

     */
    inline void SetMarker(const Aws::String& value) { m_markerHasBeenSet = true; m_marker = value; }

    /**
     *
 An optional pagination token provided by a previous request. If this
     * parameter is specified, the response includes only records beyond the marker, up
     * to the value specified by MaxRecords.

     */
    inline void SetMarker(Aws::String&& value) { m_markerHasBeenSet = true; m_marker = std::move(value); }

    /**
     *
 An optional pagination token provided by a previous request. If this
     * parameter is specified, the response includes only records beyond the marker, up
     * to the value specified by MaxRecords.

     */
    inline void SetMarker(const char* value) { m_markerHasBeenSet = true; m_marker.assign(value); }

    /**
     *
 An optional pagination token provided by a previous request. If this
     * parameter is specified, the response includes only records beyond the marker, up
     * to the value specified by MaxRecords.

     */
    inline DescribeEventsRequest& WithMarker(const Aws::String& value) { SetMarker(value); return *this;}

    /**
     *
 An optional pagination token provided by a previous request. If this
     * parameter is specified, the response includes only records beyond the marker, up
     * to the value specified by MaxRecords.

     */
    inline DescribeEventsRequest& WithMarker(Aws::String&& value) { SetMarker(std::move(value)); return *this;}

    /**
     *
 An optional pagination token provided by a previous request. If this
     * parameter is specified, the response includes only records beyond the marker, up
     * to the value specified by MaxRecords.

     */
    inline DescribeEventsRequest& WithMarker(const char* value) { SetMarker(value); return *this;}

  private:

    Aws::String m_sourceIdentifier;
    bool m_sourceIdentifierHasBeenSet;

    SourceType m_sourceType;
    bool m_sourceTypeHasBeenSet;

    Aws::Utils::DateTime m_startTime;
    bool m_startTimeHasBeenSet;

    Aws::Utils::DateTime m_endTime;
    bool m_endTimeHasBeenSet;

    int m_duration;
    bool m_durationHasBeenSet;

    Aws::Vector<Aws::String> m_eventCategories;
    bool m_eventCategoriesHasBeenSet;

    Aws::Vector<Filter> m_filters;
    bool m_filtersHasBeenSet;

    int m_maxRecords;
    bool m_maxRecordsHasBeenSet;

    Aws::String m_marker;
    bool m_markerHasBeenSet;
  };

} // namespace Model
} // namespace DatabaseMigrationService
} // namespace Aws

{'repo_name': 'aws/aws-sdk-cpp', 'stars': '1060', 'repo_language': 'C++', 'file_name': 'RunTests.cpp', 'mime_type': 'text/x-c', 'hash': 5555279037812749473, 'source_dataset': 'data'}


// ***********************************************************************
// Copyright (c) 2007 Charlie Poole, Rob Prouse
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************

using System;

namespace NUnit.Framework.Assertions
{
    [TestFixture]
    public class NotSameFixture
    {
        private readonly string s1 = "S1";
        private readonly string s2 = "S2";

        [Test]
        public void NotSame()
        {
            Assert.AreNotSame(s1, s2);
        }

        [Test]
        public void NotSameFails()
        {
            var expectedMessage =
                "  Expected: not same as \"S1\"" + Environment.NewLine +
                "  But was:  \"S1\"" + Environment.NewLine;
            var ex = Assert.Throws<AssertionException>(() => Assert.AreNotSame( s1, s1 ));
            Assert.That(ex.Message, Is.EqualTo(expectedMessage));
        }

        [Test]
        public void ShouldNotCallToStringOnClassForPassingTests()
        {
            var actual = new ThrowsIfToStringIsCalled(1);
            var expected = new ThrowsIfToStringIsCalled(1);

            Assert.AreNotSame(expected, actual);
        }
    }
}

{'repo_name': 'nunit/nunit', 'stars': '1892', 'repo_language': 'C#', 'file_name': 'Program.vb', 'mime_type': 'text/plain', 'hash': 1858142509621488154, 'source_dataset': 'data'}


#!/usr/bin/env bash

# ====================CONFIG THIS =============================== #
export COLOR_01="#000000"          # HOST
export COLOR_02="#8d534e"          # SYNTAX_STRING
export COLOR_03="#4e8d53"          # COMMAND
export COLOR_04="#888d4e"          # COMMAND_COLOR2
export COLOR_05="#534e8d"          # PATH
export COLOR_06="#8d4e88"          # SYNTAX_VAR
export COLOR_07="#4e888d"          # PROMP
export COLOR_08="#ffffff"          #

export COLOR_09="#000000"          #
export COLOR_10="#b57d78"          # COMMAND_ERROR
export COLOR_11="#78b57d"          # EXEC
export COLOR_12="#b0b578"          #
export COLOR_13="#7d78b5"          # FOLDER
export COLOR_14="#b578b0"          #
export COLOR_15="#78b0b5"          #
export COLOR_16="#ffffff"          #

export BACKGROUND_COLOR="#2e2e35"  # Background Color
export FOREGROUND_COLOR="#ffffff"  # Text
export CURSOR_COLOR="$FOREGROUND_COLOR" # Cursor
export PROFILE_NAME="Tin"
# =============================================================== #

# =============================================================== #
# | Apply Colors
# ===============================================================|#
SCRIPT_PATH="${SCRIPT_PATH:-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}"
PARENT_PATH="$(dirname "${SCRIPT_PATH}")"

# Allow developer to change url to forked url for easier testing
# IMPORTANT: Make sure you export this variable if your main shell is not bash
BASE_URL=${BASE_URL:-"https://raw.githubusercontent.com/Mayccoll/Gogh/master"}

if [[ -e "${PARENT_PATH}/apply-colors.sh" ]]; then
  bash "${PARENT_PATH}/apply-colors.sh"
else
  if [[ "$(uname)" = "Darwin" ]]; then
    # OSX ships with curl and ancient bash
    bash -c "$(curl -so- "${BASE_URL}/apply-colors.sh")"
  else
    # Linux ships with wget
    bash -c "$(wget -qO- "${BASE_URL}/apply-colors.sh")"
  fi
fi

{'repo_name': 'Mayccoll/Gogh', 'stars': '4898', 'repo_language': 'Shell', 'file_name': 'README.md', 'mime_type': 'text/plain', 'hash': -6719142754167914656, 'source_dataset': 'data'}


/*
 * Copyright 2013 Red Hat Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 *
 * Authors: Ben Skeggs
 */
#include "nv50.h"

#include <subdev/bios.h>
#include <subdev/bios/init.h>

static u64
g98_devinit_disable(struct nvkm_devinit *init)
{
	struct nvkm_device *device = init->subdev.device;
	u32 r001540 = nvkm_rd32(device, 0x001540);
	u32 r00154c = nvkm_rd32(device, 0x00154c);
	u64 disable = 0ULL;

	if (!(r001540 & 0x40000000)) {
		disable |= (1ULL << NVKM_ENGINE_MSPDEC);
		disable |= (1ULL << NVKM_ENGINE_MSVLD);
		disable |= (1ULL << NVKM_ENGINE_MSPPP);
	}

	if (!(r00154c & 0x00000004))
		disable |= (1ULL << NVKM_ENGINE_DISP);
	if (!(r00154c & 0x00000020))
		disable |= (1ULL << NVKM_ENGINE_MSVLD);
	if (!(r00154c & 0x00000040))
		disable |= (1ULL << NVKM_ENGINE_SEC);

	return disable;
}

static const struct nvkm_devinit_func
g98_devinit = {
	.preinit = nv50_devinit_preinit,
	.init = nv50_devinit_init,
	.post = nv04_devinit_post,
	.pll_set = nv50_devinit_pll_set,
	.disable = g98_devinit_disable,
};

int
g98_devinit_new(struct nvkm_device *device, int index,
		struct nvkm_devinit **pinit)
{
	return nv50_devinit_new_(&g98_devinit, device, index, pinit);
}

{'repo_name': 'alibaba/cloud-kernel', 'stars': '246', 'repo_language': 'C', 'file_name': 'Kconfig', 'mime_type': 'text/plain', 'hash': 8448630751559877837, 'source_dataset': 'data'}


<?php
// +----------------------------------------------------------------------
// | HisiPHP框架[基于ThinkPHP5.1开发]
// +----------------------------------------------------------------------
// | Copyright (c) 2016-2021 http://www.HisiPHP.com
// +----------------------------------------------------------------------
// | HisiPHP承诺基础框架永久免费开源，您可用于学习和商用，但必须保留软件版权信息。
// +----------------------------------------------------------------------
// | Author: 橘子俊 <364666827@qq.com>，开发者QQ群：50304283
// +----------------------------------------------------------------------

namespace app\system\admin;

use app\system\model\SystemConfig as ConfigModel;
use app\system\model\SystemModule as ModuleModel;
use app\system\model\SystemPlugins as PluginsModel;
use think\Validate;
use Env;

/**
 * 系统设置控制器
 * @package app\system\admin
 */
class System extends Admin
{

    /**
     * 系统基础配置
     * @author 橘子俊 <364666827@qq.com>
     * @return mixed
     */
    public function index($group = 'base')
    {
        if ($this->request->isPost()) {
            $webPath = './';
            $data = $this->request->post();
            $types = $data['type'];

            if (isset($data['id'])) {
                $ids = $data['id'];
            } else {
                $ids = $data['id'] = '';
            }

            unset($data['upload']);// 清除上传字段

            // token 验证
            $validate = new Validate([
                '__token__' => 'token',
            ]);

            if (!$validate->check($data)) {
                return $this->error($validate->getError());
            }

            // 非系统模块配置保存
            if (isset($data['module'])) {
                $row = ModuleModel::where('name', $data['module'])->field('id,config')->find()->toArray();
                if (!isset($row['config'])) {
                    return $this->error('保存失败(原因：'.$data['module'].'模块无需配置)');
                }
                $row['config'] = json_decode($row['config'], 1);
                foreach ($row['config'] as $key => &$conf) {
                    if (!isset($ids[$key]) && $conf['type'] =='switch') {
                        $conf['value'] = 0;
                    } else if ($conf['type'] =='checkbox') {
                        if (isset($ids[$key])) {
                            $conf['value'] = implode(',', $ids[$key]);
                        } else {
                            $conf['value'] = '';
                        }
                    } else {
                        $conf['value'] = $ids[$key];
                    }
                }

                if (ModuleModel::where('id', $row['id'])->setField('config', json_encode($row['config'], 1)) === false) {
                    return $this->error('保存失败');
                }
                ModuleModel::getConfig('', true);
                return $this->success('保存成功');
            }

            // 系统模块配置保存
            if (!$types) return false;
            $adminPath = config('sys.admin_path');
            foreach ($types as $k => $v) {
                if ($v == 'switch' && !isset($ids[$k])) {
                    ConfigModel::where('name', $k)->update(['value' => 0]);
                    continue;
                }

                if ($v == 'checkbox') {
                    if (isset($ids[$k])) {
                        $ids[$k] = implode(',', $ids[$k]);
                    } else {
                        $ids[$k] = '';
                    }
                }

                // 修改后台管理目录
                if ($k == 'admin_path' && $ids[$k] != config('sys.admin_path')) {
                    if (is_file($webPath.config('sys.admin_path')) && is_writable($webPath.config('sys.admin_path'))) {
                        @rename($webPath.config('sys.admin_path'), $webPath.$ids[$k]);
                        if (!is_file($webPath.$ids[$k])) {
                            $ids[$k] = config('sys.admin_path');
                        }
                        $adminPath = $ids[$k];
                    }
                }
                ConfigModel::where('name', $k)->update(['value' => $ids[$k]]);
            }

            // 更新配置缓存
            $config = ConfigModel::getConfig('', true);

            if ($group == 'sys') {
                $rootPath = Env::get('root_path');
                if (file_exists($rootPath.'.env')) {
                    unlink($rootPath.'.env');
                }
                $env = "//设置开启调试模式\napp_debug = " . ($config['sys']['app_debug'] ? 'true' : 'false');
                $env .= "\n//应用Trace\napp_trace = " . ($config['sys']['app_trace'] ? 'true' : 'false');
                file_put_contents($rootPath.'.env', $env);
            }

            return $this->success('保存成功', ROOT_DIR.$adminPath.'/system/system/index/group/'.$group.'.html');
        }
        $tabData = [];
        foreach (config('sys.config_group') as $key => $value) {
            $arr = [];
            $arr['title'] = $value;
            $arr['url'] = '?group='.$key;
            $tabData['menu'][] = $arr;
        }
        $map = [];
        $map['group'] = $group;
        $map['status'] = 1;
        $dataList = ConfigModel::where($map)->order('sort,id')->column('id,name,title,group,url,value,type,options,tips');
        foreach ($dataList as $k => &$v) {
            $v['id'] = $v['name'];
            if (!empty($v['options'])) {
                $v['options'] = parse_attr($v['options']);
            }

            if ($v['type'] == 'checkbox') {
                $v['value'] = explode(',', $v['value']);
            }
        }

        // 模块配置
        $module = ModuleModel::where('status', 2)->column('name,title,config', 'name');
        foreach ($module as $mod) {
            if (empty($mod['config'])) continue;
            $arr = [];
            $arr['title'] = $mod['title'];
            $arr['url'] = '?group='.$mod['name'];
            $tabData['menu'][] = $arr;
            if ($group == $mod['name']) {
                $dataList = json_decode($mod['config'], 1);
                foreach ($dataList as $k => &$v) {
                    if (!empty($v['options'])) {
                        $v['options'] = parse_attr($v['options']);
                    }
                    $v['id'] = $k;
                    $v['module'] = $mod['name'];
                }
            }
        }
        $tabData['current'] = url('?group='.$group);
        $_GET['group'] = $group;
        $this->assign('data_list', $dataList);
        $this->assign('hisiTabData', $tabData);
        $this->assign('hisiTabType', 3);
        return $this->fetch();
    }

    private function mkAdmin($file)
    {
        $code = <<<INFO
<?php
// +----------------------------------------------------------------------
// | HisiPHP框架[基于ThinkPHP5.1开发]
// +----------------------------------------------------------------------
// | Copyright (c) 2016-2021 http://www.HisiPHP.com
// +----------------------------------------------------------------------
// | HisiPHP提供个人非商业用途免费使用，商业需授权。
// +----------------------------------------------------------------------
// | Author: 橘子俊 <364666827@qq.com>，开发者QQ群：50304283
// +----------------------------------------------------------------------

// [ 后台入口文件 ]
namespace think;

header('Content-Type:text/html;charset=utf-8');

// 定义应用目录
define('APP_PATH', __DIR__ . '/application/');

// 定义入口为admin
define('ENTRANCE', 'admin');

// 加载基础文件
require __DIR__ . '/../thinkphp/base.php';

// 检查是否安装
if(!is_file('./../install.lock')) {
    header('location: /');
} else {
    Container::get('app')->run()->send();
}

INFO;
        if (!file_put_contents(ROOT_PATH.$file, $code)) {
            return false;
        }
        return true;
    }
}

{'repo_name': 'hisiphp/hisiphp', 'stars': '254', 'repo_language': 'PHP', 'file_name': 'systeminfo.html', 'mime_type': 'text/html', 'hash': 3991004649219366006, 'source_dataset': 'data'}


// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Migrator;

namespace Migrator.Migrations
{
    [DbContext(typeof(DefaultDbContext))]
    [Migration("20191010152744_000")]
    partial class _000
    {
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "3.0.0")
                .HasAnnotation("Relational:MaxIdentifierLength", 128)
                .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

            modelBuilder.Entity("Migrator.Entities.FooTable", b =>
                {
                    b.Property<long>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("bigint")
                        .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

                    b.Property<string>("Column0")
                        .HasColumnType("nvarchar(max)");

                    b.Property<DateTime>("CreatedAt")
                        .HasColumnType("datetime2");

                    b.Property<DateTime>("UpdatedAt")
                        .HasColumnType("datetime2");

                    b.HasKey("Id");

                    b.ToTable("FooTable");
                });
#pragma warning restore 612, 618
        }
    }
}

{'repo_name': 'anet-team/anet', 'stars': '246', 'repo_language': 'C#', 'file_name': 'Anet.Tests.csproj', 'mime_type': 'text/plain', 'hash': -1628660917855275611, 'source_dataset': 'data'}


package com.lkl.springcloud.eureka.server;

import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;

/**
 * Created by liaokailin on 16/4/30.
 */
@EnableEurekaServer
@SpringBootApplication
public class Application {
    public static void main(String[] args) {
        new SpringApplicationBuilder(Application.class).web(true).run(args);
    }
}

{'repo_name': 'liaokailin/springcloud', 'stars': '175', 'repo_language': 'Java', 'file_name': 'PreRequest.groovy', 'mime_type': 'text/plain', 'hash': -780110733673390516, 'source_dataset': 'data'}


package    # hide from PAUSE
    ViewDeps::Result::Year2010CDs;

use strict;
use warnings;
use base 'DBIx::Class::Core';

__PACKAGE__->table_class('DBIx::Class::ResultSource::View');
__PACKAGE__->table('year_2010_cds');
__PACKAGE__->result_source_instance->view_definition(
    "SELECT id,title,artist,year,number_tracks FROM cd WHERE year = '2010'");

__PACKAGE__->add_columns(
    id            => { data_type => 'integer', is_auto_increment => 1 },
    title         => { data_type => 'text' },
    artist        => { data_type => 'integer', is_nullable       => 0 },
    year          => { data_type => 'integer' },
    number_tracks => { data_type => 'integer' },
);

__PACKAGE__->set_primary_key('id');

__PACKAGE__->belongs_to( 'artist', 'ViewDeps::Result::Artist',
    { "foreign.id" => "self.artist" },
);

__PACKAGE__->has_many( 'tracks', 'ViewDeps::Result::Track',
    { "foreign.cd" => "self.id" },
);

1;

{'repo_name': 'Perl5/DBIx-Class', 'stars': '137', 'repo_language': 'Perl', 'file_name': 'dbicadmin', 'mime_type': 'text/x-perl', 'hash': -5068785570241569429, 'source_dataset': 'data'}